fix: fix the aftermath of changing EnumPropHelper.
- fix the generic error of EnumPropHelper. - use EnumPropHelper in UTIL_ioport_shared.ExportParams field instead of raw Blender string. - remove useless type hint in various modules.
This commit is contained in:
@ -5,7 +5,7 @@ from . import UTIL_functions, UTIL_translation, UTIL_bme
|
|||||||
|
|
||||||
#region BME Adder
|
#region BME Adder
|
||||||
|
|
||||||
_g_EnumHelper_BmeStructType: UTIL_bme.EnumPropHelper = UTIL_bme.EnumPropHelper()
|
_g_EnumHelper_BmeStructType = UTIL_bme.EnumPropHelper()
|
||||||
|
|
||||||
class BBP_PG_bme_adder_cfgs(bpy.types.PropertyGroup):
|
class BBP_PG_bme_adder_cfgs(bpy.types.PropertyGroup):
|
||||||
prop_int: bpy.props.IntProperty(
|
prop_int: bpy.props.IntProperty(
|
||||||
|
@ -184,7 +184,7 @@ def _get_component_icon_by_name(elename: str):
|
|||||||
icon: int | None = UTIL_icons_manager.get_component_icon(elename)
|
icon: int | None = UTIL_icons_manager.get_component_icon(elename)
|
||||||
if icon is None: return UTIL_icons_manager.get_empty_icon()
|
if icon is None: return UTIL_icons_manager.get_empty_icon()
|
||||||
else: return icon
|
else: return icon
|
||||||
_g_EnumHelper_Component: UTIL_functions.EnumPropHelper = UTIL_functions.EnumPropHelper(
|
_g_EnumHelper_Component = UTIL_functions.EnumPropHelper(
|
||||||
PROP_ballance_element.BallanceElementType,
|
PROP_ballance_element.BallanceElementType,
|
||||||
lambda x: str(x.value),
|
lambda x: str(x.value),
|
||||||
lambda x: PROP_ballance_element.BallanceElementType(int(x)),
|
lambda x: PROP_ballance_element.BallanceElementType(int(x)),
|
||||||
@ -217,7 +217,7 @@ class BBP_OT_add_component(bpy.types.Operator, ComponentSectorParam):
|
|||||||
layout.prop(self, "component_type")
|
layout.prop(self, "component_type")
|
||||||
|
|
||||||
# only show sector for non-PE/PS component
|
# only show sector for non-PE/PS component
|
||||||
eletype: PROP_ballance_element.BallanceElementType = _g_EnumHelper_Component.get_selection(self.component_type)
|
eletype = _g_EnumHelper_Component.get_selection(self.component_type)
|
||||||
if eletype != PROP_ballance_element.BallanceElementType.PS_FourFlames and eletype != PROP_ballance_element.BallanceElementType.PE_Balloon:
|
if eletype != PROP_ballance_element.BallanceElementType.PS_FourFlames and eletype != PROP_ballance_element.BallanceElementType.PE_Balloon:
|
||||||
self.draw_component_sector_params(layout)
|
self.draw_component_sector_params(layout)
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ _g_AlignModeDesc: dict[AlignMode, tuple[str, str]] = {
|
|||||||
AlignMode.AxisCenter: ("Center (Axis)", "The object's source point in specified axis."),
|
AlignMode.AxisCenter: ("Center (Axis)", "The object's source point in specified axis."),
|
||||||
AlignMode.Max: ("Max", "The max value in specified axis."),
|
AlignMode.Max: ("Max", "The max value in specified axis."),
|
||||||
}
|
}
|
||||||
_g_EnumHelper_AlignMode: UTIL_functions.EnumPropHelper = UTIL_functions.EnumPropHelper(
|
_g_EnumHelper_AlignMode = UTIL_functions.EnumPropHelper(
|
||||||
AlignMode,
|
AlignMode,
|
||||||
lambda x: str(x.value),
|
lambda x: str(x.value),
|
||||||
lambda x: AlignMode(int(x)),
|
lambda x: AlignMode(int(x)),
|
||||||
|
@ -18,7 +18,7 @@ _g_SelectModeDesc: dict[SelectMode, tuple[str, str, str]] = {
|
|||||||
SelectMode.Difference: ('Invert', 'Inverts the selection.', 'SELECT_DIFFERENCE'),
|
SelectMode.Difference: ('Invert', 'Inverts the selection.', 'SELECT_DIFFERENCE'),
|
||||||
SelectMode.Intersect: ('Intersect', 'Selects items that intersect with the existing selection.', 'SELECT_INTERSECT')
|
SelectMode.Intersect: ('Intersect', 'Selects items that intersect with the existing selection.', 'SELECT_INTERSECT')
|
||||||
}
|
}
|
||||||
_g_EnumHelper_SelectMode: UTIL_functions.EnumPropHelper = UTIL_functions.EnumPropHelper(
|
_g_EnumHelper_SelectMode = UTIL_functions.EnumPropHelper(
|
||||||
SelectMode,
|
SelectMode,
|
||||||
lambda x: str(x.value),
|
lambda x: str(x.value),
|
||||||
lambda x: SelectMode(int(x)),
|
lambda x: SelectMode(int(x)),
|
||||||
|
@ -205,7 +205,7 @@ class VirtoolsGroupsPreset(enum.Enum):
|
|||||||
|
|
||||||
Shadow = "Shadow"
|
Shadow = "Shadow"
|
||||||
|
|
||||||
_g_VtGrpPresetValues: tuple[str] = tuple(map(lambda x: x.value, VirtoolsGroupsPreset))
|
_g_VtGrpPresetValues: tuple[str, ...] = tuple(map(lambda x: x.value, VirtoolsGroupsPreset))
|
||||||
|
|
||||||
## Some of group names are not matched with icon name
|
## Some of group names are not matched with icon name
|
||||||
# So we create a convertion map to convert them.
|
# So we create a convertion map to convert them.
|
||||||
@ -236,7 +236,7 @@ def _get_group_icon_by_name(gp_name: str) -> int:
|
|||||||
if value is not None: return value
|
if value is not None: return value
|
||||||
else: return UTIL_icons_manager.get_empty_icon()
|
else: return UTIL_icons_manager.get_empty_icon()
|
||||||
# blender group name prop helper
|
# blender group name prop helper
|
||||||
_g_EnumHelper_Group: UTIL_functions.EnumPropHelper = UTIL_functions.EnumPropHelper(
|
_g_EnumHelper_Group = UTIL_functions.EnumPropHelper(
|
||||||
VirtoolsGroupsPreset,
|
VirtoolsGroupsPreset,
|
||||||
lambda x: x.value, # member is string self
|
lambda x: x.value, # member is string self
|
||||||
lambda x: VirtoolsGroupsPreset(x), # convert directly because it is StrEnum.
|
lambda x: VirtoolsGroupsPreset(x), # convert directly because it is StrEnum.
|
||||||
|
@ -73,7 +73,7 @@ class RawVirtoolsLight():
|
|||||||
|
|
||||||
# Blender Property Group
|
# Blender Property Group
|
||||||
|
|
||||||
_g_Helper_VXLIGHT_TYPE: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXLIGHT_TYPE)
|
_g_Helper_VXLIGHT_TYPE = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXLIGHT_TYPE)
|
||||||
|
|
||||||
class BBP_PG_virtools_light(bpy.types.PropertyGroup):
|
class BBP_PG_virtools_light(bpy.types.PropertyGroup):
|
||||||
light_type: bpy.props.EnumProperty(
|
light_type: bpy.props.EnumProperty(
|
||||||
|
@ -114,13 +114,13 @@ class RawVirtoolsMaterial():
|
|||||||
|
|
||||||
#region Blender Enum Prop Helper (Virtools type specified)
|
#region Blender Enum Prop Helper (Virtools type specified)
|
||||||
|
|
||||||
_g_Helper_VXTEXTURE_BLENDMODE: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXTEXTURE_BLENDMODE)
|
_g_Helper_VXTEXTURE_BLENDMODE = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXTEXTURE_BLENDMODE)
|
||||||
_g_Helper_VXTEXTURE_FILTERMODE: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXTEXTURE_FILTERMODE)
|
_g_Helper_VXTEXTURE_FILTERMODE = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXTEXTURE_FILTERMODE)
|
||||||
_g_Helper_VXTEXTURE_ADDRESSMODE: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXTEXTURE_ADDRESSMODE)
|
_g_Helper_VXTEXTURE_ADDRESSMODE = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXTEXTURE_ADDRESSMODE)
|
||||||
_g_Helper_VXBLEND_MODE: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXBLEND_MODE)
|
_g_Helper_VXBLEND_MODE = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXBLEND_MODE)
|
||||||
_g_Helper_VXFILL_MODE: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXFILL_MODE)
|
_g_Helper_VXFILL_MODE = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXFILL_MODE)
|
||||||
_g_Helper_VXSHADE_MODE: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXSHADE_MODE)
|
_g_Helper_VXSHADE_MODE = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXSHADE_MODE)
|
||||||
_g_Helper_VXCMPFUNC: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXCMPFUNC)
|
_g_Helper_VXCMPFUNC = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXCMPFUNC)
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -558,7 +558,7 @@ def preset_virtools_material(mtl: bpy.types.Material, preset_type: MaterialPrese
|
|||||||
set_raw_virtools_material(mtl, preset_data)
|
set_raw_virtools_material(mtl, preset_data)
|
||||||
|
|
||||||
# create preset enum blender helper
|
# create preset enum blender helper
|
||||||
_g_Helper_MtlPreset: UTIL_functions.EnumPropHelper = UTIL_functions.EnumPropHelper(
|
_g_Helper_MtlPreset = UTIL_functions.EnumPropHelper(
|
||||||
MaterialPresetType,
|
MaterialPresetType,
|
||||||
lambda x: str(x.value),
|
lambda x: str(x.value),
|
||||||
lambda x: MaterialPresetType(int(x)),
|
lambda x: MaterialPresetType(int(x)),
|
||||||
|
@ -15,7 +15,7 @@ class RawVirtoolsMesh():
|
|||||||
self.mLitMode = kwargs.get('mLitMode', RawVirtoolsMesh.cDefaultLitMode)
|
self.mLitMode = kwargs.get('mLitMode', RawVirtoolsMesh.cDefaultLitMode)
|
||||||
|
|
||||||
# blender enum prop helper defines
|
# blender enum prop helper defines
|
||||||
_g_Helper_VXMESH_LITMODE: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXMESH_LITMODE)
|
_g_Helper_VXMESH_LITMODE = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXMESH_LITMODE)
|
||||||
|
|
||||||
# Blender Property Group
|
# Blender Property Group
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ class RawVirtoolsTexture():
|
|||||||
self.mVideoFormat = kwargs.get('mVideoFormat', RawVirtoolsTexture.cDefaultVideoFormat)
|
self.mVideoFormat = kwargs.get('mVideoFormat', RawVirtoolsTexture.cDefaultVideoFormat)
|
||||||
|
|
||||||
# blender enum prop helper defines
|
# blender enum prop helper defines
|
||||||
_g_Helper_CK_TEXTURE_SAVEOPTIONS: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.CK_TEXTURE_SAVEOPTIONS)
|
_g_Helper_CK_TEXTURE_SAVEOPTIONS = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.CK_TEXTURE_SAVEOPTIONS)
|
||||||
_g_Helper_VX_PIXELFORMAT: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VX_PIXELFORMAT)
|
_g_Helper_VX_PIXELFORMAT = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VX_PIXELFORMAT)
|
||||||
|
|
||||||
class BBP_PG_virtools_texture(bpy.types.PropertyGroup):
|
class BBP_PG_virtools_texture(bpy.types.PropertyGroup):
|
||||||
|
|
||||||
|
@ -135,17 +135,23 @@ class EnumPropHelper(typing.Generic[_TRawEnum]):
|
|||||||
parsing data from EnumProperty string value and getting EnumProperty acceptable string format from data.
|
parsing data from EnumProperty string value and getting EnumProperty acceptable string format from data.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__mCollections: typing.Iterable[_TRawEnum]
|
# YYC MARK:
|
||||||
__mFctToStr: _TFctToStr
|
# I don't know why I can have subscripting for a `typing.Callable` object.
|
||||||
__mFctFromStr: _TFctFromStr
|
# It was not introduced in any document and I just know it from AI.
|
||||||
__mFctName: _TFctName
|
# If I am not doing this, the type hint will crash into Unknown type.
|
||||||
__mFctDesc: _TFctDesc
|
# But it works now I don't want to touch it anymore.
|
||||||
__mFctIcon: _TFctIcon
|
|
||||||
|
|
||||||
def __init__(self, collections: typing.Iterable[typing.Any],
|
__mCollections: typing.Iterable[_TRawEnum]
|
||||||
fct_to_str: _TFctToStr, fct_from_str: _TFctFromStr,
|
__mFctToStr: _TFctToStr[_TRawEnum]
|
||||||
fct_name: _TFctName, fct_desc: _TFctDesc,
|
__mFctFromStr: _TFctFromStr[_TRawEnum]
|
||||||
fct_icon: _TFctIcon):
|
__mFctName: _TFctName[_TRawEnum]
|
||||||
|
__mFctDesc: _TFctDesc[_TRawEnum]
|
||||||
|
__mFctIcon: _TFctIcon[_TRawEnum]
|
||||||
|
|
||||||
|
def __init__(self, collections: typing.Iterable[_TRawEnum],
|
||||||
|
fct_to_str: _TFctToStr[_TRawEnum], fct_from_str: _TFctFromStr[_TRawEnum],
|
||||||
|
fct_name: _TFctName[_TRawEnum], fct_desc: _TFctDesc[_TRawEnum],
|
||||||
|
fct_icon: _TFctIcon[_TRawEnum]):
|
||||||
"""
|
"""
|
||||||
Initialize an EnumProperty helper.
|
Initialize an EnumProperty helper.
|
||||||
|
|
||||||
|
@ -3,11 +3,13 @@ import enum, typing
|
|||||||
from . import UTIL_virtools_types, UTIL_functions
|
from . import UTIL_virtools_types, UTIL_functions
|
||||||
from . import PROP_ptrprop_resolver, PROP_ballance_map_info
|
from . import PROP_ptrprop_resolver, PROP_ballance_map_info
|
||||||
|
|
||||||
## Intent
|
# INTENT:
|
||||||
# Some importer or exporter may share same properties.
|
# Some importer or exporter may share same properties.
|
||||||
# So we create some shared class and user just need inherit them
|
# So we create some shared class and user just need inherit them
|
||||||
# and call general getter to get user selected data.
|
# and call general getter to get user selected data.
|
||||||
# Also provide draw function thus caller do not need draw the params themselves.
|
# Also provide draw function thus caller do not need draw the params themselves.
|
||||||
|
|
||||||
|
#region Import Params
|
||||||
|
|
||||||
class ConflictStrategy(enum.IntEnum):
|
class ConflictStrategy(enum.IntEnum):
|
||||||
Rename = enum.auto()
|
Rename = enum.auto()
|
||||||
@ -16,7 +18,7 @@ _g_ConflictStrategyDesc: dict[ConflictStrategy, tuple[str, str]] = {
|
|||||||
ConflictStrategy.Rename: ('Rename', 'Rename the new one'),
|
ConflictStrategy.Rename: ('Rename', 'Rename the new one'),
|
||||||
ConflictStrategy.Current: ('Use Current', 'Use current one'),
|
ConflictStrategy.Current: ('Use Current', 'Use current one'),
|
||||||
}
|
}
|
||||||
_g_EnumHelper_ConflictStrategy: UTIL_functions.EnumPropHelper = UTIL_functions.EnumPropHelper(
|
_g_EnumHelper_ConflictStrategy = UTIL_functions.EnumPropHelper(
|
||||||
ConflictStrategy,
|
ConflictStrategy,
|
||||||
lambda x: str(x.value),
|
lambda x: str(x.value),
|
||||||
lambda x: ConflictStrategy(int(x)),
|
lambda x: ConflictStrategy(int(x)),
|
||||||
@ -25,39 +27,6 @@ _g_EnumHelper_ConflictStrategy: UTIL_functions.EnumPropHelper = UTIL_functions.E
|
|||||||
lambda _: ''
|
lambda _: ''
|
||||||
)
|
)
|
||||||
|
|
||||||
#region Assist Classes
|
|
||||||
|
|
||||||
class ExportEditModeBackup():
|
|
||||||
"""
|
|
||||||
The class which save Edit Mode when exporting and restore it after exporting.
|
|
||||||
Because edit mode is not allowed when exporting.
|
|
||||||
Support `with` statement.
|
|
||||||
|
|
||||||
```
|
|
||||||
with ExportEditModeBackup():
|
|
||||||
# do some exporting work
|
|
||||||
blabla()
|
|
||||||
# restore automatically when exiting "with"
|
|
||||||
```
|
|
||||||
"""
|
|
||||||
mInEditMode: bool
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
if bpy.context.object and bpy.context.object.mode == "EDIT":
|
|
||||||
# set and toggle it. otherwise exporting will failed.
|
|
||||||
self.mInEditMode = True
|
|
||||||
bpy.ops.object.editmode_toggle()
|
|
||||||
else:
|
|
||||||
self.mInEditMode = False
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, traceback):
|
|
||||||
if self.mInEditMode:
|
|
||||||
bpy.ops.object.editmode_toggle()
|
|
||||||
self.mInEditMode = False
|
|
||||||
|
|
||||||
class ConflictResolver():
|
class ConflictResolver():
|
||||||
"""
|
"""
|
||||||
This class frequently used when importing objects.
|
This class frequently used when importing objects.
|
||||||
@ -151,8 +120,6 @@ class ConflictResolver():
|
|||||||
tex.name = name
|
tex.name = name
|
||||||
return (tex, True)
|
return (tex, True)
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
class ImportParams():
|
class ImportParams():
|
||||||
texture_conflict_strategy: bpy.props.EnumProperty(
|
texture_conflict_strategy: bpy.props.EnumProperty(
|
||||||
name = "Texture Name Conflict",
|
name = "Texture Name Conflict",
|
||||||
@ -239,14 +206,65 @@ class ImportParams():
|
|||||||
self.general_get_texture_conflict_strategy()
|
self.general_get_texture_conflict_strategy()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Export Params
|
||||||
|
|
||||||
|
class ExportEditModeBackup():
|
||||||
|
"""
|
||||||
|
The class which save Edit Mode when exporting and restore it after exporting.
|
||||||
|
Because edit mode is not allowed when exporting.
|
||||||
|
Support `with` statement.
|
||||||
|
|
||||||
|
```
|
||||||
|
with ExportEditModeBackup():
|
||||||
|
# do some exporting work
|
||||||
|
blabla()
|
||||||
|
# restore automatically when exiting "with"
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
mInEditMode: bool
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
if bpy.context.object and bpy.context.object.mode == "EDIT":
|
||||||
|
# set and toggle it. otherwise exporting will failed.
|
||||||
|
self.mInEditMode = True
|
||||||
|
bpy.ops.object.editmode_toggle()
|
||||||
|
else:
|
||||||
|
self.mInEditMode = False
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
if self.mInEditMode:
|
||||||
|
bpy.ops.object.editmode_toggle()
|
||||||
|
self.mInEditMode = False
|
||||||
|
|
||||||
|
class ExportMode(enum.IntEnum):
|
||||||
|
BldColl = enum.auto()
|
||||||
|
BldObj = enum.auto()
|
||||||
|
BldSelObjs = enum.auto()
|
||||||
|
_g_ExportModeDesc: dict[ExportMode, tuple[str, str, str]] = {
|
||||||
|
ExportMode.BldColl: ('Collection', 'Export a collection', 'OUTLINER_COLLECTION'),
|
||||||
|
ExportMode.BldObj: ('Object', 'Export an object', 'OBJECT_DATA'),
|
||||||
|
ExportMode.BldSelObjs: ('Selected Objects', 'Export selected objects', 'SELECT_SET'),
|
||||||
|
}
|
||||||
|
_g_EnumHelper_ExportMode = UTIL_functions.EnumPropHelper(
|
||||||
|
ExportMode,
|
||||||
|
lambda x: str(x.value),
|
||||||
|
lambda x: ExportMode(int(x)),
|
||||||
|
lambda x: _g_ExportModeDesc[x][0],
|
||||||
|
lambda x: _g_ExportModeDesc[x][1],
|
||||||
|
lambda x: _g_ExportModeDesc[x][2]
|
||||||
|
)
|
||||||
|
|
||||||
class ExportParams():
|
class ExportParams():
|
||||||
export_mode: bpy.props.EnumProperty(
|
export_mode: bpy.props.EnumProperty(
|
||||||
name = "Export Mode",
|
name = "Export Mode",
|
||||||
items = (
|
description = "Define which 3D objects should be exported",
|
||||||
('COLLECTION', "Collection", "Export a collection", 'OUTLINER_COLLECTION', 0),
|
items = _g_EnumHelper_ExportMode.generate_items(),
|
||||||
('OBJECT', "Object", "Export an object", 'OBJECT_DATA', 1),
|
default = _g_EnumHelper_ExportMode.to_selection(ExportMode.BldColl),
|
||||||
('SELECTED', "Selected Objects", "Export selected objects", 'SELECT_SET', 2),
|
|
||||||
),
|
|
||||||
translation_context = 'BBP/UTIL_ioport_shared.ExportParams/property'
|
translation_context = 'BBP/UTIL_ioport_shared.ExportParams/property'
|
||||||
) # type: ignore
|
) # type: ignore
|
||||||
|
|
||||||
@ -263,32 +281,40 @@ class ExportParams():
|
|||||||
horizon_body.prop(self, "export_mode", expand=True)
|
horizon_body.prop(self, "export_mode", expand=True)
|
||||||
|
|
||||||
# draw picker
|
# draw picker
|
||||||
|
export_mode = _g_EnumHelper_ExportMode.get_selection(self.export_mode)
|
||||||
ptrprops = PROP_ptrprop_resolver.PropsVisitor(context.scene)
|
ptrprops = PROP_ptrprop_resolver.PropsVisitor(context.scene)
|
||||||
if self.export_mode == 'COLLECTION':
|
match export_mode:
|
||||||
ptrprops.draw_export_collection(body)
|
case ExportMode.BldColl:
|
||||||
elif self.export_mode == 'OBJECT':
|
ptrprops.draw_export_collection(body)
|
||||||
ptrprops.draw_export_object(body)
|
case ExportMode.BldObj:
|
||||||
elif self.export_mode == 'SELECTED':
|
ptrprops.draw_export_object(body)
|
||||||
pass # Draw nothing
|
case ExportMode.BldSelObjs:
|
||||||
|
pass # Draw nothing
|
||||||
|
|
||||||
def general_get_export_objects(self, context: bpy.types.Context) -> tuple[bpy.types.Object, ...] | None:
|
def general_get_export_objects(self, context: bpy.types.Context) -> tuple[bpy.types.Object, ...] | None:
|
||||||
"""
|
"""
|
||||||
Return resolved exported objects or None if no selection.
|
Return resolved exported objects or None if no selection.
|
||||||
"""
|
"""
|
||||||
|
export_mode = _g_EnumHelper_ExportMode.get_selection(self.export_mode)
|
||||||
ptrprops = PROP_ptrprop_resolver.PropsVisitor(context.scene)
|
ptrprops = PROP_ptrprop_resolver.PropsVisitor(context.scene)
|
||||||
if self.export_mode == 'COLLECTION':
|
match export_mode:
|
||||||
col: bpy.types.Collection = ptrprops.get_export_collection()
|
case ExportMode.BldColl:
|
||||||
if col is None: return None
|
col: bpy.types.Collection = ptrprops.get_export_collection()
|
||||||
else: return tuple(col.all_objects)
|
if col is None: return None
|
||||||
elif self.export_mode == 'OBJECT':
|
else: return tuple(col.all_objects)
|
||||||
obj: bpy.types.Object = ptrprops.get_export_object()
|
case ExportMode.BldObj:
|
||||||
if obj is None: return None
|
obj: bpy.types.Object = ptrprops.get_export_object()
|
||||||
else: return (obj, )
|
if obj is None: return None
|
||||||
elif self.export_mode == 'SELECTED':
|
else: return (obj, )
|
||||||
return tuple(context.selected_objects)
|
case ExportMode.BldSelObjs:
|
||||||
|
return tuple(context.selected_objects)
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Virtools Params
|
||||||
|
|
||||||
# define global tex save opt blender enum prop helper
|
# define global tex save opt blender enum prop helper
|
||||||
_g_EnumHelper_CK_TEXTURE_SAVEOPTIONS: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.CK_TEXTURE_SAVEOPTIONS)
|
_g_EnumHelper_CK_TEXTURE_SAVEOPTIONS = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.CK_TEXTURE_SAVEOPTIONS)
|
||||||
|
|
||||||
class VirtoolsParams():
|
class VirtoolsParams():
|
||||||
texture_save_opt: bpy.props.EnumProperty(
|
texture_save_opt: bpy.props.EnumProperty(
|
||||||
@ -353,6 +379,10 @@ class VirtoolsParams():
|
|||||||
def general_get_compress_level(self) -> int:
|
def general_get_compress_level(self) -> int:
|
||||||
return self.compress_level
|
return self.compress_level
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Ballance Params
|
||||||
|
|
||||||
class BallanceParams():
|
class BallanceParams():
|
||||||
successive_sector: bpy.props.BoolProperty(
|
successive_sector: bpy.props.BoolProperty(
|
||||||
name="Successive Sector",
|
name="Successive Sector",
|
||||||
@ -391,3 +421,5 @@ class BallanceParams():
|
|||||||
map_info: PROP_ballance_map_info.RawBallanceMapInfo
|
map_info: PROP_ballance_map_info.RawBallanceMapInfo
|
||||||
map_info = PROP_ballance_map_info.get_raw_ballance_map_info(bpy.context.scene)
|
map_info = PROP_ballance_map_info.get_raw_ballance_map_info(bpy.context.scene)
|
||||||
return map_info.mSectorCount
|
return map_info.mSectorCount
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
Reference in New Issue
Block a user