Removed defunct material path preferences (BDK addon integration now handles this for us!)

This commit is contained in:
Colin Basnett
2023-06-20 19:00:17 -07:00
parent 5cb9714597
commit 202a77d38a
2 changed files with 8 additions and 84 deletions

View File

@@ -43,38 +43,13 @@ else:
from .psa import importer as psa_importer from .psa import importer as psa_importer
import bpy import bpy
from bpy.props import CollectionProperty, PointerProperty, StringProperty, IntProperty from bpy.props import PointerProperty
from bpy.types import AddonPreferences, PropertyGroup
classes = psx_types.classes +\
class MaterialPathPropertyGroup(PropertyGroup): psk_importer.classes +\
path: StringProperty(name='Path', subtype='DIR_PATH') psk_exporter.classes +\
psa_exporter.classes +\
psa_importer.classes
class PskPsaAddonPreferences(AddonPreferences):
bl_idname = __name__
material_path_list: CollectionProperty(type=MaterialPathPropertyGroup)
material_path_index: IntProperty()
def draw_filter(self, context, layout):
pass
def draw(self, context: bpy.types.Context):
self.layout.label(text='Material Paths')
row = self.layout.row()
row.template_list('PSX_UL_MaterialPathList', '', self, 'material_path_list', self, 'material_path_index')
column = row.column()
column.operator(psx_types.PSX_OT_MaterialPathAdd.bl_idname, icon='ADD', text='')
column.operator(psx_types.PSX_OT_MaterialPathRemove.bl_idname, icon='REMOVE', text='')
classes = ((MaterialPathPropertyGroup, PskPsaAddonPreferences) +
psx_types.classes +
psk_importer.classes +
psk_exporter.classes +
psa_exporter.classes +
psa_importer.classes)
def psk_export_menu_func(self, context): def psk_export_menu_func(self, context):

View File

@@ -1,6 +1,5 @@
import bpy.props
from bpy.props import StringProperty, IntProperty, BoolProperty, FloatProperty from bpy.props import StringProperty, IntProperty, BoolProperty, FloatProperty
from bpy.types import PropertyGroup, UIList, UILayout, Context, AnyType, Operator, Panel from bpy.types import PropertyGroup, UIList, UILayout, Context, AnyType, Panel
class PSX_UL_BoneGroupList(UIList): class PSX_UL_BoneGroupList(UIList):
@@ -12,56 +11,6 @@ class PSX_UL_BoneGroupList(UIList):
row.label(text=str(getattr(item, 'count')), icon='BONE_DATA') row.label(text=str(getattr(item, 'count')), icon='BONE_DATA')
class PSX_OT_MaterialPathAdd(Operator):
bl_idname = 'psx.material_paths_add'
bl_label = 'Add Material Path'
bl_options = {'INTERNAL'}
directory: bpy.props.StringProperty(subtype='DIR_PATH', options={'HIDDEN'})
filter_folder: bpy.props.BoolProperty(default=True, options={'HIDDEN'})
def invoke(self, context: 'Context', event: 'Event'):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
def execute(self, context: 'Context'):
m = context.preferences.addons[__package__].preferences.material_path_list.add()
m.path = self.directory
return {'FINISHED'}
class PSX_OT_MaterialPathRemove(Operator):
bl_idname = 'psx.material_paths_remove'
bl_label = 'Remove Material Path'
bl_options = {'INTERNAL'}
@classmethod
def poll(cls, context: 'Context'):
preferences = context.preferences.addons[__package__].preferences
return preferences.material_path_index >= 0
def execute(self, context: 'Context'):
preferences = context.preferences.addons[__package__].preferences
preferences.material_path_list.remove(preferences.material_path_index)
return {'FINISHED'}
class PSX_UL_MaterialPathList(UIList):
def draw_item(self,
context: 'Context',
layout: 'UILayout',
data: 'AnyType',
item: 'AnyType',
icon: int,
active_data: 'AnyType',
active_property: str,
index: int = 0,
flt_flag: int = 0):
row = layout.row()
row.label(text=getattr(item, 'path'))
class BoneGroupListItem(PropertyGroup): class BoneGroupListItem(PropertyGroup):
name: StringProperty() name: StringProperty()
index: IntProperty() index: IntProperty()
@@ -70,7 +19,7 @@ class BoneGroupListItem(PropertyGroup):
class PSX_PG_ActionExportPropertyGroup(PropertyGroup): class PSX_PG_ActionExportPropertyGroup(PropertyGroup):
compression_ratio: FloatProperty(name='Compression Ratio', default=1.0, min=0.0, max=1.0, subtype='FACTOR', description='The ratio of frames to be exported.\n\nA compression ratio of 1.0 will export all frames, while a compression ratio of 0.5 will export half of the frames') compression_ratio: FloatProperty(name='Compression Ratio', default=1.0, min=0.0, max=1.0, subtype='FACTOR', description='The key sampling ratio of the exported sequence.\n\nA compression ratio of 1.0 will export all frames, while a compression ratio of 0.5 will export half of the frames')
key_quota: IntProperty(name='Key Quota', default=0, min=1, description='The minimum number of frames to be exported') key_quota: IntProperty(name='Key Quota', default=0, min=1, description='The minimum number of frames to be exported')