Fix all Clippy warnings (#1936)
* Fix all Clippy warnings * More fixes * Bump criterion version --------- Co-authored-by: dennis@kobert.dev <dennis@kobert.dev>
This commit is contained in:
parent
858efb65bb
commit
15d125d8e7
|
|
@ -1,8 +1,8 @@
|
||||||
name: Clippy Check with PR Comments
|
name: Clippy Check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [master]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
clippy:
|
clippy:
|
||||||
|
|
@ -70,9 +70,9 @@ jobs:
|
||||||
script: |
|
script: |
|
||||||
const clippy_output = ${{ steps.clippy.outputs.CLIPPY_OUTPUT }};
|
const clippy_output = ${{ steps.clippy.outputs.CLIPPY_OUTPUT }};
|
||||||
const output = `
|
const output = `
|
||||||
<details>
|
<details open>
|
||||||
|
|
||||||
<summary> Found Clippy warnings </summary>
|
<summary>Found Clippy warnings</summary>
|
||||||
|
|
||||||
#### Clippy Warnings/Errors
|
#### Clippy Warnings/Errors
|
||||||
|
|
||||||
|
|
@ -89,4 +89,3 @@ jobs:
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
body: output
|
body: output
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -124,6 +124,12 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anes"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstream"
|
name = "anstream"
|
||||||
version = "0.6.14"
|
version = "0.6.14"
|
||||||
|
|
@ -456,17 +462,6 @@ version = "1.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "atty"
|
|
||||||
version = "0.2.14"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
|
||||||
dependencies = [
|
|
||||||
"hermit-abi 0.1.19",
|
|
||||||
"libc",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.3.0"
|
version = "1.3.0"
|
||||||
|
|
@ -941,16 +936,57 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "ciborium"
|
||||||
version = "2.34.0"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.3.2",
|
"ciborium-io",
|
||||||
"textwrap",
|
"ciborium-ll",
|
||||||
"unicode-width",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ciborium-io"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ciborium-ll"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9"
|
||||||
|
dependencies = [
|
||||||
|
"ciborium-io",
|
||||||
|
"half",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap"
|
||||||
|
version = "4.5.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc"
|
||||||
|
dependencies = [
|
||||||
|
"clap_builder",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_builder"
|
||||||
|
version = "4.5.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"clap_lex",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_lex"
|
||||||
|
version = "0.7.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clipboard-win"
|
name = "clipboard-win"
|
||||||
version = "5.4.0"
|
version = "5.4.0"
|
||||||
|
|
@ -1200,24 +1236,24 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "criterion"
|
name = "criterion"
|
||||||
version = "0.3.6"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f"
|
checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"anes",
|
||||||
"cast",
|
"cast",
|
||||||
|
"ciborium",
|
||||||
"clap",
|
"clap",
|
||||||
"criterion-plot",
|
"criterion-plot",
|
||||||
"csv",
|
"is-terminal",
|
||||||
"itertools 0.10.5",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
"once_cell",
|
||||||
"oorandom",
|
"oorandom",
|
||||||
"plotters",
|
"plotters",
|
||||||
"rayon",
|
"rayon",
|
||||||
"regex",
|
"regex",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_cbor",
|
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tinytemplate",
|
"tinytemplate",
|
||||||
|
|
@ -1226,9 +1262,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "criterion-plot"
|
name = "criterion-plot"
|
||||||
version = "0.4.5"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876"
|
checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cast",
|
"cast",
|
||||||
"itertools 0.10.5",
|
"itertools 0.10.5",
|
||||||
|
|
@ -1311,27 +1347,6 @@ dependencies = [
|
||||||
"syn 2.0.72",
|
"syn 2.0.72",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "csv"
|
|
||||||
version = "1.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe"
|
|
||||||
dependencies = [
|
|
||||||
"csv-core",
|
|
||||||
"itoa 1.0.11",
|
|
||||||
"ryu",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "csv-core"
|
|
||||||
version = "0.1.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70"
|
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ctor"
|
name = "ctor"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
|
|
@ -2470,7 +2485,7 @@ dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"dyn-any",
|
"dyn-any",
|
||||||
"glam",
|
"glam",
|
||||||
"half 2.4.1",
|
"half",
|
||||||
"image 0.25.2",
|
"image 0.25.2",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"kurbo",
|
"kurbo",
|
||||||
|
|
@ -2724,12 +2739,6 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "half"
|
|
||||||
version = "1.8.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "half"
|
name = "half"
|
||||||
version = "2.4.1"
|
version = "2.4.1"
|
||||||
|
|
@ -2794,15 +2803,6 @@ version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hermit-abi"
|
|
||||||
version = "0.1.19"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
|
|
@ -5637,16 +5637,6 @@ dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_cbor"
|
|
||||||
version = "0.11.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5"
|
|
||||||
dependencies = [
|
|
||||||
"half 1.8.3",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.204"
|
version = "1.0.204"
|
||||||
|
|
@ -6633,15 +6623,6 @@ dependencies = [
|
||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "textwrap"
|
|
||||||
version = "0.11.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
|
||||||
dependencies = [
|
|
||||||
"unicode-width",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thin-slice"
|
name = "thin-slice"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
|
|
@ -7713,7 +7694,7 @@ dependencies = [
|
||||||
"glam",
|
"glam",
|
||||||
"gpu-executor",
|
"gpu-executor",
|
||||||
"graphene-core",
|
"graphene-core",
|
||||||
"half 2.4.1",
|
"half",
|
||||||
"log",
|
"log",
|
||||||
"node-macro",
|
"node-macro",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
|
|
||||||
|
|
@ -381,7 +381,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes
|
||||||
let document_name = document_name.replace("__DO_NOT_UPGRADE__", "");
|
let document_name = document_name.replace("__DO_NOT_UPGRADE__", "");
|
||||||
|
|
||||||
let document = DocumentMessageHandler::deserialize_document(&document_serialized_content).map(|mut document| {
|
let document = DocumentMessageHandler::deserialize_document(&document_serialized_content).map(|mut document| {
|
||||||
document.name = document_name.clone();
|
document.name.clone_from(&document_name);
|
||||||
document
|
document
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ impl NodeRuntime {
|
||||||
|
|
||||||
assert_ne!(proto_network.nodes.len(), 0, "No proto nodes exist?");
|
assert_ne!(proto_network.nodes.len(), 0, "No proto nodes exist?");
|
||||||
self.executor.update(proto_network).await.map_err(|e| {
|
self.executor.update(proto_network).await.map_err(|e| {
|
||||||
self.node_graph_errors = e.clone();
|
self.node_graph_errors.clone_from(&e);
|
||||||
format!("{e:?}")
|
format!("{e:?}")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ web-sys = { workspace = true, features = [
|
||||||
# Optional workspace dependencies
|
# Optional workspace dependencies
|
||||||
ron = { workspace = true, optional = true }
|
ron = { workspace = true, optional = true }
|
||||||
|
|
||||||
|
|
||||||
[package.metadata.wasm-pack.profile.dev]
|
[package.metadata.wasm-pack.profile.dev]
|
||||||
wasm-opt = false
|
wasm-opt = false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ pub fn decode_a100<R: Read + Seek>(ifd: Ifd, file: &mut TiffRead<R>) -> RawImage
|
||||||
width: image_width,
|
width: image_width,
|
||||||
height: image_height,
|
height: image_height,
|
||||||
cfa_pattern: todo!(),
|
cfa_pattern: todo!(),
|
||||||
|
#[allow(unreachable_code)]
|
||||||
maximum: (1 << 12) - 1,
|
maximum: (1 << 12) - 1,
|
||||||
black: SubtractBlack::None,
|
black: SubtractBlack::None,
|
||||||
camera_to_xyz: None,
|
camera_to_xyz: None,
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,8 @@ fn _test_final_image(content: &[u8], raw_image: RawImage) -> Result<(), String>
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[test]
|
#[ignore]
|
||||||
|
#[test]
|
||||||
fn extract_data_from_dng_images() {
|
fn extract_data_from_dng_images() {
|
||||||
read_dir(BASE_PATH)
|
read_dir(BASE_PATH)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
||||||
|
|
@ -508,6 +508,7 @@ where
|
||||||
H: BuildHasher + Default,
|
H: BuildHasher + Default,
|
||||||
{
|
{
|
||||||
struct HashMapVisitor<K, V, H> {
|
struct HashMapVisitor<K, V, H> {
|
||||||
|
#[allow(clippy::type_complexity)]
|
||||||
marker: std::marker::PhantomData<fn() -> HashMap<K, V, H>>,
|
marker: std::marker::PhantomData<fn() -> HashMap<K, V, H>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,15 +50,13 @@ wasm-bindgen-futures = { workspace = true }
|
||||||
# Workspace dependencies
|
# Workspace dependencies
|
||||||
winit = { workspace = true }
|
winit = { workspace = true }
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = { version = "0.3", features = ["html_reports"] }
|
criterion = { version = "0.5", features = ["html_reports"] }
|
||||||
glob = "0.3"
|
glob = "0.3"
|
||||||
pprof = { version = "0.13", features = ["flamegraph"] }
|
pprof = { version = "0.13", features = ["flamegraph"] }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
graph-craft = { workspace = true, features = ["serde"] }
|
graph-craft = { workspace = true, features = ["serde"] }
|
||||||
|
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "compile_demo_art"
|
name = "compile_demo_art"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||||
use graph_craft::{document::NodeNetwork, graphene_compiler::Compiler, proto::ProtoNetwork};
|
use graph_craft::document::NodeNetwork;
|
||||||
|
use graph_craft::graphene_compiler::Compiler;
|
||||||
|
use graph_craft::proto::ProtoNetwork;
|
||||||
|
|
||||||
pub fn compile_to_proto(c: &mut Criterion) {
|
pub fn compile_to_proto(c: &mut Criterion) {
|
||||||
let artworks = glob::glob("../../demo-artwork/*.graphite").expect("failed to read glob pattern");
|
let artworks = glob::glob("../../demo-artwork/*.graphite").expect("failed to read glob pattern");
|
||||||
|
|
@ -14,9 +16,8 @@ pub fn compile_to_proto(c: &mut Criterion) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_network(document_string: &str) -> NodeNetwork {
|
fn load_network(document_string: &str) -> NodeNetwork {
|
||||||
let document: serde_json::Value = serde_json::from_str(&document_string).expect("Failed to parse document");
|
let document: serde_json::Value = serde_json::from_str(document_string).expect("Failed to parse document");
|
||||||
let network = serde_json::from_value::<NodeNetwork>(document["network_interface"]["network"].clone()).expect("Failed to parse document");
|
serde_json::from_value::<NodeNetwork>(document["network_interface"]["network"].clone()).expect("Failed to parse document")
|
||||||
network
|
|
||||||
}
|
}
|
||||||
fn compile(network: NodeNetwork) -> ProtoNetwork {
|
fn compile(network: NodeNetwork) -> ProtoNetwork {
|
||||||
let compiler = Compiler {};
|
let compiler = Compiler {};
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@ use crate::document::value::TaggedValue;
|
||||||
use crate::proto::{ConstructionArgs, ProtoNetwork, ProtoNode, ProtoNodeInput};
|
use crate::proto::{ConstructionArgs, ProtoNetwork, ProtoNode, ProtoNodeInput};
|
||||||
|
|
||||||
use dyn_any::{DynAny, StaticType};
|
use dyn_any::{DynAny, StaticType};
|
||||||
use glam::IVec2;
|
|
||||||
use graphene_core::memo::MemoHashGuard;
|
use graphene_core::memo::MemoHashGuard;
|
||||||
pub use graphene_core::uuid::generate_uuid;
|
pub use graphene_core::uuid::generate_uuid;
|
||||||
use graphene_core::{Cow, MemoHash, ProtoNodeIdentifier, Type};
|
use graphene_core::{Cow, MemoHash, ProtoNodeIdentifier, Type};
|
||||||
use rustc_hash::{FxHashMap, FxHashSet};
|
|
||||||
|
|
||||||
|
use glam::IVec2;
|
||||||
|
use rustc_hash::FxHashMap;
|
||||||
use std::collections::hash_map::DefaultHasher;
|
use std::collections::hash_map::DefaultHasher;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
@ -1026,7 +1026,7 @@ impl NodeNetwork {
|
||||||
Self::replace_value_inputs_with_nodes(
|
Self::replace_value_inputs_with_nodes(
|
||||||
&mut inner_network.exports,
|
&mut inner_network.exports,
|
||||||
&mut inner_network.nodes,
|
&mut inner_network.nodes,
|
||||||
&node.original_location.path.as_ref().unwrap_or(&vec![]),
|
node.original_location.path.as_ref().unwrap_or(&vec![]),
|
||||||
gen_id,
|
gen_id,
|
||||||
map_ids,
|
map_ids,
|
||||||
id,
|
id,
|
||||||
|
|
@ -1058,9 +1058,8 @@ impl NodeNetwork {
|
||||||
NodeInput::Node { node_id, output_index, lambda } => {
|
NodeInput::Node { node_id, output_index, lambda } => {
|
||||||
let skip = node.original_location.skip_inputs;
|
let skip = node.original_location.skip_inputs;
|
||||||
nested_node.populate_first_network_input(node_id, output_index, nested_input_index, lambda, node.original_location.inputs(*import_index), skip);
|
nested_node.populate_first_network_input(node_id, output_index, nested_input_index, lambda, node.original_location.inputs(*import_index), skip);
|
||||||
if let input_node = self.nodes.get_mut(&node_id).unwrap() {
|
let input_node = self.nodes.get_mut(&node_id).unwrap();
|
||||||
input_node.original_location.dependants[output_index].push(nested_node_id);
|
input_node.original_location.dependants[output_index].push(nested_node_id);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
NodeInput::Network { import_index, .. } => {
|
NodeInput::Network { import_index, .. } => {
|
||||||
let parent_input_index = import_index;
|
let parent_input_index = import_index;
|
||||||
|
|
@ -1276,8 +1275,7 @@ impl NodeNetwork {
|
||||||
|
|
||||||
/// Creates a proto network for evaluating each output of this network.
|
/// Creates a proto network for evaluating each output of this network.
|
||||||
pub fn into_proto_networks(self) -> impl Iterator<Item = ProtoNetwork> {
|
pub fn into_proto_networks(self) -> impl Iterator<Item = ProtoNetwork> {
|
||||||
// let input_node = self.nodes.iter().find_map(|(node_id, node)| if node.name == "SetNode" { Some(node_id.clone()) } else { None });
|
let nodes: Vec<_> = self.nodes.into_iter().map(|(id, node)| (id, node.resolve_proto_node())).collect();
|
||||||
let mut nodes: Vec<_> = self.nodes.into_iter().map(|(id, node)| (id, node.resolve_proto_node())).collect();
|
|
||||||
|
|
||||||
// Create a network to evaluate each output
|
// Create a network to evaluate each output
|
||||||
if self.exports.len() == 1 {
|
if self.exports.len() == 1 {
|
||||||
|
|
@ -1285,7 +1283,7 @@ impl NodeNetwork {
|
||||||
return vec![ProtoNetwork {
|
return vec![ProtoNetwork {
|
||||||
inputs: Vec::new(),
|
inputs: Vec::new(),
|
||||||
output: node_id,
|
output: node_id,
|
||||||
nodes: nodes,
|
nodes,
|
||||||
}]
|
}]
|
||||||
.into_iter();
|
.into_iter();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ use crate::document::{NodeId, OriginalLocation};
|
||||||
|
|
||||||
use dyn_any::DynAny;
|
use dyn_any::DynAny;
|
||||||
use graphene_core::*;
|
use graphene_core::*;
|
||||||
use rustc_hash::{FxHashMap, FxHashSet};
|
|
||||||
|
|
||||||
|
use rustc_hash::FxHashMap;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
@ -430,10 +430,7 @@ impl ProtoNetwork {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_inwards_edges_with_mapping(&self) -> (Vec<Vec<usize>>, FxHashMap<NodeId, usize>) {
|
fn collect_inwards_edges_with_mapping(&self) -> (Vec<Vec<usize>>, FxHashMap<NodeId, usize>) {
|
||||||
let mut id_map = FxHashMap::with_capacity_and_hasher(self.nodes.len(), Default::default());
|
let id_map: FxHashMap<_, _> = self.nodes.iter().enumerate().map(|(idx, (id, _))| (*id, idx)).collect();
|
||||||
|
|
||||||
// Create dense mapping
|
|
||||||
id_map = self.nodes.iter().enumerate().map(|(idx, (id, _))| (*id, idx)).collect();
|
|
||||||
|
|
||||||
// Collect inwards edges using dense indices
|
// Collect inwards edges using dense indices
|
||||||
let mut inwards_edges = vec![Vec::new(); self.nodes.len()];
|
let mut inwards_edges = vec![Vec::new(); self.nodes.len()];
|
||||||
|
|
@ -584,7 +581,7 @@ impl ProtoNetwork {
|
||||||
|
|
||||||
/// Sort the nodes vec so it is in a topological order. This ensures that no node takes an input from a node that is found later in the list.
|
/// Sort the nodes vec so it is in a topological order. This ensures that no node takes an input from a node that is found later in the list.
|
||||||
fn reorder_ids(&mut self) -> Result<(), String> {
|
fn reorder_ids(&mut self) -> Result<(), String> {
|
||||||
let (order, id_map) = self.topological_sort()?;
|
let (order, _id_map) = self.topological_sort()?;
|
||||||
|
|
||||||
// // Map of node ids to their current index in the nodes vector
|
// // Map of node ids to their current index in the nodes vector
|
||||||
// let current_positions: FxHashMap<_, _> = self.nodes.iter().enumerate().map(|(pos, (id, _))| (*id, pos)).collect();
|
// let current_positions: FxHashMap<_, _> = self.nodes.iter().enumerate().map(|(pos, (id, _))| (*id, pos)).collect();
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ async fn imaginate_maybe_fail<'a, P: Pixel, F: Fn(ImaginateStatus)>(
|
||||||
prompt: prompt.await,
|
prompt: prompt.await,
|
||||||
seed: seed.await,
|
seed: seed.await,
|
||||||
steps: samples.await,
|
steps: samples.await,
|
||||||
cfg_scale: prompt_guidance.await as f64,
|
cfg_scale: prompt_guidance.await,
|
||||||
width: res.x,
|
width: res.x,
|
||||||
height: res.y,
|
height: res.y,
|
||||||
restore_faces: improve_faces.await,
|
restore_faces: improve_faces.await,
|
||||||
|
|
@ -385,7 +385,7 @@ async fn imaginate_maybe_fail<'a, P: Pixel, F: Fn(ImaginateStatus)>(
|
||||||
override_settings: Default::default(),
|
override_settings: Default::default(),
|
||||||
|
|
||||||
init_images: vec![base64_data],
|
init_images: vec![base64_data],
|
||||||
denoising_strength: image_creativity.await as f64 * 0.01,
|
denoising_strength: image_creativity.await * 0.01,
|
||||||
mask: None,
|
mask: None,
|
||||||
};
|
};
|
||||||
let url = join_url(&base_url, SDAPI_IMAGE_TO_IMAGE)?;
|
let url = join_url(&base_url, SDAPI_IMAGE_TO_IMAGE)?;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue