Skip to content

fix: Correct create_scene argument passing and node ownership #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alienfrenZyNo1
Copy link

  1. JSON Argument Passing on Windows:

    • Previously, JSON parameters passed as command-line arguments from the Node.js server (src/index.ts) to the Godot operations script (src/scripts/godot_operations.gd) were getting corrupted on Windows.
    • This was caused by using child_process.spawn with shell: true and attempting Unix-style shell escaping, which doesn't work correctly in Windows shells (cmd/powershell).
    • Fix: Modified executeOperation in src/index.ts to use spawn with shell: false. This allows Node.js to handle argument quoting correctly across platforms, and the raw JSON string can be passed directly without needing shell-specific escaping.
  2. Godot Node Ownership Error:

    • After fixing the argument passing, the create_scene function in src/scripts/godot_operations.gd was failing with a Godot engine error: Condition "p_owner == this" is true.
    • This was caused by incorrectly setting scene_root.owner = scene_root before packing the scene.
    • Fix: Removed the scene_root.owner = scene_root line. The PackedScene.pack() method correctly handles the ownership of the root node being packed.

With these changes, the create_scene tool now functions correctly, successfully creating scene files as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant