Skip to content

Commit

Permalink
Reset assign type on duplicate/paste
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Aug 5, 2024
1 parent 41269c3 commit fb2bd08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/script/nodes/variables/local_variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,17 @@ void OScriptNodeAssignLocalVariable::post_initialize()
super::post_initialize();
}

void OScriptNodeAssignLocalVariable::post_placed_new_node()
{
Ref<OScriptNodePin> variable = find_pin("variable");
if (variable.is_valid() && _type != Variant::NIL && !variable->has_any_connections())
{
_type = Variant::NIL;
reconstruct_node();
}
super::post_placed_new_node();
}

void OScriptNodeAssignLocalVariable::allocate_default_pins()
{
create_pin(PD_Input, PT_Execution, PropertyUtils::make_exec("ExecIn"));
Expand Down
1 change: 1 addition & 0 deletions src/script/nodes/variables/local_variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class OScriptNodeAssignLocalVariable : public OScriptNode
public:
//~ Begin OScriptNode Interface
void post_initialize() override;
void post_placed_new_node() override;
void allocate_default_pins() override;
String get_node_title() const override;
String get_node_title_color_name() const override { return "variable"; }
Expand Down

0 comments on commit fb2bd08

Please sign in to comment.