Skip to main content
added 10 characters in body
Source Link
batFINGER
  • 85.2k
  • 10
  • 114
  • 244

Addon requires a Category

enter image description here

Give an addon a category, for example sake and to match op name have given it the "Object" category, can use anything here, best to stick with those available if possible. IMO this is prob a mesh operator, that adds modifiers to mesh objects

bl_info = {
    "name": "DC Mirror",
    "version": (1, 0),
    "blender": (2, 90, 0),
    "category": "Object",
}

We assign keymaps to run operators or assign properties. In addon this is "object.dc_mirror", below I've added a keymap to the window such that ShiftCtrlT calls the op.

After assingning it to "object_dc_mirror" notice how the name becomes "DC Mirror", this is confirmation the operator is registered and known to blender

enter image description here

And when run with a mesh object as context. Tip: give the operator a poll method limiting it to only mesh objects.

enter image description here

Consult the docs re adding a keymap via code https://docs.blender.org/manual/en/latest/advanced/scripting/addon_tutorial.html#keymap

Common logic error

Worth mentioning that there is an issue with your addon if run again, it will add a new mirror modifier, but only ever alter the properties of the one having name "Mirror"

Recommend instead

def execute(self, context):
    ob = context.object
    mm = ob.modifiers.new(name="Mirror", type='MIRROR')
    
    mm.show_on_cage = True
    mm.use_bisect_axis.xuse_bisect_axis[0] = True # x axis
    mm.use_clip = True


    return {'FINISHED'}

Addon requires a Category

enter image description here

Give an addon a category, for example sake and to match op name have given it the "Object" category, can use anything here, best to stick with those available if possible. IMO this is prob a mesh operator, that adds modifiers to mesh objects

bl_info = {
    "name": "DC Mirror",
    "version": (1, 0),
    "blender": (2, 90, 0),
    "category": "Object",
}

We assign keymaps to run operators or assign properties. In addon this is "object.dc_mirror", below I've added a keymap to the window such that ShiftCtrlT calls the op.

After assingning it to "object_dc_mirror" notice how the name becomes "DC Mirror", this is confirmation the operator is registered and known to blender

enter image description here

And when run with a mesh object as context. Tip: give the operator a poll method limiting it to only mesh objects.

enter image description here

Consult the docs re adding a keymap via code https://docs.blender.org/manual/en/latest/advanced/scripting/addon_tutorial.html#keymap

Common logic error

Worth mentioning that there is an issue with your addon if run again, it will add a new mirror modifier, but only ever alter the properties of the one having name "Mirror"

Recommend instead

def execute(self, context):
    ob = context.object
    mm = ob.modifiers.new(name="Mirror", type='MIRROR')
    
    mm.show_on_cage = True
    mm.use_bisect_axis.x = True
    mm.use_clip = True


    return {'FINISHED'}

Addon requires a Category

enter image description here

Give an addon a category, for example sake and to match op name have given it the "Object" category, can use anything here, best to stick with those available if possible. IMO this is prob a mesh operator, that adds modifiers to mesh objects

bl_info = {
    "name": "DC Mirror",
    "version": (1, 0),
    "blender": (2, 90, 0),
    "category": "Object",
}

We assign keymaps to run operators or assign properties. In addon this is "object.dc_mirror", below I've added a keymap to the window such that ShiftCtrlT calls the op.

After assingning it to "object_dc_mirror" notice how the name becomes "DC Mirror", this is confirmation the operator is registered and known to blender

enter image description here

And when run with a mesh object as context. Tip: give the operator a poll method limiting it to only mesh objects.

enter image description here

Consult the docs re adding a keymap via code https://docs.blender.org/manual/en/latest/advanced/scripting/addon_tutorial.html#keymap

Common logic error

Worth mentioning that there is an issue with your addon if run again, it will add a new mirror modifier, but only ever alter the properties of the one having name "Mirror"

Recommend instead

def execute(self, context):
    ob = context.object
    mm = ob.modifiers.new(name="Mirror", type='MIRROR')
    
    mm.show_on_cage = True
    mm.use_bisect_axis[0] = True # x axis
    mm.use_clip = True


    return {'FINISHED'}
added 490 characters in body
Source Link
batFINGER
  • 85.2k
  • 10
  • 114
  • 244

Addon requires a Category

enter image description here

Give an addon a category, for example sake and to match op name have given it the "Object" category, can use anything here, best to stick with those available if possible. IMO this is prob a mesh operator, that adds modifiers to mesh objects

bl_info = {
    "name": "DC Mirror",
    "version": (1, 0),
    "blender": (2, 90, 0),
    "category": "Object",
}

We assign keymaps to run operators or assign properties. In addon this is "object.dc_mirror", below I've added a keymap to the window such that ShiftCtrlT calls the op.

After assingning it to "object_dc_mirror" notice how the name becomes "DC Mirror", this is confirmation the operator is registered and known to blender

enter image description here

And when run with a mesh object as context. Tip: give the operator a poll method limiting it to only mesh objects.

enter image description here

Consult the docs re adding a keymap via code https://docs.blender.org/manual/en/latest/advanced/scripting/addon_tutorial.html#keymap

Common logic error

Worth mentioning that there is an issue with your addon if run again, it will add a new mirror modifier, but only ever alter the properties of the first.. or the one having name "Mirror"

Recommend instead

def execute(self, context):
    ob = context.object
    mm = ob.modifiers.new(name="Mirror", type='MIRROR')
    
    mm.show_on_cage = True
    mm.use_bisect_axis.x = True
    mm.use_clip = True


    return {'FINISHED'}

Addon requires a Category

enter image description here

Give an addon a category, for example sake and to match op name have given it the "Object" category, can use anything here, best to stick with those available if possible. IMO this is prob a mesh operator, that adds modifiers to mesh objects

bl_info = {
    "name": "DC Mirror",
    "version": (1, 0),
    "blender": (2, 90, 0),
    "category": "Object",
}

We assign keymaps to run operators or assign properties. In addon this is "object.dc_mirror", below I've added a keymap to the window such that ShiftCtrlT calls the op.

enter image description here

And when run with a mesh object as context. Tip: give the operator a poll method limiting it to only mesh objects.

enter image description here

Consult the docs re adding a keymap via code https://docs.blender.org/manual/en/latest/advanced/scripting/addon_tutorial.html#keymap

Common logic error

Worth mentioning that there is an issue with your addon if run again, it will add a new mirror modifier, but only ever alter the properties of the first.. or the one having name "Mirror"

Recommend instead

def execute(self, context):
    ob = context.object
    mm = ob.modifiers.new(name="Mirror", type='MIRROR')
    
    mm.show_on_cage = True
    mm.use_bisect_axis.x = True
    mm.use_clip = True


    return {'FINISHED'}

Addon requires a Category

enter image description here

Give an addon a category, for example sake and to match op name have given it the "Object" category, can use anything here, best to stick with those available if possible. IMO this is prob a mesh operator, that adds modifiers to mesh objects

bl_info = {
    "name": "DC Mirror",
    "version": (1, 0),
    "blender": (2, 90, 0),
    "category": "Object",
}

We assign keymaps to run operators or assign properties. In addon this is "object.dc_mirror", below I've added a keymap to the window such that ShiftCtrlT calls the op.

After assingning it to "object_dc_mirror" notice how the name becomes "DC Mirror", this is confirmation the operator is registered and known to blender

enter image description here

And when run with a mesh object as context. Tip: give the operator a poll method limiting it to only mesh objects.

enter image description here

Consult the docs re adding a keymap via code https://docs.blender.org/manual/en/latest/advanced/scripting/addon_tutorial.html#keymap

Common logic error

Worth mentioning that there is an issue with your addon if run again, it will add a new mirror modifier, but only ever alter the properties of the one having name "Mirror"

Recommend instead

def execute(self, context):
    ob = context.object
    mm = ob.modifiers.new(name="Mirror", type='MIRROR')
    
    mm.show_on_cage = True
    mm.use_bisect_axis.x = True
    mm.use_clip = True


    return {'FINISHED'}
added 490 characters in body
Source Link
batFINGER
  • 85.2k
  • 10
  • 114
  • 244

Addon requires a Category

enter image description here

Give an addon a category, for example sake and to match op name have given it the "Object" category, can use anything here, best to stick with those available if possible. IMO this is prob a mesh operator, that adds modifiers to mesh objects

bl_info = {
    "name": "DC Mirror",
    "version": (1, 0),
    "blender": (2, 90, 0),
    "category": "Object",
}

We assign keymaps to run operators or assign properties. In addon this is "object.dc_mirror", below I've added a keymap to the window such that ShiftCtrlT calls the op.

enter image description here

And when run with a mesh object as context. Tip: give the operator a poll method limiting it to only mesh objects.

enter image description here

Consult the docs re adding a keymap via code https://docs.blender.org/manual/en/latest/advanced/scripting/addon_tutorial.html#keymap

Common logic error

Worth mentioning that there is an issue with your addon if run again, it will add a new mirror modifier, but only ever alter the properties of the first.. or the one having name "Mirror"

Recommend instead

def execute(self, context):
    ob = context.object
    mm = ob.modifiers.new(name="Mirror", type='MIRROR')
    
    mm.show_on_cage = True
    mm.use_bisect_axis.x = True
    mm.use_clip = True


    return {'FINISHED'}

Addon requires a Category

enter image description here

Give an addon a category, for example sake and to match op name have given it the "Object" category, can use anything here, best to stick with those available if possible. IMO this is prob a mesh operator, that adds modifiers to mesh objects

bl_info = {
    "name": "DC Mirror",
    "version": (1, 0),
    "blender": (2, 90, 0),
    "category": "Object",
}

We assign keymaps to run operators or assign properties. In addon this is "object.dc_mirror", below I've added a keymap to the window such that ShiftCtrlT calls the op.

enter image description here

And when run with a mesh object as context. Tip: give the operator a poll method limiting it to only mesh objects.

enter image description here

Consult the docs re adding a keymap via code https://docs.blender.org/manual/en/latest/advanced/scripting/addon_tutorial.html#keymap

Addon requires a Category

enter image description here

Give an addon a category, for example sake and to match op name have given it the "Object" category, can use anything here, best to stick with those available if possible. IMO this is prob a mesh operator, that adds modifiers to mesh objects

bl_info = {
    "name": "DC Mirror",
    "version": (1, 0),
    "blender": (2, 90, 0),
    "category": "Object",
}

We assign keymaps to run operators or assign properties. In addon this is "object.dc_mirror", below I've added a keymap to the window such that ShiftCtrlT calls the op.

enter image description here

And when run with a mesh object as context. Tip: give the operator a poll method limiting it to only mesh objects.

enter image description here

Consult the docs re adding a keymap via code https://docs.blender.org/manual/en/latest/advanced/scripting/addon_tutorial.html#keymap

Common logic error

Worth mentioning that there is an issue with your addon if run again, it will add a new mirror modifier, but only ever alter the properties of the first.. or the one having name "Mirror"

Recommend instead

def execute(self, context):
    ob = context.object
    mm = ob.modifiers.new(name="Mirror", type='MIRROR')
    
    mm.show_on_cage = True
    mm.use_bisect_axis.x = True
    mm.use_clip = True


    return {'FINISHED'}
Source Link
batFINGER
  • 85.2k
  • 10
  • 114
  • 244
Loading