Move Separate By to Additional Tools
Move Separate BY to Additional tools, makes no sense having these smaller functions in it's own file.
This commit is contained in:
@@ -119,3 +119,44 @@ class AvatarToolKit_OT_DeleteBoneConstraints(Operator):
|
|||||||
|
|
||||||
self.report({'INFO'}, t("Tools.delete_bone_constraints.success").format(constraints_removed=constraints_removed))
|
self.report({'INFO'}, t("Tools.delete_bone_constraints.success").format(constraints_removed=constraints_removed))
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
@register_wrap
|
||||||
|
class AvatarToolKit_OT_SeparateByMaterials(Operator):
|
||||||
|
bl_idname = "avatar_toolkit.separate_by_materials"
|
||||||
|
bl_label = t("Tools.separate_by_materials.label")
|
||||||
|
bl_description = t("Tools.separate_by_materials.desc")
|
||||||
|
bl_options = {'REGISTER', 'UNDO'}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context: Context) -> bool:
|
||||||
|
return context.active_object and context.active_object.type == 'MESH'
|
||||||
|
|
||||||
|
def execute(self, context: Context) -> set[str]:
|
||||||
|
obj = context.active_object
|
||||||
|
bpy.ops.object.mode_set(mode='EDIT')
|
||||||
|
bpy.ops.mesh.select_all(action='SELECT')
|
||||||
|
bpy.ops.mesh.separate(type='MATERIAL')
|
||||||
|
bpy.ops.object.mode_set(mode='OBJECT')
|
||||||
|
self.report({'INFO'}, t("Tools.separate_by_materials.success"))
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
@register_wrap
|
||||||
|
class AvatarToolKit_OT_SeparateByLooseParts(Operator):
|
||||||
|
bl_idname = "avatar_toolkit.separate_by_loose_parts"
|
||||||
|
bl_label = t("Tools.separate_by_loose_parts.label")
|
||||||
|
bl_description = t("Tools.separate_by_loose_parts.desc")
|
||||||
|
bl_options = {'REGISTER', 'UNDO'}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context: Context) -> bool:
|
||||||
|
return context.active_object and context.active_object.type == 'MESH'
|
||||||
|
|
||||||
|
def execute(self, context: Context) -> set[str]:
|
||||||
|
obj = context.active_object
|
||||||
|
bpy.ops.object.mode_set(mode='EDIT')
|
||||||
|
bpy.ops.mesh.select_all(action='SELECT')
|
||||||
|
bpy.ops.mesh.separate(type='LOOSE')
|
||||||
|
bpy.ops.object.mode_set(mode='OBJECT')
|
||||||
|
self.report({'INFO'}, t("Tools.separate_by_loose_parts.success"))
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
import bpy
|
|
||||||
from bpy.types import Context, Operator
|
|
||||||
from ..core.register import register_wrap
|
|
||||||
from ..functions.translations import t
|
|
||||||
|
|
||||||
@register_wrap
|
|
||||||
class AvatarToolKit_OT_SeparateByMaterials(Operator):
|
|
||||||
bl_idname = "avatar_toolkit.separate_by_materials"
|
|
||||||
bl_label = t("Tools.separate_by_materials.label")
|
|
||||||
bl_description = t("Tools.separate_by_materials.desc")
|
|
||||||
bl_options = {'REGISTER', 'UNDO'}
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def poll(cls, context: Context) -> bool:
|
|
||||||
return context.active_object and context.active_object.type == 'MESH'
|
|
||||||
|
|
||||||
def execute(self, context: Context) -> set[str]:
|
|
||||||
obj = context.active_object
|
|
||||||
bpy.ops.object.mode_set(mode='EDIT')
|
|
||||||
bpy.ops.mesh.select_all(action='SELECT')
|
|
||||||
bpy.ops.mesh.separate(type='MATERIAL')
|
|
||||||
bpy.ops.object.mode_set(mode='OBJECT')
|
|
||||||
self.report({'INFO'}, t("Tools.separate_by_materials.success"))
|
|
||||||
return {'FINISHED'}
|
|
||||||
|
|
||||||
@register_wrap
|
|
||||||
class AvatarToolKit_OT_SeparateByLooseParts(Operator):
|
|
||||||
bl_idname = "avatar_toolkit.separate_by_loose_parts"
|
|
||||||
bl_label = t("Tools.separate_by_loose_parts.label")
|
|
||||||
bl_description = t("Tools.separate_by_loose_parts.desc")
|
|
||||||
bl_options = {'REGISTER', 'UNDO'}
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def poll(cls, context: Context) -> bool:
|
|
||||||
return context.active_object and context.active_object.type == 'MESH'
|
|
||||||
|
|
||||||
def execute(self, context: Context) -> set[str]:
|
|
||||||
obj = context.active_object
|
|
||||||
bpy.ops.object.mode_set(mode='EDIT')
|
|
||||||
bpy.ops.mesh.select_all(action='SELECT')
|
|
||||||
bpy.ops.mesh.separate(type='LOOSE')
|
|
||||||
bpy.ops.object.mode_set(mode='OBJECT')
|
|
||||||
self.report({'INFO'}, t("Tools.separate_by_loose_parts.success"))
|
|
||||||
return {'FINISHED'}
|
|
||||||
+1
-2
@@ -7,8 +7,7 @@ from ..functions.resonite_functions import AvatarToolKit_OT_ConvertToResonite
|
|||||||
from ..functions.translations import t
|
from ..functions.translations import t
|
||||||
from ..core.common import get_selected_armature
|
from ..core.common import get_selected_armature
|
||||||
from ..functions.mesh_tools import AvatarToolkit_OT_RemoveUnusedShapekeys
|
from ..functions.mesh_tools import AvatarToolkit_OT_RemoveUnusedShapekeys
|
||||||
from ..functions.seperate_by import AvatarToolKit_OT_SeparateByMaterials, AvatarToolKit_OT_SeparateByLooseParts
|
from ..functions.additional_tools import AvatarToolKit_OT_ApplyTransforms, AvatarToolKit_OT_ConnectBones, AvatarToolKit_OT_DeleteBoneConstraints, AvatarToolKit_OT_SeparateByMaterials, AvatarToolKit_OT_SeparateByLooseParts
|
||||||
from ..functions.additional_tools import AvatarToolKit_OT_ApplyTransforms, AvatarToolKit_OT_ConnectBones, AvatarToolKit_OT_DeleteBoneConstraints
|
|
||||||
from ..functions.armature_modifying import AvatarToolkit_OT_RemoveZeroWeightBones, AvatarToolkit_OT_MergeBonesToActive, AvatarToolkit_OT_MergeBonesToParents
|
from ..functions.armature_modifying import AvatarToolkit_OT_RemoveZeroWeightBones, AvatarToolkit_OT_MergeBonesToActive, AvatarToolkit_OT_MergeBonesToParents
|
||||||
from ..functions.rigify_functions import AvatarToolKit_OT_ConvertRigifyToUnity
|
from ..functions.rigify_functions import AvatarToolKit_OT_ConvertRigifyToUnity
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user