Newer
Older
description="Distribute vertices at constant distances along the loop",
default=True
)
CoDEmanX
committed
# space properties
name="Influence",
description="Force of the tool",
default=100.0,
min=0.0,
max=100.0,
precision=1,
subtype='PERCENTAGE'
)
name="Input",
items=(("all", "Parallel (all)", "Also use non-selected "
"parallel loops as input"),
("selected", "Selection", "Only use selected vertices as input")),
description="Loops that are spaced",
default='selected'
)
name="Interpolation",
items=(("cubic", "Cubic", "Natural cubic spline, smooth results"),
("linear", "Linear", "Vertices are projected on existing edges")),
description="Algorithm used for interpolation",
default='cubic'
)
name="Lock X",
description="Lock editing of the x-coordinate",
default=False
)
name="Lock Y",
description="Lock editing of the y-coordinate",
default=False
)
name="Lock Z",
description="Lock editing of the z-coordinate",
default=False
)
# draw function for integration in menus
def menu_func(self, context):
self.layout.menu("VIEW3D_MT_edit_mesh_looptools")
self.layout.separator()
# Add-ons Preferences Update Panel
# Define Panel classes for updating
panels = (
VIEW3D_PT_tools_looptools,
)
message = "LoopTools: Updating Panel locations has failed"
for panel in panels:
if "bl_rna" in panel.__dict__:
bpy.utils.unregister_class(panel)
for panel in panels:
panel.bl_category = context.preferences.addons[__name__].preferences.category
bpy.utils.register_class(panel)
except Exception as e:
print("\n[{}]\n{}\n\nError:\n{}".format(__name__, message, e))
class LoopPreferences(AddonPreferences):
# this must match the addon name, use '__package__'
# when defining this in a submodule of a python package.
bl_idname = __name__
name="Tab Category",
description="Choose a name for the category of the panel",
default="Edit",
def draw(self, context):
layout = self.layout
row = layout.row()
col = row.column()
col.label(text="Tab Category:")
col.prop(self, "category", text="")
# define classes for registration
VIEW3D_PT_tools_looptools,
LoopToolsProps,
Bridge,
Circle,
Curve,
Flatten,
# registering and menu integration
def register():
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.VIEW3D_MT_edit_mesh_context_menu.prepend(menu_func)
bpy.types.WindowManager.looptools = PointerProperty(type=LoopToolsProps)
meta-androcto
committed
update_panel(None, bpy.context)
# unregistering and removing menus
def unregister():
bpy.utils.unregister_class(cls)
bpy.types.VIEW3D_MT_edit_mesh_context_menu.remove(menu_func)
try:
del bpy.types.WindowManager.looptools
except Exception as e:
print('unregister fail:\n', e)
pass
if __name__ == "__main__":
register()