Skip to content

Commit

Permalink
GH-472 Show event actions when dragging from input pins
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Jul 13, 2024
1 parent 53d23f3 commit 2eaf767
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/editor/graph/graph_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@ void OrchestratorGraphEdit::_on_attempt_connection_to_empty(const StringName& p_
return;

OrchestratorGraphActionFilter filter;
filter.flags = OrchestratorGraphActionFilter::Filter_RejectEvents;
filter.context.graph = this;
filter.context.pins.push_back(pin);

Expand Down
44 changes: 43 additions & 1 deletion src/editor/graph/graph_node_spawner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,49 @@ bool OrchestratorGraphNodeSpawnerEvent::is_filtered(const OrchestratorGraphActio
return true;
}

return OrchestratorGraphNodeSpawnerCallMemberFunction::is_filtered(p_filter, p_spec);
bool reject_methods = p_filter.flags & OrchestratorGraphActionFilter::Filter_RejectMethods;
bool reject_virtual = p_filter.flags & OrchestratorGraphActionFilter::Filter_RejectVirtualMethods;

// Simply do not add these virtual overrides to the UI
// Users should always use the non-virtual "get" and "set methods only
if (_method.name.match("_get") || _method.name.match("_set"))
return true;

if (reject_methods && reject_virtual)
return true;

if (reject_virtual && (_method.flags & METHOD_FLAG_VIRTUAL))
return true;

if (reject_methods && (!(_method.flags & METHOD_FLAG_VIRTUAL)))
return true;

if (p_filter.context_sensitive)
{
bool args_filtered = false;
for (OrchestratorGraphNodePin* pin : p_filter.context.pins)
{
if (pin->is_input())
{
bool found = false;
for (const PropertyInfo& property : _method.arguments)
{
if (property.type == pin->get_value_type())
{
found = true;
break;
}
}
if (!found)
args_filtered = true;
}
}

if (args_filtered)
return true;
}

return OrchestratorGraphNodeSpawner::is_filtered(p_filter, p_spec);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 2eaf767

Please sign in to comment.