mirror of
https://github.com/ApfelTeeSaft/lightspeed64.git
synced 2026-09-02 12:23:33 +00:00
Panel UI refactor (#24)
* Only show Q Menu Panels for selected game * refactored panels to only show what is relevant * refactor get_legacy_export_type * added comments explaining custom panel properties * remove handler on 'unregister' * changed upgrade func names to upgrade_changed_props * removed old incorrect comment * simplify get_legacy_export_type * use .remove instead
This commit is contained in:
+36
-12
@@ -155,16 +155,9 @@ class SM64_AddWaterBox(AddWaterBox):
|
||||
def setEmptyType(self, emptyObj):
|
||||
emptyObj.sm64_obj_type = "Water Box"
|
||||
|
||||
class SM64_ArmatureToolsPanel(bpy.types.Panel):
|
||||
class SM64_ArmatureToolsPanel(SM64_Panel):
|
||||
bl_idname = "SM64_PT_armature_tools"
|
||||
bl_label = "SM64 Tools"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
@@ -188,6 +181,7 @@ class F3D_GlobalSettingsPanel(bpy.types.Panel):
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
col = self.layout.column()
|
||||
col.scale_y = 1.1 # extra padding
|
||||
prop_split(col, context.scene, 'f3d_type', "F3D Microcode")
|
||||
col.prop(context.scene, 'isHWv1')
|
||||
col.prop(context.scene, 'saveTextures')
|
||||
@@ -228,6 +222,7 @@ class Fast64_GlobalSettingsPanel(bpy.types.Panel):
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
col = self.layout.column()
|
||||
col.scale_y = 1.1 # extra padding
|
||||
prop_split(col, context.scene, 'gameEditorMode', "Game")
|
||||
col.prop(context.scene, 'exportHiddenGeometry')
|
||||
col.prop(context.scene, 'fullTraceback')
|
||||
@@ -248,7 +243,19 @@ class Fast64_GlobalToolsPanel(bpy.types.Panel):
|
||||
col = self.layout.column()
|
||||
col.operator(ArmatureApplyWithMesh.bl_idname)
|
||||
#col.operator(CreateMetarig.bl_idname)
|
||||
|
||||
|
||||
class Fast64Settings_Properties(bpy.types.PropertyGroup):
|
||||
'''Settings affecting exports for all games found in scene.fast64.settings'''
|
||||
version: bpy.props.IntProperty(name="Fast64Settings_Properties Version", default=0)
|
||||
|
||||
class Fast64_Properties(bpy.types.PropertyGroup):
|
||||
'''
|
||||
Properties in scene.fast64.
|
||||
All new properties should be children of one of these three property groups.
|
||||
'''
|
||||
sm64: bpy.props.PointerProperty(type=SM64_Properties, name="SM64 Properties")
|
||||
oot: bpy.props.PointerProperty(type=OOT_Properties, name="OOT Properties")
|
||||
settings: bpy.props.PointerProperty(type=Fast64Settings_Properties, name="Fast64 Settings")
|
||||
|
||||
#def updateGameEditor(scene, context):
|
||||
# if scene.currentGameEditorMode == 'SM64':
|
||||
@@ -268,6 +275,9 @@ class Fast64_GlobalToolsPanel(bpy.types.Panel):
|
||||
# scene.currentGameEditorMode = scene.gameEditorMode
|
||||
|
||||
classes = (
|
||||
Fast64Settings_Properties,
|
||||
Fast64_Properties,
|
||||
|
||||
ArmatureApplyWithMesh,
|
||||
AddBoneGroups,
|
||||
CreateMetarig,
|
||||
@@ -280,6 +290,14 @@ classes = (
|
||||
Fast64_GlobalToolsPanel,
|
||||
)
|
||||
|
||||
def upgrade_changed_props():
|
||||
'''Set scene properties after a scene loads, used for migrating old properties'''
|
||||
SM64_Properties.upgrade_changed_props()
|
||||
|
||||
@bpy.app.handlers.persistent
|
||||
def after_load(_a, _b):
|
||||
upgrade_changed_props()
|
||||
|
||||
# called on add-on enabling
|
||||
# register operators and panels here
|
||||
# append menu layout drawing function to an existing window
|
||||
@@ -290,11 +308,10 @@ def register():
|
||||
sm64_register(True)
|
||||
oot_register(True)
|
||||
|
||||
bsdf_conv_panel_regsiter()
|
||||
|
||||
for cls in classes:
|
||||
register_class(cls)
|
||||
|
||||
|
||||
bsdf_conv_panel_regsiter()
|
||||
f3d_writer_register()
|
||||
f3d_parser_register()
|
||||
|
||||
@@ -314,6 +331,9 @@ def register():
|
||||
bpy.types.Scene.exportHiddenGeometry = bpy.props.BoolProperty(name = "Export Hidden Geometry", default = True)
|
||||
bpy.types.Scene.blenderF3DScale = bpy.props.FloatProperty(name = "F3D Blender Scale", default = 100)
|
||||
|
||||
bpy.types.Scene.fast64 = bpy.props.PointerProperty(type=Fast64_Properties, name="Fast64 Properties")
|
||||
bpy.app.handlers.load_post.append(after_load)
|
||||
|
||||
# called on add-on disabling
|
||||
def unregister():
|
||||
f3d_writer_unregister()
|
||||
@@ -334,5 +354,9 @@ def unregister():
|
||||
del bpy.types.Scene.exportHiddenGeometry
|
||||
del bpy.types.Scene.blenderF3DScale
|
||||
|
||||
del bpy.types.Scene.fast64
|
||||
|
||||
for cls in classes:
|
||||
unregister_class(cls)
|
||||
|
||||
bpy.app.handlers.load_post.remove(after_load)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from .f3d_material_converter import *
|
||||
from .f3d import *
|
||||
from .sm64 import *
|
||||
from .oot import *
|
||||
from .oot import *
|
||||
from .panels import *
|
||||
|
||||
@@ -434,7 +434,7 @@ def convertF3DUV(value, maxSize):
|
||||
try:
|
||||
valueBytes = int.to_bytes(value, 2, 'big', signed = True)
|
||||
except OverflowError:
|
||||
valueBytes = int.to_bytes(valule, 2, 'big', signed = False)
|
||||
valueBytes = int.to_bytes(value, 2, 'big', signed = False)
|
||||
|
||||
return ((int.from_bytes(valueBytes, 'big', signed = True) / 32) + 0.5) / (maxSize if maxSize > 0 else 1)
|
||||
|
||||
@@ -1920,6 +1920,7 @@ class F3D_ImportDLPanel(bpy.types.Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'Fast64'
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@@ -1979,4 +1980,4 @@ def f3d_parser_unregister():
|
||||
del bpy.types.Scene.DLImportDrawLayer
|
||||
del bpy.types.Scene.DLImportBasePath
|
||||
del bpy.types.Scene.DLImportOtherFiles
|
||||
del bpy.types.Scene.DLImportOtherFilesIndex
|
||||
del bpy.types.Scene.DLImportOtherFilesIndex
|
||||
|
||||
@@ -2376,6 +2376,7 @@ class F3D_ExportDLPanel(bpy.types.Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'Fast64'
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from ..panels import OOT_Panel
|
||||
from .oot_f3d_writer import *
|
||||
#from .oot_geolayout_writer import *
|
||||
#from .oot_geolayout_parser import *
|
||||
@@ -21,20 +22,15 @@ ootEnumRefreshVer = [
|
||||
("Refresh 3", "Refresh 3", "Refresh 3"),
|
||||
]
|
||||
|
||||
class OOT_FileSettingsPanel(bpy.types.Panel):
|
||||
class OOT_FileSettingsPanel(OOT_Panel):
|
||||
bl_idname = "OOT_PT_file_settings"
|
||||
bl_label = "OOT File Settings"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'OOT'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
bl_options = set() # default to being open
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
col = self.layout.column()
|
||||
col.scale_y = 1.1 # extra padding, makes it easier to see these main settings
|
||||
prop_split(col, context.scene, 'ootBlenderScale', 'OOT Scene Scale')
|
||||
prop_split(col, context.scene, 'ootActorBlenderScale', 'OOT Actor Scale')
|
||||
|
||||
@@ -44,8 +40,13 @@ class OOT_FileSettingsPanel(bpy.types.Panel):
|
||||
|
||||
#prop_split(col, context.scene, 'ootRefreshVer', 'Decomp Func Map')
|
||||
|
||||
class OOT_Properties(bpy.types.PropertyGroup):
|
||||
'''Global OOT Scene Properties found under scene.fast64.oot'''
|
||||
version: bpy.props.IntProperty(name="OOT_Properties Version", default=0)
|
||||
|
||||
oot_classes = (
|
||||
OOT_FileSettingsPanel,
|
||||
OOT_Properties,
|
||||
)
|
||||
|
||||
def oot_panel_register():
|
||||
@@ -130,4 +131,4 @@ def oot_unregister(unregisterPanels):
|
||||
del bpy.types.Scene.ootRefreshVer
|
||||
del bpy.types.Scene.ootBlenderScale
|
||||
del bpy.types.Scene.ootActorBlenderScale
|
||||
del bpy.types.Scene.ootDecompPath
|
||||
del bpy.types.Scene.ootDecompPath
|
||||
|
||||
@@ -5,6 +5,7 @@ from .oot_constants import *
|
||||
from .oot_utility import *
|
||||
from .oot_skeleton import *
|
||||
from ..utility import *
|
||||
from ..panels import OOT_Panel
|
||||
|
||||
class OOTAnimation:
|
||||
def __init__(self, name):
|
||||
@@ -345,16 +346,9 @@ class OOT_ImportAnim(bpy.types.Operator):
|
||||
|
||||
return {'FINISHED'} # must return a set
|
||||
|
||||
class OOT_ExportAnimPanel(bpy.types.Panel):
|
||||
class OOT_ExportAnimPanel(OOT_Panel):
|
||||
bl_idname = "OOT_PT_export_anim"
|
||||
bl_label = "OOT Animation Exporter"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'OOT'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
@@ -425,4 +419,4 @@ def oot_anim_unregister():
|
||||
del bpy.types.Scene.ootAnimSkeletonName
|
||||
del bpy.types.Scene.ootAnimName
|
||||
for cls in reversed(oot_anim_classes):
|
||||
unregister_class(cls)
|
||||
unregister_class(cls)
|
||||
|
||||
@@ -2,6 +2,7 @@ from .oot_constants import *
|
||||
from .oot_utility import *
|
||||
|
||||
from ..utility import *
|
||||
from ..panels import OOT_Panel
|
||||
|
||||
from bpy.utils import register_class, unregister_class
|
||||
from io import BytesIO
|
||||
@@ -865,16 +866,9 @@ class OOT_ExportCollision(bpy.types.Operator):
|
||||
raisePluginError(self, e)
|
||||
return {'CANCELLED'} # must return a set
|
||||
|
||||
class OOT_ExportCollisionPanel(bpy.types.Panel):
|
||||
class OOT_ExportCollisionPanel(OOT_Panel):
|
||||
bl_idname = "OOT_PT_export_collision"
|
||||
bl_label = "OOT Collision Exporter"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'OOT'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
|
||||
@@ -7,6 +7,7 @@ from .oot_constants import *
|
||||
from .oot_utility import *
|
||||
from .oot_scene_room import *
|
||||
from ..f3d.f3d_parser import *
|
||||
from ..panels import OOT_Panel
|
||||
|
||||
class OOTModel(FModel):
|
||||
def __init__(self, f3dType, isHWv1, name, DLFormat, drawLayerOverride):
|
||||
@@ -494,16 +495,9 @@ class OOT_ExportDL(bpy.types.Operator):
|
||||
raisePluginError(self, e)
|
||||
return {'CANCELLED'} # must return a set
|
||||
|
||||
class OOT_ExportDLPanel(bpy.types.Panel):
|
||||
class OOT_ExportDLPanel(OOT_Panel):
|
||||
bl_idname = "OOT_PT_export_dl"
|
||||
bl_label = "OOT DL Exporter"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'OOT'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
|
||||
@@ -11,6 +11,7 @@ from .oot_spline import *
|
||||
from .c_writer import *
|
||||
|
||||
from ..utility import *
|
||||
from ..panels import OOT_Panel
|
||||
|
||||
from bpy.utils import register_class, unregister_class
|
||||
from io import BytesIO
|
||||
@@ -599,16 +600,9 @@ class OOT_RemoveScene(bpy.types.Operator):
|
||||
self.report({'INFO'}, 'Success!')
|
||||
return {'FINISHED'} # must return a set
|
||||
|
||||
class OOT_ExportScenePanel(bpy.types.Panel):
|
||||
class OOT_ExportScenePanel(OOT_Panel):
|
||||
bl_idname = "OOT_PT_export_level"
|
||||
bl_label = "OOT Scene Exporter"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'OOT'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
|
||||
@@ -3,6 +3,7 @@ from bpy.utils import register_class, unregister_class
|
||||
from ..utility import *
|
||||
from ..f3d.f3d_material import *
|
||||
from ..operators import *
|
||||
from ..panels import OOT_Panel
|
||||
|
||||
class OOT_AddWaterBox(AddWaterBox):
|
||||
bl_idname = 'object.oot_add_water_box'
|
||||
@@ -137,16 +138,9 @@ class OOT_AddRoom(bpy.types.Operator):
|
||||
context.view_layer.objects.active = roomObj
|
||||
return {"FINISHED"}
|
||||
|
||||
class OOT_OperatorsPanel(bpy.types.Panel):
|
||||
class OOT_OperatorsPanel(OOT_Panel):
|
||||
bl_idname = "OOT_PT_operators"
|
||||
bl_label = "OOT Tools"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'OOT'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
@@ -182,4 +176,4 @@ def oot_operator_register():
|
||||
|
||||
def oot_operator_unregister():
|
||||
for cls in reversed(oot_operator_classes):
|
||||
unregister_class(cls)
|
||||
unregister_class(cls)
|
||||
|
||||
@@ -8,6 +8,7 @@ from .oot_constants import *
|
||||
from .oot_utility import *
|
||||
from .oot_f3d_writer import *
|
||||
from ..utility import *
|
||||
from ..panels import OOT_Panel
|
||||
|
||||
ootEnumBoneType = [
|
||||
("Default", "Default", "Default"),
|
||||
@@ -772,16 +773,9 @@ class OOT_ExportSkeleton(bpy.types.Operator):
|
||||
raisePluginError(self, e)
|
||||
return {'CANCELLED'} # must return a set
|
||||
|
||||
class OOT_ExportSkeletonPanel(bpy.types.Panel):
|
||||
class OOT_ExportSkeletonPanel(OOT_Panel):
|
||||
bl_idname = "OOT_PT_export_skeleton"
|
||||
bl_label = "OOT Skeleton Exporter"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'OOT'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
@@ -936,4 +930,4 @@ def oot_skeleton_unregister():
|
||||
del bpy.types.Bone.ootCustomDLName
|
||||
|
||||
for cls in reversed(oot_skeleton_classes):
|
||||
unregister_class(cls)
|
||||
unregister_class(cls)
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
import bpy
|
||||
from .fast64_internal import *
|
||||
|
||||
sm64GoalImport = 'Import' # Not in enum, separate UI option
|
||||
sm64GoalTypeEnum = [
|
||||
('All', 'All', 'All'),
|
||||
('Export Object/Actor/Anim', 'Export Object/Actor/Anim', 'Export Object/Actor/Anim'),
|
||||
('Export Level', 'Export Level', 'Export Level'),
|
||||
('Export Displaylist', 'Export Displaylist', 'Export Displaylist'),
|
||||
('Export UI Image', 'Export UI Image', 'Export UI Image'),
|
||||
]
|
||||
|
||||
class SM64_Panel(bpy.types.Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
# goal refers to the selected sm64GoalTypeEnum, a different selection than this goal will filter this panel out
|
||||
goal = None
|
||||
# if this is True, the panel is hidden whenever the scene's exportType is not 'C'
|
||||
decomp_only = False
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
sm64Props = bpy.context.scene.fast64.sm64
|
||||
if context.scene.gameEditorMode != 'SM64':
|
||||
return False
|
||||
elif not cls.goal:
|
||||
return True # Panel should always be shown
|
||||
elif cls.goal == sm64GoalImport:
|
||||
# Only show if importing is enabled
|
||||
return sm64Props.showImportingMenus
|
||||
elif cls.decomp_only and sm64Props.exportType != 'C':
|
||||
return False
|
||||
|
||||
sceneGoal = sm64Props.goal
|
||||
return sceneGoal == 'All' or sceneGoal == cls.goal
|
||||
|
||||
class OOT_Panel(bpy.types.Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'OOT'
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.scene.gameEditorMode == 'OOT'
|
||||
@@ -12,6 +12,7 @@ from .sm64_objects import *
|
||||
from .sm64_level_writer import *
|
||||
from .sm64_spline import *
|
||||
from .sm64_f3d_parser import *
|
||||
from ..panels import SM64_Panel, sm64GoalTypeEnum, sm64GoalImport
|
||||
|
||||
import bpy
|
||||
from bpy.utils import register_class, unregister_class
|
||||
@@ -65,46 +66,51 @@ class SM64_AddrConv(bpy.types.Operator):
|
||||
raisePluginError(self, e)
|
||||
return {'CANCELLED'} # must return a set
|
||||
|
||||
class SM64_FileSettingsPanel(bpy.types.Panel):
|
||||
class SM64_MenuVisibilityPanel(SM64_Panel):
|
||||
bl_idname = "SM64_PT_menu_visibility_settings"
|
||||
bl_label = "SM64 Menu Visibility Settings"
|
||||
bl_options = set() # default to open
|
||||
bl_order = 0 # force to front
|
||||
|
||||
def draw(self, context):
|
||||
col = self.layout.column()
|
||||
col.scale_y = 1.1 # extra padding
|
||||
sm64Props: SM64_Properties = context.scene.fast64.sm64
|
||||
|
||||
prop_split(col, sm64Props, 'goal', 'Export goal')
|
||||
prop_split(col, sm64Props, 'showImportingMenus', 'Show Importing Options')
|
||||
|
||||
class SM64_FileSettingsPanel(SM64_Panel):
|
||||
bl_idname = "SM64_PT_file_settings"
|
||||
bl_label = "SM64 File Settings"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
bl_options = set()
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
col = self.layout.column()
|
||||
col = self.layout.column()
|
||||
col.scale_y = 1.1 # extra padding
|
||||
sm64Props: SM64_Properties = context.scene.fast64.sm64
|
||||
|
||||
prop_split(col, sm64Props, 'exportType', 'Export type')
|
||||
prop_split(col, context.scene, 'blenderToSM64Scale', 'Blender To SM64 Scale')
|
||||
|
||||
col.prop(context.scene, 'importRom')
|
||||
col.prop(context.scene, 'exportRom')
|
||||
col.prop(context.scene, 'outputRom')
|
||||
col.prop(context.scene, 'extendBank4')
|
||||
|
||||
col.prop(context.scene, 'disableScroll')
|
||||
|
||||
col.prop(context.scene, 'decompPath')
|
||||
|
||||
prop_split(col, context.scene, 'refreshVer', 'Decomp Func Map')
|
||||
prop_split(col, context.scene, 'compressionFormat', 'Compression Format')
|
||||
if sm64Props.showImportingMenus:
|
||||
col.prop(context.scene, 'importRom')
|
||||
|
||||
class SM64_AddressConvertPanel(bpy.types.Panel):
|
||||
if sm64Props.exportType == 'Binary':
|
||||
col.prop(context.scene, 'exportRom')
|
||||
col.prop(context.scene, 'outputRom')
|
||||
col.prop(context.scene, 'extendBank4')
|
||||
elif sm64Props.exportType == 'C':
|
||||
col.prop(context.scene, 'disableScroll')
|
||||
col.prop(context.scene, 'decompPath')
|
||||
prop_split(col, context.scene, 'refreshVer', 'Decomp Func Map')
|
||||
prop_split(col, context.scene, 'compressionFormat', 'Compression Format')
|
||||
|
||||
class SM64_AddressConvertPanel(SM64_Panel):
|
||||
bl_idname = "SM64_PT_addr_conv"
|
||||
bl_label = "SM64 Address Converter"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
goal = sm64GoalImport
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
col = self.layout.column()
|
||||
segToVirtOp = col.operator(SM64_AddrConv.bl_idname,
|
||||
@@ -116,11 +122,60 @@ class SM64_AddressConvertPanel(bpy.types.Panel):
|
||||
prop_split(col, context.scene, 'convertibleAddr', 'Address')
|
||||
col.prop(context.scene, 'levelConvert')
|
||||
|
||||
def get_legacy_export_type():
|
||||
legacy_export_types = ('C', 'Binary', 'Insertable Binary')
|
||||
scene = bpy.context.scene
|
||||
|
||||
for exportKey in ['animExportType', 'colExportType', 'DLExportType', 'geoExportType']:
|
||||
eType = scene.pop(exportKey, None)
|
||||
if eType is not None and legacy_export_types[eType] != 'C':
|
||||
return legacy_export_types[eType]
|
||||
|
||||
return 'C'
|
||||
|
||||
class SM64_Properties(bpy.types.PropertyGroup):
|
||||
'''Global SM64 Scene Properties found under scene.fast64.sm64'''
|
||||
version: bpy.props.IntProperty(name="SM64_Properties Version", default=0)
|
||||
cur_version = 1 # version after property migration
|
||||
|
||||
# UI Selection
|
||||
showImportingMenus: bpy.props.BoolProperty(name='Show Importing Menus', default=False)
|
||||
exportType: bpy.props.EnumProperty(items = enumExportType, name = 'Export Type', default = 'C')
|
||||
goal: bpy.props.EnumProperty(items=sm64GoalTypeEnum, name = 'Export Goal', default = 'All')
|
||||
|
||||
# TODO: Utilize these across all exports
|
||||
# C exporting
|
||||
# useCustomExportLocation = bpy.props.BoolProperty(name = 'Use Custom Export Path')
|
||||
# customExportPath: bpy.props.StringProperty(name = 'Custom Export Path', subtype = 'FILE_PATH')
|
||||
# exportLocation: bpy.props.EnumProperty(items = enumExportHeaderType, name = 'Export Location', default = 'Actor')
|
||||
# useSelectedObjectName = bpy.props.BoolProperty(name = 'Use Name From Selected Object', default=False)
|
||||
# exportName: bpy.props.StringProperty(name='Name', default='mario')
|
||||
# exportGeolayoutName: bpy.props.StringProperty(name='Name', default='mario_geo')
|
||||
|
||||
# Actor exports
|
||||
# exportGroup: bpy.props.StringProperty(name='Group', default='group0')
|
||||
|
||||
# Level exports
|
||||
# exportLevelName: bpy.props.StringProperty(name = 'Level', default = 'bob')
|
||||
# exportLevelOption: bpy.props.EnumProperty(items = enumLevelNames, name = 'Level', default = 'bob')
|
||||
|
||||
# Insertable Binary
|
||||
# exportInsertableBinaryPath: bpy.props.StringProperty(name = 'Filepath', subtype = 'FILE_PATH')
|
||||
|
||||
@staticmethod
|
||||
def upgrade_changed_props():
|
||||
if bpy.context.scene.fast64.sm64.version != SM64_Properties.cur_version:
|
||||
bpy.context.scene.fast64.sm64.exportType = get_legacy_export_type()
|
||||
bpy.context.scene.fast64.sm64.version = SM64_Properties.cur_version
|
||||
|
||||
|
||||
sm64_classes = (
|
||||
SM64_AddrConv,
|
||||
SM64_Properties,
|
||||
)
|
||||
|
||||
sm64_panel_classes = (
|
||||
SM64_MenuVisibilityPanel,
|
||||
SM64_FileSettingsPanel,
|
||||
SM64_AddressConvertPanel,
|
||||
)
|
||||
@@ -236,4 +291,4 @@ def sm64_unregister(unregisterPanels):
|
||||
|
||||
del bpy.types.Scene.blenderToSM64Scale
|
||||
del bpy.types.Scene.decompPath
|
||||
del bpy.types.Scene.compressionFormat
|
||||
del bpy.types.Scene.compressionFormat
|
||||
|
||||
@@ -6,6 +6,7 @@ from math import pi
|
||||
from bpy.utils import register_class, unregister_class
|
||||
|
||||
from ..utility import *
|
||||
from ..panels import SM64_Panel, sm64GoalImport
|
||||
|
||||
sm64_anim_types = {'ROTATE', 'TRANSLATE'}
|
||||
|
||||
@@ -604,7 +605,7 @@ class SM64_ExportAnimMario(bpy.types.Operator):
|
||||
applyRotation([armatureObj],
|
||||
math.radians(90), 'X')
|
||||
|
||||
if context.scene.animExportType == 'C':
|
||||
if context.scene.fast64.sm64.exportType == 'C':
|
||||
exportPath, levelName = getPathAndLevel(context.scene.animCustomExport,
|
||||
context.scene.animExportPath, context.scene.animLevelName,
|
||||
context.scene.animLevelOption)
|
||||
@@ -615,7 +616,7 @@ class SM64_ExportAnimMario(bpy.types.Operator):
|
||||
bpy.context.scene.animGroupName,
|
||||
context.scene.animCustomExport, context.scene.animExportHeaderType, levelName)
|
||||
self.report({'INFO'}, 'Success!')
|
||||
elif context.scene.animExportType == 'Insertable Binary':
|
||||
elif context.scene.fast64.sm64.exportType == 'Insertable Binary':
|
||||
exportAnimationInsertableBinary(
|
||||
bpy.path.abspath(context.scene.animInsertableBinaryPath),
|
||||
armatureObj, context.scene.isDMAExport,
|
||||
@@ -703,25 +704,18 @@ class SM64_ExportAnimMario(bpy.types.Operator):
|
||||
|
||||
return {'FINISHED'} # must return a set
|
||||
|
||||
class SM64_ExportAnimPanel(bpy.types.Panel):
|
||||
class SM64_ExportAnimPanel(SM64_Panel):
|
||||
bl_idname = "SM64_PT_export_anim"
|
||||
bl_label = "SM64 Animation Exporter"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
goal = "Export Object/Actor/Anim"
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
col = self.layout.column()
|
||||
propsAnimExport = col.operator(SM64_ExportAnimMario.bl_idname)
|
||||
|
||||
col.prop(context.scene, 'animExportType')
|
||||
|
||||
col.prop(context.scene, 'loopAnimation')
|
||||
if context.scene.animExportType == 'C':
|
||||
if context.scene.fast64.sm64.exportType == 'C':
|
||||
col.prop(context.scene, 'animCustomExport')
|
||||
if context.scene.animCustomExport:
|
||||
col.prop(context.scene, 'animExportPath')
|
||||
@@ -743,7 +737,7 @@ class SM64_ExportAnimPanel(bpy.types.Panel):
|
||||
context.scene.animName, context.scene.animLevelName,
|
||||
context.scene.animLevelOption)
|
||||
|
||||
elif context.scene.animExportType == 'Insertable Binary':
|
||||
elif context.scene.fast64.sm64.exportType == 'Insertable Binary':
|
||||
col.prop(context.scene, 'isDMAExport')
|
||||
col.prop(context.scene, 'animInsertableBinaryPath')
|
||||
else:
|
||||
@@ -820,16 +814,10 @@ class SM64_ImportAnimMario(bpy.types.Operator):
|
||||
|
||||
return {'FINISHED'} # must return a set
|
||||
|
||||
class SM64_ImportAnimPanel(bpy.types.Panel):
|
||||
class SM64_ImportAnimPanel(SM64_Panel):
|
||||
bl_idname = "SM64_PT_import_anim"
|
||||
bl_label = "SM64 Animation Importer"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
goal = sm64GoalImport
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
@@ -887,8 +875,6 @@ def sm64_anim_register():
|
||||
name = '0x27 Command Address', default = '21CD00')
|
||||
bpy.types.Scene.addr_0x28 = bpy.props.StringProperty(
|
||||
name = '0x28 Command Address', default = '21CD08')
|
||||
bpy.types.Scene.animExportType = bpy.props.EnumProperty(
|
||||
items = enumExportType, name = 'Export', default = 'C')
|
||||
bpy.types.Scene.animExportPath = bpy.props.StringProperty(
|
||||
name = 'Directory', subtype = 'FILE_PATH')
|
||||
bpy.types.Scene.animOverwriteDMAEntry = bpy.props.BoolProperty(
|
||||
@@ -936,7 +922,6 @@ def sm64_anim_unregister():
|
||||
del bpy.types.Scene.overwrite_0x28
|
||||
del bpy.types.Scene.addr_0x27
|
||||
del bpy.types.Scene.addr_0x28
|
||||
del bpy.types.Scene.animExportType
|
||||
del bpy.types.Scene.animExportPath
|
||||
del bpy.types.Scene.animOverwriteDMAEntry
|
||||
del bpy.types.Scene.animInsertableBinaryPath
|
||||
@@ -950,4 +935,4 @@ def sm64_anim_unregister():
|
||||
del bpy.types.Scene.animCustomExport
|
||||
del bpy.types.Scene.animExportHeaderType
|
||||
del bpy.types.Scene.animLevelName
|
||||
del bpy.types.Scene.animLevelOption
|
||||
del bpy.types.Scene.animLevelOption
|
||||
|
||||
@@ -3,9 +3,10 @@ from .sm64_objects import *
|
||||
from bpy.utils import register_class, unregister_class
|
||||
from .sm64_level_parser import parseLevelAtPointer
|
||||
from .sm64_rom_tweaks import ExtendBank0x04
|
||||
import bpy, bmesh, os, math
|
||||
import bpy, shutil, os, math
|
||||
from io import BytesIO
|
||||
from ..utility import *
|
||||
from ..panels import SM64_Panel
|
||||
|
||||
class CollisionVertex:
|
||||
def __init__(self, position):
|
||||
@@ -477,7 +478,7 @@ class SM64_ExportCollision(bpy.types.Operator):
|
||||
|
||||
try:
|
||||
applyRotation([obj], math.radians(90), 'X')
|
||||
if context.scene.colExportType == 'C':
|
||||
if context.scene.fast64.sm64.exportType == 'C':
|
||||
exportPath, levelName = getPathAndLevel(context.scene.colCustomExport,
|
||||
context.scene.colExportPath, context.scene.colLevelName,
|
||||
context.scene.colLevelOption)
|
||||
@@ -489,7 +490,7 @@ class SM64_ExportCollision(bpy.types.Operator):
|
||||
bpy.context.scene.colName, context.scene.colCustomExport, context.scene.colExportRooms,
|
||||
context.scene.colExportHeaderType, context.scene.colGroupName, levelName)
|
||||
self.report({'INFO'}, 'Success!')
|
||||
elif context.scene.colExportType == 'Insertable Binary':
|
||||
elif context.scene.fast64.sm64.exportType == 'Insertable Binary':
|
||||
exportCollisionInsertableBinary(obj, finalTransform,
|
||||
bpy.path.abspath(context.scene.colInsertableBinaryPath),
|
||||
False, context.scene.colIncludeChildren)
|
||||
@@ -545,7 +546,7 @@ class SM64_ExportCollision(bpy.types.Operator):
|
||||
|
||||
applyRotation([obj], math.radians(-90), 'X')
|
||||
|
||||
if context.scene.colExportType == 'Binary':
|
||||
if context.scene.fast64.sm64.exportType == 'Binary':
|
||||
if romfileOutput is not None:
|
||||
romfileOutput.close()
|
||||
if tempROM is not None and os.path.exists(bpy.path.abspath(tempROM)):
|
||||
@@ -555,26 +556,19 @@ class SM64_ExportCollision(bpy.types.Operator):
|
||||
raisePluginError(self, e)
|
||||
return {'CANCELLED'} # must return a set
|
||||
|
||||
class SM64_ExportCollisionPanel(bpy.types.Panel):
|
||||
class SM64_ExportCollisionPanel(SM64_Panel):
|
||||
bl_idname = "SM64_PT_export_collision"
|
||||
bl_label = "SM64 Collision Exporter"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
goal = "Export Object/Actor/Anim"
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
col = self.layout.column()
|
||||
propsColE = col.operator(SM64_ExportCollision.bl_idname)
|
||||
|
||||
col.prop(context.scene, 'colExportType')
|
||||
col.prop(context.scene, 'colIncludeChildren')
|
||||
|
||||
if context.scene.colExportType == 'C':
|
||||
if context.scene.fast64.sm64.exportType == 'C':
|
||||
col.prop(context.scene, 'colExportRooms')
|
||||
col.prop(context.scene, 'colCustomExport')
|
||||
if context.scene.colCustomExport:
|
||||
@@ -596,7 +590,7 @@ class SM64_ExportCollisionPanel(bpy.types.Panel):
|
||||
writeBoxExportType(writeBox, context.scene.colExportHeaderType,
|
||||
context.scene.colName, context.scene.colLevelName, context.scene.colLevelOption)
|
||||
|
||||
elif context.scene.colExportType == 'Insertable Binary':
|
||||
elif context.scene.fast64.sm64.exportType == 'Insertable Binary':
|
||||
col.prop(context.scene, 'colInsertableBinaryPath')
|
||||
else:
|
||||
prop_split(col, context.scene, 'colStartAddr', 'Start Address')
|
||||
@@ -633,8 +627,6 @@ def sm64_col_register():
|
||||
# Collision
|
||||
bpy.types.Scene.colExportPath = bpy.props.StringProperty(
|
||||
name = 'Directory', subtype = 'FILE_PATH')
|
||||
bpy.types.Scene.colExportType = bpy.props.EnumProperty(
|
||||
items = enumExportType, name = 'Export', default = 'C')
|
||||
bpy.types.Scene.colExportLevel = bpy.props.EnumProperty(items = level_enums,
|
||||
name = 'Level Used By Collision', default = 'WF')
|
||||
bpy.types.Scene.addr_0x2A = bpy.props.StringProperty(
|
||||
@@ -689,7 +681,6 @@ def sm64_col_register():
|
||||
def sm64_col_unregister():
|
||||
# Collision
|
||||
del bpy.types.Scene.colExportPath
|
||||
del bpy.types.Scene.colExportType
|
||||
del bpy.types.Scene.colExportLevel
|
||||
del bpy.types.Scene.addr_0x2A
|
||||
del bpy.types.Scene.set_addr_0x2A
|
||||
@@ -1301,4 +1292,4 @@ enumPaintingCollisionType = [
|
||||
|
||||
enumUnusedCollisionType = [
|
||||
('SURFACE_0004','0004','0004'),
|
||||
]
|
||||
]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import bpy
|
||||
from ..panels import SM64_Panel, sm64GoalImport
|
||||
from ..utility import *
|
||||
from ..f3d.f3d_parser import *
|
||||
from bpy.utils import register_class, unregister_class
|
||||
@@ -50,16 +51,10 @@ class SM64_ImportDL(bpy.types.Operator):
|
||||
raisePluginError(self, e)
|
||||
return {'CANCELLED'}
|
||||
|
||||
class SM64_ImportDLPanel(bpy.types.Panel):
|
||||
class SM64_ImportDLPanel(SM64_Panel):
|
||||
bl_idname = "SM64_PT_import_dl"
|
||||
bl_label = "SM64 DL Importer"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
goal = sm64GoalImport
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
@@ -104,4 +99,4 @@ def sm64_dl_parser_unregister():
|
||||
|
||||
del bpy.types.Scene.levelDLImport
|
||||
del bpy.types.Scene.DLImportStart
|
||||
del bpy.types.Scene.isSegmentedAddrDLImport
|
||||
del bpy.types.Scene.isSegmentedAddrDLImport
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import shutil, copy, bpy, cProfile, pstats
|
||||
|
||||
from ..panels import SM64_Panel
|
||||
from ..f3d.f3d_writer import *
|
||||
from ..f3d.f3d_material import *
|
||||
from ..f3d.f3d_gbi import FMaterial
|
||||
from .sm64_texscroll import *
|
||||
from .sm64_utility import *
|
||||
from bpy.utils import register_class, unregister_class
|
||||
from .sm64_constants import level_enums, enumLevelNames
|
||||
from .sm64_constants import level_enums, enumLevelNames, level_pointers, defaultExtendSegment4, bank0Segment, insertableBinaryTypes
|
||||
from .sm64_level_parser import parseLevelAtPointer
|
||||
from .sm64_rom_tweaks import ExtendBank0x04
|
||||
from .sm64_constants import level_pointers, defaultExtendSegment4, bank0Segment
|
||||
|
||||
|
||||
enumHUDExportLocation = [
|
||||
('HUD', 'HUD', 'Exports to src/game/hud.c'),
|
||||
@@ -499,7 +500,7 @@ class SM64_ExportDL(bpy.types.Operator):
|
||||
|
||||
try:
|
||||
applyRotation([obj], math.radians(90), 'X')
|
||||
if context.scene.DLExportType == 'C':
|
||||
if context.scene.fast64.sm64.exportType == 'C':
|
||||
exportPath, levelName = getPathAndLevel(context.scene.DLCustomExport,
|
||||
context.scene.DLExportPath, context.scene.DLLevelName,
|
||||
context.scene.DLLevelOption)
|
||||
@@ -530,7 +531,7 @@ class SM64_ExportDL(bpy.types.Operator):
|
||||
#p.sort_stats("cumulative").print_stats(2000)
|
||||
self.report({'INFO'}, 'Success!')
|
||||
|
||||
elif context.scene.DLExportType == 'Insertable Binary':
|
||||
elif context.scene.fast64.sm64.exportType == 'Insertable Binary':
|
||||
exportF3DtoInsertableBinary(
|
||||
bpy.path.abspath(context.scene.DLInsertableBinaryPath),
|
||||
finalTransform, obj, context.scene.f3d_type,
|
||||
@@ -601,7 +602,7 @@ class SM64_ExportDL(bpy.types.Operator):
|
||||
if context.mode != 'OBJECT':
|
||||
bpy.ops.object.mode_set(mode = 'OBJECT')
|
||||
applyRotation([obj], math.radians(-90), 'X')
|
||||
if context.scene.DLExportType == 'Binary':
|
||||
if context.scene.fast64.sm64.exportType == 'Binary':
|
||||
if romfileOutput is not None:
|
||||
romfileOutput.close()
|
||||
if tempROM is not None and os.path.exists(bpy.path.abspath(tempROM)):
|
||||
@@ -609,24 +610,17 @@ class SM64_ExportDL(bpy.types.Operator):
|
||||
raisePluginError(self, e)
|
||||
return {'CANCELLED'} # must return a set
|
||||
|
||||
class SM64_ExportDLPanel(bpy.types.Panel):
|
||||
class SM64_ExportDLPanel(SM64_Panel):
|
||||
bl_idname = "SM64_PT_export_dl"
|
||||
bl_label = "SM64 DL Exporter"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
goal = 'Export Displaylist'
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
col = self.layout.column()
|
||||
propsDLE = col.operator(SM64_ExportDL.bl_idname)
|
||||
|
||||
col.prop(context.scene, 'DLExportType')
|
||||
if context.scene.DLExportType == 'C':
|
||||
if context.scene.fast64.sm64.exportType == 'C':
|
||||
col.prop(context.scene, 'DLExportisStatic')
|
||||
|
||||
|
||||
@@ -656,7 +650,7 @@ class SM64_ExportDLPanel(bpy.types.Panel):
|
||||
writeBoxExportType(writeBox, context.scene.DLExportHeaderType,
|
||||
context.scene.DLName, context.scene.DLLevelName, context.scene.DLLevelOption)
|
||||
|
||||
elif context.scene.DLExportType == 'Insertable Binary':
|
||||
elif context.scene.fast64.sm64.exportType == 'Insertable Binary':
|
||||
col.prop(context.scene, 'DLInsertableBinaryPath')
|
||||
else:
|
||||
prop_split(col, context.scene, 'DLExportStart', 'Start Address')
|
||||
@@ -719,16 +713,11 @@ class UnlinkTexRect(bpy.types.Operator):
|
||||
context.scene.texrect.tex = None
|
||||
return {'FINISHED'} # must return a set
|
||||
|
||||
class ExportTexRectDrawPanel(bpy.types.Panel):
|
||||
class ExportTexRectDrawPanel(SM64_Panel):
|
||||
bl_idname = "TEXTURE_PT_export_texrect"
|
||||
bl_label = "SM64 UI Image Exporter"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
goal = 'Export UI Image'
|
||||
decomp_only = True
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
@@ -880,8 +869,6 @@ def sm64_dl_writer_register():
|
||||
name ='Geolayout Pointer', default = '132AA8')
|
||||
bpy.types.Scene.overwriteGeoPtr = bpy.props.BoolProperty(
|
||||
name = "Overwrite geolayout pointer", default = False)
|
||||
bpy.types.Scene.DLExportType = bpy.props.EnumProperty(
|
||||
items = enumExportType, name = 'Export', default = 'C')
|
||||
bpy.types.Scene.DLExportPath = bpy.props.StringProperty(
|
||||
name = 'Directory', subtype = 'FILE_PATH')
|
||||
bpy.types.Scene.DLExportisStatic = bpy.props.BoolProperty(
|
||||
@@ -929,7 +916,6 @@ def sm64_dl_writer_unregister():
|
||||
del bpy.types.Scene.DLExportEnd
|
||||
del bpy.types.Scene.DLExportGeoPtr
|
||||
del bpy.types.Scene.overwriteGeoPtr
|
||||
del bpy.types.Scene.DLExportType
|
||||
del bpy.types.Scene.DLExportPath
|
||||
del bpy.types.Scene.DLExportisStatic
|
||||
del bpy.types.Scene.DLDefinePath
|
||||
|
||||
@@ -11,6 +11,7 @@ from .sm64_constants import *
|
||||
from ..f3d.f3d_material import createF3DMat, update_preset_manual
|
||||
from ..f3d.f3d_parser import *
|
||||
from ..utility import *
|
||||
from ..panels import SM64_Panel, sm64GoalImport
|
||||
|
||||
blender_modes = {'OBJECT', 'BONE'}
|
||||
|
||||
@@ -1196,16 +1197,10 @@ class SM64_ImportGeolayout(bpy.types.Operator):
|
||||
raisePluginError(self, e)
|
||||
return {'CANCELLED'} # must return a set
|
||||
|
||||
class SM64_ImportGeolayoutPanel(bpy.types.Panel):
|
||||
class SM64_ImportGeolayoutPanel(SM64_Panel):
|
||||
bl_idname = "SM64_PT_import_geolayout"
|
||||
bl_label = "SM64 Geolayout Importer"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
goal = sm64GoalImport
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
@@ -1262,4 +1257,4 @@ def sm64_geo_parser_unregister():
|
||||
del bpy.types.Scene.generateArmature
|
||||
del bpy.types.Scene.geoImportAddr
|
||||
del bpy.types.Scene.levelGeoImport
|
||||
del bpy.types.Scene.ignoreSwitch
|
||||
del bpy.types.Scene.ignoreSwitch
|
||||
|
||||
@@ -17,6 +17,7 @@ from .sm64_utility import *
|
||||
|
||||
from ..utility import *
|
||||
from ..operators import ObjectDataExporter
|
||||
from ..panels import SM64_Panel
|
||||
|
||||
def appendSecondaryGeolayout(geoDirPath, geoName1, geoName2, additionalNode = ''):
|
||||
geoPath = os.path.join(geoDirPath, 'geo.inc.c')
|
||||
@@ -2097,7 +2098,7 @@ class SM64_ExportGeolayoutObject(ObjectDataExporter):
|
||||
|
||||
saveTextures = bpy.context.scene.saveTextures or bpy.context.scene.ignoreTextureRestrictions
|
||||
|
||||
if context.scene.geoExportType == 'C':
|
||||
if context.scene.fast64.sm64.exportType == 'C':
|
||||
exportPath, levelName = getPathAndLevel(context.scene.geoCustomExport,
|
||||
context.scene.geoExportPath, context.scene.geoLevelName,
|
||||
context.scene.geoLevelOption)
|
||||
@@ -2113,7 +2114,7 @@ class SM64_ExportGeolayoutObject(ObjectDataExporter):
|
||||
context.scene.geoExportHeaderType,
|
||||
context.scene.geoName, context.scene.geoStructName, levelName, context.scene.geoCustomExport, DLFormat.Static)
|
||||
self.report({'INFO'}, 'Success!')
|
||||
elif context.scene.geoExportType == 'Insertable Binary':
|
||||
elif context.scene.fast64.sm64.exportType == 'Insertable Binary':
|
||||
exportGeolayoutObjectInsertableBinary(obj,
|
||||
finalTransform, context.scene.f3d_type,
|
||||
context.scene.isHWv1,
|
||||
@@ -2200,7 +2201,7 @@ class SM64_ExportGeolayoutObject(ObjectDataExporter):
|
||||
self.cleanup_temp_object_data()
|
||||
applyRotation([obj], math.radians(-90), 'X')
|
||||
|
||||
if context.scene.geoExportType == 'Binary':
|
||||
if context.scene.fast64.sm64.exportType == 'Binary':
|
||||
if romfileOutput is not None:
|
||||
romfileOutput.close()
|
||||
if tempROM is not None and os.path.exists(bpy.path.abspath(tempROM)):
|
||||
@@ -2280,7 +2281,7 @@ class SM64_ExportGeolayoutArmature(bpy.types.Operator):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
bpy.ops.object.transform_apply(location = False, rotation = True,
|
||||
scale = True, properties = False)
|
||||
if context.scene.geoExportType == 'C':
|
||||
if context.scene.fast64.sm64.exportType == 'C':
|
||||
exportPath, levelName = getPathAndLevel(context.scene.geoCustomExport,
|
||||
context.scene.geoExportPath, context.scene.geoLevelName,
|
||||
context.scene.geoLevelOption)
|
||||
@@ -2298,7 +2299,7 @@ class SM64_ExportGeolayoutArmature(bpy.types.Operator):
|
||||
context.scene.geoName, context.scene.geoStructName, levelName, context.scene.geoCustomExport, DLFormat.Static)
|
||||
starSelectWarning(self, fileStatus)
|
||||
self.report({'INFO'}, 'Success!')
|
||||
elif context.scene.geoExportType == 'Insertable Binary':
|
||||
elif context.scene.fast64.sm64.exportType == 'Insertable Binary':
|
||||
exportGeolayoutArmatureInsertableBinary(armatureObj, obj,
|
||||
finalTransform, context.scene.f3d_type,
|
||||
context.scene.isHWv1,
|
||||
@@ -2384,7 +2385,7 @@ class SM64_ExportGeolayoutArmature(bpy.types.Operator):
|
||||
applyRotation([armatureObj] + linkedArmatures,
|
||||
math.radians(-90), 'X')
|
||||
|
||||
if context.scene.geoExportType == 'Binary':
|
||||
if context.scene.fast64.sm64.exportType == 'Binary':
|
||||
if romfileOutput is not None:
|
||||
romfileOutput.close()
|
||||
if tempROM is not None and os.path.exists(bpy.path.abspath(tempROM)):
|
||||
@@ -2395,16 +2396,10 @@ class SM64_ExportGeolayoutArmature(bpy.types.Operator):
|
||||
raisePluginError(self, e)
|
||||
return {'CANCELLED'} # must return a set
|
||||
|
||||
class SM64_ExportGeolayoutPanel(bpy.types.Panel):
|
||||
class SM64_ExportGeolayoutPanel(SM64_Panel):
|
||||
bl_idname = "SM64_PT_export_geolayout"
|
||||
bl_label = "SM64 Geolayout Exporter"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
goal = 'Export Object/Actor/Anim'
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
@@ -2412,8 +2407,7 @@ class SM64_ExportGeolayoutPanel(bpy.types.Panel):
|
||||
propsGeoE = col.operator(SM64_ExportGeolayoutArmature.bl_idname)
|
||||
propsGeoE = col.operator(SM64_ExportGeolayoutObject.bl_idname)
|
||||
|
||||
col.prop(context.scene, 'geoExportType')
|
||||
if context.scene.geoExportType == 'C':
|
||||
if context.scene.fast64.sm64.exportType == 'C':
|
||||
if not bpy.context.scene.ignoreTextureRestrictions and context.scene.saveTextures:
|
||||
if context.scene.geoCustomExport:
|
||||
prop_split(col, context.scene, 'geoTexDir', 'Texture Include Path')
|
||||
@@ -2502,7 +2496,7 @@ class SM64_ExportGeolayoutPanel(bpy.types.Panel):
|
||||
context.scene.geoLevelOption)
|
||||
|
||||
#extendedRAMLabel(col)
|
||||
elif context.scene.geoExportType == 'Insertable Binary':
|
||||
elif context.scene.fast64.sm64.exportType == 'Insertable Binary':
|
||||
col.prop(context.scene, 'geoInsertableBinaryPath')
|
||||
else:
|
||||
prop_split(col, context.scene, 'geoExportStart', 'Start Address')
|
||||
@@ -2562,8 +2556,6 @@ def sm64_geo_writer_register():
|
||||
name = 'Dump geolayout as text', default = False)
|
||||
bpy.types.Scene.textDumpGeoPath = bpy.props.StringProperty(
|
||||
name ='Text Dump Path', subtype = 'FILE_PATH')
|
||||
bpy.types.Scene.geoExportType = bpy.props.EnumProperty(
|
||||
items = enumExportType, name = 'Export', default = 'C')
|
||||
bpy.types.Scene.geoExportPath = bpy.props.StringProperty(
|
||||
name = 'Directory', subtype = 'FILE_PATH')
|
||||
bpy.types.Scene.geoUseBank0 = bpy.props.BoolProperty(name = 'Use Bank 0')
|
||||
@@ -2612,7 +2604,6 @@ def sm64_geo_writer_unregister():
|
||||
del bpy.types.Scene.modelID
|
||||
del bpy.types.Scene.textDumpGeo
|
||||
del bpy.types.Scene.textDumpGeoPath
|
||||
del bpy.types.Scene.geoExportType
|
||||
del bpy.types.Scene.geoExportPath
|
||||
del bpy.types.Scene.geoUseBank0
|
||||
del bpy.types.Scene.geoRAMAddr
|
||||
|
||||
@@ -10,6 +10,7 @@ from .sm64_texscroll import *
|
||||
from .sm64_utility import *
|
||||
|
||||
from ..utility import *
|
||||
from ..panels import SM64_Panel
|
||||
from ..operators import ObjectDataExporter
|
||||
|
||||
levelDefineArgs = {
|
||||
@@ -1024,16 +1025,11 @@ class SM64_ExportLevel(ObjectDataExporter):
|
||||
raisePluginError(self, e)
|
||||
return {'CANCELLED'} # must return a set
|
||||
|
||||
class SM64_ExportLevelPanel(bpy.types.Panel):
|
||||
class SM64_ExportLevelPanel(SM64_Panel):
|
||||
bl_idname = "SM64_PT_export_level"
|
||||
bl_label = "SM64 Level Exporter"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'SM64'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
goal = 'Export Level'
|
||||
decomp_only = True
|
||||
|
||||
# called every frame
|
||||
def draw(self, context):
|
||||
|
||||
Reference in New Issue
Block a user