THe classic method of scale 2d object is like to
###some script to configure ob data bmesh etc.
pivot = Vector(0.5,0.5)
scale_factor = 0.9 decrease scale example
for v in bm.verts:
v.co -= pivot
v.co.x *= scale_factor
v.co.y *= scale_factor
v.co += pivot
but i whant controll the scale with floatproperty in ui panel like to
pivot = Vector(0.5,0.5)
scale_factor = my_float_property
for v in bm.verts:
v.co -= pivot
v.co.x *= scale_factor
v.co.y *= scale_factor
v.co += pivot
Clearly this cannot work, I tried to declare a previous value in another floatproperty, so I tried:
def myfunction(self,context):
custom = bpy.context.object.mycustomclass
pivot = Vector(0.5,0.5)
scale_factor = 1- (custom.my_float_property-custom.last_float)
for v in bm.verts:
v.co -= pivot
v.co.x *= scale_factor
v.co.y *= scale_factor
v.co += pivot
custom.last_float = custom.my_float_property
but have some problem,it is not accurate.
Any idea how to control the scale with a slider, in fact (my_float_property)?