refactor BlenderEnumPropHelper
This commit is contained in:
parent
52f3936e42
commit
a6de69c882
@ -94,7 +94,12 @@ def _check_component_existance(comp_type: PROP_ballance_element.BallanceElementT
|
|||||||
if expect_name in bpy.data.objects: return expect_name
|
if expect_name in bpy.data.objects: return expect_name
|
||||||
else: return None
|
else: return None
|
||||||
|
|
||||||
def _general_create_component(comp_type: PROP_ballance_element.BallanceElementType, comp_sector: int, comp_count: int, comp_offset: typing.Callable[[int], mathutils.Matrix]) -> None:
|
def _general_create_component(
|
||||||
|
comp_type: PROP_ballance_element.BallanceElementType,
|
||||||
|
comp_sector: int,
|
||||||
|
comp_count: int,
|
||||||
|
comp_offset: typing.Callable[[int], mathutils.Matrix]
|
||||||
|
) -> None:
|
||||||
"""
|
"""
|
||||||
General component creation function.
|
General component creation function.
|
||||||
|
|
||||||
@ -121,40 +126,24 @@ def _general_create_component(comp_type: PROP_ballance_element.BallanceElementTy
|
|||||||
UTIL_functions.add_into_scene_and_move_to_cursor(obj)
|
UTIL_functions.add_into_scene_and_move_to_cursor(obj)
|
||||||
# move with extra offset by calling offset getter
|
# move with extra offset by calling offset getter
|
||||||
obj.matrix_world = obj.matrix_world @ comp_offset(i)
|
obj.matrix_world = obj.matrix_world @ comp_offset(i)
|
||||||
|
|
||||||
class EnumPropHelper():
|
|
||||||
"""
|
|
||||||
Generate component types for this module's operator
|
|
||||||
"""
|
|
||||||
@staticmethod
|
|
||||||
def generate_items() -> tuple[tuple, ...]:
|
|
||||||
# token, display name, descriptions, icon, index
|
|
||||||
return tuple(
|
|
||||||
(
|
|
||||||
str(item.value),
|
|
||||||
item.name,
|
|
||||||
"",
|
|
||||||
UTIL_icons_manager.get_component_icon(PROP_ballance_element.get_ballance_element_name(item)),
|
|
||||||
item.value
|
|
||||||
) for item in PROP_ballance_element.BallanceElementType
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_selection(prop: str) -> PROP_ballance_element.BallanceElementType:
|
|
||||||
# prop will return identifier which is defined as the string type of int value.
|
|
||||||
# so we parse it to int and then parse it to enum type.
|
|
||||||
return PROP_ballance_element.BallanceElementType(int(prop))
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def to_selection(val: PROP_ballance_element.BallanceElementType) -> str:
|
|
||||||
# like get_selection, we need get it int value, then convert it to string as the indetifier of enum props
|
|
||||||
# them enum property will accept it.
|
|
||||||
return str(val.value)
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Noemal Component Adder
|
#region Noemal Component Adder
|
||||||
|
|
||||||
|
# element enum prop helper
|
||||||
|
|
||||||
|
def _get_component_icon_by_name(elename: str):
|
||||||
|
icon: int | None = UTIL_icons_manager.get_component_icon(elename)
|
||||||
|
if icon is None: return UTIL_icons_manager.get_empty_icon()
|
||||||
|
else: return icon
|
||||||
|
_g_EnumHelper_Component: UTIL_functions.EnumPropHelper = UTIL_functions.EnumPropHelper(
|
||||||
|
PROP_ballance_element.BallanceElementType,
|
||||||
|
lambda x: x.name,
|
||||||
|
lambda x: '',
|
||||||
|
lambda x: _get_component_icon_by_name(PROP_ballance_element.get_ballance_element_name(x)),
|
||||||
|
)
|
||||||
|
|
||||||
class BBP_OT_add_component(bpy.types.Operator, ComponentSectorParam):
|
class BBP_OT_add_component(bpy.types.Operator, ComponentSectorParam):
|
||||||
"""Add Component"""
|
"""Add Component"""
|
||||||
bl_idname = "bbp.add_component"
|
bl_idname = "bbp.add_component"
|
||||||
@ -164,7 +153,7 @@ class BBP_OT_add_component(bpy.types.Operator, ComponentSectorParam):
|
|||||||
component_type: bpy.props.EnumProperty(
|
component_type: bpy.props.EnumProperty(
|
||||||
name = "Type",
|
name = "Type",
|
||||||
description = "This component type",
|
description = "This component type",
|
||||||
items = EnumPropHelper.generate_items(),
|
items = _g_EnumHelper_Component.generate_items(),
|
||||||
)
|
)
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
@ -177,35 +166,35 @@ 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 = EnumPropHelper.get_selection(self.component_type)
|
eletype: PROP_ballance_element.BallanceElementType = _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)
|
||||||
|
|
||||||
# check for some special components and show warning
|
# check for some special components and show warning
|
||||||
elename: str | None = _check_component_existance(EnumPropHelper.get_selection(self.component_type), self.general_get_component_sector())
|
elename: str | None = _check_component_existance(_g_EnumHelper_Component.get_selection(self.component_type), self.general_get_component_sector())
|
||||||
if elename is not None:
|
if elename is not None:
|
||||||
layout.label(text = f'Warning: {elename} already exist.')
|
layout.label(text = f'Warning: {elename} already exist.')
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
# call general creator
|
# call general creator
|
||||||
_general_create_component(
|
_general_create_component(
|
||||||
EnumPropHelper.get_selection(self.component_type),
|
_g_EnumHelper_Component.get_selection(self.component_type),
|
||||||
self.general_get_component_sector(),
|
self.general_get_component_sector(),
|
||||||
1, # only create one
|
1, # only create one
|
||||||
lambda _: mathutils.Matrix.Identity(4)
|
lambda _: mathutils.Matrix.Identity(4)
|
||||||
)
|
)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
@classmethod
|
@staticmethod
|
||||||
def draw_blc_menu(self, layout: bpy.types.UILayout):
|
def draw_blc_menu(layout: bpy.types.UILayout):
|
||||||
for item in PROP_ballance_element.BallanceElementType:
|
for item in PROP_ballance_element.BallanceElementType:
|
||||||
item_name: str = PROP_ballance_element.get_ballance_element_name(item)
|
item_name: str = PROP_ballance_element.get_ballance_element_name(item)
|
||||||
|
|
||||||
cop = layout.operator(
|
cop = layout.operator(
|
||||||
self.bl_idname, text = item_name,
|
BBP_OT_add_component.bl_idname, text = item_name,
|
||||||
icon_value = UTIL_icons_manager.get_component_icon(item_name)
|
icon_value = UTIL_icons_manager.get_component_icon(item_name)
|
||||||
)
|
)
|
||||||
cop.component_type = EnumPropHelper.to_selection(item)
|
cop.component_type = _g_EnumHelper_Component.to_selection(item)
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -235,8 +224,8 @@ class BBP_OT_add_nong_extra_point(bpy.types.Operator, ComponentSectorParam, Comp
|
|||||||
)
|
)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
@classmethod
|
@staticmethod
|
||||||
def draw_blc_menu(self, layout: bpy.types.UILayout):
|
def draw_blc_menu(layout: bpy.types.UILayout):
|
||||||
layout.operator(
|
layout.operator(
|
||||||
BBP_OT_add_nong_extra_point.bl_idname,
|
BBP_OT_add_nong_extra_point.bl_idname,
|
||||||
icon_value = UTIL_icons_manager.get_component_icon(
|
icon_value = UTIL_icons_manager.get_component_icon(
|
||||||
@ -282,8 +271,8 @@ class BBP_OT_add_tilting_block_series(bpy.types.Operator, ComponentSectorParam,
|
|||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
@classmethod
|
@staticmethod
|
||||||
def draw_blc_menu(self, layout: bpy.types.UILayout):
|
def draw_blc_menu(layout: bpy.types.UILayout):
|
||||||
layout.operator(
|
layout.operator(
|
||||||
BBP_OT_add_tilting_block_series.bl_idname,
|
BBP_OT_add_tilting_block_series.bl_idname,
|
||||||
icon_value = UTIL_icons_manager.get_component_icon(
|
icon_value = UTIL_icons_manager.get_component_icon(
|
||||||
@ -326,8 +315,8 @@ class BBP_OT_add_ventilator_series(bpy.types.Operator, ComponentSectorParam, Com
|
|||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
@classmethod
|
@staticmethod
|
||||||
def draw_blc_menu(self, layout: bpy.types.UILayout):
|
def draw_blc_menu(layout: bpy.types.UILayout):
|
||||||
layout.operator(
|
layout.operator(
|
||||||
BBP_OT_add_ventilator_series.bl_idname,
|
BBP_OT_add_ventilator_series.bl_idname,
|
||||||
icon_value = UTIL_icons_manager.get_component_icon(
|
icon_value = UTIL_icons_manager.get_component_icon(
|
||||||
@ -407,8 +396,8 @@ class BBP_OT_add_sector_component_pair(bpy.types.Operator, ComponentSectorParam)
|
|||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
@classmethod
|
@staticmethod
|
||||||
def draw_blc_menu(self, layout: bpy.types.UILayout):
|
def draw_blc_menu(layout: bpy.types.UILayout):
|
||||||
layout.operator(
|
layout.operator(
|
||||||
BBP_OT_add_sector_component_pair.bl_idname,
|
BBP_OT_add_sector_component_pair.bl_idname,
|
||||||
icon_value = UTIL_icons_manager.get_component_icon(
|
icon_value = UTIL_icons_manager.get_component_icon(
|
||||||
|
@ -6,6 +6,9 @@ from . import UTIL_virtools_types, UTIL_functions, UTIL_file_browser, UTIL_blend
|
|||||||
from . import PROP_virtools_group, PROP_virtools_material, PROP_virtools_mesh, PROP_virtools_texture
|
from . import PROP_virtools_group, PROP_virtools_material, PROP_virtools_mesh, PROP_virtools_texture
|
||||||
from .PyBMap import bmap_wrapper as bmap
|
from .PyBMap import bmap_wrapper as bmap
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
class BBP_OT_export_virtools(bpy.types.Operator, UTIL_file_browser.ExportVirtoolsFile, UTIL_ioport_shared.ExportParams, UTIL_ioport_shared.VirtoolsParams):
|
class BBP_OT_export_virtools(bpy.types.Operator, UTIL_file_browser.ExportVirtoolsFile, UTIL_ioport_shared.ExportParams, UTIL_ioport_shared.VirtoolsParams):
|
||||||
"""Export Virtools File"""
|
"""Export Virtools File"""
|
||||||
bl_idname = "bbp.export_virtools"
|
bl_idname = "bbp.export_virtools"
|
||||||
@ -15,11 +18,8 @@ class BBP_OT_export_virtools(bpy.types.Operator, UTIL_file_browser.ExportVirtool
|
|||||||
texture_save_opt: bpy.props.EnumProperty(
|
texture_save_opt: bpy.props.EnumProperty(
|
||||||
name = "Global Texture Save Options",
|
name = "Global Texture Save Options",
|
||||||
description = "Decide how texture saved if texture is specified as Use Global as its Save Options.",
|
description = "Decide how texture saved if texture is specified as Use Global as its Save Options.",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_EnumHelper_CK_TEXTURE_SAVEOPTIONS.generate_items(),
|
||||||
UTIL_virtools_types.CK_TEXTURE_SAVEOPTIONS,
|
default = _g_EnumHelper_CK_TEXTURE_SAVEOPTIONS.to_selection(UTIL_virtools_types.CK_TEXTURE_SAVEOPTIONS.CKTEXTURE_EXTERNAL)
|
||||||
UTIL_virtools_types.g_Annotation_CK_TEXTURE_SAVEOPTIONS
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(UTIL_virtools_types.CK_TEXTURE_SAVEOPTIONS.CKTEXTURE_EXTERNAL)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
use_compress: bpy.props.BoolProperty(
|
use_compress: bpy.props.BoolProperty(
|
||||||
@ -56,7 +56,7 @@ class BBP_OT_export_virtools(bpy.types.Operator, UTIL_file_browser.ExportVirtool
|
|||||||
_export_virtools(
|
_export_virtools(
|
||||||
self.general_get_filename(),
|
self.general_get_filename(),
|
||||||
self.general_get_vt_encodings(),
|
self.general_get_vt_encodings(),
|
||||||
UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.CK_TEXTURE_SAVEOPTIONS, self.texture_save_opt),
|
_g_EnumHelper_CK_TEXTURE_SAVEOPTIONS.get_selection(self.texture_save_opt),
|
||||||
self.use_compress,
|
self.use_compress,
|
||||||
self.compress_level,
|
self.compress_level,
|
||||||
objls
|
objls
|
||||||
|
@ -238,6 +238,13 @@ def _get_group_icon_by_name(gp_name: str) -> int:
|
|||||||
value = UTIL_icons_manager.get_component_icon(gp_name)
|
value = UTIL_icons_manager.get_component_icon(gp_name)
|
||||||
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
|
||||||
|
_g_EnumHelper_Group: UTIL_functions.EnumPropHelper = UTIL_functions.EnumPropHelper(
|
||||||
|
VirtoolsGroupsPreset,
|
||||||
|
lambda x: x.value,
|
||||||
|
lambda _: '',
|
||||||
|
lambda x: _get_group_icon_by_name(x.value)
|
||||||
|
)
|
||||||
|
|
||||||
class SharedGroupNameInputProperties():
|
class SharedGroupNameInputProperties():
|
||||||
group_name_source: bpy.props.EnumProperty(
|
group_name_source: bpy.props.EnumProperty(
|
||||||
@ -249,12 +256,9 @@ class SharedGroupNameInputProperties():
|
|||||||
)
|
)
|
||||||
|
|
||||||
preset_group_name: bpy.props.EnumProperty(
|
preset_group_name: bpy.props.EnumProperty(
|
||||||
name="Group Name",
|
name = "Group Name",
|
||||||
description="Pick vanilla Ballance group name.",
|
description = "Pick vanilla Ballance group name.",
|
||||||
items=tuple(
|
items = _g_EnumHelper_Group.generate_items(),
|
||||||
# token, display name, descriptions, icon, index
|
|
||||||
(str(idx), grp, "", _get_group_icon_by_name(grp), idx) for idx, grp in enumerate(_g_VtGrpPresetValues)
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
custom_group_name: bpy.props.StringProperty(
|
custom_group_name: bpy.props.StringProperty(
|
||||||
@ -274,7 +278,7 @@ class SharedGroupNameInputProperties():
|
|||||||
if self.group_name_source == 'CUSTOM':
|
if self.group_name_source == 'CUSTOM':
|
||||||
return self.custom_group_name
|
return self.custom_group_name
|
||||||
else:
|
else:
|
||||||
return _g_VtGrpPresetValues[int(self.preset_group_name)]
|
return _g_EnumHelper_Group.get_selection(self.preset_group_name).value
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -112,6 +112,18 @@ class RawVirtoolsMaterial():
|
|||||||
# specular power
|
# specular power
|
||||||
self.mSpecularPower = UTIL_functions.clamp_float(self.mSpecularPower, 0.0, 100.0)
|
self.mSpecularPower = UTIL_functions.clamp_float(self.mSpecularPower, 0.0, 100.0)
|
||||||
|
|
||||||
|
#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_FILTERMODE: UTIL_virtools_types.EnumPropHelper = 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_VXBLEND_MODE: UTIL_virtools_types.EnumPropHelper = 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_VXSHADE_MODE: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXSHADE_MODE)
|
||||||
|
_g_Helper_VXCMPFUNC: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXCMPFUNC)
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
class BBP_PG_virtools_material(bpy.types.PropertyGroup):
|
class BBP_PG_virtools_material(bpy.types.PropertyGroup):
|
||||||
ambient: bpy.props.FloatVectorProperty(
|
ambient: bpy.props.FloatVectorProperty(
|
||||||
name = "Ambient",
|
name = "Ambient",
|
||||||
@ -180,81 +192,57 @@ class BBP_PG_virtools_material(bpy.types.PropertyGroup):
|
|||||||
texture_blend_mode: bpy.props.EnumProperty(
|
texture_blend_mode: bpy.props.EnumProperty(
|
||||||
name = "Texture Blend",
|
name = "Texture Blend",
|
||||||
description = "Texture blend mode",
|
description = "Texture blend mode",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_VXTEXTURE_BLENDMODE.generate_items(),
|
||||||
UTIL_virtools_types.VXTEXTURE_BLENDMODE,
|
default = _g_Helper_VXTEXTURE_BLENDMODE.to_selection(RawVirtoolsMaterial.cDefaultTextureBlendMode)
|
||||||
UTIL_virtools_types.g_Annotation_VXTEXTURE_BLENDMODE
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsMaterial.cDefaultTextureBlendMode)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
texture_min_mode: bpy.props.EnumProperty(
|
texture_min_mode: bpy.props.EnumProperty(
|
||||||
name = "Filter Min",
|
name = "Filter Min",
|
||||||
description = "Texture filter mode when the texture is minified",
|
description = "Texture filter mode when the texture is minified",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_VXTEXTURE_FILTERMODE.generate_items(),
|
||||||
UTIL_virtools_types.VXTEXTURE_FILTERMODE,
|
default = _g_Helper_VXTEXTURE_FILTERMODE.to_selection(RawVirtoolsMaterial.cDefaultTextureMinMode)
|
||||||
UTIL_virtools_types.g_Annotation_VXTEXTURE_FILTERMODE
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsMaterial.cDefaultTextureMinMode)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
texture_mag_mode: bpy.props.EnumProperty(
|
texture_mag_mode: bpy.props.EnumProperty(
|
||||||
name = "Filter Mag",
|
name = "Filter Mag",
|
||||||
description = "Texture filter mode when the texture is magnified",
|
description = "Texture filter mode when the texture is magnified",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_VXTEXTURE_FILTERMODE.generate_items(),
|
||||||
UTIL_virtools_types.VXTEXTURE_FILTERMODE,
|
default = _g_Helper_VXTEXTURE_FILTERMODE.to_selection(RawVirtoolsMaterial.cDefaultTextureMagMode)
|
||||||
UTIL_virtools_types.g_Annotation_VXTEXTURE_FILTERMODE
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsMaterial.cDefaultTextureMagMode)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
texture_address_mode: bpy.props.EnumProperty(
|
texture_address_mode: bpy.props.EnumProperty(
|
||||||
name = "Address Mode",
|
name = "Address Mode",
|
||||||
description = "The address mode controls how the texture coordinates outside the range 0..1",
|
description = "The address mode controls how the texture coordinates outside the range 0..1",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_VXTEXTURE_ADDRESSMODE.generate_items(),
|
||||||
UTIL_virtools_types.VXTEXTURE_ADDRESSMODE,
|
default = _g_Helper_VXTEXTURE_ADDRESSMODE.to_selection(RawVirtoolsMaterial.cDefaultTextureAddressMode)
|
||||||
UTIL_virtools_types.g_Annotation_VXTEXTURE_ADDRESSMODE
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsMaterial.cDefaultTextureAddressMode)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
source_blend: bpy.props.EnumProperty(
|
source_blend: bpy.props.EnumProperty(
|
||||||
name = "Source Blend",
|
name = "Source Blend",
|
||||||
description = "Source blend factor",
|
description = "Source blend factor",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_VXBLEND_MODE.generate_items(),
|
||||||
UTIL_virtools_types.VXBLEND_MODE,
|
default = _g_Helper_VXBLEND_MODE.to_selection(RawVirtoolsMaterial.cDefaultSourceBlend)
|
||||||
UTIL_virtools_types.g_Annotation_VXBLEND_MODE
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsMaterial.cDefaultSourceBlend)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
dest_blend: bpy.props.EnumProperty(
|
dest_blend: bpy.props.EnumProperty(
|
||||||
name = "Destination Blend",
|
name = "Destination Blend",
|
||||||
description = "Destination blend factor",
|
description = "Destination blend factor",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_VXBLEND_MODE.generate_items(),
|
||||||
UTIL_virtools_types.VXBLEND_MODE,
|
default = _g_Helper_VXBLEND_MODE.to_selection(RawVirtoolsMaterial.cDefaultDestBlend)
|
||||||
UTIL_virtools_types.g_Annotation_VXBLEND_MODE
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsMaterial.cDefaultDestBlend)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fill_mode: bpy.props.EnumProperty(
|
fill_mode: bpy.props.EnumProperty(
|
||||||
name = "Fill Mode",
|
name = "Fill Mode",
|
||||||
description = "Fill mode",
|
description = "Fill mode",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_VXFILL_MODE.generate_items(),
|
||||||
UTIL_virtools_types.VXFILL_MODE,
|
default = _g_Helper_VXFILL_MODE.to_selection(RawVirtoolsMaterial.cDefaultFillMode)
|
||||||
UTIL_virtools_types.g_Annotation_VXFILL_MODE
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsMaterial.cDefaultFillMode)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
shade_mode: bpy.props.EnumProperty(
|
shade_mode: bpy.props.EnumProperty(
|
||||||
name = "Shade Mode",
|
name = "Shade Mode",
|
||||||
description = "Shade mode",
|
description = "Shade mode",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_VXSHADE_MODE.generate_items(),
|
||||||
UTIL_virtools_types.VXSHADE_MODE,
|
default = _g_Helper_VXSHADE_MODE.to_selection(RawVirtoolsMaterial.cDefaultShadeMode)
|
||||||
UTIL_virtools_types.g_Annotation_VXSHADE_MODE
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsMaterial.cDefaultShadeMode)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
enable_alpha_test: bpy.props.BoolProperty(
|
enable_alpha_test: bpy.props.BoolProperty(
|
||||||
@ -294,21 +282,15 @@ class BBP_PG_virtools_material(bpy.types.PropertyGroup):
|
|||||||
alpha_func: bpy.props.EnumProperty(
|
alpha_func: bpy.props.EnumProperty(
|
||||||
name = "Alpha Test Function",
|
name = "Alpha Test Function",
|
||||||
description = "Alpha comparision function",
|
description = "Alpha comparision function",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_VXCMPFUNC.generate_items(),
|
||||||
UTIL_virtools_types.VXCMPFUNC,
|
default = _g_Helper_VXCMPFUNC.to_selection(RawVirtoolsMaterial.cDefaultAlphaFunc)
|
||||||
UTIL_virtools_types.g_Annotation_VXCMPFUNC
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsMaterial.cDefaultAlphaFunc)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
z_func: bpy.props.EnumProperty(
|
z_func: bpy.props.EnumProperty(
|
||||||
name = "Z Compare Function",
|
name = "Z Compare Function",
|
||||||
description = "Z Comparison function",
|
description = "Z Comparison function",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_VXCMPFUNC.generate_items(),
|
||||||
UTIL_virtools_types.VXCMPFUNC,
|
default = _g_Helper_VXCMPFUNC.to_selection(RawVirtoolsMaterial.cDefaultZFunc)
|
||||||
UTIL_virtools_types.g_Annotation_VXCMPFUNC
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsMaterial.cDefaultZFunc)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#region Getter Setter
|
#region Getter Setter
|
||||||
@ -329,15 +311,15 @@ def get_raw_virtools_material(mtl: bpy.types.Material) -> RawVirtoolsMaterial:
|
|||||||
rawdata.mTexture = props.texture
|
rawdata.mTexture = props.texture
|
||||||
rawdata.mTextureBorderColor.from_const_rgba(props.texture_border_color)
|
rawdata.mTextureBorderColor.from_const_rgba(props.texture_border_color)
|
||||||
|
|
||||||
rawdata.mTextureBlendMode = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.VXTEXTURE_BLENDMODE, props.texture_blend_mode)
|
rawdata.mTextureBlendMode = _g_Helper_VXTEXTURE_BLENDMODE.get_selection(props.texture_blend_mode)
|
||||||
rawdata.mTextureMinMode = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.VXTEXTURE_FILTERMODE, props.texture_min_mode)
|
rawdata.mTextureMinMode = _g_Helper_VXTEXTURE_FILTERMODE.get_selection(props.texture_min_mode)
|
||||||
rawdata.mTextureMagMode = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.VXTEXTURE_FILTERMODE, props.texture_mag_mode)
|
rawdata.mTextureMagMode = _g_Helper_VXTEXTURE_FILTERMODE.get_selection(props.texture_mag_mode)
|
||||||
rawdata.mTextureAddressMode = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.VXTEXTURE_ADDRESSMODE, props.texture_address_mode)
|
rawdata.mTextureAddressMode = _g_Helper_VXTEXTURE_ADDRESSMODE.get_selection(props.texture_address_mode)
|
||||||
|
|
||||||
rawdata.mSourceBlend = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.VXBLEND_MODE, props.source_blend)
|
rawdata.mSourceBlend = _g_Helper_VXBLEND_MODE.get_selection(props.source_blend)
|
||||||
rawdata.mDestBlend = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.VXBLEND_MODE, props.dest_blend)
|
rawdata.mDestBlend = _g_Helper_VXBLEND_MODE.get_selection(props.dest_blend)
|
||||||
rawdata.mFillMode = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.VXFILL_MODE, props.fill_mode)
|
rawdata.mFillMode = _g_Helper_VXFILL_MODE.get_selection(props.fill_mode)
|
||||||
rawdata.mShadeMode = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.VXSHADE_MODE, props.shade_mode)
|
rawdata.mShadeMode = _g_Helper_VXSHADE_MODE.get_selection(props.shade_mode)
|
||||||
|
|
||||||
rawdata.mEnableAlphaTest = props.enable_alpha_test
|
rawdata.mEnableAlphaTest = props.enable_alpha_test
|
||||||
rawdata.mEnableAlphaBlend = props.enable_alpha_blend
|
rawdata.mEnableAlphaBlend = props.enable_alpha_blend
|
||||||
@ -346,8 +328,8 @@ def get_raw_virtools_material(mtl: bpy.types.Material) -> RawVirtoolsMaterial:
|
|||||||
rawdata.mEnableTwoSided = props.enable_two_sided
|
rawdata.mEnableTwoSided = props.enable_two_sided
|
||||||
|
|
||||||
rawdata.mAlphaRef = props.alpha_ref
|
rawdata.mAlphaRef = props.alpha_ref
|
||||||
rawdata.mAlphaFunc = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.VXCMPFUNC, props.alpha_func)
|
rawdata.mAlphaFunc = _g_Helper_VXCMPFUNC.get_selection(props.alpha_func)
|
||||||
rawdata.mZFunc = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.VXCMPFUNC, props.z_func)
|
rawdata.mZFunc = _g_Helper_VXCMPFUNC.get_selection(props.z_func)
|
||||||
|
|
||||||
rawdata.regulate()
|
rawdata.regulate()
|
||||||
return rawdata
|
return rawdata
|
||||||
@ -364,15 +346,15 @@ def set_raw_virtools_material(mtl: bpy.types.Material, rawdata: RawVirtoolsMater
|
|||||||
props.texture = rawdata.mTexture
|
props.texture = rawdata.mTexture
|
||||||
props.texture_border_color = rawdata.mTextureBorderColor.to_const_rgba()
|
props.texture_border_color = rawdata.mTextureBorderColor.to_const_rgba()
|
||||||
|
|
||||||
props.texture_blend_mode = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mTextureBlendMode)
|
props.texture_blend_mode = _g_Helper_VXTEXTURE_BLENDMODE.to_selection(rawdata.mTextureBlendMode)
|
||||||
props.texture_min_mode = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mTextureMinMode)
|
props.texture_min_mode = _g_Helper_VXTEXTURE_FILTERMODE.to_selection(rawdata.mTextureMinMode)
|
||||||
props.texture_mag_mode = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mTextureMagMode)
|
props.texture_mag_mode = _g_Helper_VXTEXTURE_FILTERMODE.to_selection(rawdata.mTextureMagMode)
|
||||||
props.texture_address_mode = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mTextureAddressMode)
|
props.texture_address_mode = _g_Helper_VXTEXTURE_ADDRESSMODE.to_selection(rawdata.mTextureAddressMode)
|
||||||
|
|
||||||
props.source_blend = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mSourceBlend)
|
props.source_blend = _g_Helper_VXBLEND_MODE.to_selection(rawdata.mSourceBlend)
|
||||||
props.dest_blend = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mDestBlend)
|
props.dest_blend = _g_Helper_VXBLEND_MODE.to_selection(rawdata.mDestBlend)
|
||||||
props.fill_mode = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mFillMode)
|
props.fill_mode = _g_Helper_VXFILL_MODE.to_selection(rawdata.mFillMode)
|
||||||
props.shade_mode = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mShadeMode)
|
props.shade_mode = _g_Helper_VXSHADE_MODE.to_selection(rawdata.mShadeMode)
|
||||||
|
|
||||||
props.enable_alpha_test = rawdata.mEnableAlphaTest
|
props.enable_alpha_test = rawdata.mEnableAlphaTest
|
||||||
props.enable_alpha_blend = rawdata.mEnableAlphaBlend
|
props.enable_alpha_blend = rawdata.mEnableAlphaBlend
|
||||||
@ -381,8 +363,8 @@ def set_raw_virtools_material(mtl: bpy.types.Material, rawdata: RawVirtoolsMater
|
|||||||
props.enable_two_sided = rawdata.mEnableTwoSided
|
props.enable_two_sided = rawdata.mEnableTwoSided
|
||||||
|
|
||||||
props.alpha_ref = rawdata.mAlphaRef
|
props.alpha_ref = rawdata.mAlphaRef
|
||||||
props.alpha_func = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mAlphaFunc)
|
props.alpha_func = _g_Helper_VXCMPFUNC.to_selection(rawdata.mAlphaFunc)
|
||||||
props.z_func = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mZFunc)
|
props.z_func = _g_Helper_VXCMPFUNC.to_selection(rawdata.mZFunc)
|
||||||
|
|
||||||
def apply_to_blender_material(mtl: bpy.types.Material):
|
def apply_to_blender_material(mtl: bpy.types.Material):
|
||||||
# get raw material data
|
# get raw material data
|
||||||
@ -536,37 +518,13 @@ def preset_virtools_material(mtl: bpy.types.Material, preset_type: MaterialPrese
|
|||||||
preset_data: MaterialPresetData = _g_MaterialPresets[preset_type]
|
preset_data: MaterialPresetData = _g_MaterialPresets[preset_type]
|
||||||
set_raw_virtools_material(mtl, preset_data.mData)
|
set_raw_virtools_material(mtl, preset_data.mData)
|
||||||
|
|
||||||
class _MtlPresetEnumPropHelper():
|
# create preset enum blender helper
|
||||||
"""
|
_g_Helper_MtlPreset: UTIL_functions.EnumPropHelper = UTIL_functions.EnumPropHelper(
|
||||||
Operate like UTIL_virtools_types.EnumPropHelper
|
MaterialPresetType,
|
||||||
"""
|
lambda x: x.name,
|
||||||
|
lambda _: '',
|
||||||
@staticmethod
|
lambda _: ''
|
||||||
def __get_name(v: MaterialPresetType) -> str:
|
)
|
||||||
entry: MaterialPresetData | None = _g_MaterialPresets.get(v, None)
|
|
||||||
if entry: return entry.mDisplayName
|
|
||||||
else: return ""
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def generate_items() -> tuple[tuple, ...]:
|
|
||||||
# token, display name, descriptions, icon, index
|
|
||||||
return tuple(
|
|
||||||
(
|
|
||||||
str(member.value),
|
|
||||||
_MtlPresetEnumPropHelper.__get_name(member),
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
member.value
|
|
||||||
) for member in MaterialPresetType
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_selection(prop: str) -> MaterialPresetType:
|
|
||||||
return MaterialPresetType(int(prop))
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def to_selection(val: MaterialPresetType) -> str:
|
|
||||||
return str(val.value)
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -596,7 +554,7 @@ class BBP_OT_preset_virtools_material(bpy.types.Operator):
|
|||||||
preset_type: bpy.props.EnumProperty(
|
preset_type: bpy.props.EnumProperty(
|
||||||
name = "Preset",
|
name = "Preset",
|
||||||
description = "The preset which you want to apply.",
|
description = "The preset which you want to apply.",
|
||||||
items = _MtlPresetEnumPropHelper.generate_items(),
|
items = _g_Helper_MtlPreset.generate_items(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -613,7 +571,7 @@ class BBP_OT_preset_virtools_material(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
# get essential value
|
# get essential value
|
||||||
mtl: bpy.types.Material = context.material
|
mtl: bpy.types.Material = context.material
|
||||||
expected_preset: MaterialPresetType = _MtlPresetEnumPropHelper.get_selection(self.preset_type)
|
expected_preset: MaterialPresetType = _g_Helper_MtlPreset.get_selection(self.preset_type)
|
||||||
|
|
||||||
# apply preset to material
|
# apply preset to material
|
||||||
preset_virtools_material(mtl, expected_preset)
|
preset_virtools_material(mtl, expected_preset)
|
||||||
|
@ -14,17 +14,17 @@ class RawVirtoolsMesh():
|
|||||||
# assign default value for each component
|
# assign default value for each component
|
||||||
self.mLitMode = kwargs.get('mLitMode', RawVirtoolsMesh.cDefaultLitMode)
|
self.mLitMode = kwargs.get('mLitMode', RawVirtoolsMesh.cDefaultLitMode)
|
||||||
|
|
||||||
|
# blender enum prop helper defines
|
||||||
|
_g_Helper_VXMESH_LITMODE: UTIL_virtools_types.EnumPropHelper = UTIL_virtools_types.EnumPropHelper(UTIL_virtools_types.VXMESH_LITMODE)
|
||||||
|
|
||||||
# Blender Property Group
|
# Blender Property Group
|
||||||
|
|
||||||
class BBP_PG_virtools_mesh(bpy.types.PropertyGroup):
|
class BBP_PG_virtools_mesh(bpy.types.PropertyGroup):
|
||||||
lit_mode: bpy.props.EnumProperty(
|
lit_mode: bpy.props.EnumProperty(
|
||||||
name = "Lit Mode",
|
name = "Lit Mode",
|
||||||
description = "Lighting mode of the mesh.",
|
description = "Lighting mode of the mesh.",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_VXMESH_LITMODE.generate_items(),
|
||||||
UTIL_virtools_types.VXMESH_LITMODE,
|
default = _g_Helper_VXMESH_LITMODE.to_selection(RawVirtoolsMesh.cDefaultLitMode)
|
||||||
UTIL_virtools_types.g_Annotation_VXMESH_LITMODE
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsMesh.cDefaultLitMode)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Getter Setter
|
# Getter Setter
|
||||||
@ -36,14 +36,14 @@ def get_raw_virtools_mesh(mesh: bpy.types.Mesh) -> RawVirtoolsMesh:
|
|||||||
props: BBP_PG_virtools_mesh = get_virtools_mesh(mesh)
|
props: BBP_PG_virtools_mesh = get_virtools_mesh(mesh)
|
||||||
rawdata: RawVirtoolsMesh = RawVirtoolsMesh()
|
rawdata: RawVirtoolsMesh = RawVirtoolsMesh()
|
||||||
|
|
||||||
rawdata.mLitMode = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.VXMESH_LITMODE, props.lit_mode)
|
rawdata.mLitMode = _g_Helper_VXMESH_LITMODE.get_selection(props.lit_mode)
|
||||||
|
|
||||||
return rawdata
|
return rawdata
|
||||||
|
|
||||||
def set_raw_virtools_mesh(mesh: bpy.types.Mesh, rawdata: RawVirtoolsMesh) -> None:
|
def set_raw_virtools_mesh(mesh: bpy.types.Mesh, rawdata: RawVirtoolsMesh) -> None:
|
||||||
props: BBP_PG_virtools_mesh = get_virtools_mesh(mesh)
|
props: BBP_PG_virtools_mesh = get_virtools_mesh(mesh)
|
||||||
|
|
||||||
props.lit_mode = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mLitMode)
|
props.lit_mode = _g_Helper_VXMESH_LITMODE.to_selection(rawdata.mLitMode)
|
||||||
|
|
||||||
# Display Panel
|
# Display Panel
|
||||||
|
|
||||||
|
@ -19,26 +19,24 @@ class RawVirtoolsTexture():
|
|||||||
self.mSaveOptions = kwargs.get('mSaveOptions', RawVirtoolsTexture.cDefaultSaveOptions)
|
self.mSaveOptions = kwargs.get('mSaveOptions', RawVirtoolsTexture.cDefaultSaveOptions)
|
||||||
self.mVideoFormat = kwargs.get('mVideoFormat', RawVirtoolsTexture.cDefaultVideoFormat)
|
self.mVideoFormat = kwargs.get('mVideoFormat', RawVirtoolsTexture.cDefaultVideoFormat)
|
||||||
|
|
||||||
|
# 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_VX_PIXELFORMAT: UTIL_virtools_types.EnumPropHelper = 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):
|
||||||
|
|
||||||
save_options: bpy.props.EnumProperty(
|
save_options: bpy.props.EnumProperty(
|
||||||
name = "Save Options",
|
name = "Save Options",
|
||||||
description = "When saving a composition textures or sprites can be kept as reference to external files or converted to a given format and saved inside the composition file.",
|
description = "When saving a composition textures or sprites can be kept as reference to external files or converted to a given format and saved inside the composition file.",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_CK_TEXTURE_SAVEOPTIONS.generate_items(),
|
||||||
UTIL_virtools_types.CK_TEXTURE_SAVEOPTIONS,
|
default = _g_Helper_CK_TEXTURE_SAVEOPTIONS.to_selection(RawVirtoolsTexture.cDefaultSaveOptions)
|
||||||
UTIL_virtools_types.g_Annotation_CK_TEXTURE_SAVEOPTIONS
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsTexture.cDefaultSaveOptions)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
video_format: bpy.props.EnumProperty(
|
video_format: bpy.props.EnumProperty(
|
||||||
name = "Video Format",
|
name = "Video Format",
|
||||||
description = "The desired surface pixel format in video memory.",
|
description = "The desired surface pixel format in video memory.",
|
||||||
items = UTIL_virtools_types.EnumPropHelper.generate_items(
|
items = _g_Helper_VX_PIXELFORMAT.generate_items(),
|
||||||
UTIL_virtools_types.VX_PIXELFORMAT,
|
default = _g_Helper_VX_PIXELFORMAT.to_selection(RawVirtoolsTexture.cDefaultVideoFormat)
|
||||||
UTIL_virtools_types.g_Annotation_VX_PIXELFORMAT
|
|
||||||
),
|
|
||||||
default = UTIL_virtools_types.EnumPropHelper.to_selection(RawVirtoolsTexture.cDefaultVideoFormat)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#region Virtools Texture Getter Setter
|
#region Virtools Texture Getter Setter
|
||||||
@ -50,15 +48,15 @@ def get_raw_virtools_texture(img: bpy.types.Image) -> RawVirtoolsTexture:
|
|||||||
props: BBP_PG_virtools_texture = get_virtools_texture(img)
|
props: BBP_PG_virtools_texture = get_virtools_texture(img)
|
||||||
rawdata: RawVirtoolsTexture = RawVirtoolsTexture()
|
rawdata: RawVirtoolsTexture = RawVirtoolsTexture()
|
||||||
|
|
||||||
rawdata.mSaveOptions = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.CK_TEXTURE_SAVEOPTIONS, props.save_options)
|
rawdata.mSaveOptions = _g_Helper_CK_TEXTURE_SAVEOPTIONS.get_selection(props.save_options)
|
||||||
rawdata.mVideoFormat = UTIL_virtools_types.EnumPropHelper.get_selection(UTIL_virtools_types.VX_PIXELFORMAT, props.video_format)
|
rawdata.mVideoFormat = _g_Helper_VX_PIXELFORMAT.get_selection(props.video_format)
|
||||||
return rawdata
|
return rawdata
|
||||||
|
|
||||||
def set_raw_virtools_texture(img: bpy.types.Image, rawdata: RawVirtoolsTexture) -> None:
|
def set_raw_virtools_texture(img: bpy.types.Image, rawdata: RawVirtoolsTexture) -> None:
|
||||||
props: BBP_PG_virtools_texture = get_virtools_texture(img)
|
props: BBP_PG_virtools_texture = get_virtools_texture(img)
|
||||||
|
|
||||||
props.save_options = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mSaveOptions)
|
props.save_options = _g_Helper_CK_TEXTURE_SAVEOPTIONS.to_selection(rawdata.mSaveOptions)
|
||||||
props.video_format = UTIL_virtools_types.EnumPropHelper.to_selection(rawdata.mVideoFormat)
|
props.video_format = _g_Helper_VX_PIXELFORMAT.to_selection(rawdata.mVideoFormat)
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ class VX_PIXELFORMAT(enum.IntEnum):
|
|||||||
"""!
|
"""!
|
||||||
Pixel format types.
|
Pixel format types.
|
||||||
"""
|
"""
|
||||||
UNKNOWN_PF = 0 ##< Unknown pixel format
|
#UNKNOWN_PF = 0 ##< Unknown pixel format
|
||||||
_32_ARGB8888 = 1 ##< 32-bit ARGB pixel format with alpha
|
_32_ARGB8888 = 1 ##< 32-bit ARGB pixel format with alpha
|
||||||
_32_RGB888 = 2 ##< 32-bit RGB pixel format without alpha
|
_32_RGB888 = 2 ##< 32-bit RGB pixel format without alpha
|
||||||
_24_RGB888 = 3 ##< 24-bit RGB pixel format
|
_24_RGB888 = 3 ##< 24-bit RGB pixel format
|
||||||
|
@ -67,3 +67,94 @@ def add_into_scene_and_move_to_cursor(obj: bpy.types.Object):
|
|||||||
collection.objects.link(obj)
|
collection.objects.link(obj)
|
||||||
|
|
||||||
move_to_cursor(obj)
|
move_to_cursor(obj)
|
||||||
|
|
||||||
|
class EnumPropHelper():
|
||||||
|
"""
|
||||||
|
These class contain all functions related to EnumProperty creation for Python Enums
|
||||||
|
"""
|
||||||
|
|
||||||
|
# define some type hint
|
||||||
|
|
||||||
|
_TEnumVar = typing.TypeVar('_TEnumVar', bound = enum.Enum) ##< Mean a variable of enum.Enum's children
|
||||||
|
_TEnum = type[_TEnumVar] ##< Mean the type self which is enum.Enum's children.
|
||||||
|
_TFctName = typing.Callable[[_TEnumVar], str]
|
||||||
|
_TFctDesc = typing.Callable[[_TEnumVar], str]
|
||||||
|
_TFctIcon = typing.Callable[[_TEnumVar], str | int]
|
||||||
|
|
||||||
|
# define class member
|
||||||
|
|
||||||
|
__mTy: _TEnum
|
||||||
|
__mIsIntEnum: bool
|
||||||
|
__mFctName: _TFctName
|
||||||
|
__mFctDesc: _TFctDesc
|
||||||
|
__mFctIcon: _TFctIcon
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
ty: _TEnum,
|
||||||
|
fct_name: _TFctName,
|
||||||
|
fct_desc: _TFctDesc,
|
||||||
|
fct_icon: _TFctIcon):
|
||||||
|
# check type
|
||||||
|
if not issubclass(ty, enum.Enum):
|
||||||
|
raise BBPException('invalid type for EnumPropHelper')
|
||||||
|
# assign member
|
||||||
|
self.__mTy = ty
|
||||||
|
self.__mIsIntEnum = issubclass(ty, enum.IntEnum)
|
||||||
|
self.__mFctName = fct_name
|
||||||
|
self.__mFctDesc = fct_desc
|
||||||
|
self.__mFctIcon = fct_icon
|
||||||
|
|
||||||
|
def generate_items(self) -> tuple[tuple[str, str, str, int | str, int], ...]:
|
||||||
|
"""
|
||||||
|
Generate a tuple which can be applied to Blender EnumProperty's "items".
|
||||||
|
"""
|
||||||
|
# blender enum prop item format:
|
||||||
|
# (token, display name, descriptions, icon, index)
|
||||||
|
if self.__mIsIntEnum:
|
||||||
|
# for intenum, we can use its value as index number directly.
|
||||||
|
# and use the string format of index as blender prop token.
|
||||||
|
return tuple(
|
||||||
|
(
|
||||||
|
str(member.value),
|
||||||
|
self.__mFctName(member),
|
||||||
|
self.__mFctDesc(member),
|
||||||
|
self.__mFctIcon(member),
|
||||||
|
member.value
|
||||||
|
) for member in self.__mTy
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# for non-intenum, we need create number index manually for it.
|
||||||
|
# and directly use its value as blender prop token
|
||||||
|
return tuple(
|
||||||
|
(
|
||||||
|
member.value,
|
||||||
|
self.__mFctName(member),
|
||||||
|
self.__mFctDesc(member),
|
||||||
|
self.__mFctIcon(member),
|
||||||
|
idx
|
||||||
|
) for idx, member in enumerate(self.__mTy)
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_selection(self, prop: str) -> _TEnumVar:
|
||||||
|
"""
|
||||||
|
Return Python enum value from given Blender EnumProp.
|
||||||
|
"""
|
||||||
|
# for intenum, param is its string format, we need use int() to convert it first
|
||||||
|
# for non-intenum, param is just its value, we use it directly
|
||||||
|
# then we parse it to python enum type
|
||||||
|
if self.__mIsIntEnum:
|
||||||
|
return self.__mTy(int(prop))
|
||||||
|
else:
|
||||||
|
return self.__mTy(prop)
|
||||||
|
|
||||||
|
def to_selection(self, val: _TEnumVar) -> str:
|
||||||
|
"""
|
||||||
|
Parse Python enum value to Blender EnumProp acceptable string.
|
||||||
|
"""
|
||||||
|
# the inversed operation of get_selection().
|
||||||
|
if self.__mIsIntEnum:
|
||||||
|
return str(val.value)
|
||||||
|
else:
|
||||||
|
return val.value
|
||||||
|
|
||||||
|
@ -187,43 +187,43 @@ class BallanceObjectInfo():
|
|||||||
#region Naming Convention Declaration
|
#region Naming Convention Declaration
|
||||||
|
|
||||||
_g_BlcNormalComponents: set[str] = set((
|
_g_BlcNormalComponents: set[str] = set((
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Extra_Life.value,
|
"P_Extra_Life",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Extra_Point.value,
|
"P_Extra_Point",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Trafo_Paper.value,
|
"P_Trafo_Paper",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Trafo_Stone.value,
|
"P_Trafo_Stone",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Trafo_Wood.value,
|
"P_Trafo_Wood",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Ball_Paper.value,
|
"P_Ball_Paper",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Ball_Stone.value,
|
"P_Ball_Stone",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Ball_Wood.value,
|
"P_Ball_Wood",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Box.value,
|
"P_Box",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Dome.value,
|
"P_Dome",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_01.value,
|
"P_Modul_01",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_03.value,
|
"P_Modul_03",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_08.value,
|
"P_Modul_08",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_17.value,
|
"P_Modul_17",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_18.value,
|
"P_Modul_18",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_19.value,
|
"P_Modul_19",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_25.value,
|
"P_Modul_25",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_26.value,
|
"P_Modul_26",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_29.value,
|
"P_Modul_29",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_30.value,
|
"P_Modul_30",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_34.value,
|
"P_Modul_34",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_37.value,
|
"P_Modul_37",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.P_Modul_41.value,
|
"P_Modul_41"
|
||||||
))
|
))
|
||||||
_g_BlcUniqueComponents: set[str] = set((
|
_g_BlcUniqueComponents: set[str] = set((
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.PS_Levelstart.value,
|
"PS_Levelstart",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.PE_Levelende.value,
|
"PE_Levelende",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.PC_Checkpoints.value,
|
"PC_Checkpoints",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.PR_Resetpoints.value,
|
"PR_Resetpoints"
|
||||||
))
|
))
|
||||||
_g_BlcFloor: set[str] = set((
|
_g_BlcFloor: set[str] = set((
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.Sound_HitID_01.value,
|
"Sound_HitID_01",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.Sound_RollID_01.value,
|
"Sound_RollID_01"
|
||||||
))
|
))
|
||||||
_g_BlcWood: set[str] = set((
|
_g_BlcWood: set[str] = set((
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.Sound_HitID_02.value,
|
"Sound_HitID_02",
|
||||||
PROP_virtools_group.VirtoolsGroupsPreset.Sound_RollID_02.value,
|
"Sound_RollID_02"
|
||||||
))
|
))
|
||||||
|
|
||||||
class VirtoolsGroupConvention():
|
class VirtoolsGroupConvention():
|
||||||
@ -277,11 +277,11 @@ class VirtoolsGroupConvention():
|
|||||||
if len(inter_gps) == 1:
|
if len(inter_gps) == 1:
|
||||||
# get it
|
# get it
|
||||||
match((tuple(inter_gps))[0]):
|
match((tuple(inter_gps))[0]):
|
||||||
case PROP_virtools_group.VirtoolsGroupsPreset.PS_Levelstart.value:
|
case 'PS_Levelstart':
|
||||||
return BallanceObjectInfo.create_from_others(BallanceObjectType.LEVEL_START)
|
return BallanceObjectInfo.create_from_others(BallanceObjectType.LEVEL_START)
|
||||||
case PROP_virtools_group.VirtoolsGroupsPreset.PE_Levelende.value:
|
case 'PE_Levelende':
|
||||||
return BallanceObjectInfo.create_from_others(BallanceObjectType.LEVEL_END)
|
return BallanceObjectInfo.create_from_others(BallanceObjectType.LEVEL_END)
|
||||||
case PROP_virtools_group.VirtoolsGroupsPreset.PC_Checkpoints.value | PROP_virtools_group.VirtoolsGroupsPreset.PR_Resetpoints.value:
|
case 'PC_Checkpoints' | 'PR_Resetpoints':
|
||||||
# these type's data should be gotten from its name
|
# these type's data should be gotten from its name
|
||||||
return VirtoolsGroupConvention.__get_pcpr_from_name(obj.name, reporter)
|
return VirtoolsGroupConvention.__get_pcpr_from_name(obj.name, reporter)
|
||||||
case _:
|
case _:
|
||||||
@ -312,10 +312,10 @@ class VirtoolsGroupConvention():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
# distinguish road
|
# distinguish road
|
||||||
if gp.contain_group(PROP_virtools_group.VirtoolsGroupsPreset.Phys_FloorRails.value):
|
if gp.contain_group('Phys_FloorRails'):
|
||||||
# rail
|
# rail
|
||||||
return BallanceObjectInfo.create_from_others(BallanceObjectType.RAIL)
|
return BallanceObjectInfo.create_from_others(BallanceObjectType.RAIL)
|
||||||
elif gp.contain_group(PROP_virtools_group.VirtoolsGroupsPreset.Phys_Floors.value):
|
elif gp.contain_group('Phys_Floors'):
|
||||||
# distinguish it between Floor and Wood
|
# distinguish it between Floor and Wood
|
||||||
floor_result = gp.intersect_groups(_g_BlcFloor)
|
floor_result = gp.intersect_groups(_g_BlcFloor)
|
||||||
rail_result = gp.intersect_groups(_g_BlcWood)
|
rail_result = gp.intersect_groups(_g_BlcWood)
|
||||||
@ -326,9 +326,9 @@ class VirtoolsGroupConvention():
|
|||||||
else:
|
else:
|
||||||
if reporter: reporter.add_warning("Can't distinguish object between Floors and Rails. Suppose it is Floors.")
|
if reporter: reporter.add_warning("Can't distinguish object between Floors and Rails. Suppose it is Floors.")
|
||||||
return BallanceObjectInfo.create_from_others(BallanceObjectType.FLOOR)
|
return BallanceObjectInfo.create_from_others(BallanceObjectType.FLOOR)
|
||||||
elif gp.contain_group(PROP_virtools_group.VirtoolsGroupsPreset.Phys_FloorStopper.value):
|
elif gp.contain_group('Phys_FloorStopper'):
|
||||||
return BallanceObjectInfo.create_from_others(BallanceObjectType.STOPPER)
|
return BallanceObjectInfo.create_from_others(BallanceObjectType.STOPPER)
|
||||||
elif gp.contain_group(PROP_virtools_group.VirtoolsGroupsPreset.DepthTestCubes.value):
|
elif gp.contain_group('DepthTestCubes'):
|
||||||
return BallanceObjectInfo.create_from_others(BallanceObjectType.DEPTH_CUBE)
|
return BallanceObjectInfo.create_from_others(BallanceObjectType.DEPTH_CUBE)
|
||||||
|
|
||||||
# no matched
|
# no matched
|
||||||
@ -345,31 +345,31 @@ class VirtoolsGroupConvention():
|
|||||||
case BallanceObjectType.SKYLAYER: pass # sky layer do not need group
|
case BallanceObjectType.SKYLAYER: pass # sky layer do not need group
|
||||||
|
|
||||||
case BallanceObjectType.LEVEL_START:
|
case BallanceObjectType.LEVEL_START:
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.PS_Levelstart.value)
|
gp.add_group('PS_Levelstart')
|
||||||
case BallanceObjectType.LEVEL_END:
|
case BallanceObjectType.LEVEL_END:
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.PE_Levelende.value)
|
gp.add_group('PE_Levelende')
|
||||||
case BallanceObjectType.CHECKPOINT:
|
case BallanceObjectType.CHECKPOINT:
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.PC_Checkpoints.value)
|
gp.add_group('PC_Checkpoints')
|
||||||
case BallanceObjectType.RESETPOINT:
|
case BallanceObjectType.RESETPOINT:
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.PR_Resetpoints.value)
|
gp.add_group('PR_Resetpoints')
|
||||||
|
|
||||||
case BallanceObjectType.DEPTH_CUBE:
|
case BallanceObjectType.DEPTH_CUBE:
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.PE_Levelende.value)
|
gp.add_group('PE_Levelende')
|
||||||
|
|
||||||
case BallanceObjectType.FLOOR:
|
case BallanceObjectType.FLOOR:
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.Phys_Floors.value)
|
gp.add_group('Phys_Floors')
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.Sound_HitID_01.value)
|
gp.add_group('Sound_HitID_01')
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.Sound_RollID_01.value)
|
gp.add_group('Sound_RollID_01')
|
||||||
case BallanceObjectType.RAIL:
|
case BallanceObjectType.RAIL:
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.Phys_FloorRails.value)
|
gp.add_group('Phys_FloorRails')
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.Sound_HitID_02.value)
|
gp.add_group('Sound_HitID_02')
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.Sound_RollID_02.value)
|
gp.add_group('Sound_RollID_02')
|
||||||
case BallanceObjectType.WOOD:
|
case BallanceObjectType.WOOD:
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.Phys_Floors.value)
|
gp.add_group('Phys_Floors')
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.Sound_HitID_03.value)
|
gp.add_group('Sound_HitID_03')
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.Sound_RollID_03.value)
|
gp.add_group('Sound_RollID_03')
|
||||||
case BallanceObjectType.STOPPER:
|
case BallanceObjectType.STOPPER:
|
||||||
gp.add_group(PROP_virtools_group.VirtoolsGroupsPreset.Phys_FloorStopper.value)
|
gp.add_group('Phys_FloorStopper')
|
||||||
|
|
||||||
case BallanceObjectType.COMPONENT:
|
case BallanceObjectType.COMPONENT:
|
||||||
# group into component type
|
# group into component type
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import mathutils
|
import mathutils
|
||||||
import typing, sys
|
import typing, sys
|
||||||
|
from . import UTIL_functions
|
||||||
|
|
||||||
# extract all declarations in PyBMap
|
# extract all declarations in PyBMap
|
||||||
from .PyBMap.virtools_types import *
|
from .PyBMap.virtools_types import *
|
||||||
@ -84,168 +85,133 @@ class EnumAnnotation():
|
|||||||
self.mDisplayName = display_name
|
self.mDisplayName = display_name
|
||||||
self.mDescription = description
|
self.mDescription = description
|
||||||
|
|
||||||
class EnumPropHelper():
|
_g_Annotation: dict[type, dict[int, EnumAnnotation]] = {
|
||||||
|
VXTEXTURE_BLENDMODE: {
|
||||||
|
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_DECAL.value: EnumAnnotation("Decal", "Texture replace any material information "),
|
||||||
|
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_MODULATE.value: EnumAnnotation("Modulate", "Texture and material are combine. Alpha information of the texture replace material alpha component. "),
|
||||||
|
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_DECALALPHA.value: EnumAnnotation("Decal Alpha", "Alpha information in the texture specify how material and texture are combined. Alpha information of the texture replace material alpha component. "),
|
||||||
|
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_MODULATEALPHA.value: EnumAnnotation("Modulate Alpha", "Alpha information in the texture specify how material and texture are combined "),
|
||||||
|
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_DECALMASK.value: EnumAnnotation("Decal Mask", ""),
|
||||||
|
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_MODULATEMASK.value: EnumAnnotation("Modulate Mask", ""),
|
||||||
|
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_COPY.value: EnumAnnotation("Copy", "Equivalent to DECAL "),
|
||||||
|
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_ADD.value: EnumAnnotation("Add", ""),
|
||||||
|
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_DOTPRODUCT3.value: EnumAnnotation("Dot Product 3", "Perform a Dot Product 3 between texture (normal map) and a referential vector given in VXRENDERSTATE_TEXTUREFACTOR. "),
|
||||||
|
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_MAX.value: EnumAnnotation("Max", ""),
|
||||||
|
},
|
||||||
|
VXTEXTURE_FILTERMODE: {
|
||||||
|
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_NEAREST.value: EnumAnnotation("Nearest", "No Filter "),
|
||||||
|
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_LINEAR.value: EnumAnnotation("Linear", "Bilinear Interpolation "),
|
||||||
|
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_MIPNEAREST.value: EnumAnnotation("Mip Nearest", "Mip mapping "),
|
||||||
|
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_MIPLINEAR.value: EnumAnnotation("Mip Linear", "Mip Mapping with Bilinear interpolation "),
|
||||||
|
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_LINEARMIPNEAREST.value: EnumAnnotation("Linear Mip Nearest", "Mip Mapping with Bilinear interpolation between mipmap levels. "),
|
||||||
|
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_LINEARMIPLINEAR.value: EnumAnnotation("Linear Mip Linear", "Trilinear Filtering "),
|
||||||
|
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_ANISOTROPIC.value: EnumAnnotation("Anisotropic", "Anisotropic filtering "),
|
||||||
|
},
|
||||||
|
VXBLEND_MODE: {
|
||||||
|
VXBLEND_MODE.VXBLEND_ZERO.value: EnumAnnotation("Zero", "Blend factor is (0, 0, 0, 0). "),
|
||||||
|
VXBLEND_MODE.VXBLEND_ONE.value: EnumAnnotation("One", "Blend factor is (1, 1, 1, 1). "),
|
||||||
|
VXBLEND_MODE.VXBLEND_SRCCOLOR.value: EnumAnnotation("Src Color", "Blend factor is (Rs, Gs, Bs, As). "),
|
||||||
|
VXBLEND_MODE.VXBLEND_INVSRCCOLOR.value: EnumAnnotation("Inv Src Color", "Blend factor is (1-Rs, 1-Gs, 1-Bs, 1-As). "),
|
||||||
|
VXBLEND_MODE.VXBLEND_SRCALPHA.value: EnumAnnotation("Src Alpha", "Blend factor is (As, As, As, As). "),
|
||||||
|
VXBLEND_MODE.VXBLEND_INVSRCALPHA.value: EnumAnnotation("Inv Src Alpha", "Blend factor is (1-As, 1-As, 1-As, 1-As). "),
|
||||||
|
VXBLEND_MODE.VXBLEND_DESTALPHA.value: EnumAnnotation("Dest Alpha", "Blend factor is (Ad, Ad, Ad, Ad). "),
|
||||||
|
VXBLEND_MODE.VXBLEND_INVDESTALPHA.value: EnumAnnotation("Inv Dest Alpha", "Blend factor is (1-Ad, 1-Ad, 1-Ad, 1-Ad). "),
|
||||||
|
VXBLEND_MODE.VXBLEND_DESTCOLOR.value: EnumAnnotation("Dest Color", "Blend factor is (Rd, Gd, Bd, Ad). "),
|
||||||
|
VXBLEND_MODE.VXBLEND_INVDESTCOLOR.value: EnumAnnotation("Inv Dest Color", "Blend factor is (1-Rd, 1-Gd, 1-Bd, 1-Ad). "),
|
||||||
|
VXBLEND_MODE.VXBLEND_SRCALPHASAT.value: EnumAnnotation("Src Alpha Sat", "Blend factor is (f, f, f, 1); f = min(As, 1-Ad). "),
|
||||||
|
#VXBLEND_MODE.VXBLEND_BOTHSRCALPHA.value: EnumAnnotation("Both Src Alpha", "Source blend factor is (As, As, As, As) and destination blend factor is (1-As, 1-As, 1-As, 1-As) "),
|
||||||
|
#VXBLEND_MODE.VXBLEND_BOTHINVSRCALPHA.value: EnumAnnotation("Both Inv Src Alpha", "Source blend factor is (1-As, 1-As, 1-As, 1-As) and destination blend factor is (As, As, As, As) "),
|
||||||
|
},
|
||||||
|
VXTEXTURE_ADDRESSMODE: {
|
||||||
|
VXTEXTURE_ADDRESSMODE.VXTEXTURE_ADDRESSWRAP.value: EnumAnnotation("Wrap", "Default mesh wrap mode is used (see CKMesh::SetWrapMode) "),
|
||||||
|
VXTEXTURE_ADDRESSMODE.VXTEXTURE_ADDRESSMIRROR.value: EnumAnnotation("Mirror", "Texture coordinates outside the range [0..1] are flipped evenly. "),
|
||||||
|
VXTEXTURE_ADDRESSMODE.VXTEXTURE_ADDRESSCLAMP.value: EnumAnnotation("Clamp", "Texture coordinates greater than 1.0 are set to 1.0, and values less than 0.0 are set to 0.0. "),
|
||||||
|
VXTEXTURE_ADDRESSMODE.VXTEXTURE_ADDRESSBORDER.value: EnumAnnotation("Border", "When texture coordinates are greater than 1.0 or less than 0.0 texture is set to a color defined in CKMaterial::SetTextureBorderColor. "),
|
||||||
|
VXTEXTURE_ADDRESSMODE.VXTEXTURE_ADDRESSMIRRORONCE.value: EnumAnnotation("Mirror Once", " "),
|
||||||
|
},
|
||||||
|
VXFILL_MODE: {
|
||||||
|
VXFILL_MODE.VXFILL_POINT.value: EnumAnnotation("Point", "Vertices rendering "),
|
||||||
|
VXFILL_MODE.VXFILL_WIREFRAME.value: EnumAnnotation("Wireframe", "Edges rendering "),
|
||||||
|
VXFILL_MODE.VXFILL_SOLID.value: EnumAnnotation("Solid", "Face rendering "),
|
||||||
|
},
|
||||||
|
VXSHADE_MODE: {
|
||||||
|
VXSHADE_MODE.VXSHADE_FLAT.value: EnumAnnotation("Flat", "Flat Shading "),
|
||||||
|
VXSHADE_MODE.VXSHADE_GOURAUD.value: EnumAnnotation("Gouraud", "Gouraud Shading "),
|
||||||
|
VXSHADE_MODE.VXSHADE_PHONG.value: EnumAnnotation("Phong", "Phong Shading (Not yet supported by most implementation) "),
|
||||||
|
},
|
||||||
|
VXCMPFUNC: {
|
||||||
|
VXCMPFUNC.VXCMP_NEVER.value: EnumAnnotation("Never", "Always fail the test. "),
|
||||||
|
VXCMPFUNC.VXCMP_LESS.value: EnumAnnotation("Less", "Accept if value if less than current value. "),
|
||||||
|
VXCMPFUNC.VXCMP_EQUAL.value: EnumAnnotation("Equal", "Accept if value if equal than current value. "),
|
||||||
|
VXCMPFUNC.VXCMP_LESSEQUAL.value: EnumAnnotation("Less Equal", "Accept if value if less or equal than current value. "),
|
||||||
|
VXCMPFUNC.VXCMP_GREATER.value: EnumAnnotation("Greater", "Accept if value if greater than current value. "),
|
||||||
|
VXCMPFUNC.VXCMP_NOTEQUAL.value: EnumAnnotation("Not Equal", "Accept if value if different than current value. "),
|
||||||
|
VXCMPFUNC.VXCMP_GREATEREQUAL.value: EnumAnnotation("Greater Equal", "Accept if value if greater or equal current value. "),
|
||||||
|
VXCMPFUNC.VXCMP_ALWAYS.value: EnumAnnotation("Always", "Always accept the test. "),
|
||||||
|
},
|
||||||
|
CK_TEXTURE_SAVEOPTIONS: {
|
||||||
|
CK_TEXTURE_SAVEOPTIONS.CKTEXTURE_RAWDATA.value: EnumAnnotation("Raw Data", "Save raw data inside file. The bitmap is saved in a raw 32 bit per pixel format. "),
|
||||||
|
CK_TEXTURE_SAVEOPTIONS.CKTEXTURE_EXTERNAL.value: EnumAnnotation("External", "Store only the file name for the texture. The bitmap file must be present in the bitmap paths when loading the composition. "),
|
||||||
|
CK_TEXTURE_SAVEOPTIONS.CKTEXTURE_IMAGEFORMAT.value: EnumAnnotation("Image Format", "Save using format specified. The bitmap data will be converted to the specified format by the correspondant bitmap plugin and saved inside file. "),
|
||||||
|
CK_TEXTURE_SAVEOPTIONS.CKTEXTURE_USEGLOBAL.value: EnumAnnotation("Use Global", "Use Global settings, that is the settings given with CKContext::SetGlobalImagesSaveOptions. (Not valid when using CKContext::SetImagesSaveOptions). "),
|
||||||
|
CK_TEXTURE_SAVEOPTIONS.CKTEXTURE_INCLUDEORIGINALFILE.value: EnumAnnotation("Include Original File", "Insert original image file inside CMO file. The bitmap file that was used originally for the texture or sprite will be append to the composition file and extracted when the file is loaded. "),
|
||||||
|
},
|
||||||
|
VX_PIXELFORMAT: {
|
||||||
|
VX_PIXELFORMAT._32_ARGB8888.value: EnumAnnotation("32 Bits ARGB8888", "32-bit ARGB pixel format with alpha "),
|
||||||
|
VX_PIXELFORMAT._32_RGB888.value: EnumAnnotation("32 Bits RGB888", "32-bit RGB pixel format without alpha "),
|
||||||
|
VX_PIXELFORMAT._24_RGB888.value: EnumAnnotation("24 Bits RGB888", "24-bit RGB pixel format "),
|
||||||
|
VX_PIXELFORMAT._16_RGB565.value: EnumAnnotation("16 Bits RGB565", "16-bit RGB pixel format "),
|
||||||
|
VX_PIXELFORMAT._16_RGB555.value: EnumAnnotation("16 Bits RGB555", "16-bit RGB pixel format (5 bits per color) "),
|
||||||
|
VX_PIXELFORMAT._16_ARGB1555.value: EnumAnnotation("16 Bits ARGB1555", "16-bit ARGB pixel format (5 bits per color + 1 bit for alpha) "),
|
||||||
|
VX_PIXELFORMAT._16_ARGB4444.value: EnumAnnotation("16 Bits ARGB4444", "16-bit ARGB pixel format (4 bits per color) "),
|
||||||
|
VX_PIXELFORMAT._8_RGB332.value: EnumAnnotation("8 Bits RGB332", "8-bit RGB pixel format "),
|
||||||
|
VX_PIXELFORMAT._8_ARGB2222.value: EnumAnnotation("8 Bits ARGB2222", "8-bit ARGB pixel format "),
|
||||||
|
VX_PIXELFORMAT._32_ABGR8888.value: EnumAnnotation("32 Bits ABGR8888", "32-bit ABGR pixel format "),
|
||||||
|
VX_PIXELFORMAT._32_RGBA8888.value: EnumAnnotation("32 Bits RGBA8888", "32-bit RGBA pixel format "),
|
||||||
|
VX_PIXELFORMAT._32_BGRA8888.value: EnumAnnotation("32 Bits BGRA8888", "32-bit BGRA pixel format "),
|
||||||
|
VX_PIXELFORMAT._32_BGR888.value: EnumAnnotation("32 Bits BGR888", "32-bit BGR pixel format "),
|
||||||
|
VX_PIXELFORMAT._24_BGR888.value: EnumAnnotation("24 Bits BGR888", "24-bit BGR pixel format "),
|
||||||
|
VX_PIXELFORMAT._16_BGR565.value: EnumAnnotation("16 Bits BGR565", "16-bit BGR pixel format "),
|
||||||
|
VX_PIXELFORMAT._16_BGR555.value: EnumAnnotation("16 Bits BGR555", "16-bit BGR pixel format (5 bits per color) "),
|
||||||
|
VX_PIXELFORMAT._16_ABGR1555.value: EnumAnnotation("16 Bits ABGR1555", "16-bit ABGR pixel format (5 bits per color + 1 bit for alpha) "),
|
||||||
|
VX_PIXELFORMAT._16_ABGR4444.value: EnumAnnotation("16 Bits ABGR4444", "16-bit ABGR pixel format (4 bits per color) "),
|
||||||
|
VX_PIXELFORMAT._DXT1.value: EnumAnnotation("DXT1", "S3/DirectX Texture Compression 1 "),
|
||||||
|
VX_PIXELFORMAT._DXT2.value: EnumAnnotation("DXT2", "S3/DirectX Texture Compression 2 "),
|
||||||
|
VX_PIXELFORMAT._DXT3.value: EnumAnnotation("DXT3", "S3/DirectX Texture Compression 3 "),
|
||||||
|
VX_PIXELFORMAT._DXT4.value: EnumAnnotation("DXT4", "S3/DirectX Texture Compression 4 "),
|
||||||
|
VX_PIXELFORMAT._DXT5.value: EnumAnnotation("DXT5", "S3/DirectX Texture Compression 5 "),
|
||||||
|
VX_PIXELFORMAT._16_V8U8.value: EnumAnnotation("16 Bits V8U8", "16-bit Bump Map format format (8 bits per color) "),
|
||||||
|
VX_PIXELFORMAT._32_V16U16.value: EnumAnnotation("32 Bits V16U16", "32-bit Bump Map format format (16 bits per color) "),
|
||||||
|
VX_PIXELFORMAT._16_L6V5U5.value: EnumAnnotation("16 Bits L6V5U5", "16-bit Bump Map format format with luminance "),
|
||||||
|
VX_PIXELFORMAT._32_X8L8V8U8.value: EnumAnnotation("32 Bits X8L8V8U8", "32-bit Bump Map format format with luminance "),
|
||||||
|
VX_PIXELFORMAT._8_ABGR8888_CLUT.value: EnumAnnotation("8 Bits ABGR8888 CLUT", "8 bits indexed CLUT (ABGR) "),
|
||||||
|
VX_PIXELFORMAT._8_ARGB8888_CLUT.value: EnumAnnotation("8 Bits ARGB8888 CLUT", "8 bits indexed CLUT (ARGB) "),
|
||||||
|
VX_PIXELFORMAT._4_ABGR8888_CLUT.value: EnumAnnotation("4 Bits ABGR8888 CLUT", "4 bits indexed CLUT (ABGR) "),
|
||||||
|
VX_PIXELFORMAT._4_ARGB8888_CLUT.value: EnumAnnotation("4 Bits ARGB8888 CLUT", "4 bits indexed CLUT (ARGB) "),
|
||||||
|
},
|
||||||
|
VXMESH_LITMODE: {
|
||||||
|
VXMESH_LITMODE.VX_PRELITMESH.value: EnumAnnotation("Prelit", "Lighting use color information store with vertices "),
|
||||||
|
VXMESH_LITMODE.VX_LITMESH.value: EnumAnnotation("Lit", "Lighting is done by renderer using normals and face material information. "),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class EnumPropHelper(UTIL_functions.EnumPropHelper):
|
||||||
"""
|
"""
|
||||||
These class contain all functions related to EnumProperty creation for Virtools Enums
|
Virtools type specified Blender EnumProp helper.
|
||||||
"""
|
"""
|
||||||
|
__mAnnotationDict: dict[int, EnumAnnotation]
|
||||||
|
|
||||||
_TIntEnumChildrenVar = typing.TypeVar('_TIntEnumChildrenVar', bound = enum.IntEnum) ##< Mean a variable of IntEnum's children
|
def __init__(self, ty: UTIL_functions.EnumPropHelper._TEnum):
|
||||||
_TIntEnumChildren = type[_TIntEnumChildrenVar] ##< Mean the type self which is IntEnum's children.
|
# set self annotation ref
|
||||||
_TAnnoDict = dict[int, EnumAnnotation]
|
self.__mAnnotationDict = _g_Annotation[ty]
|
||||||
|
# init parent data
|
||||||
@staticmethod
|
UTIL_functions.EnumPropHelper.__init__(
|
||||||
def __get_name(v: _TIntEnumChildrenVar, anno: _TAnnoDict):
|
self,
|
||||||
entry: EnumAnnotation | None = anno.get(v, None)
|
ty,
|
||||||
if entry is not None: return entry.mDisplayName
|
lambda x: self.__mAnnotationDict[x.value].mDisplayName,
|
||||||
else: return v.name
|
lambda x: self.__mAnnotationDict[x.value].mDescription,
|
||||||
|
lambda _: ''
|
||||||
@staticmethod
|
|
||||||
def __get_desc(v: _TIntEnumChildrenVar, anno: _TAnnoDict):
|
|
||||||
entry: EnumAnnotation | None = anno.get(v, None)
|
|
||||||
if entry is not None: return entry.mDescription
|
|
||||||
else: return ""
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def generate_items(enum_data: _TIntEnumChildren, anno: _TAnnoDict) -> tuple[tuple, ...]:
|
|
||||||
"""
|
|
||||||
Generate a tuple which can be applied to Blender EnumProperty's "items".
|
|
||||||
"""
|
|
||||||
# token, display name, descriptions, icon, index
|
|
||||||
return tuple(
|
|
||||||
(
|
|
||||||
str(member.value),
|
|
||||||
EnumPropHelper.__get_name(member, anno),
|
|
||||||
EnumPropHelper.__get_desc(member, anno),
|
|
||||||
"",
|
|
||||||
member.value
|
|
||||||
) for member in enum_data
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_selection(enum_define: _TIntEnumChildren, prop: str) -> _TIntEnumChildrenVar:
|
|
||||||
# prop will return identifier which is defined as the string type of int value.
|
|
||||||
# so we parse it to int and then parse it to enum type.
|
|
||||||
return enum_define(int(prop))
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def to_selection(val: _TIntEnumChildrenVar) -> str:
|
|
||||||
# like get_selection, we need get it int value, then convert it to string as the indetifier of enum props
|
|
||||||
# them enum property will accept it.
|
|
||||||
return str(val.value)
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Enum Annotations
|
|
||||||
|
|
||||||
g_Annotation_VXTEXTURE_BLENDMODE: dict[int, EnumAnnotation] = {
|
|
||||||
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_DECAL.value: EnumAnnotation("Decal", "Texture replace any material information "),
|
|
||||||
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_MODULATE.value: EnumAnnotation("Modulate", "Texture and material are combine. Alpha information of the texture replace material alpha component. "),
|
|
||||||
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_DECALALPHA.value: EnumAnnotation("Decal Alpha", "Alpha information in the texture specify how material and texture are combined. Alpha information of the texture replace material alpha component. "),
|
|
||||||
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_MODULATEALPHA.value: EnumAnnotation("Modulate Alpha", "Alpha information in the texture specify how material and texture are combined "),
|
|
||||||
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_DECALMASK.value: EnumAnnotation("Decal Mask", ""),
|
|
||||||
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_MODULATEMASK.value: EnumAnnotation("Modulate Mask", ""),
|
|
||||||
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_COPY.value: EnumAnnotation("Copy", "Equivalent to DECAL "),
|
|
||||||
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_ADD.value: EnumAnnotation("Add", ""),
|
|
||||||
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_DOTPRODUCT3.value: EnumAnnotation("Dot Product 3", "Perform a Dot Product 3 between texture (normal map) and a referential vector given in VXRENDERSTATE_TEXTUREFACTOR. "),
|
|
||||||
VXTEXTURE_BLENDMODE.VXTEXTUREBLEND_MAX.value: EnumAnnotation("Max", ""),
|
|
||||||
}
|
|
||||||
g_Annotation_VXTEXTURE_FILTERMODE: dict[int, EnumAnnotation] = {
|
|
||||||
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_NEAREST.value: EnumAnnotation("Nearest", "No Filter "),
|
|
||||||
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_LINEAR.value: EnumAnnotation("Linear", "Bilinear Interpolation "),
|
|
||||||
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_MIPNEAREST.value: EnumAnnotation("Mip Nearest", "Mip mapping "),
|
|
||||||
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_MIPLINEAR.value: EnumAnnotation("Mip Linear", "Mip Mapping with Bilinear interpolation "),
|
|
||||||
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_LINEARMIPNEAREST.value: EnumAnnotation("Linear Mip Nearest", "Mip Mapping with Bilinear interpolation between mipmap levels. "),
|
|
||||||
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_LINEARMIPLINEAR.value: EnumAnnotation("Linear Mip Linear", "Trilinear Filtering "),
|
|
||||||
VXTEXTURE_FILTERMODE.VXTEXTUREFILTER_ANISOTROPIC.value: EnumAnnotation("Anisotropic", "Anisotropic filtering "),
|
|
||||||
}
|
|
||||||
g_Annotation_VXBLEND_MODE: dict[int, EnumAnnotation] = {
|
|
||||||
VXBLEND_MODE.VXBLEND_ZERO.value: EnumAnnotation("Zero", "Blend factor is (0, 0, 0, 0). "),
|
|
||||||
VXBLEND_MODE.VXBLEND_ONE.value: EnumAnnotation("One", "Blend factor is (1, 1, 1, 1). "),
|
|
||||||
VXBLEND_MODE.VXBLEND_SRCCOLOR.value: EnumAnnotation("Src Color", "Blend factor is (Rs, Gs, Bs, As). "),
|
|
||||||
VXBLEND_MODE.VXBLEND_INVSRCCOLOR.value: EnumAnnotation("Inv Src Color", "Blend factor is (1-Rs, 1-Gs, 1-Bs, 1-As). "),
|
|
||||||
VXBLEND_MODE.VXBLEND_SRCALPHA.value: EnumAnnotation("Src Alpha", "Blend factor is (As, As, As, As). "),
|
|
||||||
VXBLEND_MODE.VXBLEND_INVSRCALPHA.value: EnumAnnotation("Inv Src Alpha", "Blend factor is (1-As, 1-As, 1-As, 1-As). "),
|
|
||||||
VXBLEND_MODE.VXBLEND_DESTALPHA.value: EnumAnnotation("Dest Alpha", "Blend factor is (Ad, Ad, Ad, Ad). "),
|
|
||||||
VXBLEND_MODE.VXBLEND_INVDESTALPHA.value: EnumAnnotation("Inv Dest Alpha", "Blend factor is (1-Ad, 1-Ad, 1-Ad, 1-Ad). "),
|
|
||||||
VXBLEND_MODE.VXBLEND_DESTCOLOR.value: EnumAnnotation("Dest Color", "Blend factor is (Rd, Gd, Bd, Ad). "),
|
|
||||||
VXBLEND_MODE.VXBLEND_INVDESTCOLOR.value: EnumAnnotation("Inv Dest Color", "Blend factor is (1-Rd, 1-Gd, 1-Bd, 1-Ad). "),
|
|
||||||
VXBLEND_MODE.VXBLEND_SRCALPHASAT.value: EnumAnnotation("Src Alpha Sat", "Blend factor is (f, f, f, 1); f = min(As, 1-Ad). "),
|
|
||||||
#VXBLEND_MODE.VXBLEND_BOTHSRCALPHA.value: EnumAnnotation("Both Src Alpha", "Source blend factor is (As, As, As, As) and destination blend factor is (1-As, 1-As, 1-As, 1-As) "),
|
|
||||||
#VXBLEND_MODE.VXBLEND_BOTHINVSRCALPHA.value: EnumAnnotation("Both Inv Src Alpha", "Source blend factor is (1-As, 1-As, 1-As, 1-As) and destination blend factor is (As, As, As, As) "),
|
|
||||||
}
|
|
||||||
g_Annotation_VXTEXTURE_ADDRESSMODE: dict[int, EnumAnnotation] = {
|
|
||||||
VXTEXTURE_ADDRESSMODE.VXTEXTURE_ADDRESSWRAP.value: EnumAnnotation("Wrap", "Default mesh wrap mode is used (see CKMesh::SetWrapMode) "),
|
|
||||||
VXTEXTURE_ADDRESSMODE.VXTEXTURE_ADDRESSMIRROR.value: EnumAnnotation("Mirror", "Texture coordinates outside the range [0..1] are flipped evenly. "),
|
|
||||||
VXTEXTURE_ADDRESSMODE.VXTEXTURE_ADDRESSCLAMP.value: EnumAnnotation("Clamp", "Texture coordinates greater than 1.0 are set to 1.0, and values less than 0.0 are set to 0.0. "),
|
|
||||||
VXTEXTURE_ADDRESSMODE.VXTEXTURE_ADDRESSBORDER.value: EnumAnnotation("Border", "When texture coordinates are greater than 1.0 or less than 0.0 texture is set to a color defined in CKMaterial::SetTextureBorderColor. "),
|
|
||||||
VXTEXTURE_ADDRESSMODE.VXTEXTURE_ADDRESSMIRRORONCE.value: EnumAnnotation("Mirror Once", " "),
|
|
||||||
}
|
|
||||||
g_Annotation_VXFILL_MODE: dict[int, EnumAnnotation] = {
|
|
||||||
VXFILL_MODE.VXFILL_POINT.value: EnumAnnotation("Point", "Vertices rendering "),
|
|
||||||
VXFILL_MODE.VXFILL_WIREFRAME.value: EnumAnnotation("Wireframe", "Edges rendering "),
|
|
||||||
VXFILL_MODE.VXFILL_SOLID.value: EnumAnnotation("Solid", "Face rendering "),
|
|
||||||
}
|
|
||||||
g_Annotation_VXSHADE_MODE: dict[int, EnumAnnotation] = {
|
|
||||||
VXSHADE_MODE.VXSHADE_FLAT.value: EnumAnnotation("Flat", "Flat Shading "),
|
|
||||||
VXSHADE_MODE.VXSHADE_GOURAUD.value: EnumAnnotation("Gouraud", "Gouraud Shading "),
|
|
||||||
VXSHADE_MODE.VXSHADE_PHONG.value: EnumAnnotation("Phong", "Phong Shading (Not yet supported by most implementation) "),
|
|
||||||
}
|
|
||||||
g_Annotation_VXCMPFUNC: dict[int, EnumAnnotation] = {
|
|
||||||
VXCMPFUNC.VXCMP_NEVER.value: EnumAnnotation("Never", "Always fail the test. "),
|
|
||||||
VXCMPFUNC.VXCMP_LESS.value: EnumAnnotation("Less", "Accept if value if less than current value. "),
|
|
||||||
VXCMPFUNC.VXCMP_EQUAL.value: EnumAnnotation("Equal", "Accept if value if equal than current value. "),
|
|
||||||
VXCMPFUNC.VXCMP_LESSEQUAL.value: EnumAnnotation("Less Equal", "Accept if value if less or equal than current value. "),
|
|
||||||
VXCMPFUNC.VXCMP_GREATER.value: EnumAnnotation("Greater", "Accept if value if greater than current value. "),
|
|
||||||
VXCMPFUNC.VXCMP_NOTEQUAL.value: EnumAnnotation("Not Equal", "Accept if value if different than current value. "),
|
|
||||||
VXCMPFUNC.VXCMP_GREATEREQUAL.value: EnumAnnotation("Greater Equal", "Accept if value if greater or equal current value. "),
|
|
||||||
VXCMPFUNC.VXCMP_ALWAYS.value: EnumAnnotation("Always", "Always accept the test. "),
|
|
||||||
}
|
|
||||||
|
|
||||||
g_Annotation_CK_TEXTURE_SAVEOPTIONS: dict[int, EnumAnnotation] = {
|
|
||||||
CK_TEXTURE_SAVEOPTIONS.CKTEXTURE_RAWDATA.value: EnumAnnotation("Raw Data", "Save raw data inside file. The bitmap is saved in a raw 32 bit per pixel format. "),
|
|
||||||
CK_TEXTURE_SAVEOPTIONS.CKTEXTURE_EXTERNAL.value: EnumAnnotation("External", "Store only the file name for the texture. The bitmap file must be present in the bitmap paths when loading the composition. "),
|
|
||||||
CK_TEXTURE_SAVEOPTIONS.CKTEXTURE_IMAGEFORMAT.value: EnumAnnotation("Image Format", "Save using format specified. The bitmap data will be converted to the specified format by the correspondant bitmap plugin and saved inside file. "),
|
|
||||||
CK_TEXTURE_SAVEOPTIONS.CKTEXTURE_USEGLOBAL.value: EnumAnnotation("Use Global", "Use Global settings, that is the settings given with CKContext::SetGlobalImagesSaveOptions. (Not valid when using CKContext::SetImagesSaveOptions). "),
|
|
||||||
CK_TEXTURE_SAVEOPTIONS.CKTEXTURE_INCLUDEORIGINALFILE.value: EnumAnnotation("Include Original File", "Insert original image file inside CMO file. The bitmap file that was used originally for the texture or sprite will be append to the composition file and extracted when the file is loaded. "),
|
|
||||||
}
|
|
||||||
g_Annotation_VX_PIXELFORMAT: dict[int, EnumAnnotation] = {
|
|
||||||
VX_PIXELFORMAT._32_ARGB8888.value: EnumAnnotation("32 Bits ARGB8888", "32-bit ARGB pixel format with alpha "),
|
|
||||||
VX_PIXELFORMAT._32_RGB888.value: EnumAnnotation("32 Bits RGB888", "32-bit RGB pixel format without alpha "),
|
|
||||||
VX_PIXELFORMAT._24_RGB888.value: EnumAnnotation("24 Bits RGB888", "24-bit RGB pixel format "),
|
|
||||||
VX_PIXELFORMAT._16_RGB565.value: EnumAnnotation("16 Bits RGB565", "16-bit RGB pixel format "),
|
|
||||||
VX_PIXELFORMAT._16_RGB555.value: EnumAnnotation("16 Bits RGB555", "16-bit RGB pixel format (5 bits per color) "),
|
|
||||||
VX_PIXELFORMAT._16_ARGB1555.value: EnumAnnotation("16 Bits ARGB1555", "16-bit ARGB pixel format (5 bits per color + 1 bit for alpha) "),
|
|
||||||
VX_PIXELFORMAT._16_ARGB4444.value: EnumAnnotation("16 Bits ARGB4444", "16-bit ARGB pixel format (4 bits per color) "),
|
|
||||||
VX_PIXELFORMAT._8_RGB332.value: EnumAnnotation("8 Bits RGB332", "8-bit RGB pixel format "),
|
|
||||||
VX_PIXELFORMAT._8_ARGB2222.value: EnumAnnotation("8 Bits ARGB2222", "8-bit ARGB pixel format "),
|
|
||||||
VX_PIXELFORMAT._32_ABGR8888.value: EnumAnnotation("32 Bits ABGR8888", "32-bit ABGR pixel format "),
|
|
||||||
VX_PIXELFORMAT._32_RGBA8888.value: EnumAnnotation("32 Bits RGBA8888", "32-bit RGBA pixel format "),
|
|
||||||
VX_PIXELFORMAT._32_BGRA8888.value: EnumAnnotation("32 Bits BGRA8888", "32-bit BGRA pixel format "),
|
|
||||||
VX_PIXELFORMAT._32_BGR888.value: EnumAnnotation("32 Bits BGR888", "32-bit BGR pixel format "),
|
|
||||||
VX_PIXELFORMAT._24_BGR888.value: EnumAnnotation("24 Bits BGR888", "24-bit BGR pixel format "),
|
|
||||||
VX_PIXELFORMAT._16_BGR565.value: EnumAnnotation("16 Bits BGR565", "16-bit BGR pixel format "),
|
|
||||||
VX_PIXELFORMAT._16_BGR555.value: EnumAnnotation("16 Bits BGR555", "16-bit BGR pixel format (5 bits per color) "),
|
|
||||||
VX_PIXELFORMAT._16_ABGR1555.value: EnumAnnotation("16 Bits ABGR1555", "16-bit ABGR pixel format (5 bits per color + 1 bit for alpha) "),
|
|
||||||
VX_PIXELFORMAT._16_ABGR4444.value: EnumAnnotation("16 Bits ABGR4444", "16-bit ABGR pixel format (4 bits per color) "),
|
|
||||||
VX_PIXELFORMAT._DXT1.value: EnumAnnotation("DXT1", "S3/DirectX Texture Compression 1 "),
|
|
||||||
VX_PIXELFORMAT._DXT2.value: EnumAnnotation("DXT2", "S3/DirectX Texture Compression 2 "),
|
|
||||||
VX_PIXELFORMAT._DXT3.value: EnumAnnotation("DXT3", "S3/DirectX Texture Compression 3 "),
|
|
||||||
VX_PIXELFORMAT._DXT4.value: EnumAnnotation("DXT4", "S3/DirectX Texture Compression 4 "),
|
|
||||||
VX_PIXELFORMAT._DXT5.value: EnumAnnotation("DXT5", "S3/DirectX Texture Compression 5 "),
|
|
||||||
VX_PIXELFORMAT._16_V8U8.value: EnumAnnotation("16 Bits V8U8", "16-bit Bump Map format format (8 bits per color) "),
|
|
||||||
VX_PIXELFORMAT._32_V16U16.value: EnumAnnotation("32 Bits V16U16", "32-bit Bump Map format format (16 bits per color) "),
|
|
||||||
VX_PIXELFORMAT._16_L6V5U5.value: EnumAnnotation("16 Bits L6V5U5", "16-bit Bump Map format format with luminance "),
|
|
||||||
VX_PIXELFORMAT._32_X8L8V8U8.value: EnumAnnotation("32 Bits X8L8V8U8", "32-bit Bump Map format format with luminance "),
|
|
||||||
VX_PIXELFORMAT._8_ABGR8888_CLUT.value: EnumAnnotation("8 Bits ABGR8888 CLUT", "8 bits indexed CLUT (ABGR) "),
|
|
||||||
VX_PIXELFORMAT._8_ARGB8888_CLUT.value: EnumAnnotation("8 Bits ARGB8888 CLUT", "8 bits indexed CLUT (ARGB) "),
|
|
||||||
VX_PIXELFORMAT._4_ABGR8888_CLUT.value: EnumAnnotation("4 Bits ABGR8888 CLUT", "4 bits indexed CLUT (ABGR) "),
|
|
||||||
VX_PIXELFORMAT._4_ARGB8888_CLUT.value: EnumAnnotation("4 Bits ARGB8888 CLUT", "4 bits indexed CLUT (ARGB) "),
|
|
||||||
}
|
|
||||||
|
|
||||||
g_Annotation_VXMESH_LITMODE: dict[int, EnumAnnotation] = {
|
|
||||||
VXMESH_LITMODE.VX_PRELITMESH.value: EnumAnnotation("Prelit", "Lighting use color information store with vertices "),
|
|
||||||
VXMESH_LITMODE.VX_LITMESH.value: EnumAnnotation("Lit", "Lighting is done by renderer using normals and face material information. "),
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user