godot icon indicating copy to clipboard operation
godot copied to clipboard

Updating .blend file does not reflect in @export variable PackedScene

Open ManasMakde opened this issue 1 year ago • 4 comments

Tested versions

v4.2.2.stable.official [15073afe3]

System information

Godot v4.2.2.stable - Ubuntu 22.04.4 LTS 22.04 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1660 Ti (nvidia; 535.183.01) - AMD Ryzen 7 4800H with Radeon Graphics (16 Threads)

Issue description

Updating a .blend file in blender does not reflect changes in the @export variable:PackedScene rather it creates a PackedScene of the old .blend file

Steps to reproduce

I have an exported variable as such:

@export var my_blend_scene:PackedScene

and I've passed a blend file as a scene into it as such:

Editor Screenshot 1

but whenever I update & save the .blend file in blender (version 3.6.9) and then open godot again, the export variable does not update rather it creates a PackedScene of the old blend file:

Editor Screenshot 2

If this is the intended behaviour, then is there any other way to keep the exported variable in sync with the .blend file?

Minimal reproduction project (MRP)

Blend File Export (MRP).zip

ManasMakde avatar Jul 23 '24 06:07 ManasMakde

Can you check behavior in 4.3 beta3 I suspect that there were some bugfixes.

fire avatar Jul 24 '24 05:07 fire

@fire yep it's fixed in v4.3.beta3.official [82cedc83c],

when I Open Scene via the @export my_blend_scene in the inspector it shows the updated version, However when I view the instantiated $Main/cube it no longer updates

https://github.com/user-attachments/assets/749f01ea-d435-4eea-85c6-7c52264cb1b7

so this seems to be a new bug now :/

Edit:
I tested this in v4.2.2.stable.official [15073afe3] as well and the instantiated $Main/cube does update when updating the .blend file

ManasMakde avatar Jul 24 '24 06:07 ManasMakde

I noticed you didn't save the instantiated $Main/cube so it no longer updates so I suspect it isn't being tracked for reloading as designed?

I think this new behaviour might be wanted. Let me know how it affects your workflows.

fire avatar Jul 24 '24 17:07 fire

@fire could you elaborate what you mean by "save the instantiated $Main/cube" ? Do you mean like save it as a separate scene? or do you mean save the entire Main scene (as in just pressing Ctrl + s)?

Also after some testing I found out that if I pass the cube.blend as an argument to my_blend_scene then the $Main/cube does not update BUT if I remove it as an argument then it starts tracking updates

https://github.com/user-attachments/assets/943f9523-9352-452e-b5a6-135640211dce

Not sure but maybe some issue with the reference count?

Edit: Turns out the inconsistent updating might be related to #75970 If that issue is resolved maybe this will be solved too (will have to test before closing though)

ManasMakde avatar Jul 25 '24 04:07 ManasMakde

@ManasMakde This issue appears to be resolved in v4.3.rc.custom_build [3e0c10d39] can you confirm?

yahkr avatar Jul 31 '24 12:07 yahkr

@yahkr yep it seems to be resolved now, closing this issue

Edit: I had a problem where updating a .blend file and then instancing it did not give the updated version:

var cube = load("res://cube.blend").instance(PackedScene.GEN_EDIT_STATE_INSTANCE)
self.add_child(cube)
cube.owner = get_tree().edited_scene_root

image

Turns out it was an issue with cache and as far as I can tell godot was instancing the old cached version of the .blend file, to fix it I adjusted the code as such:

var cube = ResourceLoader.load("res://cube.blend", "", ResourceLoader.CACHE_MODE_IGNORE).instance(PackedScene.GEN_EDIT_STATE_INSTANCE)
self.add_child(cube)
cube.owner = get_tree().edited_scene_root

Hope this helps :)

ManasMakde avatar Aug 01 '24 05:08 ManasMakde