new addon simple_deform_helper #104464
@ -5,7 +5,7 @@ import gpu
|
|||||||
from gpu_extras.batch import batch_for_shader
|
from gpu_extras.batch import batch_for_shader
|
||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
|
|
||||||
from .update import change_active_object, simple_update
|
from .update import ChangeActiveObject, simple_update
|
||||||
from .utils import GizmoUtils
|
from .utils import GizmoUtils
|
||||||
|
|
||||||
|
|
||||||
@ -30,8 +30,8 @@ class DrawPublic(GizmoUtils):
|
|||||||
@property
|
@property
|
||||||
def draw_poll(self) -> bool:
|
def draw_poll(self) -> bool:
|
||||||
if simple_update.timers_update_poll():
|
if simple_update.timers_update_poll():
|
||||||
is_switch_obj = change_active_object.is_change_active_object(False)
|
is_switch_obj = ChangeActiveObject.is_change_active_object(False)
|
||||||
if self.simple_deform_public_poll(bpy.context) and not is_switch_obj:
|
if self.poll_simple_deform_public(bpy.context) and not is_switch_obj:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ class Draw3D(DrawHandler):
|
|||||||
self.draw_limits_bound_box()
|
self.draw_limits_bound_box()
|
||||||
|
|
||||||
self.draw_text_handler()
|
self.draw_text_handler()
|
||||||
elif self.simple_deform_show_bend_axis_witch_poll(context):
|
elif self.poll_simple_deform_show_bend_axis_witch(context):
|
||||||
self.draw_bound_box()
|
self.draw_bound_box()
|
||||||
|
|
||||||
def draw_bound_box(self):
|
def draw_bound_box(self):
|
||||||
|
@ -6,7 +6,7 @@ from bpy.types import (
|
|||||||
GizmoGroup,
|
GizmoGroup,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..update import change_active_modifier_parameter
|
from ..update import ChangeActiveModifierParameter
|
||||||
from ..utils import GizmoUtils, GizmoGroupUtils
|
from ..utils import GizmoUtils, GizmoGroupUtils
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ class AngleGizmo(Gizmo, AngleUpdate):
|
|||||||
self.update_prop_value(event, tweak)
|
self.update_prop_value(event, tweak)
|
||||||
self.update_deform_wireframe()
|
self.update_deform_wireframe()
|
||||||
self.update_header_text(context)
|
self.update_header_text(context)
|
||||||
change_active_modifier_parameter.update_modifier_parameter()
|
ChangeActiveModifierParameter.update_modifier_parameter()
|
||||||
self.tag_redraw(context)
|
self.tag_redraw(context)
|
||||||
return self.event_handle(event)
|
return self.event_handle(event)
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class BendAxiSwitchGizmoGroup(GizmoGroup, GizmoGroupUtils):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return cls.simple_deform_show_bend_axis_witch_poll(context)
|
return cls.poll_simple_deform_show_bend_axis_witch(context)
|
||||||
|
|
||||||
def setup(self, context):
|
def setup(self, context):
|
||||||
_draw_type = 'SimpleDeform_Bend_Direction_'
|
_draw_type = 'SimpleDeform_Bend_Direction_'
|
||||||
|
@ -6,7 +6,7 @@ from bpy.types import Gizmo, GizmoGroup
|
|||||||
from bpy_extras import view3d_utils
|
from bpy_extras import view3d_utils
|
||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
|
|
||||||
from ..update import change_active_modifier_parameter
|
from ..update import ChangeActiveModifierParameter
|
||||||
from ..utils import GizmoUtils, GizmoGroupUtils
|
from ..utils import GizmoUtils, GizmoGroupUtils
|
||||||
|
|
||||||
|
|
||||||
@ -202,6 +202,7 @@ class UpDownLimitsGizmo(Gizmo, GizmoUpdate):
|
|||||||
'down_limits', self.int_value_down_limits)
|
'down_limits', self.int_value_down_limits)
|
||||||
|
|
||||||
def modal(self, context, event, tweak):
|
def modal(self, context, event, tweak):
|
||||||
|
st = time()
|
||||||
self.clear_point_cache()
|
self.clear_point_cache()
|
||||||
|
|
||||||
if self.modifier_is_use_origin_axis:
|
if self.modifier_is_use_origin_axis:
|
||||||
@ -215,13 +216,15 @@ class UpDownLimitsGizmo(Gizmo, GizmoUpdate):
|
|||||||
self.set_prop_value(event)
|
self.set_prop_value(event)
|
||||||
self.clear_point_cache()
|
self.clear_point_cache()
|
||||||
self.update_object_origin_matrix()
|
self.update_object_origin_matrix()
|
||||||
except Exception:
|
except Exception as e:
|
||||||
...
|
print(e.args)
|
||||||
|
# ...
|
||||||
# return {'FINISHED'}
|
# return {'FINISHED'}
|
||||||
self.update_header_text(context)
|
self.update_header_text(context)
|
||||||
return_handle = self.event_handle(event)
|
return_handle = self.event_handle(event)
|
||||||
change_active_modifier_parameter.update_modifier_parameter()
|
ChangeActiveModifierParameter.update_modifier_parameter()
|
||||||
self.update_deform_wireframe()
|
self.update_deform_wireframe()
|
||||||
|
print('run modal time:', time() - st)
|
||||||
return return_handle
|
return return_handle
|
||||||
|
|
||||||
|
|
||||||
@ -231,6 +234,7 @@ class UpDownLimitsGizmoGroup(GizmoGroup, GizmoGroupUtils):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
|
|
||||||
return cls.simple_deform_show_gizmo_poll(context)
|
return cls.simple_deform_show_gizmo_poll(context)
|
||||||
|
|
||||||
def setup(self, context):
|
def setup(self, context):
|
||||||
|
@ -16,38 +16,47 @@ class SimpleDeformHelperToolPanel(Panel, GizmoUtils):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return cls.simple_deform_public_poll(context)
|
show_in_tool_options = GizmoUtils.pref_().show_gizmo_property_location == 'ToolOptions'
|
||||||
|
return cls.poll_simple_deform_public(context) and show_in_tool_options
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
|
if self.poll(context):
|
||||||
|
self.draw_property(self.layout, context)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def draw_property(layout, context):
|
||||||
cls = SimpleDeformHelperToolPanel
|
cls = SimpleDeformHelperToolPanel
|
||||||
if cls.poll(context):
|
pref = cls.pref_()
|
||||||
pref = cls.pref_()
|
|
||||||
layout = self.layout
|
|
||||||
|
|
||||||
obj = context.object
|
obj = context.object
|
||||||
mod = obj.modifiers.active
|
mod = obj.modifiers.active
|
||||||
prop = obj.SimpleDeformGizmo_PropertyGroup
|
prop = obj.SimpleDeformGizmo_PropertyGroup
|
||||||
|
|
||||||
ctrl_obj = mod.origin.SimpleDeformGizmo_PropertyGroup if mod.origin else prop
|
ctrl_obj = mod.origin.SimpleDeformGizmo_PropertyGroup if mod.origin else prop
|
||||||
|
|
||||||
layout.prop(ctrl_obj,
|
layout.prop(ctrl_obj,
|
||||||
'origin_mode',
|
'origin_mode',
|
||||||
text='')
|
text='')
|
||||||
|
layout.prop(pref,
|
||||||
|
'update_deform_wireframe',
|
||||||
|
icon='MOD_WIREFRAME',
|
||||||
|
text='')
|
||||||
|
layout.prop(pref,
|
||||||
|
'show_set_axis_button',
|
||||||
|
icon='EMPTY_AXIS',
|
||||||
|
text='')
|
||||||
|
if pref.modifier_deform_method_is_bend:
|
||||||
layout.prop(pref,
|
layout.prop(pref,
|
||||||
'update_deform_wireframe',
|
'display_bend_axis_switch_gizmo',
|
||||||
icon='MOD_WIREFRAME',
|
toggle=1)
|
||||||
text='')
|
layout.prop(pref,
|
||||||
layout.prop(pref,
|
'modifiers_limits_tolerance',
|
||||||
'show_set_axis_button',
|
text='')
|
||||||
icon='EMPTY_AXIS',
|
|
||||||
text='')
|
def draw_settings(self, context):
|
||||||
if pref.modifier_deform_method_is_bend:
|
show_in_settings = GizmoUtils.pref_().show_gizmo_property_location == 'ToolSettings'
|
||||||
layout.prop(pref,
|
if show_in_settings:
|
||||||
'display_bend_axis_switch_gizmo',
|
SimpleDeformHelperToolPanel.draw_property(self.layout, context)
|
||||||
toggle=1)
|
|
||||||
layout.prop(pref,
|
|
||||||
'modifiers_limits_tolerance',
|
|
||||||
text='')
|
|
||||||
|
|
||||||
|
|
||||||
class_list = (
|
class_list = (
|
||||||
@ -59,9 +68,9 @@ register_class, unregister_class = bpy.utils.register_classes_factory(class_list
|
|||||||
|
|
||||||
def register():
|
def register():
|
||||||
register_class()
|
register_class()
|
||||||
VIEW3D_HT_tool_header.append(SimpleDeformHelperToolPanel.draw)
|
VIEW3D_HT_tool_header.append(SimpleDeformHelperToolPanel.draw_settings)
|
||||||
|
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
unregister_class()
|
unregister_class()
|
||||||
VIEW3D_HT_tool_header.remove(SimpleDeformHelperToolPanel.draw)
|
VIEW3D_HT_tool_header.remove(SimpleDeformHelperToolPanel.draw_settings)
|
||||||
|
@ -60,6 +60,14 @@ class SimpleDeformGizmoAddonPreferences(AddonPreferences, GizmoUtils):
|
|||||||
name='Show Set Axis Button',
|
name='Show Set Axis Button',
|
||||||
default=False)
|
default=False)
|
||||||
|
|
||||||
|
show_gizmo_property_location: EnumProperty(
|
||||||
|
name='Gizmo Property Show Location',
|
||||||
|
items=[('ToolSettings', 'Tool Settings', ''),
|
||||||
|
('ToolOptions', 'Tool Options', ''),
|
||||||
|
],
|
||||||
|
default='ToolSettings'
|
||||||
|
)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
col = self.layout.column()
|
col = self.layout.column()
|
||||||
box = col.box()
|
box = col.box()
|
||||||
@ -73,13 +81,12 @@ class SimpleDeformGizmoAddonPreferences(AddonPreferences, GizmoUtils):
|
|||||||
col.prop(self, 'deform_wireframe_color')
|
col.prop(self, 'deform_wireframe_color')
|
||||||
col.prop(self, 'bound_box_color')
|
col.prop(self, 'bound_box_color')
|
||||||
col.prop(self, 'limits_bound_box_color')
|
col.prop(self, 'limits_bound_box_color')
|
||||||
col.prop(self, 'modifiers_limits_tolerance')
|
|
||||||
col.prop(self, 'display_bend_axis_switch_gizmo')
|
col.label(text='Gizmo Property Show Location')
|
||||||
col.prop(self, 'update_deform_wireframe', icon='MOD_WIREFRAME', )
|
col.prop(self, 'show_gizmo_property_location', expand=True)
|
||||||
col.prop(self, 'show_set_axis_button', icon='EMPTY_AXIS', )
|
|
||||||
|
|
||||||
def draw_header_tool_settings(self, context):
|
def draw_header_tool_settings(self, context):
|
||||||
if GizmoUtils.simple_deform_public_poll(context):
|
if GizmoUtils.poll_simple_deform_public(context):
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
obj = context.object
|
obj = context.object
|
||||||
mod = obj.modifiers.active
|
mod = obj.modifiers.active
|
||||||
|
@ -12,7 +12,7 @@ translations_dict = {
|
|||||||
"zh_CN": {
|
"zh_CN": {
|
||||||
("上下文", "原文"): "翻译文字",
|
("上下文", "原文"): "翻译文字",
|
||||||
("*", "Show Toggle Bend Axis Gizmo"): "显示切换弯曲轴向Gizmo",
|
("*", "Show Toggle Bend Axis Gizmo"): "显示切换弯曲轴向Gizmo",
|
||||||
|
("*", "Gizmo Property Show Location"): "Gizmo属性显示位置",
|
||||||
("*", "You can press the following shortcut keys when dragging values"):
|
("*", "You can press the following shortcut keys when dragging values"):
|
||||||
"拖动值时可以按以下快捷键",
|
"拖动值时可以按以下快捷键",
|
||||||
("*", " Wheel: Switch Origin Ctrl Mode"):
|
("*", " Wheel: Switch Origin Ctrl Mode"):
|
||||||
@ -25,7 +25,6 @@ translations_dict = {
|
|||||||
" A: Switch To Select Bend Axis Mode(deform_method=='BEND')"):
|
" A: Switch To Select Bend Axis Mode(deform_method=='BEND')"):
|
||||||
" A: 切换到选择弯曲轴模式(形变方法='弯曲')",
|
" A: 切换到选择弯曲轴模式(形变方法='弯曲')",
|
||||||
("*", "Show Set Axis Button"): "显示设置轴向Gizmo",
|
("*", "Show Set Axis Button"): "显示设置轴向Gizmo",
|
||||||
|
|
||||||
("*", "Follow Upper Limit(Red)"): "跟随上限(红色)",
|
("*", "Follow Upper Limit(Red)"): "跟随上限(红色)",
|
||||||
("*", "Follow Lower Limit(Green)"): "跟随下限(绿色)",
|
("*", "Follow Lower Limit(Green)"): "跟随下限(绿色)",
|
||||||
("*", "Lower limit(Green)"): "下限(绿色)",
|
("*", "Lower limit(Green)"): "下限(绿色)",
|
||||||
@ -60,6 +59,7 @@ translations_dict = {
|
|||||||
("*", "3D View -> Select an object and the active modifier is simple deformation"): "3D视图 -> 选择一个物体,"
|
("*", "3D View -> Select an object and the active modifier is simple deformation"): "3D视图 -> 选择一个物体,"
|
||||||
"并且活动修改器为简易形修改器",
|
"并且活动修改器为简易形修改器",
|
||||||
("*", "3D View: Simple Deform Helper"): "3D 视图: Simple Deform Helper 简易形变助手",
|
("*", "3D View: Simple Deform Helper"): "3D 视图: Simple Deform Helper 简易形变助手",
|
||||||
|
("*", "Simple Deform Helper"): "简易形变助手",
|
||||||
("*", ""): "",
|
("*", ""): "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ class simple_update(update_public, GizmoUpdate):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def timers_update_poll(cls):
|
def timers_update_poll(cls):
|
||||||
obj = bpy.context.object
|
obj = bpy.context.object
|
||||||
if not cls.context_mode_is_object():
|
if not cls.poll_context_mode_is_object():
|
||||||
...
|
...
|
||||||
elif not obj:
|
elif not obj:
|
||||||
...
|
...
|
||||||
@ -94,7 +94,7 @@ class simple_update(update_public, GizmoUpdate):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class change_active_object(simple_update):
|
class ChangeActiveObject(simple_update):
|
||||||
@classmethod
|
@classmethod
|
||||||
@cache
|
@cache
|
||||||
def update_poll(cls):
|
def update_poll(cls):
|
||||||
@ -118,7 +118,7 @@ class change_active_object(simple_update):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class change_active_simple_deform_modifier(simple_update):
|
class ChangeActiveSimpleDeformModifier(simple_update):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@cache
|
@cache
|
||||||
@ -134,7 +134,7 @@ class change_active_simple_deform_modifier(simple_update):
|
|||||||
def update():
|
def update():
|
||||||
cls.tmp_save_data['modifiers'] = modifiers
|
cls.tmp_save_data['modifiers'] = modifiers
|
||||||
|
|
||||||
if change_active_object.update_poll():
|
if ChangeActiveObject.update_poll():
|
||||||
update()
|
update()
|
||||||
elif 'modifiers' not in cls.tmp_save_data:
|
elif 'modifiers' not in cls.tmp_save_data:
|
||||||
update()
|
update()
|
||||||
@ -150,7 +150,7 @@ class change_active_simple_deform_modifier(simple_update):
|
|||||||
'modifiers': list(i.name for i in obj.modifiers)}
|
'modifiers': list(i.name for i in obj.modifiers)}
|
||||||
|
|
||||||
|
|
||||||
class change_active_modifier_parameter(simple_update):
|
class ChangeActiveModifierParameter(simple_update):
|
||||||
key = 'active_modifier_parameter'
|
key = 'active_modifier_parameter'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -174,9 +174,9 @@ class change_active_modifier_parameter(simple_update):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def is_change_active_simple_parameter(cls):
|
def is_change_active_simple_parameter(cls):
|
||||||
parameter = cls.get_modifiers_parameter(gizmo.modifier)
|
parameter = cls.get_modifiers_parameter(gizmo.modifier)
|
||||||
if change_active_object.update_poll():
|
if ChangeActiveObject.update_poll():
|
||||||
cls.update_modifier_parameter(parameter)
|
cls.update_modifier_parameter(parameter)
|
||||||
elif change_active_simple_deform_modifier.update_poll():
|
elif ChangeActiveSimpleDeformModifier.update_poll():
|
||||||
cls.update_modifier_parameter(parameter)
|
cls.update_modifier_parameter(parameter)
|
||||||
elif cls.key not in cls.tmp_save_data:
|
elif cls.key not in cls.tmp_save_data:
|
||||||
cls.update_modifier_parameter(parameter)
|
cls.update_modifier_parameter(parameter)
|
||||||
@ -192,9 +192,9 @@ def register():
|
|||||||
def p():
|
def p():
|
||||||
gizmo.update_multiple_modifiers_data()
|
gizmo.update_multiple_modifiers_data()
|
||||||
|
|
||||||
change_active_object.append(p)
|
ChangeActiveObject.append(p)
|
||||||
change_active_modifier_parameter.append(p)
|
ChangeActiveModifierParameter.append(p)
|
||||||
change_active_simple_deform_modifier.append(p)
|
ChangeActiveSimpleDeformModifier.append(p)
|
||||||
|
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
|
@ -107,11 +107,11 @@ class PublicClass(PublicData):
|
|||||||
|
|
||||||
class PublicPoll(PublicClass):
|
class PublicPoll(PublicClass):
|
||||||
@classmethod
|
@classmethod
|
||||||
def context_mode_is_object(cls) -> bool:
|
def poll_context_mode_is_object(cls) -> bool:
|
||||||
return bpy.context.mode == 'OBJECT'
|
return bpy.context.mode == 'OBJECT'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def simple_deform_modifier_is_simple(cls, context):
|
def poll_modifier_type_is_simple(cls, context):
|
||||||
"""
|
"""
|
||||||
Active Object in ('MESH', 'LATTICE')
|
Active Object in ('MESH', 'LATTICE')
|
||||||
Active Modifier Type Is 'SIMPLE_DEFORM' and show_viewport
|
Active Modifier Type Is 'SIMPLE_DEFORM' and show_viewport
|
||||||
@ -128,13 +128,23 @@ class PublicPoll(PublicClass):
|
|||||||
|
|
||||||
available_obj_type = cls.obj_type_is_mesh_or_lattice(obj)
|
available_obj_type = cls.obj_type_is_mesh_or_lattice(obj)
|
||||||
is_available_obj = cls.mod_is_simple_deform_type(mod) and available_obj_type
|
is_available_obj = cls.mod_is_simple_deform_type(mod) and available_obj_type
|
||||||
is_obj_mode = cls.context_mode_is_object()
|
is_obj_mode = cls.poll_context_mode_is_object()
|
||||||
show_mod = mod.show_viewport
|
show_mod = mod.show_viewport
|
||||||
not_is_self_mesh = obj.name != cls.G_NAME
|
not_is_self_mesh = obj.name != cls.G_NAME
|
||||||
return is_available_obj and is_obj_mode and show_mod and not_is_self_mesh
|
return is_available_obj and is_obj_mode and show_mod and not_is_self_mesh
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def simple_deform_public_poll(cls, context: 'bpy.types.context') -> bool:
|
def poll_object_is_show(cls, context: 'bpy.types.Context') -> bool:
|
||||||
|
"""
|
||||||
|
hava active object and object is show
|
||||||
|
:param context:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
obj = context.object
|
||||||
|
return obj and (not obj.hide_viewport) and (not obj.hide_get())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll_simple_deform_public(cls, context: 'bpy.types.context') -> bool:
|
||||||
"""Public poll
|
"""Public poll
|
||||||
In 3D View
|
In 3D View
|
||||||
return True
|
return True
|
||||||
@ -143,32 +153,33 @@ class PublicPoll(PublicClass):
|
|||||||
if not space:
|
if not space:
|
||||||
return False
|
return False
|
||||||
show_gizmo = space.show_gizmo if space.type == 'VIEW_3D' else True
|
show_gizmo = space.show_gizmo if space.type == 'VIEW_3D' else True
|
||||||
obj = cls.simple_deform_modifier_is_simple(context)
|
is_simple = cls.poll_modifier_type_is_simple(context)
|
||||||
return obj and show_gizmo
|
is_show = cls.poll_object_is_show(context)
|
||||||
|
return is_simple and show_gizmo and is_show
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _simple_deform_modifier_is_bend_poll(cls, context):
|
def poll_simple_deform_modifier_is_bend(cls, context):
|
||||||
"""
|
"""
|
||||||
Public poll
|
Public poll
|
||||||
active modifier deform_method =='BEND'
|
active modifier deform_method =='BEND'
|
||||||
"""
|
"""
|
||||||
simple = cls.simple_deform_public_poll(context)
|
simple = cls.poll_simple_deform_public(context)
|
||||||
is_bend = simple and (context.object.modifiers.active.deform_method == 'BEND')
|
is_bend = simple and (context.object.modifiers.active.deform_method == 'BEND')
|
||||||
return simple and is_bend
|
return simple and is_bend
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def simple_deform_show_bend_axis_witch_poll(cls, context):
|
def poll_simple_deform_show_bend_axis_witch(cls, context):
|
||||||
"""
|
"""
|
||||||
Show D
|
Show D
|
||||||
"""
|
"""
|
||||||
switch_axis = cls.pref_().display_bend_axis_switch_gizmo
|
switch_axis = cls.pref_().display_bend_axis_switch_gizmo
|
||||||
bend = cls._simple_deform_modifier_is_bend_poll(context)
|
bend = cls.poll_simple_deform_modifier_is_bend(context)
|
||||||
return switch_axis and bend
|
return switch_axis and bend
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def simple_deform_show_gizmo_poll(cls, context):
|
def simple_deform_show_gizmo_poll(cls, context):
|
||||||
poll = cls.simple_deform_public_poll(context)
|
poll = cls.poll_simple_deform_public(context)
|
||||||
not_switch = (not cls.simple_deform_show_bend_axis_witch_poll(context))
|
not_switch = (not cls.poll_simple_deform_show_bend_axis_witch(context))
|
||||||
return poll and not_switch
|
return poll and not_switch
|
||||||
|
|
||||||
|
|
||||||
@ -272,6 +283,8 @@ class GizmoClassMethod(PublicTranslate):
|
|||||||
list_vertices = np.zeros(ver_len * 3, dtype=np.float32)
|
list_vertices = np.zeros(ver_len * 3, dtype=np.float32)
|
||||||
obj.data.points.foreach_get('co_deform', list_vertices)
|
obj.data.points.foreach_get('co_deform', list_vertices)
|
||||||
list_vertices = list_vertices.reshape(ver_len, 3)
|
list_vertices = list_vertices.reshape(ver_len, 3)
|
||||||
|
else:
|
||||||
|
list_vertices = np.zeros((3, 3), dtype=np.float32)
|
||||||
return Vector(list_vertices.min(axis=0)).freeze(), Vector(list_vertices.max(axis=0)).freeze()
|
return Vector(list_vertices.min(axis=0)).freeze(), Vector(list_vertices.max(axis=0)).freeze()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -287,7 +300,6 @@ class GizmoClassMethod(PublicTranslate):
|
|||||||
elif f == 1:
|
elif f == 1:
|
||||||
i[1] -= 0.1
|
i[1] -= 0.1
|
||||||
j[1] += 0.1
|
j[1] += 0.1
|
||||||
|
|
||||||
else:
|
else:
|
||||||
i[2] -= 0.1
|
i[2] -= 0.1
|
||||||
j[2] += 0.1
|
j[2] += 0.1
|
||||||
@ -659,7 +671,7 @@ class GizmoUpdate(PublicProperty):
|
|||||||
def update_multiple_modifiers_data(self):
|
def update_multiple_modifiers_data(self):
|
||||||
obj = self.obj
|
obj = self.obj
|
||||||
context = bpy.context
|
context = bpy.context
|
||||||
if not self.obj_type_is_mesh_or_lattice(obj) or not self.simple_deform_modifier_is_simple(context):
|
if not self.obj_type_is_mesh_or_lattice(obj) or not self.poll_modifier_type_is_simple(context):
|
||||||
return
|
return
|
||||||
self.clear_point_cache()
|
self.clear_point_cache()
|
||||||
self.clear_modifiers_data()
|
self.clear_modifiers_data()
|
||||||
|
Loading…
Reference in New Issue
Block a user