Skip to content

Commit cf271df

Browse files
committed
Prevent crash during migration
1 parent e9d33e5 commit cf271df

2 files changed

Lines changed: 14 additions & 20 deletions

File tree

editor/src/messages/portfolio/document_migration.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,18 +1633,19 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
16331633
}
16341634

16351635
// TODO: Also add this for "Animation Time"
1636-
// Upgrade the "Instance Position" node to add the "Loop Level" input
1637-
if reference == DefinitionIdentifier::ProtoNode(graphene_std::vector_nodes::instance::instance_position::IDENTIFIER) && inputs_count < 2 {
1638-
let mut node_template = resolve_document_node_type(&reference)?.default_node_template();
1639-
document.network_interface.replace_implementation(node_id, network_path, &mut node_template);
16401636

1641-
document
1642-
.network_interface
1643-
.set_input(&InputConnector::node(*node_id, 0), NodeInput::value(TaggedValue::None, false), network_path);
1644-
document
1645-
.network_interface
1646-
.set_input(&InputConnector::node(*node_id, 1), NodeInput::value(TaggedValue::U32(0), false), network_path);
1647-
}
1637+
// // Upgrade the "Instance Position" node to add the "Loop Level" input
1638+
// if reference == DefinitionIdentifier::ProtoNode(graphene_std::vector_nodes::instance::instance_position::IDENTIFIER) && inputs_count < 2 {
1639+
// let mut node_template = resolve_document_node_type(&reference)?.default_node_template();
1640+
// document.network_interface.replace_implementation(node_id, network_path, &mut node_template);
1641+
1642+
// document
1643+
// .network_interface
1644+
// .set_input(&InputConnector::node(*node_id, 0), NodeInput::value(TaggedValue::None, false), network_path);
1645+
// document
1646+
// .network_interface
1647+
// .set_input(&InputConnector::node(*node_id, 1), NodeInput::value(TaggedValue::U32(0), false), network_path);
1648+
// }
16481649

16491650
// Migrate from the old source/target "Morph" node to the new vector table based "Morph" node.
16501651
// This doesn't produce exactly equivalent results in cases involving input vector tables with multiple rows.

node-graph/nodes/vector/src/instance.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,11 @@ async fn instance_repeat<T: Into<Graphic> + Default + Send + Clone + 'static>(
8484
}
8585

8686
#[node_macro::node(category("Instancing"), path(core_types::vector))]
87-
async fn instance_position(
88-
ctx: impl Ctx + ExtractPosition,
89-
_primary: (),
90-
/// The number of nested loops to traverse outwards (from the innermost loop) to get the position from. The most upstream loop is level 0, and downstream loops add levels.
91-
///
92-
/// In programming terms: inside the double loop `i { j { ... } }`, *Loop Level* 0 = `j` and 1 = `i`. After inserting a third loop `k { ... }`, inside it, levels would be 0 = `k`, 1 = `j`, and 2 = `i`.
93-
loop_level: u32,
94-
) -> DVec2 {
87+
async fn instance_position(ctx: impl Ctx + ExtractPosition) -> DVec2 {
9588
let Some(position_iter) = ctx.try_position() else { return DVec2::ZERO };
9689
let mut last = DVec2::ZERO;
9790
for (i, position) in position_iter.enumerate() {
98-
if i == loop_level as usize {
91+
if i == 0 as usize {
9992
return position;
10093
}
10194
last = position;

0 commit comments

Comments
 (0)