YHOYO
(YHOYO)
March 26, 2014, 1:22pm
1
hi how are you?
I’m trying to do a new simmetry button…here the code:
props = row.operator("object.modifier_add", text="Mirror/ Simetria", icon='MOD_MIRROR').type="MIRROR"
this work fine in order to add the simmetry but I want check for default:
use_clip
use_mirror_u
use_mirror_v
I already read the api http://www.blender.org/documentation/blender_python_api_2_62_0/bpy.types.MirrorModifier.html but in this moment I confused
thanks for help
Diego
YHOYO
(YHOYO)
April 22, 2014, 11:31am
2
hi again no ideas for this??
CoDEmanX
(CoDEmanX)
April 22, 2014, 4:10pm
3
The modifier_add() operator does not provide any parameters to set certain defaults, you need to make up your own. Something along:
class OBJECT_OT_simetria_add(bpy.types.Operator):
bl_idname = "object.simetria_add"
bl_label = "Mirror / Simetria"
@classmethod
def poll(cls, context):
return context.object is not None and context.object.type == 'MESH'
def execute(self, context):
mod = context.object.modifiers.new("Simetria", 'MIRROR')
mod.use_clip = True
mod.use_mirror_u = True
mod.use_mirror_v = True
return {'FINISHED'}
# ...
row.operator("object.simetria_add", icon='MOD_MIRROR')
YHOYO
(YHOYO)
April 24, 2014, 6:38am
4
ummm thanks for this idea… ummmmay be is a stupid dummy cuestion… but … how I know which “things” into blender provide parameters???
thanks again
Diego
CoDEmanX
(CoDEmanX)
April 24, 2014, 12:52pm
5
If the functions / methods are Python-defined, you can check the source code. Otherwise experiment with auto-complete in the python console, or see the API docs (not everything is covered here however).
You may also use the dir(…) function on objects to list all methods and attributes.
YHOYO
(YHOYO)
April 24, 2014, 8:22pm
6
really thanks CoDEmanX I’m going to try to do my own code and when I finish put here
thanks again