Newer
Older
name="Delete strokes",
description="Remove Grease Pencil strokes if they have been used "
"for Gstretch. WARNING: DOES NOT SUPPORT UNDO",
default=False
)
name="Influence",
description="Force of the tool",
default=100.0,
min=0.0,
max=100.0,
precision=1,
subtype='PERCENTAGE'
)
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
)
name="Method",
items=(("project", "Project", "Project vertices onto the stroke, "
"using vertex normals and connected edges"),
("irregular", "Spread", "Distribute vertices along the full "
"stroke, retaining relative distances between the vertices"),
("regular", "Spread evenly", "Distribute vertices at regular "
"distances along the full stroke")),
description="Method of distributing the vertices over the Grease "
"Pencil stroke",
default='regular'
)
gstretch_use_guide: EnumProperty(
name="Use guides",
items=(("None", "None", "None"),
("Annotation", "Annotation", "Annotation"),
("GPencil", "GPencil", "GPencil")),
default="None"
)
gstretch_guide: PointerProperty(
name="GPencil object",
description="Set GPencil object",
type=bpy.types.Object
)
CoDEmanX
committed
# relax properties
items=(("all", "Parallel (all)", "Also use non-selected "
"parallel loops as input"),
("selected", "Selection", "Only use selected vertices as input")),
description="Loops that are relaxed",
default='selected'
)
name="Interpolation",
items=(("cubic", "Cubic", "Natural cubic spline, smooth results"),
("linear", "Linear", "Simple and fast linear algorithm")),
description="Algorithm used for interpolation",
default='cubic'
)
relax_iterations: EnumProperty(name="Iterations",
items=(("1", "1", "One"),
("3", "3", "Three"),
("5", "5", "Five"),
("10", "10", "Ten"),
("25", "25", "Twenty-five")),
description="Number of times the loop is relaxed",
default="1"
)
name="Regular",
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,
RemoveAnnotation,
RemoveGPencil,
# 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()