feat: support component-bound events in add_event handler#483
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds a guarded component-bound event path in ChangesComponent-Bound Event Handling in add_event
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Around line 22-28: The CHANGELOG.md file contains unresolved git merge
conflict markers (<<<<<<< Updated upstream, =======, and >>>>>>> Stashed
changes) between lines 22-28 that must be removed before shipping. Resolve this
conflict by reviewing both versions separated by the markers, deciding which
changelog entries to keep or combining them if both are valuable, then remove
all three conflict markers along with the separator lines so the changelog
contains only the final resolved content without any git markers.
In
`@plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/Domains/Blueprint/Events/McpAutomationBridge_BlueprintHandlersAddEvent.cpp`:
- Around line 175-179: The bIsComponentBoundRequest detection in
McpAutomationBridge_BlueprintHandlersAddEvent.cpp currently requires
ComponentName to be non-empty, allowing explicit ComponentBoundEvent hints
without a componentName to bypass validation and fall into incorrect branches.
Refactor the logic to first detect explicit component-bound intent by checking
if NodeTypeLower or EventTypeLower contains "componentboundevent" as a separate
condition that indicates component-bound intent regardless of ComponentName
presence, then separately validate that required fields like ComponentName and
event names are provided, returning INVALID_ARGUMENT when they are missing
instead of allowing the request to proceed into unrelated event handling
branches.
- Around line 181-299: When MCP_HAS_K2NODE_COMPONENTBOUNDEVENT is 0,
component-bound event requests currently fall through to non-component logic
without notifying the caller that the feature is unavailable. Add an explicit
else branch after the endif for MCP_HAS_K2NODE_COMPONENTBOUNDEVENT that checks
if bIsComponentBoundRequest is true, and if so, calls Bridge.SendAutomationError
with a clear message indicating that component-bound event handling is not
available in this build configuration, using TEXT("FEATURE_NOT_AVAILABLE") as
the error code. This ensures that when the component-bound feature is compiled
out, callers receive an explicit failure message instead of misleading behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 95adc9a6-58b2-4bc7-bf88-792330d23172
📒 Files selected for processing (2)
CHANGELOG.mdplugins/McpAutomationBridge/Source/McpAutomationBridge/Private/Domains/Blueprint/Events/McpAutomationBridge_BlueprintHandlersAddEvent.cpp
- resolve CHANGELOG stash-pop conflict; scope the Unreleased entry to this PR (component-bound events) and drop the leftover Fixed bullets that belong to other PRs - detect an explicit ComponentBoundEvent hint (nodeType/eventType) independently of field presence, and validate componentName and eventName separately inside the branch, so an explicit request with a missing field returns INVALID_ARGUMENT instead of silently becoming a dead custom event - add an #else NOT_AVAILABLE path: when MCP_HAS_K2NODE_COMPONENTBOUNDEVENT is 0, a component-bound request now errors clearly instead of falling through to the custom-event branch
Summary
add_eventpreviously had no path forK2Node_ComponentBoundEvent, so callers asking to wire a component's multicast delegate (e.g.MyCollider.OnComponentBeginOverlap) fell through to the custom-event branch and got an unboundEvent_<guid>that never fired. This PR adds a dedicated branch that creates a properly initialized component-bound event node, so per-component overlap / hit / value-changed delegates can be authored over MCP.Changes
HandleBlueprintAddEvent, triggered when the payload suppliescomponentNameplus a delegateeventName(or setsnodeType/eventTypetoK2Node_ComponentBoundEvent/ComponentBoundEvent).OnComponentBeginOverlap) and the engine's generated__DelegateSignatureform.UK2Node_ComponentBoundEventwithComponentPropertyName,DelegatePropertyName, andDelegateOwnerClassset, so the bound event actually fires on broadcast.INVALID_ARGUMENT,COMPONENT_NOT_FOUND,COMPONENT_CLASS_UNRESOLVED,DELEGATE_NOT_FOUND.__has_includefallback pattern already applied toK2Node_DynamicCast/K2Node_CreateWidget, plus anMCP_HAS_K2NODE_COMPONENTBOUNDEVENTguard so the file still compiles cleanly on engine layouts where the header isn't reachable through any of the tried include paths.Addedentry under[Unreleased]in CHANGELOG.md; also cleaned up two stray merge labels (fix/dynamiccast-target-class,dev) that were sitting in the changelog as plain text.Related Issues
Type of Change
Testing
Pre-Merge Checklist
[Unreleased])