Skip to content

Instantly share code, notes, and snippets.

@zeffii
Last active December 1, 2015 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/88499a79a078a9cccbc6 to your computer and use it in GitHub Desktop.
Save zeffii/88499a79a078a9cccbc6 to your computer and use it in GitHub Desktop.
import bpy
class DuplicateAndUnparent(bpy.types.Operator):
"""Tooltip"""
bl_idname = "object.duplicate_and_unparent"
bl_label = "Duplicate And Unparent"
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
bpy.ops.object.duplicate_move()
bpy.ops.object.parent_clear(type='CLEAR')
bpy.ops.transform.translate('INVOKE_DEFAULT')
return {'FINISHED'}
def register():
bpy.utils.register_module(__name__)
def unregister():
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment