Help with button mirror modifier

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

hi again :smiley: no ideas for this??

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')

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

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.

really thanks CoDEmanX I’m going to try to do my own code and when I finish put here :smiley:

thanks again