refactor: rename some operators and modules.
- rename module OP_MTL_fix_all_material to OP_MTL_fix_all_materials. - rename operator BBP_OT_fix_all_material to BBP_OT_fix_all_materials. - rename module UTIL_naming_convension to UTIL_naming_convention. - change some translation contexts to correspond with this change.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import bpy, mathutils
|
||||
import math, typing
|
||||
from . import UTIL_functions, UTIL_icons_manager, UTIL_naming_convension
|
||||
from . import UTIL_functions, UTIL_icons_manager, UTIL_naming_convention
|
||||
from . import PROP_ballance_element, PROP_virtools_group, PROP_ballance_map_info
|
||||
|
||||
#region Param Help Classes
|
||||
@ -41,33 +41,33 @@ class ComponentCountParam():
|
||||
|
||||
#region Help Classes & Functions
|
||||
|
||||
def _get_component_info(comp_type: PROP_ballance_element.BallanceElementType, comp_sector: int) -> UTIL_naming_convension.BallanceObjectInfo:
|
||||
def _get_component_info(comp_type: PROP_ballance_element.BallanceElementType, comp_sector: int) -> UTIL_naming_convention.BallanceObjectInfo:
|
||||
match(comp_type):
|
||||
# process for 2 special unique components
|
||||
case PROP_ballance_element.BallanceElementType.PS_FourFlames:
|
||||
return UTIL_naming_convension.BallanceObjectInfo.create_from_others(UTIL_naming_convension.BallanceObjectType.LEVEL_START)
|
||||
return UTIL_naming_convention.BallanceObjectInfo.create_from_others(UTIL_naming_convention.BallanceObjectType.LEVEL_START)
|
||||
case PROP_ballance_element.BallanceElementType.PE_Balloon:
|
||||
return UTIL_naming_convension.BallanceObjectInfo.create_from_others(UTIL_naming_convension.BallanceObjectType.LEVEL_END)
|
||||
return UTIL_naming_convention.BallanceObjectInfo.create_from_others(UTIL_naming_convention.BallanceObjectType.LEVEL_END)
|
||||
# process naming convention required special components
|
||||
case PROP_ballance_element.BallanceElementType.PC_TwoFlames:
|
||||
return UTIL_naming_convension.BallanceObjectInfo.create_from_checkpoint(comp_sector)
|
||||
return UTIL_naming_convention.BallanceObjectInfo.create_from_checkpoint(comp_sector)
|
||||
case PROP_ballance_element.BallanceElementType.PR_Resetpoint:
|
||||
return UTIL_naming_convension.BallanceObjectInfo.create_from_resetpoint(comp_sector)
|
||||
return UTIL_naming_convention.BallanceObjectInfo.create_from_resetpoint(comp_sector)
|
||||
# process for other components
|
||||
case _:
|
||||
return UTIL_naming_convension.BallanceObjectInfo.create_from_component(
|
||||
return UTIL_naming_convention.BallanceObjectInfo.create_from_component(
|
||||
PROP_ballance_element.get_ballance_element_name(comp_type),
|
||||
comp_sector
|
||||
)
|
||||
|
||||
def _set_component_by_info(obj: bpy.types.Object, info: UTIL_naming_convension.BallanceObjectInfo) -> None:
|
||||
def _set_component_by_info(obj: bpy.types.Object, info: UTIL_naming_convention.BallanceObjectInfo) -> None:
|
||||
# set component name and grouping it into virtools group at the same time
|
||||
# set name first
|
||||
if not UTIL_naming_convension.YYCToolchainConvention.set_to_object(obj, info, None):
|
||||
if not UTIL_naming_convention.YYCToolchainConvention.set_to_object(obj, info, None):
|
||||
raise UTIL_functions.BBPException('impossible fail to set component name.')
|
||||
|
||||
# set vt group next
|
||||
if not UTIL_naming_convension.VirtoolsGroupConvention.set_to_object(obj, info, None):
|
||||
if not UTIL_naming_convention.VirtoolsGroupConvention.set_to_object(obj, info, None):
|
||||
raise UTIL_functions.BBPException('impossible fail to set component virtools groups.')
|
||||
|
||||
def _check_component_existance(comp_type: PROP_ballance_element.BallanceElementType, comp_sector: int) -> str | None:
|
||||
@ -85,10 +85,10 @@ def _check_component_existance(comp_type: PROP_ballance_element.BallanceElementT
|
||||
return None # return, do not check
|
||||
|
||||
# get info
|
||||
comp_info: UTIL_naming_convension.BallanceObjectInfo = _get_component_info(comp_type, comp_sector)
|
||||
comp_info: UTIL_naming_convention.BallanceObjectInfo = _get_component_info(comp_type, comp_sector)
|
||||
|
||||
# get expected name
|
||||
expect_name: str | None = UTIL_naming_convension.YYCToolchainConvention.set_to_name(comp_info, None)
|
||||
expect_name: str | None = UTIL_naming_convention.YYCToolchainConvention.set_to_name(comp_info, None)
|
||||
if expect_name is None:
|
||||
raise UTIL_functions.BBPException('impossible fail to get component name.')
|
||||
|
||||
@ -129,7 +129,7 @@ class _GeneralComponentCreator():
|
||||
@return The created component instance.
|
||||
"""
|
||||
# get element info first
|
||||
ele_info: UTIL_naming_convension.BallanceObjectInfo = _get_component_info(comp_type, comp_sector)
|
||||
ele_info: UTIL_naming_convention.BallanceObjectInfo = _get_component_info(comp_type, comp_sector)
|
||||
|
||||
# create blc element context
|
||||
with PROP_ballance_element.BallanceElementsHelper(bpy.context.scene) as creator:
|
||||
@ -152,12 +152,12 @@ class _GeneralComponentCreator():
|
||||
enlarged_sector: int
|
||||
# check component type to get enlarged value
|
||||
match(ele_info.mBasicType):
|
||||
case UTIL_naming_convension.BallanceObjectType.COMPONENT:
|
||||
case UTIL_naming_convention.BallanceObjectType.COMPONENT:
|
||||
enlarged_sector = comp_sector
|
||||
case UTIL_naming_convension.BallanceObjectType.CHECKPOINT:
|
||||
case UTIL_naming_convention.BallanceObjectType.CHECKPOINT:
|
||||
# checkpoint 1 means that there is sector 2, so we plus 1 for it.
|
||||
enlarged_sector = comp_sector + 1
|
||||
case UTIL_naming_convension.BallanceObjectType.RESETPOINT:
|
||||
case UTIL_naming_convention.BallanceObjectType.RESETPOINT:
|
||||
enlarged_sector = comp_sector
|
||||
case _:
|
||||
# this component is not a sector based component
|
||||
|
@ -1,8 +1,8 @@
|
||||
import bpy, mathutils
|
||||
from bpy_extras.wm_utils.progress_report import ProgressReport
|
||||
import tempfile, os, typing
|
||||
from . import PROP_preferences, UTIL_ioport_shared
|
||||
from . import UTIL_virtools_types, UTIL_functions, UTIL_file_browser, UTIL_blender_mesh, UTIL_ballance_texture, UTIL_naming_convension
|
||||
from . import PROP_preferences, UTIL_ioport_shared, UTIL_naming_convention
|
||||
from . import UTIL_virtools_types, UTIL_functions, UTIL_file_browser, UTIL_blender_mesh, UTIL_ballance_texture
|
||||
from . import PROP_virtools_group, PROP_virtools_material, PROP_virtools_mesh, PROP_virtools_texture, PROP_virtools_light
|
||||
from .PyBMap import bmap_wrapper as bmap
|
||||
|
||||
@ -190,7 +190,7 @@ def _export_virtools_groups(
|
||||
# So we create all needed sector group in here to make sure exported virtools file can be read by Ballancde correctly.
|
||||
if successive_sector:
|
||||
for i in range(successive_sector_count):
|
||||
gp_name: str = UTIL_naming_convension.build_name_from_sector_index(i + 1)
|
||||
gp_name: str = UTIL_naming_convention.build_name_from_sector_index(i + 1)
|
||||
vtgroup: bmap.BMGroup | None = group_cret_map.get(gp_name, None)
|
||||
if vtgroup is None:
|
||||
vtgroup = writer.create_group()
|
||||
|
@ -1,8 +1,8 @@
|
||||
import bpy, mathutils
|
||||
from bpy_extras.wm_utils.progress_report import ProgressReport
|
||||
import tempfile, os, typing
|
||||
from . import PROP_preferences, UTIL_ioport_shared
|
||||
from . import UTIL_virtools_types, UTIL_functions, UTIL_file_browser, UTIL_blender_mesh, UTIL_ballance_texture, UTIL_naming_convension
|
||||
from . import PROP_preferences, UTIL_ioport_shared, UTIL_naming_convention
|
||||
from . import UTIL_virtools_types, UTIL_functions, UTIL_file_browser, UTIL_blender_mesh, UTIL_ballance_texture
|
||||
from . import PROP_virtools_group, PROP_virtools_material, PROP_virtools_mesh, PROP_virtools_texture, PROP_virtools_light, PROP_ballance_map_info
|
||||
from .PyBMap import bmap_wrapper as bmap
|
||||
|
||||
@ -432,7 +432,7 @@ def _import_virtools_groups(
|
||||
if group_name is None: continue
|
||||
|
||||
# try extracting sector info
|
||||
potential_sector_count: int | None = UTIL_naming_convension.extract_sector_from_name(group_name)
|
||||
potential_sector_count: int | None = UTIL_naming_convention.extract_sector_from_name(group_name)
|
||||
if potential_sector_count is not None:
|
||||
sector_count = max(sector_count, potential_sector_count)
|
||||
|
||||
|
@ -2,12 +2,12 @@ import bpy
|
||||
from . import UTIL_functions
|
||||
from . import PROP_virtools_material, PROP_preferences
|
||||
|
||||
class BBP_OT_fix_all_material(bpy.types.Operator):
|
||||
class BBP_OT_fix_all_materials(bpy.types.Operator):
|
||||
"""Fix All Materials by Its Referred Ballance Texture Name."""
|
||||
bl_idname = "bbp.fix_all_material"
|
||||
bl_idname = "bbp.fix_all_materials"
|
||||
bl_label = "Fix All Materials"
|
||||
bl_options = {'UNDO'}
|
||||
bl_translation_context = 'BBP_OT_fix_all_material'
|
||||
bl_translation_context = 'BBP_OT_fix_all_materials'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@ -31,12 +31,12 @@ class BBP_OT_fix_all_material(bpy.types.Operator):
|
||||
|
||||
# report and return
|
||||
tr_text: str = bpy.app.translations.pgettext_rpt(
|
||||
'Fix {0}/{1} materials.', 'BBP_OT_fix_all_material/draw')
|
||||
'Fix {0}/{1} materials.', 'BBP_OT_fix_all_materials/draw')
|
||||
self.report({'INFO'}, tr_text.format(counter_suc, counter_all))
|
||||
return {'FINISHED'}
|
||||
|
||||
def register() -> None:
|
||||
bpy.utils.register_class(BBP_OT_fix_all_material)
|
||||
bpy.utils.register_class(BBP_OT_fix_all_materials)
|
||||
|
||||
def unregister() -> None:
|
||||
bpy.utils.unregister_class(BBP_OT_fix_all_material)
|
||||
bpy.utils.unregister_class(BBP_OT_fix_all_materials)
|
@ -1,6 +1,6 @@
|
||||
import bpy
|
||||
import typing
|
||||
from . import UTIL_naming_convension, UTIL_functions, UTIL_icons_manager
|
||||
from . import UTIL_functions, UTIL_icons_manager, UTIL_naming_convention
|
||||
|
||||
class BBP_OT_regulate_objects_name(bpy.types.Operator):
|
||||
"""Regulate Objects Name by Virtools Group and Naming Convention"""
|
||||
@ -15,8 +15,8 @@ class BBP_OT_regulate_objects_name(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
_rename_core(
|
||||
UTIL_naming_convension.VirtoolsGroupConvention.parse_from_object,
|
||||
UTIL_naming_convension.YYCToolchainConvention.set_to_object
|
||||
UTIL_naming_convention.VirtoolsGroupConvention.parse_from_object,
|
||||
UTIL_naming_convention.YYCToolchainConvention.set_to_object
|
||||
)
|
||||
return {'FINISHED'}
|
||||
|
||||
@ -33,8 +33,8 @@ class BBP_OT_auto_grouping(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
_rename_core(
|
||||
UTIL_naming_convension.YYCToolchainConvention.parse_from_object,
|
||||
UTIL_naming_convension.VirtoolsGroupConvention.set_to_object
|
||||
UTIL_naming_convention.YYCToolchainConvention.parse_from_object,
|
||||
UTIL_naming_convention.VirtoolsGroupConvention.set_to_object
|
||||
)
|
||||
return {'FINISHED'}
|
||||
|
||||
@ -51,26 +51,26 @@ class BBP_OT_convert_to_imengyu(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
_rename_core(
|
||||
UTIL_naming_convension.YYCToolchainConvention.parse_from_object,
|
||||
UTIL_naming_convension.ImengyuConvention.set_to_object
|
||||
UTIL_naming_convention.YYCToolchainConvention.parse_from_object,
|
||||
UTIL_naming_convention.ImengyuConvention.set_to_object
|
||||
)
|
||||
return {'FINISHED'}
|
||||
|
||||
def _rename_core(
|
||||
fct_get_info: typing.Callable[[bpy.types.Object, UTIL_naming_convension.RenameErrorReporter], UTIL_naming_convension.BallanceObjectInfo | None],
|
||||
ftc_set_info: typing.Callable[[bpy.types.Object, UTIL_naming_convension.BallanceObjectInfo, UTIL_naming_convension.RenameErrorReporter], bool]
|
||||
fct_get_info: typing.Callable[[bpy.types.Object, UTIL_naming_convention.RenameErrorReporter], UTIL_naming_convention.BallanceObjectInfo | None],
|
||||
ftc_set_info: typing.Callable[[bpy.types.Object, UTIL_naming_convention.BallanceObjectInfo, UTIL_naming_convention.RenameErrorReporter], bool]
|
||||
) -> None:
|
||||
# get selected objects. allow nested collection
|
||||
selected_objects: typing.Iterable[bpy.types.Object] = bpy.context.view_layer.active_layer_collection.collection.all_objects
|
||||
|
||||
# create reporter
|
||||
with UTIL_naming_convension.RenameErrorReporter() as reporter:
|
||||
with UTIL_naming_convention.RenameErrorReporter() as reporter:
|
||||
# iterate objects
|
||||
for obj in selected_objects:
|
||||
reporter.enter_object(obj)
|
||||
|
||||
# try get info
|
||||
info: UTIL_naming_convension.BallanceObjectInfo | None = fct_get_info(obj, reporter)
|
||||
info: UTIL_naming_convention.BallanceObjectInfo | None = fct_get_info(obj, reporter)
|
||||
if info is not None:
|
||||
# if info is valid, try assign it
|
||||
if not ftc_set_info(obj, info, reporter):
|
||||
|
@ -1,6 +1,6 @@
|
||||
import bpy
|
||||
import os, typing
|
||||
from . import UTIL_naming_convension
|
||||
from . import UTIL_naming_convention
|
||||
|
||||
class RawPreferences():
|
||||
cBallanceTextureFolder: typing.ClassVar[str] = ""
|
||||
|
@ -1,7 +1,7 @@
|
||||
import bpy, mathutils
|
||||
import os, json, enum, typing, math
|
||||
from . import PROP_virtools_group, PROP_bme_material
|
||||
from . import UTIL_functions, UTIL_icons_manager, UTIL_blender_mesh, UTIL_virtools_types, UTIL_naming_convension
|
||||
from . import PROP_virtools_group, PROP_bme_material, UTIL_naming_convention
|
||||
from . import UTIL_functions, UTIL_icons_manager, UTIL_blender_mesh, UTIL_virtools_types
|
||||
|
||||
## NOTE: Outside caller should use BME struct's unique indetifier to visit each prototype
|
||||
# and drive this class' functions to work.
|
||||
@ -271,23 +271,23 @@ def create_bme_struct_wrapper(ident: str, cfgs: dict[str, typing.Any]) -> bpy.ty
|
||||
|
||||
# create object and assign prop
|
||||
# get obj info first
|
||||
obj_info: UTIL_naming_convension.BallanceObjectInfo
|
||||
obj_info: UTIL_naming_convention.BallanceObjectInfo
|
||||
match(PrototypeShowcaseTypes(proto[TOKEN_SHOWCASE][TOKEN_SHOWCASE_TYPE])):
|
||||
case PrototypeShowcaseTypes.No:
|
||||
obj_info = UTIL_naming_convension.BallanceObjectInfo.create_from_others(UTIL_naming_convension.BallanceObjectType.DECORATION)
|
||||
obj_info = UTIL_naming_convention.BallanceObjectInfo.create_from_others(UTIL_naming_convention.BallanceObjectType.DECORATION)
|
||||
case PrototypeShowcaseTypes.Floor:
|
||||
obj_info = UTIL_naming_convension.BallanceObjectInfo.create_from_others(UTIL_naming_convension.BallanceObjectType.FLOOR)
|
||||
obj_info = UTIL_naming_convention.BallanceObjectInfo.create_from_others(UTIL_naming_convention.BallanceObjectType.FLOOR)
|
||||
case PrototypeShowcaseTypes.Rail:
|
||||
obj_info = UTIL_naming_convension.BallanceObjectInfo.create_from_others(UTIL_naming_convension.BallanceObjectType.RAIL)
|
||||
obj_info = UTIL_naming_convention.BallanceObjectInfo.create_from_others(UTIL_naming_convention.BallanceObjectType.RAIL)
|
||||
case PrototypeShowcaseTypes.Wood:
|
||||
obj_info = UTIL_naming_convension.BallanceObjectInfo.create_from_others(UTIL_naming_convension.BallanceObjectType.WOOD)
|
||||
obj_info = UTIL_naming_convention.BallanceObjectInfo.create_from_others(UTIL_naming_convention.BallanceObjectType.WOOD)
|
||||
# then get object name
|
||||
obj_name: str | None = UTIL_naming_convension.YYCToolchainConvention.set_to_name(obj_info, None)
|
||||
obj_name: str | None = UTIL_naming_convention.YYCToolchainConvention.set_to_name(obj_info, None)
|
||||
if obj_name is None: raise UTIL_functions.BBPException('impossible null name')
|
||||
# create object by name
|
||||
obj: bpy.types.Object = bpy.data.objects.new(obj_name, mesh)
|
||||
# assign virtools groups
|
||||
UTIL_naming_convension.VirtoolsGroupConvention.set_to_object(obj, obj_info, None)
|
||||
UTIL_naming_convention.VirtoolsGroupConvention.set_to_object(obj, obj_info, None)
|
||||
|
||||
# return object
|
||||
return obj
|
||||
|
@ -72,7 +72,7 @@ class RenameErrorReporter():
|
||||
print('============')
|
||||
print(bpy.app.translations.pgettext_rpt(
|
||||
'Rename Report',
|
||||
'BBP/UTIL_naming_convension.RenameErrorReporter'
|
||||
'BBP/UTIL_naming_convention.RenameErrorReporter'
|
||||
))
|
||||
print('------------')
|
||||
# return self as context
|
||||
@ -82,7 +82,7 @@ class RenameErrorReporter():
|
||||
# print console report tail
|
||||
print('------------')
|
||||
tr_text: str = bpy.app.translations.pgettext_rpt(
|
||||
'All / Failed - {0} / {1}', 'BBP/UTIL_naming_convension.RenameErrorReporter')
|
||||
'All / Failed - {0} / {1}', 'BBP/UTIL_naming_convention.RenameErrorReporter')
|
||||
print(tr_text.format(self.mAllObjCounter, self.mFailedObjCounter))
|
||||
print('============')
|
||||
# reset variables
|
||||
@ -107,10 +107,10 @@ class RenameErrorReporter():
|
||||
tr_text: str
|
||||
new_name: str = obj.name
|
||||
if self.mOldName == new_name:
|
||||
tr_text = bpy.app.translations.pgettext_rpt('For object "{0}"', 'BBP/UTIL_naming_convension.RenameErrorReporter')
|
||||
tr_text = bpy.app.translations.pgettext_rpt('For object "{0}"', 'BBP/UTIL_naming_convention.RenameErrorReporter')
|
||||
print(tr_text.format(new_name))
|
||||
else:
|
||||
tr_text = bpy.app.translations.pgettext_rpt('For object "{0}" (Old name: "{1}")', 'BBP/UTIL_naming_convension.RenameErrorReporter')
|
||||
tr_text = bpy.app.translations.pgettext_rpt('For object "{0}" (Old name: "{1}")', 'BBP/UTIL_naming_convention.RenameErrorReporter')
|
||||
print(tr_text.format(new_name, self.mOldName))
|
||||
|
||||
# output error list with indent
|
||||
@ -125,11 +125,11 @@ class RenameErrorReporter():
|
||||
def __errtype_to_string(err_v: _RenameErrorType) -> str:
|
||||
match(err_v):
|
||||
case _RenameErrorType.ERROR:
|
||||
return bpy.app.translations.pgettext_rpt('ERROR', 'BBP/UTIL_naming_convension.RenameErrorReporter')
|
||||
return bpy.app.translations.pgettext_rpt('ERROR', 'BBP/UTIL_naming_convention.RenameErrorReporter')
|
||||
case _RenameErrorType.WARNING:
|
||||
return bpy.app.translations.pgettext_rpt('WARN', 'BBP/UTIL_naming_convension.RenameErrorReporter')
|
||||
return bpy.app.translations.pgettext_rpt('WARN', 'BBP/UTIL_naming_convention.RenameErrorReporter')
|
||||
case _RenameErrorType.INFO:
|
||||
return bpy.app.translations.pgettext_rpt('INFO', 'BBP/UTIL_naming_convension.RenameErrorReporter')
|
||||
return bpy.app.translations.pgettext_rpt('INFO', 'BBP/UTIL_naming_convention.RenameErrorReporter')
|
||||
case _: raise UTIL_functions.BBPException("Unknown error type.")
|
||||
@staticmethod
|
||||
def __erritem_to_string(item: _RenameErrorItem) -> str:
|
||||
@ -292,7 +292,7 @@ class VirtoolsGroupConvention():
|
||||
)
|
||||
|
||||
tr_text: str = bpy.app.translations.pgettext_rpt(
|
||||
"PC_Checkpoints or PR_Resetpoints detected. But couldn't get sector from name.", 'BBP/UTIL_naming_convension.VirtoolsGroupConvention')
|
||||
"PC_Checkpoints or PR_Resetpoints detected. But couldn't get sector from name.", 'BBP/UTIL_naming_convention.VirtoolsGroupConvention')
|
||||
if reporter: reporter.add_error(tr_text)
|
||||
return None
|
||||
|
||||
@ -337,12 +337,12 @@ class VirtoolsGroupConvention():
|
||||
return VirtoolsGroupConvention.__get_pcpr_from_name(obj.name, reporter)
|
||||
case _:
|
||||
tr_text = bpy.app.translations.pgettext_rpt(
|
||||
"The match of Unique Component lost.", 'BBP/UTIL_naming_convension.VirtoolsGroupConvention')
|
||||
"The match of Unique Component lost.", 'BBP/UTIL_naming_convention.VirtoolsGroupConvention')
|
||||
if reporter: reporter.add_error(tr_text)
|
||||
return None
|
||||
elif len(inter_gps) != 0:
|
||||
tr_text = bpy.app.translations.pgettext_rpt(
|
||||
"A Multi-grouping Unique Component.", 'BBP/UTIL_naming_convension.VirtoolsGroupConvention')
|
||||
"A Multi-grouping Unique Component.", 'BBP/UTIL_naming_convention.VirtoolsGroupConvention')
|
||||
if reporter: reporter.add_error(tr_text)
|
||||
return None
|
||||
|
||||
@ -356,7 +356,7 @@ class VirtoolsGroupConvention():
|
||||
if gotten_sector is None:
|
||||
# fail to get sector
|
||||
tr_text = bpy.app.translations.pgettext_rpt(
|
||||
"Component detected. But couldn't get sector from CKGroup data.", 'BBP/UTIL_naming_convension.VirtoolsGroupConvention')
|
||||
"Component detected. But couldn't get sector from CKGroup data.", 'BBP/UTIL_naming_convention.VirtoolsGroupConvention')
|
||||
if reporter: reporter.add_error(tr_text)
|
||||
return None
|
||||
return BallanceObjectInfo.create_from_component(
|
||||
@ -366,7 +366,7 @@ class VirtoolsGroupConvention():
|
||||
elif len(inter_gps) != 0:
|
||||
# must be a weird grouping, report it
|
||||
tr_text = bpy.app.translations.pgettext_rpt(
|
||||
"A Multi-grouping Component.", 'BBP/UTIL_naming_convension.VirtoolsGroupConvention')
|
||||
"A Multi-grouping Component.", 'BBP/UTIL_naming_convention.VirtoolsGroupConvention')
|
||||
if reporter: reporter.add_error(tr_text)
|
||||
return None
|
||||
|
||||
@ -384,7 +384,7 @@ class VirtoolsGroupConvention():
|
||||
return BallanceObjectInfo.create_from_others(BallanceObjectType.WOOD)
|
||||
else:
|
||||
tr_text = bpy.app.translations.pgettext_rpt(
|
||||
"Can't distinguish object between Floors and Rails. Suppose it is Floors.", 'BBP/UTIL_naming_convension.VirtoolsGroupConvention')
|
||||
"Can't distinguish object between Floors and Rails. Suppose it is Floors.", 'BBP/UTIL_naming_convention.VirtoolsGroupConvention')
|
||||
if reporter: reporter.add_warning(tr_text)
|
||||
return BallanceObjectInfo.create_from_others(BallanceObjectType.FLOOR)
|
||||
elif gp.contain_group('Phys_FloorStopper'):
|
||||
@ -394,7 +394,7 @@ class VirtoolsGroupConvention():
|
||||
|
||||
# no matched
|
||||
tr_text = bpy.app.translations.pgettext_rpt(
|
||||
"Group match lost.", 'BBP/UTIL_naming_convension.VirtoolsGroupConvention')
|
||||
"Group match lost.", 'BBP/UTIL_naming_convention.VirtoolsGroupConvention')
|
||||
if reporter: reporter.add_error(tr_text)
|
||||
return None
|
||||
|
||||
@ -445,7 +445,7 @@ class VirtoolsGroupConvention():
|
||||
|
||||
case _:
|
||||
tr_text: str = bpy.app.translations.pgettext_rpt(
|
||||
"No matched info.", 'BBP/UTIL_naming_convension.VirtoolsGroupConvention')
|
||||
"No matched info.", 'BBP/UTIL_naming_convention.VirtoolsGroupConvention')
|
||||
if reporter: reporter.add_error(tr_text)
|
||||
return False
|
||||
|
||||
@ -499,7 +499,7 @@ class YYCToolchainConvention():
|
||||
return BallanceObjectInfo.create_from_others(BallanceObjectType.SKYLAYER)
|
||||
|
||||
tr_text: str = bpy.app.translations.pgettext_rpt(
|
||||
"Name match lost.", 'BBP/UTIL_naming_convension.YYCToolchainConvention')
|
||||
"Name match lost.", 'BBP/UTIL_naming_convention.YYCToolchainConvention')
|
||||
if reporter: reporter.add_error(tr_text)
|
||||
return None
|
||||
|
||||
@ -543,7 +543,7 @@ class YYCToolchainConvention():
|
||||
|
||||
case _:
|
||||
tr_text: str = bpy.app.translations.pgettext_rpt(
|
||||
"No matched info.", 'BBP/UTIL_naming_convension.YYCToolchainConvention')
|
||||
"No matched info.", 'BBP/UTIL_naming_convention.YYCToolchainConvention')
|
||||
if reporter: reporter.add_error(tr_text)
|
||||
return None
|
||||
|
||||
@ -607,7 +607,7 @@ class ImengyuConvention():
|
||||
return BallanceObjectInfo.create_from_others(BallanceObjectType.SKYLAYER)
|
||||
|
||||
tr_text: str = bpy.app.translations.pgettext_rpt(
|
||||
"Name match lost.", 'BBP/UTIL_naming_convension.ImengyuConvention')
|
||||
"Name match lost.", 'BBP/UTIL_naming_convention.ImengyuConvention')
|
||||
if reporter: reporter.add_error(tr_text)
|
||||
return None
|
||||
|
||||
@ -653,7 +653,7 @@ class ImengyuConvention():
|
||||
|
||||
case _:
|
||||
tr_text: str = bpy.app.translations.pgettext_rpt(
|
||||
"No matched info.", 'BBP/UTIL_naming_convension.ImengyuConvention')
|
||||
"No matched info.", 'BBP/UTIL_naming_convention.ImengyuConvention')
|
||||
if reporter: reporter.add_error(tr_text)
|
||||
return None
|
||||
|
@ -1,6 +1,6 @@
|
||||
import bpy, bmesh, mathutils, math
|
||||
import typing
|
||||
from . import UTIL_functions, UTIL_naming_convension
|
||||
from . import UTIL_functions, UTIL_naming_convention
|
||||
from . import PROP_bme_material
|
||||
|
||||
#region BMesh Operations Helper
|
||||
@ -132,16 +132,16 @@ def rail_creator_wrapper(fct_poly_cret: typing.Callable[[bmesh.types.BMesh], Non
|
||||
|
||||
# create object and assoc with it
|
||||
# create info first
|
||||
rail_info: UTIL_naming_convension.BallanceObjectInfo = UTIL_naming_convension.BallanceObjectInfo.create_from_others(
|
||||
UTIL_naming_convension.BallanceObjectType.RAIL
|
||||
rail_info: UTIL_naming_convention.BallanceObjectInfo = UTIL_naming_convention.BallanceObjectInfo.create_from_others(
|
||||
UTIL_naming_convention.BallanceObjectType.RAIL
|
||||
)
|
||||
# then get object name
|
||||
rail_name: str | None = UTIL_naming_convension.YYCToolchainConvention.set_to_name(rail_info, None)
|
||||
rail_name: str | None = UTIL_naming_convention.YYCToolchainConvention.set_to_name(rail_info, None)
|
||||
if rail_name is None: raise UTIL_functions.BBPException('impossible null name')
|
||||
# create object by name
|
||||
obj: bpy.types.Object = bpy.data.objects.new(rail_name, mesh)
|
||||
# assign virtools groups
|
||||
UTIL_naming_convension.VirtoolsGroupConvention.set_to_object(obj, rail_info, None)
|
||||
UTIL_naming_convention.VirtoolsGroupConvention.set_to_object(obj, rail_info, None)
|
||||
|
||||
# move to cursor
|
||||
UTIL_functions.add_into_scene_and_move_to_cursor(obj)
|
||||
|
@ -23,7 +23,7 @@ from . import PROP_preferences, PROP_ptrprop_resolver, PROP_virtools_material, P
|
||||
from . import PROP_ballance_element, PROP_bme_material, PROP_ballance_map_info
|
||||
from . import OP_IMPORT_bmfile, OP_EXPORT_bmfile, OP_IMPORT_virtools, OP_EXPORT_virtools
|
||||
from . import OP_UV_flatten_uv, OP_UV_rail_uv
|
||||
from . import OP_MTL_fix_material
|
||||
from . import OP_MTL_fix_materials
|
||||
from . import OP_ADDS_component, OP_ADDS_bme, OP_ADDS_rail
|
||||
from . import OP_OBJECT_legacy_align, OP_OBJECT_virtools_group, OP_OBJECT_snoop_group_then_to_mesh, OP_OBJECT_naming_convention
|
||||
|
||||
@ -50,7 +50,7 @@ class BBP_MT_View3DMenu(bpy.types.Menu):
|
||||
layout.operator(OP_OBJECT_virtools_group.BBP_OT_select_object_by_virtools_group.bl_idname)
|
||||
layout.separator()
|
||||
layout.label(text='Material', icon='MATERIAL', text_ctxt='BBP_MT_View3DMenu/draw')
|
||||
layout.operator(OP_MTL_fix_material.BBP_OT_fix_all_material.bl_idname)
|
||||
layout.operator(OP_MTL_fix_materials.BBP_OT_fix_all_materials.bl_idname)
|
||||
|
||||
class BBP_MT_AddBmeMenu(bpy.types.Menu):
|
||||
"""Add Ballance Floor"""
|
||||
@ -256,7 +256,7 @@ def register() -> None:
|
||||
OP_UV_rail_uv.register()
|
||||
OP_UV_flatten_uv.register()
|
||||
|
||||
OP_MTL_fix_material.register()
|
||||
OP_MTL_fix_materials.register()
|
||||
|
||||
OP_ADDS_component.register()
|
||||
OP_ADDS_bme.register()
|
||||
@ -297,7 +297,7 @@ def unregister() -> None:
|
||||
OP_ADDS_bme.unregister()
|
||||
OP_ADDS_component.unregister()
|
||||
|
||||
OP_MTL_fix_material.unregister()
|
||||
OP_MTL_fix_materials.unregister()
|
||||
|
||||
OP_UV_flatten_uv.unregister()
|
||||
OP_UV_rail_uv.unregister()
|
||||
|
Reference in New Issue
Block a user