I`m working on little plugin for my friend where he can do multi object operations which are not available in blender (removing vertex groups to all objects and so on…), and I’m stuck on property view and I can’t find my use case on internet so I’m here.
Clicking and everythin works, but slider for my smoothValue property is static and i can’t change value, I don’t understand what i have to do to make it work.
As you can see on image, dragging of this value starts scene selection.
you can’t change the value because the property isn’t “active” since the operator isn’t running. If all you want to do is set the autosmooth angle for a mesh, why not just pass in the mesh’s property directly rather than doing some kind of round-about method with an operator?
if context.active_object.type =='MESH':
box.prop(context.active_object.data, 'auto_smooth_angle', slider=True)
Also layout.prop(context.active_object.data, 'use_auto_smooth', toggle=True) for toggling autosmooth directly ? No need to reinvent the wheel when you can re-draw UI elements
Thats for multi objects operation, so uix use case of toggle button could be weird because half of selected object has attribute on true and half dont, this is easier to see, just disable / enable it
Alright, then you need to understand unless you store the properties somewhere else in the file (eg bpy.types.Scene) you can’t change these before clicking on the operator, because they’re not tied to this instance of the operator yet, because it doesn’t exist when this part of the layout is drawn.
You’ll need to use invoke. and then tweak your props in the popup :
You can change the operator draw method to layout the popup as you wish