Cloning layout / too many operators

Hi,

I’m cloning/copying this layout but I noticed it has a lot of buttons.


If I’m right I would need to create more than 30 operators classes. However half of them are these numeric buttons that should be way easier to code than the rest.
Is there an easier way to create these buttons or I’m forced to create the 30 operator classes?

Thanks

I think you can do it with 10 operators and the rest with properties (you don’t need one operator per button, you can actually re-use a lot of them for -0.1/-0.5/+0.5/+0.1). Not sure if “Apply” is really needed, because in Blender properties are usually applied automatically and immediately.

Hmmm… Thanks but I think I don’t get it.
The numeric buttons are modifying the numeric sliders on the left. So if the slider is set to 1 and I click -0.5, then the slider becomes 0.5.
Can I do that with a property? I’m kind of newbie with the python api in Blender but when I use a property I only see the same “item”. So if I use properties instead of operators for those numeric buttons I will end with 4 extra sliders apart of the original slider (per row).
So I assume I’m not getting something.

The slider itself would be a property, the buttons to increment and decrement a single operator, that is added several times to the panel layout with different option / arguments.

wait, wait. You can use option/arguments in the operators? How? Do you have a link or something?

In the API docs obviously:
http://www.blender.org/api/blender_python_api_2_74_release/info_tutorial_addon.html#operator-property

Also in many of the Templates found in Blender’s Text Editor regarding Operators (e.g. Operator Mesh Add).

Some related stackexchange posts:



If you want to change context members, you don’t even have to define an operator. You can use the stock bpy.ops.wm.context_set_* operators instead:
http://www.blender.org/api/blender_python_api_2_74_release/bpy.ops.wm.html#bpy.ops.wm.context_set_boolean

It works! Thank you very much.