Skip to content
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

Saving with auto export destructively removes empty nodes from scene #149

Open
DylanRJohnston opened this issue Feb 29, 2024 · 8 comments
Open

Comments

@DylanRJohnston
Copy link

DylanRJohnston commented Feb 29, 2024

When saving with the auto export plugin, empty nodes are destructively removed from the scene (cannot be recovered with undo) and the script produces the following error.

Traceback (most recent call last):
  File "/Users/dylanj/Library/Application Support/Blender/4.0/scripts/addons/gltf_auto_export/auto_export/auto_export.py", line 116, in auto_export
    export_main_scene(bpy.data.scenes[scene_name], folder_path, addon_prefs, library_collections)
  File "/Users/dylanj/Library/Application Support/Blender/4.0/scripts/addons/gltf_auto_export/auto_export/export_main_scenes.py", line 57, in export_main_scene
    generate_and_export(
  File "/Users/dylanj/Library/Application Support/Blender/4.0/scripts/addons/gltf_auto_export/helpers/generate_and_export.py", line 57, in generate_and_export
    bpy.ops.object.mode_set( mode = original_mode )
  File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 109, in __call__
    ret = _op_call(self.idname_py(), kw)
RuntimeError: Operator bpy.ops.object.mode_set.poll() Context missing active object

I've been trying to used empty nodes to mark spawn point and camera positions, but they get destroyed upon save. Turning them into blueprints works but produces an extra glb file that needs to be requested over the network on load and is extra work for one off markers.

@DylanRJohnston
Copy link
Author

For now I've created a generic "Marker" blueprint which I then customize with the required components once it's instanced in the scene. This ensures there's only a single extraneous glb file created.

Actually upon second thought, I could probably just override the behavior so it doesn't get split out into its own file.

@kaosat-dev
Copy link
Owner

Do you mean Blender's "Empty" Objects ?
Those should be exported normally, have been using them for testing for a while, even added an automated test, and they are exported as they should, cannot reproduce this issue.
As in the other issue you reported, I would need more information to reproduce & fix

  • are you using them in your main or library scene ?
  • what is your setup (ie more information about scene etc)
  • what version of gltf_auto_export are you using ?

@DylanRJohnston
Copy link
Author

Yeah sorry I meant the Empty nodes you create with Shift+A. When using them in the main scene, if they're not a blueprint instance they get removed (and can't be undone) from the main scene and the plugin generates the provided error.

In this screenshot you can see the Marker blueprints I've created to work around the issue under the Pregame Spawns collection.
Screenshot 2024-03-01 at 1 06 11 pm

I'm currently using v0.13.0 of the gltf_auto_export plugin. I'm on macOS Sonoma on an Apple M3 Pro, python 3.9.6, blender 4.0.2.

@kaosat-dev
Copy link
Owner

  • Thanks for the information, it all seems ok, very weird.
  • v0.13.1 of gltf_auto_export is out and it fixes some issues that are normally not related (except animated objects and nested parent/child hierarchies) , but might be worth a try ?
  • empties: So you mean these empties right ?
    image
  • btw this is the screenshot of the test file for the automated tests:
    image, as you can see it has an "empty" for testing, so I am baffled.
    I also think your two issues might be related, weirder still: the issues you describe where present in previous versions of the add-on .

If all else fails, can you perhaps send me a copy of your blend file so that I can take a closer look ?
If you don't want to share it publicly I understand, I'll give you my email

@DylanRJohnston
Copy link
Author

I'm happy to share it publicly as it's already on github https://github.com/DylanRJohnston/deep-space-derby/blob/main/simulation/game.blend

@kaosat-dev
Copy link
Owner

@DylanRJohnston Thanks for the file !
I was actually able to reproduce this issue !

  • It turns out , the issue is with empties inside another collection, inside the main scene :D I'll try to fix that asap.
  • Btw I was not able to reproduce the error with change detection, even with your example file .
  • I do not know if you are interested in feedback as far as project organization (Blender side) goes, but I would have a few tips if you want ? (some things I noticed while trying out your blend file)

@kaosat-dev
Copy link
Owner

@DylanRJohnston , sadly I spoke too soon: while I was able to reproduce this issue with your blend file, the tests I added for this, and any other project I tested this with have not had this issue :(
I tried various levels of nesting of empties, inside & outside collections etc

@DylanRJohnston
Copy link
Author

Yeah definitely, I’m super new to blender and largely have no idea what I’m doing.

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

No branches or pull requests

2 participants