Add Lattice Magic to Addons #48

Merged
Nick Alberelli merged 36 commits from feature/lattice_magic into main 2023-05-17 20:48:52 +02:00
Showing only changes of commit 46f502132c - Show all commits

View File

@ -178,21 +178,14 @@ class TWEAKLAT_OT_Falloff(bpy.types.Operator):
ensure_falloff_vgroup(lattice_ob, 'Hook', multiplier=self.multiplier, power=self.power) ensure_falloff_vgroup(lattice_ob, 'Hook', multiplier=self.multiplier, power=self.power)
hook['Power'] = self.power hook['Power'] = self.power
hook['Multiplier'] = self.multiplier hook['Multiplier'] = self.multiplier
if self.radius!=hook['Radius']:
hook['Radius'] = self.radius
rad_diff = self.radius - self.start_radius
lattice_ob.scale = Vector(self.lattice_start_scale[:]) * Vector([1-rad_diff]*3)
hook.scale = Vector(self.hook_start_scale[:]) * Vector([1-rad_diff]*3)
# Actual parameters # Actual parameters
radius: FloatProperty(name="Radius", default=1, update=update, min=0.0001, soft_max=0.2)
power: FloatProperty(name="Power", default=1, update=update, min=0, soft_max=2) power: FloatProperty(name="Power", default=1, update=update, min=0, soft_max=2)
multiplier: FloatProperty(name="Multiplier", default=1, update=update, min=0, soft_max=2) multiplier: FloatProperty(name="Multiplier", default=1, update=update, min=0, soft_max=2)
# Storage to share info between Invoke and Update # Storage to share info between Invoke and Update
lattice_start_scale: FloatVectorProperty() lattice_start_scale: FloatVectorProperty()
hook_start_scale: FloatVectorProperty() hook_start_scale: FloatVectorProperty()
start_radius: FloatProperty()
doing_invoke: BoolProperty(default=True) doing_invoke: BoolProperty(default=True)
@classmethod @classmethod
@ -202,7 +195,6 @@ class TWEAKLAT_OT_Falloff(bpy.types.Operator):
def invoke(self, context, event): def invoke(self, context, event):
hook = context.object hook = context.object
self.start_radius = self.radius = hook['Radius']
self.power = hook['Power'] self.power = hook['Power']
self.multiplier = hook['Multiplier'] self.multiplier = hook['Multiplier']
self.hook_start_scale = hook.scale.copy() self.hook_start_scale = hook.scale.copy()
@ -217,7 +209,6 @@ class TWEAKLAT_OT_Falloff(bpy.types.Operator):
layout = self.layout layout = self.layout
layout.use_property_split = True layout.use_property_split = True
layout.use_property_decorate = False layout.use_property_decorate = False
layout.prop(self, 'radius', text="Radius", slider=True)
layout.prop(self, 'power', text="Smoothness", slider=True) layout.prop(self, 'power', text="Smoothness", slider=True)
layout.prop(self, 'multiplier', text="Strength", slider=True) layout.prop(self, 'multiplier', text="Strength", slider=True)