More cleanup

- operator strings are referenced via the class property rather than a hard coded string
- class names have been cleaned to have _OT_ or _PT_ depending on the kind of class it was.
- Class names should mostly be CamelCase now.
This commit is contained in:
Onan Chew
2024-09-04 20:16:34 -04:00
parent ce6cedd776
commit a08d888acb
20 changed files with 91 additions and 87 deletions
+8 -8
View File
@@ -21,7 +21,7 @@ class SceneMatClass(PropertyGroup):
register_class(SceneMatClass)
class material_list_bool:
class MaterialListBool:
#For the love that is holy do not ever touch these. If this was java I would make these private
#They should only be accessed via context.scene.texture_atlas_Has_Mat_List_Shown
#This is so we know if the materials are up to date. messing with these variables directly will make the thing blow up.
@@ -31,9 +31,9 @@ class material_list_bool:
bool_material_list_expand: dict[str,bool] = {}
def set_bool(self, value: bool) -> None:
material_list_bool.bool_material_list_expand[bpy.context.scene.name] = value
MaterialListBool.bool_material_list_expand[bpy.context.scene.name] = value
if value == False:
material_list_bool.old_list[bpy.context.scene.name] = []
MaterialListBool.old_list[bpy.context.scene.name] = []
def get_bool(self) -> bool:
newlist: list[Material] = []
@@ -45,20 +45,20 @@ class material_list_bool:
newlist.append(mat_slot.material)
still_the_same: bool = True
if bpy.context.scene.name in material_list_bool.old_list:
if bpy.context.scene.name in MaterialListBool.old_list:
for item in newlist:
if item not in material_list_bool.old_list[bpy.context.scene.name]:
if item not in MaterialListBool.old_list[bpy.context.scene.name]:
still_the_same = False
break
for item in material_list_bool.old_list[bpy.context.scene.name]:
for item in MaterialListBool.old_list[bpy.context.scene.name]:
if item not in newlist:
still_the_same = False
break
else:
still_the_same = False
material_list_bool.bool_material_list_expand[bpy.context.scene.name] = still_the_same
MaterialListBool.bool_material_list_expand[bpy.context.scene.name] = still_the_same
return material_list_bool.bool_material_list_expand[bpy.context.scene.name]
return MaterialListBool.bool_material_list_expand[bpy.context.scene.name]
### Clean up material names in the given mesh by removing the '.001' suffix.
+1 -1
View File
@@ -9,7 +9,7 @@ from ..functions.translations import t
@register_wrap
class ExportResonite(Operator):
class AvatarToolKit_OT_ExportResonite(Operator):
bl_idname = 'avatar_toolkit.export_resonite'
bl_label = t("Importer.export_resonite.label")
bl_description = t("Importer.export_resonite.desc")
+3 -3
View File
@@ -4,7 +4,7 @@ from ..core.register import register_property
from bpy.types import Scene, Object, Material, Context
from bpy.props import BoolProperty, EnumProperty, IntProperty, CollectionProperty, StringProperty, FloatVectorProperty, PointerProperty
from ..core.addon_preferences import get_preference
from ..core.common import SceneMatClass, material_list_bool, get_armatures, get_mesh_items
from ..core.common import SceneMatClass, MaterialListBool, get_armatures, get_mesh_items
def register() -> None:
default_language = get_preference("language", 0)
@@ -106,8 +106,8 @@ def register() -> None:
register_property((Scene, "texture_atlas_Has_Mat_List_Shown", BoolProperty(
default=False,
get=material_list_bool.get_bool,
set=material_list_bool.set_bool)))
get=MaterialListBool.get_bool,
set=MaterialListBool.set_bool)))
def unregister() -> None: