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

Overwrite global parameters with the creation of new instances #3

Open
MattiaPugliatti opened this issue Jul 3, 2024 · 2 comments
Open
Assignees

Comments

@MattiaPugliatti
Copy link
Owner

for example, as in "Camera" or "Body", etc.

@micmaestrini
Copy link
Collaborator

micmaestrini commented Jul 4, 2024

Some properties of an instance are initialized in the constructor, however they are global variables and therefore new instances would overwrite them in the Blender environment. Examples:

@micmaestrini
Copy link
Collaborator

After preliminary review, the following solution is proposed in bc61c25.

  • For the body class, it is already behaving as expected. If a new body instance is created it will override the "diffuse bounces property", if one wishes to define multiple objects they shall have the same property. If this is not the case, different instances can be created and the method set_diffuse_bounces can be used to fix the intended behavior.
  • For the camera class, the global properties will be overwritten in the blender environment, but their local copy is stored as attributes of the instance in the workspace. Consequently, the method toBlender() has been implemented to allow to push the variables from the local workshpace to Blender without having to redefine the camera. Basically, once multiple cameras are created, the global variables will be set to the latest camera created, however if a different one is needed, the global parameters can be set from the attributes of one of the instances by simply pushing them to Blender through toBlender() method.
  • For the rendering class the behavior has been fixed in the same way as for camera class.

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

No branches or pull requests

2 participants