Commit 48377027 authored by NBurn's avatar NBurn

addons-contrib CreaPrim: partial 2.80 update

parent 8f8e7125
......@@ -92,7 +92,7 @@ class CreaPrim(bpy.types.Operator):
objlist = []
for selobj in bpy.context.scene.objects:
if selobj.select and test_data(selobj) is True:
if selobj.select_get() and test_data(selobj) is True:
objlist.append(selobj)
if len(objlist) == 0:
......@@ -194,8 +194,15 @@ def panel_func(self, context):
self.layout.prop(scn, "Creaprim_Apply")
classes = (
CreaPrim,
MessageOperator)
def register():
bpy.utils.register_module(__name__)
for cls in classes:
bpy.utils.register_class(cls)
#bpy.utils.register_module(__name__)
bpy.types.Scene.Creaprim_Name = bpy.props.StringProperty(
name="Name",
description="Name for the primitive",
......@@ -206,14 +213,20 @@ def register():
description="Apply transform to selected objects",
default=False
)
bpy.types.VIEW3D_PT_tools_object.append(panel_func)
bpy.app.handlers.scene_update_post.append(setname)
#bpy.types.VIEW3D_PT_tools_object.append(panel_func)
bpy.types.VIEW3D_PT_overlay_object.append(panel_func)
#bpy.app.handlers.scene_update_post.append(setname)
bpy.app.handlers.depsgraph_update_post.append(setname)
def unregister():
bpy.utils.unregister_module(__name__)
bpy.types.VIEW3D_PT_tools_object.remove(panel_func)
bpy.app.handlers.scene_update_post.remove(setname)
#bpy.utils.unregister_module(__name__)
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
#bpy.types.VIEW3D_PT_tools_object.remove(panel_func)
bpy.types.VIEW3D_PT_overlay_object.remove(panel_func)
#bpy.app.handlers.scene_update_post.remove(setname)
bpy.app.handlers.depsgraph_update_post.remove(setname)
del bpy.types.Scene.Creaprim_Name
del bpy.types.Scene.Creaprim_Apply
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment