I have a scene with custom properties, written in a class, I am now able to access the values of these properties, I would like to know how to write these values in a new scene. For example:
This is the properties:
class MySceneProperty(bpy.types.PropertyGroup): my_bool: BoolProperty(default=false) my_int: IntProperty(default=0) my_float: FloatProperty(default=0.0) def register(): bpy.types.Scene.scene_prop = bpy.props.PointerProperty(type=MySceneProperty)
I would like to create a new scene and use the previous parameters, as they could be changed by the default value, so the approach would be.
def my_function(self,context): first_scene = bpy.context.scene ###get attributes: for key in first_scene.scene_prop.__annotations__.keys(): first_attributes = getattr(first_scene.scene_prop, key) ###new scene creation: new_scene= bpy.data.scenes.new("New scene") context.window.scene = new_scene #Here I would like to set the attributes of the previous scene but I #don't know how to do it ###set attributes??? (this obviously produces an error) for key in new_scene.scene_prop.__annotations__.keys(): setattr(new_scene.scene_prop, key) = first_attributes