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

Phantom Camera Host script environment/attributes duplicate() seems rerolling resource IDs in .tscn muddying git commits. #368

Open
JelaMiraj opened this issue Aug 21, 2024 · 2 comments
Labels
3D Issues concerning 3D scenes Blocked enhancement New feature or request phantom camera Related to PhantomCamera nodes

Comments

@JelaMiraj
Copy link

JelaMiraj commented Aug 21, 2024

Issue description

I'm using Godot 4.3 dotnet release on windows 11. Everytime I load or save a scene (including caused by just by reopening the project in godot editor) backed by .tscn with my phantom camera setup the random slug ending of the name of the resource id of duplicated camera attributes and environment property nodes get rerolled causing that as a detected change by git. Most likely a result of how lines 598 to 602 of the phantom_camera_host.gd script plays out.

` if _active_pcam_3d.attributes != null:
camera_3d.attributes = _active_pcam_3d.attributes.duplicate()

		if _active_pcam_3d.environment != null:
			camera_3d.environment = _active_pcam_3d.environment.duplicate()

`
I have 3 phantom cameras wide, main, and close with different priorities and leave the 2 i'm not currently using set to hidden. the scene has just one normal camera3d with the phantomcamerahost node with attached script as a child node.

Hopefully either some workaround that I've yet to find or an actual change in the addon can prevent this issue while preserving need functionality of different camera shots needing different physical camera attribute resources and pbr lighting needing environments...

I have minimal bug demo project options included while we sort this out. Hopefully the solution will be relatively easy to work through! 😻 👍

Steps to reproduce

  1. have a godot project backed by git scm with no pending changes.
  2. Have a scene saved as a .tscn.
  3. add camera3d node.
  4. add phantom camera node.
  5. add environment resource and camera attributes resource to phantom camera node properties. (I chose ones backed by external files).
  6. save scene and the git pending changes to narrow the list later.
  7. attach phantomcamerahost node with its script as a child of camera3d node. (it's first activation will make the random ID's resource in the scene and subseqently brand new ones with new names for git to detect endlessly.)
  8. save or (re)load the .tscn and check git pending changes.
  9. if no randomly renamed environment or camera attributes resource id in .tscn try again save/(re)load the .tscn and check git pending changes.

(Optional) Minimal reproduction project

Reproduction minimal demo project with commits:
Linked until I private when I know resolved
Attached zip of git repo of min bug demo project at same commit at that time.
PhantomCam_TScene_Save_HCam_AttrEnv_Glitch_Example-main.zip

@ramokz ramokz added enhancement New feature or request phantom camera Related to PhantomCamera nodes 3D Issues concerning 3D scenes labels Aug 21, 2024
@ramokz
Copy link
Owner

ramokz commented Aug 21, 2024

It's basically like you have deduced, and should be an addon solution rather than something the user has to do.

The addon code basically just needs to update the environment and attribute properties to the Camera3D only on change, rather than duplicating and reassigning the resource every frame. It was purposely written less efficiently like this to get the release and feature out sooner, hence the TODO optimization comment a few lines above the ones you referenced.

It shouldn't cause any issues as the resource ID is specific to the Camera3D node. So the git change can be ignored / reverted for now.

@ramokz ramokz added this to the 0.8 milestone Sep 11, 2024
@ramokz ramokz moved this to 🔖 Ready in PhantomCamera Sep 11, 2024
@ramokz ramokz modified the milestones: 0.8, 0.8.1 Oct 16, 2024
@ramokz
Copy link
Owner

ramokz commented Nov 21, 2024

Got a branch set up that circumvents the .duplicate() approach and also allows for changing the properties during runtime. However, it's currently blocked due to a bug where not all properties emit the changed() signal.

Have submitted an issue, it only covers attributes for now, as I don't want to conflate both attributes and environment resources into one issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3D Issues concerning 3D scenes Blocked enhancement New feature or request phantom camera Related to PhantomCamera nodes
Projects
Status: 🏗 In progress
Development

No branches or pull requests

2 participants