The question is: how to make changes in last action menu affect the operation with properties are passed in, like if I change them in MainPanel menu before the Operator execution? I want to make like dynamically changing properties.
I have my PropertyGroup:
class FBGenProperties(PropertyGroup):
root_subdiv : IntProperty(
name = "Chains Amount",
default = 3, min = 1, max = 100,
soft_min = 3, soft_max = 20,
subtype = "FACTOR"
)
bone_length : FloatProperty(
name = "Segments Length",
default = .1, min = 0.001, max = 100,
subtype = "DISTANCE"
)
Also the Operator:
class BonesGen(Operator):
bl_idname = "object.bones_gen"
root_subdiv : IntProperty()
bone_length : FloatProperty()
def execute(self, context) -> set:
self.obj = context.active_object
self.selected = self.obj.select_get() if self.obj is not None else False
props = self.obj.FB_gen_props
self.root_subdiv = props.root_subdiv
self.bone_length = props.bone_length
# I create this cylinder just for testing
bpy.ops.mesh.primitive_cylinder_add(
radius = self.root_subdiv,
depth = self.bone_length,
location = (0, 0, 0),
rotation = (0, 0, 0)
)
return {'FINISHED'}
Panel, where I can executes the BonesGen Operator from:
class MainPanel(Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
def draw(self, context):
layout = self.layout
obj = context.active_object
selected = obj.select_get() if obj!= None else False
name = obj.name if selected else ""
layout.label(text="Active is: " + name)
if name != "":
props = obj.FB_gen_props
col = layout.column()
col.prop(props, 'root_subdiv')
col.prop(props, 'bone_length')
layout.operator(operator = "object.bones_gen", text = "Generate Bones")
And following line in register() to make every object has my FBGenProperties properties:
bpy.types.Object.FB_gen_props = PointerProperty(type = FBGenProperties)
The question is: how to make changes in root_subdiv and bone_length properties (FBGenProperties) when operator executed like if this properties was an operator properties? I want my changes in 'last action menu' affect the primitive_cylinder_add() operation (any operation properties are passed in actually) like if I change them in MainPanel menu. Whatever help is offered. Thank you!