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.

@An-actual-duck
Copy link

An-actual-duck commented May 24, 2025

Well I can create scenes now using the ide but for some reason creating a node causes the ide to hang. Because it just hangs there I'm not getting any output or anything to look at and explain why. Huge thanks for solving one issue, let me know if you have any idea why creating a node may be causing the ide to hang now.

edit: After messing around a small note. If I restart my ide it can then create a node, but after creating 1 node it can't do another.

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.

2 participants