Skip to content

Commit e56f73c

Browse files
committed
Fix test compilation
1 parent 58660f5 commit e56f73c

File tree

5 files changed

+40
-34
lines changed

5 files changed

+40
-34
lines changed

editor/src/dispatcher.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ mod test {
260260
use crate::messages::prelude::*;
261261
use crate::test_utils::EditorTestUtils;
262262

263+
use document_legacy::document_metadata::LayerNodeIdentifier;
263264
use document_legacy::LayerId;
264265
use document_legacy::Operation;
265266
use graphene_core::raster::color::Color;

editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/document_node_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2517,7 +2517,7 @@ pub fn wrap_network_in_scope(mut network: NodeNetwork, hash: u64) -> NodeNetwork
25172517
.to_document_node(vec![input_type.unwrap()], DocumentNodeMetadata::default());
25182518
if let DocumentNodeImplementation::Network(g) = &mut begin_scope.implementation {
25192519
if let Some(node) = g.nodes.get_mut(&0) {
2520-
node.hash = hash;
2520+
node.world_state_hash = hash;
25212521
}
25222522
}
25232523

node-graph/graph-craft/src/document.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub struct DocumentNode {
148148
pub skip_deduplication: bool,
149149
/// Used as a hash of the graph input where applicable. This ensures that protonodes that depend on the graph's input are always regenerated.
150150
#[serde(default)]
151-
pub hash: u64,
151+
pub world_state_hash: u64,
152152
/// The path to this node as of when [`NodeNetwork::generate_node_paths`] was called.
153153
/// For example if this node was ID 6 inside a node with ID 4 and with a [`DocumentNodeImplementation::Network`], the path would be [4, 6].
154154
pub path: Option<Vec<NodeId>>,
@@ -164,7 +164,7 @@ impl Default for DocumentNode {
164164
implementation: Default::default(),
165165
metadata: Default::default(),
166166
skip_deduplication: Default::default(),
167-
hash: Default::default(),
167+
world_state_hash: Default::default(),
168168
path: Default::default(),
169169
}
170170
}
@@ -230,7 +230,7 @@ impl DocumentNode {
230230
construction_args: args,
231231
document_node_path: self.path.unwrap_or_default(),
232232
skip_deduplication: self.skip_deduplication,
233-
hash: self.hash,
233+
world_state_hash: self.world_state_hash,
234234
}
235235
}
236236

@@ -1248,8 +1248,7 @@ mod test {
12481248
identifier: "graphene_core::structural::ConsNode".into(),
12491249
input: ProtoNodeInput::ManualComposition(concrete!(u32)),
12501250
construction_args: ConstructionArgs::Nodes(vec![(0, false)]),
1251-
document_node_path: vec![],
1252-
skip_deduplication: false,
1251+
..Default::default()
12531252
};
12541253
assert_eq!(proto_node, reference);
12551254
}
@@ -1267,7 +1266,7 @@ mod test {
12671266
input: ProtoNodeInput::ManualComposition(concrete!(u32)),
12681267
construction_args: ConstructionArgs::Nodes(vec![(14, false)]),
12691268
document_node_path: vec![1, 0],
1270-
skip_deduplication: false,
1269+
..Default::default()
12711270
},
12721271
),
12731272
(
@@ -1277,7 +1276,7 @@ mod test {
12771276
input: ProtoNodeInput::Node(10, false),
12781277
construction_args: ConstructionArgs::Nodes(vec![]),
12791278
document_node_path: vec![1, 1],
1280-
skip_deduplication: false,
1279+
..Default::default()
12811280
},
12821281
),
12831282
(14, ProtoNode::value(ConstructionArgs::Value(TaggedValue::U32(2)), vec![1, 4])),

node-graph/graph-craft/src/proto.rs

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,21 @@ pub struct ProtoNode {
207207
pub identifier: NodeIdentifier,
208208
pub document_node_path: Vec<NodeId>,
209209
pub skip_deduplication: bool,
210-
pub hash: u64,
210+
/// Represents a global state on which the node depends. This is a hack, TODO: figure out a proper solution
211+
pub world_state_hash: u64,
212+
}
213+
214+
impl Default for ProtoNode {
215+
fn default() -> Self {
216+
Self {
217+
identifier: NodeIdentifier::new("graphene_core::ops::IdNode"),
218+
construction_args: ConstructionArgs::Value(value::TaggedValue::U32(0)),
219+
input: ProtoNodeInput::None,
220+
document_node_path: vec![],
221+
skip_deduplication: false,
222+
world_state_hash: 0,
223+
}
224+
}
211225
}
212226

213227
/// A ProtoNodeInput represents the primary input of a node in a ProtoNetwork.
@@ -253,7 +267,7 @@ impl ProtoNode {
253267
if self.skip_deduplication {
254268
self.document_node_path.hash(&mut hasher);
255269
}
256-
self.hash.hash(&mut hasher);
270+
self.world_state_hash.hash(&mut hasher);
257271
std::mem::discriminant(&self.input).hash(&mut hasher);
258272
match self.input {
259273
ProtoNodeInput::None => (),
@@ -273,7 +287,7 @@ impl ProtoNode {
273287
input: ProtoNodeInput::None,
274288
document_node_path: path,
275289
skip_deduplication: false,
276-
hash: 0,
290+
world_state_hash: 0,
277291
}
278292
}
279293

@@ -386,7 +400,7 @@ impl ProtoNetwork {
386400
input,
387401
document_node_path: path,
388402
skip_deduplication: false,
389-
hash: 0,
403+
world_state_hash: 0,
390404
},
391405
));
392406

@@ -778,12 +792,12 @@ mod test {
778792
assert_eq!(
779793
ids,
780794
vec![
781-
2785293541695324513,
782-
12994980551665119079,
783-
17926586814106640907,
784-
2523412932923113119,
785-
12965978620570332342,
786-
16191561097939296982
795+
17957338642374791135,
796+
1303972037140595827,
797+
15485192931817078264,
798+
9739645351331265115,
799+
4165308598738454684,
800+
5557529806312473178
787801
]
788802
);
789803
}
@@ -799,8 +813,7 @@ mod test {
799813
identifier: "id".into(),
800814
input: ProtoNodeInput::Node(11, false),
801815
construction_args: ConstructionArgs::Nodes(vec![]),
802-
document_node_path: vec![],
803-
skip_deduplication: false,
816+
..Default::default()
804817
},
805818
),
806819
(
@@ -809,8 +822,7 @@ mod test {
809822
identifier: "id".into(),
810823
input: ProtoNodeInput::Node(11, false),
811824
construction_args: ConstructionArgs::Nodes(vec![]),
812-
document_node_path: vec![],
813-
skip_deduplication: false,
825+
..Default::default()
814826
},
815827
),
816828
(
@@ -819,8 +831,7 @@ mod test {
819831
identifier: "cons".into(),
820832
input: ProtoNodeInput::ManualComposition(concrete!(u32)),
821833
construction_args: ConstructionArgs::Nodes(vec![(14, false)]),
822-
document_node_path: vec![],
823-
skip_deduplication: false,
834+
..Default::default()
824835
},
825836
),
826837
(
@@ -829,8 +840,7 @@ mod test {
829840
identifier: "add".into(),
830841
input: ProtoNodeInput::Node(10, false),
831842
construction_args: ConstructionArgs::Nodes(vec![]),
832-
document_node_path: vec![],
833-
skip_deduplication: false,
843+
..Default::default()
834844
},
835845
),
836846
(
@@ -839,8 +849,7 @@ mod test {
839849
identifier: "value".into(),
840850
input: ProtoNodeInput::None,
841851
construction_args: ConstructionArgs::Value(value::TaggedValue::U32(2)),
842-
document_node_path: vec![],
843-
skip_deduplication: false,
852+
..Default::default()
844853
},
845854
),
846855
]
@@ -860,8 +869,7 @@ mod test {
860869
identifier: "id".into(),
861870
input: ProtoNodeInput::Node(2, false),
862871
construction_args: ConstructionArgs::Nodes(vec![]),
863-
document_node_path: vec![],
864-
skip_deduplication: false,
872+
..Default::default()
865873
},
866874
),
867875
(
@@ -870,8 +878,7 @@ mod test {
870878
identifier: "id".into(),
871879
input: ProtoNodeInput::Node(1, false),
872880
construction_args: ConstructionArgs::Nodes(vec![]),
873-
document_node_path: vec![],
874-
skip_deduplication: false,
881+
..Default::default()
875882
},
876883
),
877884
]

node-graph/interpreted-executor/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pub mod node_registry;
55
mod tests {
66
use graph_craft::document::value::TaggedValue;
77
use graphene_core::*;
8-
use std::borrow::Cow;
98

109
use futures::executor::block_on;
1110

@@ -95,7 +94,7 @@ mod tests {
9594
0,
9695
DocumentNode {
9796
name: "id".into(),
98-
inputs: vec![NodeInput::ShortCircut(concrete!(u32))],
97+
inputs: vec![NodeInput::Network(concrete!(u32))],
9998
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::IdNode")),
10099
..Default::default()
101100
},

0 commit comments

Comments
 (0)