diff --git a/fast64_internal/f3d/f3d_material.py b/fast64_internal/f3d/f3d_material.py index 890176c34..df2f7025b 100644 --- a/fast64_internal/f3d/f3d_material.py +++ b/fast64_internal/f3d/f3d_material.py @@ -768,11 +768,11 @@ def tmemUsageUI(layout, textureProp): # cycle type = 1 cycle class F3DPanel(Panel): bl_label = "F3D Material" + bl_parent_id = "EEVEE_MATERIAL_PT_context_material" bl_idname = "MATERIAL_PT_F3D_Inspector" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "material" - bl_options = {"HIDE_HEADER"} def ui_prop(self, material, layout, name, setName, setProp, showCheckBox): nodes = material.node_tree.nodes @@ -1418,9 +1418,6 @@ def draw(self, context): f3dMat = material.f3d_mat settings = f3dMat.rdp_settings layout.prop(context.scene, "f3d_simple", text="Show Simplified UI") - layout = layout.box() - titleCol = layout.column() - titleCol.box().label(text="F3D Material Inspector") if material.mat_ver < 5: box = layout.box().column() @@ -1465,11 +1462,11 @@ def draw(self, context): class F3DMeshPanel(Panel): bl_label = "F3D Mesh Inspector" + bl_parent_id = "OBJECT_PT_context_object" bl_idname = "F3D_PT_Mesh_Inspector" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -1477,8 +1474,7 @@ def poll(cls, context): def draw(self, context): new_gbi = not get_F3D_GBI().F3D_OLD_GBI - col = self.layout.box().column() - col.box().label(text=self.bl_label, icon="MESH_DATA") + col = self.layout.column() row = col.row() row.enabled = new_gbi row.prop(context.object, "use_f3d_culling") @@ -1494,14 +1490,7 @@ def ui_tileScroll(tex, name, layout): row.prop(tex.tile_scroll, "interval", text="Interval:") -def ui_procAnimVecEnum(material, procAnimVec, layout, name, vecType, useDropdown, useTex0, useTex1): - layout = layout.box() - box = layout.column() - if useDropdown: - layout.prop(procAnimVec, "menu", text=name, icon="TRIA_DOWN" if procAnimVec.menu else "TRIA_RIGHT") - else: - layout.box().label(text=name) - +def ui_procAnimVecEnum(material, procAnimVec, layout, vecType, useDropdown, useTex0, useTex1): if not useDropdown or procAnimVec.menu: box = layout.column() combinedOption = None @@ -1524,8 +1513,6 @@ def ui_procAnimVecEnum(material, procAnimVec, layout, name, vecType, useDropdown pass if useTex0 or useTex1: - layout.box().label(text="SM64 SetTileSize Texture Scroll") - if useTex0: ui_tileScroll(material.tex0, "Texture 0 Speed", layout) @@ -1565,8 +1552,8 @@ def ui_procAnimField(procAnimField, layout, name): split2.prop(procAnimField, "noiseAmplitude") -def ui_procAnim(material, layout, useTex0, useTex1, title, useDropdown): - ui_procAnimVecEnum(material.f3d_mat, material.f3d_mat.UVanim0, layout, title, "UV", useDropdown, useTex0, useTex1) +def ui_procAnim(material, layout, useTex0, useTex1, useDropdown): + ui_procAnimVecEnum(material.f3d_mat, material.f3d_mat.UVanim0, layout, "UV", useDropdown, useTex0, useTex1) def update_node_values(self, context, update_preset): @@ -3891,10 +3878,10 @@ def draw_rdp_world_defaults(layout: UILayout, scene: Scene): class DefaultRDPSettingsPanel(Panel): bl_label = "RDP Default Settings" bl_idname = "WORLD_PT_RDP_Default_Inspector" + bl_parent_id = "WORLD_PT_context_world" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "world" - bl_options = {"HIDE_HEADER"} def draw(self, context): draw_rdp_world_defaults(self.layout, context.scene) @@ -4991,7 +4978,6 @@ def mat_register(): World.menu_upper = bpy.props.BoolProperty() World.menu_lower = bpy.props.BoolProperty() World.menu_other = bpy.props.BoolProperty() - World.menu_layers = bpy.props.BoolProperty() Material.is_f3d = bpy.props.BoolProperty() Material.mat_ver = bpy.props.IntProperty(default=1) diff --git a/fast64_internal/f3d/flipbook.py b/fast64_internal/f3d/flipbook.py index 2377dd069..acabef0e3 100644 --- a/fast64_internal/f3d/flipbook.py +++ b/fast64_internal/f3d/flipbook.py @@ -211,7 +211,6 @@ def drawFlipbookGroupProperty( checkFlipbookReference: Callable[[str], bool], drawFlipbookRequirementMessage: Callable[[bpy.types.UILayout], None], ): - layout.box().column().label(text="Flipbook Properties") if drawFlipbookRequirementMessage is not None: drawFlipbookRequirementMessage(layout) for i in range(2): @@ -275,12 +274,12 @@ def flipbookAnimHandler(dummy): class Flipbook_MaterialPanel(bpy.types.Panel): - bl_label = "Flipbook Material" + bl_label = "Flipbook Properties" bl_idname = "MATERIAL_PT_Flipbook_Material_Inspector" + bl_parent_id = "MATERIAL_PT_OOT_Material_Inspector" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "material" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -298,7 +297,7 @@ def draw(self, context): checkFlipbookReference = None drawFlipbookRequirementMessage = None - drawFlipbookGroupProperty(col.box().column(), mat, checkFlipbookReference, drawFlipbookRequirementMessage) + drawFlipbookGroupProperty(col, mat, checkFlipbookReference, drawFlipbookRequirementMessage) def setTexNodeImage(material: bpy.types.Material, texIndex: int, flipbookIndex: int): diff --git a/fast64_internal/sm64/__init__.py b/fast64_internal/sm64/__init__.py index 81fdbf596..7de9deb22 100644 --- a/fast64_internal/sm64/__init__.py +++ b/fast64_internal/sm64/__init__.py @@ -1,3 +1,6 @@ +from bpy.utils import register_class, unregister_class +from bpy.types import Panel + from .settings import ( settings_props_register, settings_props_unregister, @@ -91,7 +94,28 @@ ) +class SM64_MaterialPanel(Panel): + bl_label = "SM64 Material" + bl_idname = "MATERIAL_PT_SM64_Material_Inspector" + bl_parent_id = "EEVEE_MATERIAL_PT_context_material" + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "material" + + @classmethod + def poll(cls, context): + return context.material is not None and context.material.is_f3d and context.scene.gameEditorMode == "SM64" + + def draw(self, context): + pass + + +panels = (SM64_MaterialPanel,) + + def sm64_panel_register(): + for cls in panels: + register_class(cls) settings_panels_register() tools_panels_register() sm64_col_panel_register() @@ -107,6 +131,8 @@ def sm64_panel_register(): def sm64_panel_unregister(): + for cls in panels: + unregister_class(cls) settings_panels_unregister() tools_panels_unregister() sm64_col_panel_unregister() diff --git a/fast64_internal/sm64/sm64_camera.py b/fast64_internal/sm64/sm64_camera.py index 2fdab9f0f..a0f56d5bb 100644 --- a/fast64_internal/sm64/sm64_camera.py +++ b/fast64_internal/sm64/sm64_camera.py @@ -43,12 +43,12 @@ class CameraSettingsPanel(bpy.types.Panel): - bl_label = "Camera Settings" + bl_label = "SM64 Camera Settings" bl_idname = "Camera_Inspector" + bl_parent_id = "DATA_PT_context_camera" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "data" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): diff --git a/fast64_internal/sm64/sm64_collision.py b/fast64_internal/sm64/sm64_collision.py index 39e8a0960..d8e55c2c1 100644 --- a/fast64_internal/sm64/sm64_collision.py +++ b/fast64_internal/sm64/sm64_collision.py @@ -191,16 +191,12 @@ def to_binary(self): class SM64CollisionPanel(bpy.types.Panel): - bl_label = "Collision Inspector" + bl_label = "Collision" bl_idname = "MATERIAL_PT_SM64_Collision_Inspector" + bl_parent_id = "MATERIAL_PT_SM64_Material_Inspector" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "material" - bl_options = {"HIDE_HEADER"} - - @classmethod - def poll(cls, context): - return context.scene.gameEditorMode == "SM64" and context.material is not None def paramInfo(self, layout): box = layout.box() @@ -210,32 +206,32 @@ def paramInfo(self, layout): box.label(text="Second byte is a rotation value.") def draw(self, context): - box = self.layout.box() + col = self.layout.column() # box.label(text = 'Collision Inspector') material = context.material if not material.collision_all_options: - prop_split(box, material, "collision_type_simple", "SM64 Collision Type") + prop_split(col, material, "collision_type_simple", "SM64 Collision Type") if material.collision_type_simple == "Custom": - prop_split(box, material, "collision_custom", "Collision Value") + prop_split(col, material, "collision_custom", "Collision Value") # if material.collision_type_simple in specialSurfaces: # prop_split(box, material, 'collision_param', 'Parameter') # self.paramInfo(box) else: - prop_split(box, material, "collision_type", "SM64 Collision Type All") + prop_split(col, material, "collision_type", "SM64 Collision Type All") if material.collision_type == "Custom": - prop_split(box, material, "collision_custom", "Collision Value") + prop_split(col, material, "collision_custom", "Collision Value") # if material.collision_type in specialSurfaces: # prop_split(box, material, 'collision_param', 'Parameter') # self.paramInfo(box) - split = box.split(factor=0.5) + split = col.split(factor=0.5) split.label(text="") split.prop(material, "collision_all_options") - box.prop(material, "use_collision_param") + col.prop(material, "use_collision_param") if material.use_collision_param: - prop_split(box, material, "collision_param", "Parameter") - self.paramInfo(box) + prop_split(col, material, "collision_param", "Parameter") + self.paramInfo(col) # infoBox = box.box() # infoBox.label(text = \ diff --git a/fast64_internal/sm64/sm64_f3d_writer.py b/fast64_internal/sm64/sm64_f3d_writer.py index 1aad38346..815cd3a00 100644 --- a/fast64_internal/sm64/sm64_f3d_writer.py +++ b/fast64_internal/sm64/sm64_f3d_writer.py @@ -857,10 +857,10 @@ def draw(self, context): class SM64_DrawLayersPanel(bpy.types.Panel): bl_label = "SM64 Draw Layers" bl_idname = "WORLD_PT_SM64_Draw_Layers_Panel" + bl_parent_id = "WORLD_PT_context_world" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "world" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -881,38 +881,33 @@ def draw(self, context): def drawLayerUI(layout, drawLayer, world): - box = layout.box() - box.label(text="Layer " + str(drawLayer)) - row = box.row() + layout.label(text="Layer " + str(drawLayer)) + row = layout.row() row.prop(world, "draw_layer_" + str(drawLayer) + "_cycle_1", text="") row.prop(world, "draw_layer_" + str(drawLayer) + "_cycle_2", text="") -class SM64_MaterialPanel(bpy.types.Panel): - bl_label = "SM64 Material" - bl_idname = "MATERIAL_PT_SM64_Material_Inspector" +class SM64_ScrollPanel(bpy.types.Panel): + bl_label = "Scrolling" + bl_idname = "MATERIAL_PT_SM64_Scroll" + bl_parent_id = "MATERIAL_PT_SM64_Material_Inspector" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "material" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): - return context.material is not None and context.material.is_f3d and context.scene.gameEditorMode == "SM64" + use_dict = all_combiner_uses(context.material.f3d_mat) + return use_dict["Texture 0"] or use_dict["Texture 1"] def draw(self, context): - layout = self.layout + col = self.layout.column() material = context.material - col = layout.column() - - if material.mat_ver > 3: - f3dMat = material.f3d_mat - else: - f3dMat = material + f3dMat = material.f3d_mat useDict = all_combiner_uses(f3dMat) if useDict["Texture"]: - ui_procAnim(material, col, useDict["Texture 0"], useDict["Texture 1"], "SM64 UV Texture Scroll", False) + ui_procAnim(material, col, useDict["Texture 0"], useDict["Texture 1"], False) sm64_dl_writer_classes = ( @@ -922,7 +917,7 @@ def draw(self, context): ) sm64_dl_writer_panel_classes = ( - SM64_MaterialPanel, + SM64_ScrollPanel, SM64_DrawLayersPanel, SM64_ExportDLPanel, ExportTexRectDrawPanel, diff --git a/fast64_internal/sm64/sm64_geolayout_bone.py b/fast64_internal/sm64/sm64_geolayout_bone.py index 855d16808..35294833c 100644 --- a/fast64_internal/sm64/sm64_geolayout_bone.py +++ b/fast64_internal/sm64/sm64_geolayout_bone.py @@ -83,7 +83,6 @@ def drawGeoInfo(panel: Panel, bone: Bone): bone_props: "SM64_BoneProperties" = bone.fast64.sm64 - panel.layout.box().label(text="Geolayout Inspector") if bone is None: panel.layout.label(text="Edit geolayout properties in Pose mode.") return @@ -168,12 +167,12 @@ def drawGeoInfo(panel: Panel, bone: Bone): class GeolayoutBonePanel(Panel): - bl_label = "Geolayout Inspector" + bl_label = "SM64 Bone Inspector" bl_idname = "BONE_PT_SM64_Geolayout_Inspector" + bl_parent_id = "BONE_PT_context_bone" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "bone" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -184,12 +183,12 @@ def draw(self, context): class GeolayoutArmaturePanel(Panel): - bl_label = "Geolayout Armature Inspector" + bl_label = "SM64 Armature Inspector" bl_idname = "OBJECT_PT_SM64_Armature_Geolayout_Inspector" + bl_parent_id = "OBJECT_PT_context_object" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -201,8 +200,7 @@ def poll(cls, context): def draw(self, context): obj = context.object - col = self.layout.column().box() - col.box().label(text="Armature Geolayout Inspector") + col = self.layout.column() col.prop(obj, "use_render_area") if obj.use_render_area: @@ -218,12 +216,12 @@ def drawLayerWarningBox(layout, prop, data): class GeolayoutObjectPanel(Panel): - bl_label = "Object Geolayout Inspector" - bl_idname = "OBJECT_PT_SM64_Object_Geolayout_Inspector" + bl_label = "SM64 Geolayout" + bl_idname = "OBJECT_PT_SM64_Geolayout" + bl_parent_id = "OBJECT_PT_context_object" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -235,8 +233,7 @@ def poll(cls, context): def draw(self, context): obj = context.object - col = self.layout.column().box() - col.box().label(text="Object Geolayout Inspector") + col = self.layout.column() prop_split(col, obj, "geo_cmd_static", "Geolayout Command") drawLayerWarningBox(col, obj, "draw_layer_static") diff --git a/fast64_internal/sm64/sm64_objects.py b/fast64_internal/sm64/sm64_objects.py index f2243a2e2..16fa50819 100644 --- a/fast64_internal/sm64/sm64_objects.py +++ b/fast64_internal/sm64/sm64_objects.py @@ -1071,12 +1071,12 @@ def invoke(self, context, event): class SM64ObjectPanel(bpy.types.Panel): - bl_label = "Object Inspector" + bl_label = "SM64 Empty Inspector" bl_idname = "OBJECT_PT_SM64_Object_Inspector" + bl_parent_id = "OBJECT_PT_context_object" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -1173,117 +1173,114 @@ def draw_behavior_params(self, obj: bpy.types.Object, parent_box: bpy.types.UILa parent_box.separator() def draw(self, context): - prop_split(self.layout, context.scene, "gameEditorMode", "Game") - box = self.layout.box().column() - column = self.layout.box().column() # added just for puppycam trigger importing - box.box().label(text="SM64 Object Inspector") + col = self.layout.column() obj = context.object props = obj.fast64.sm64 - prop_split(box, obj, "sm64_obj_type", "Object Type") + prop_split(col, obj, "sm64_obj_type", "Object Type") if obj.sm64_obj_type == "Object": - prop_split(box, obj, "sm64_model_enum", "Model") + prop_split(col, obj, "sm64_model_enum", "Model") if obj.sm64_model_enum == "Custom": - prop_split(box, obj, "sm64_obj_model", "Model ID") - box.operator(SearchModelIDEnumOperator.bl_idname, icon="VIEWZOOM") - box.box().label(text="Model IDs defined in include/model_ids.h.") - prop_split(box, obj, "sm64_behaviour_enum", "Behaviour") + prop_split(col, obj, "sm64_obj_model", "Model ID") + col.operator(SearchModelIDEnumOperator.bl_idname, icon="VIEWZOOM") + col.box().label(text="Model IDs defined in include/model_ids.h.") + prop_split(col, obj, "sm64_behaviour_enum", "Behaviour") if obj.sm64_behaviour_enum == "Custom": - prop_split(box, obj, "sm64_obj_behaviour", "Behaviour Name") - box.operator(SearchBehaviourEnumOperator.bl_idname, icon="VIEWZOOM") - behaviourLabel = box.box() + prop_split(col, obj, "sm64_obj_behaviour", "Behaviour Name") + col.operator(SearchBehaviourEnumOperator.bl_idname, icon="VIEWZOOM") + behaviourLabel = col.box() behaviourLabel.label(text="Behaviours defined in include/behaviour_data.h.") behaviourLabel.label(text="Actual contents in data/behaviour_data.c.") - self.draw_behavior_params(obj, box) - self.draw_acts(obj, box) + self.draw_behavior_params(obj, col) + self.draw_acts(obj, col) elif obj.sm64_obj_type == "Macro": - prop_split(box, obj, "sm64_macro_enum", "Preset") + prop_split(col, obj, "sm64_macro_enum", "Preset") if obj.sm64_macro_enum == "Custom": - prop_split(box, obj, "sm64_obj_preset", "Preset Name") - box.operator(SearchMacroEnumOperator.bl_idname, icon="VIEWZOOM") - box.box().label(text="Macro presets defined in include/macro_preset_names.h.") - box.prop(obj, "sm64_obj_set_bparam", text="Set Behaviour Parameter") + prop_split(col, obj, "sm64_obj_preset", "Preset Name") + col.operator(SearchMacroEnumOperator.bl_idname, icon="VIEWZOOM") + col.box().label(text="Macro presets defined in include/macro_preset_names.h.") + col.prop(obj, "sm64_obj_set_bparam", text="Set Behaviour Parameter") if obj.sm64_obj_set_bparam: - self.draw_behavior_params(obj, box) + self.draw_behavior_params(obj, col) elif obj.sm64_obj_type == "Special": - prop_split(box, obj, "sm64_special_enum", "Preset") + prop_split(col, obj, "sm64_special_enum", "Preset") if obj.sm64_special_enum == "Custom": - prop_split(box, obj, "sm64_obj_preset", "Preset Name") - box.operator(SearchSpecialEnumOperator.bl_idname, icon="VIEWZOOM") - box.box().label(text="Special presets defined in include/special_preset_names.h.") - box.prop(obj, "sm64_obj_set_yaw", text="Set Yaw") + prop_split(col, obj, "sm64_obj_preset", "Preset Name") + col.operator(SearchSpecialEnumOperator.bl_idname, icon="VIEWZOOM") + col.box().label(text="Special presets defined in include/special_preset_names.h.") + col.prop(obj, "sm64_obj_set_yaw", text="Set Yaw") if obj.sm64_obj_set_yaw: - box.prop(obj, "sm64_obj_set_bparam", text="Set Behaviour Parameter") + col.prop(obj, "sm64_obj_set_bparam", text="Set Behaviour Parameter") if obj.sm64_obj_set_bparam: - self.draw_behavior_params(obj, box) + self.draw_behavior_params(obj, col) elif obj.sm64_obj_type == "Mario Start": - prop_split(box, obj, "sm64_obj_mario_start_area", "Area") + prop_split(col, obj, "sm64_obj_mario_start_area", "Area") elif obj.sm64_obj_type == "Trajectory": pass elif obj.sm64_obj_type == "Whirlpool": - prop_split(box, obj, "whirpool_index", "Index") - prop_split(box, obj, "whirpool_condition", "Condition") - prop_split(box, obj, "whirpool_strength", "Strength") + prop_split(col, obj, "whirpool_index", "Index") + prop_split(col, obj, "whirpool_condition", "Condition") + prop_split(col, obj, "whirpool_strength", "Strength") pass - elif obj.sm64_obj_type == "Water Box": - prop_split(box, obj, "waterBoxType", "Water Box Type") - box.box().label(text="Water box area defined by top face of box shaped empty.") - box.box().label(text="No rotation allowed.") + elif obj.sm64_obj_type == "Water col": + prop_split(col, obj, "watercolType", "Water col Type") + col.box().label(text="Water col area defined by top face of col shaped empty.") + col.box().label(text="No rotation allowed.") elif obj.sm64_obj_type == "Level Root": levelObj = obj.fast64.sm64.level if obj.useBackgroundColor: - prop_split(box, obj, "backgroundColor", "Background Color") - box.prop(obj, "useBackgroundColor") + prop_split(col, obj, "backgroundColor", "Background Color") + col.prop(obj, "useBackgroundColor") else: - # prop_split(box, obj, 'backgroundID', 'Background ID') - prop_split(box, obj, "background", "Background") + # prop_split(col, obj, 'backgroundID', 'Background ID') + prop_split(col, obj, "background", "Background") if obj.background == "CUSTOM": - prop_split(box, levelObj, "backgroundID", "Custom ID") - prop_split(box, levelObj, "backgroundSegment", "Custom Background Segment") - segmentExportBox = box.box() + prop_split(col, levelObj, "backgroundID", "Custom ID") + prop_split(col, levelObj, "backgroundSegment", "Custom Background Segment") + segmentExportBox = col.box() segmentExportBox.label( text=f"Exported Segment: _{levelObj.backgroundSegment}_{context.scene.fast64.sm64.compression_format}SegmentRomStart" ) - box.prop(obj, "useBackgroundColor") - # box.box().label(text = 'Background IDs defined in include/geo_commands.h.') - box.prop(obj, "actSelectorIgnore") - box.prop(obj, "setAsStartLevel") - obj.fast64.sm64.segment_loads.draw_props(box) - prop_split(box, obj, "acousticReach", "Acoustic Reach") - obj.starGetCutscenes.draw(box) + col.prop(obj, "useBackgroundColor") + # col.box().label(text = 'Background IDs defined in include/geo_commands.h.') + col.prop(obj, "actSelectorIgnore") + col.prop(obj, "setAsStartLevel") + obj.fast64.sm64.segment_loads.draw_props(col) + prop_split(col, obj, "acousticReach", "Acoustic Reach") + obj.starGetCutscenes.draw(bocolx) elif obj.sm64_obj_type == "Area Root": area_props = props.area # Code that used to be in area inspector - prop_split(box, obj, "areaIndex", "Area Index") - box.prop(obj, "noMusic", text="Disable Music") + prop_split(col, obj, "areaIndex", "Area Index") + col.prop(obj, "noMusic", text="Disable Music") if not obj.noMusic: - prop_split(box, obj, "music_preset", "Music Preset") - prop_split(box, obj, "musicSeqEnum", "Music Sequence") + prop_split(col, obj, "music_preset", "Music Preset") + prop_split(col, obj, "musicSeqEnum", "Music Sequence") if obj.musicSeqEnum == "Custom": - prop_split(box, obj, "music_seq", "") + prop_split(col, obj, "music_seq", "") - prop_split(box, obj, "terrainEnum", "Terrain") + prop_split(col, obj, "terrainEnum", "Terrain") if obj.terrainEnum == "Custom": - prop_split(box, obj, "terrain_type", "") - prop_split(box, obj, "envOption", "Environment Type") + prop_split(col, obj, "terrain_type", "") + prop_split(col, obj, "envOption", "Environment Type") if obj.envOption == "Custom": - prop_split(box, obj, "envType", "") - prop_split(box, obj, "camOption", "Camera Type") + prop_split(col, obj, "envType", "") + prop_split(col, obj, "camOption", "Camera Type") if obj.camOption == "Custom": - prop_split(box, obj, "camType", "") - camBox = box.box() + prop_split(col, obj, "camType", "") + camBox = col.box() camBox.label(text="Warning: Camera modes can be overriden by area specific camera code.") camBox.label(text="Check the switch statment in camera_course_processing() in src/game/camera.c.") - fog_box = box.box().column() + fog_box = col.box().column() fog_box.prop(area_props, "set_fog") fog_props = fog_box.column() fog_props.enabled = area_props.set_fog @@ -1300,28 +1297,28 @@ def draw(self, context): prop_split(fog_props, obj, "area_fog_position", "Position") if obj.areaIndex == 1 or obj.areaIndex == 2 or obj.areaIndex == 3: - prop_split(box, obj, "echoLevel", "Echo Level") + prop_split(col, obj, "echoLevel", "Echo Level") if obj.areaIndex == 1 or obj.areaIndex == 2 or obj.areaIndex == 3 or obj.areaIndex == 4: - box.prop(obj, "zoomOutOnPause") + col.prop(obj, "zoomOutOnPause") - box.prop(area_props, "disable_background") + col.prop(area_props, "disable_background") - areaLayout = box.box() + areaLayout = col.box() areaLayout.enabled = not obj.fast64.sm64.area.disable_background areaLayout.prop(obj, "areaOverrideBG") if obj.areaOverrideBG: prop_split(areaLayout, obj, "areaBGColor", "Background Color") - box.prop(obj, "showStartDialog") + col.prop(obj, "showStartDialog") if obj.showStartDialog: - prop_split(box, obj, "startDialog", "Start Dialog") - dialogBox = box.box() + prop_split(col, obj, "startDialog", "Start Dialog") + dialogBox = col.box() dialogBox.label(text="See text/us/dialogs.h for values.") dialogBox.label(text="See load_level_init_text() in src/game/level_update.c for conditions.") - box.prop(obj, "enableRoomSwitch") + col.prop(obj, "enableRoomSwitch") if obj.enableRoomSwitch: - infoBox = box.box() + infoBox = col.box() infoBox.label( text="Every child hierarchy of the area root will be treated as its own room (except for the first one.)" ) @@ -1329,65 +1326,65 @@ def draw(self, context): text='You can use empties with the "None" type as empty geolayout nodes to group related geometry under.' ) infoBox.label(text="Children will ordered alphabetically, with the first child being always visible.") - box.prop(obj, "useDefaultScreenRect") + col.prop(obj, "useDefaultScreenRect") if not obj.useDefaultScreenRect: - prop_split(box, obj, "screenPos", "Screen Position") - prop_split(box, obj, "screenSize", "Screen Size") + prop_split(col, obj, "screenPos", "Screen Position") + prop_split(col, obj, "screenSize", "Screen Size") - prop_split(box, obj, "clipPlanes", "Clip Planes") + prop_split(col, obj, "clipPlanes", "Clip Planes") - box.label(text="Warp Nodes") - box.operator(AddWarpNode.bl_idname).option = len(obj.warpNodes) + col.label(text="Warp Nodes") + col.operator(AddWarpNode.bl_idname).option = len(obj.warpNodes) for i in range(len(obj.warpNodes)): - drawWarpNodeProperty(box, obj.warpNodes[i], i) + drawWarpNodeProperty(col, obj.warpNodes[i], i) elif obj.sm64_obj_type == "Camera Volume": - prop_split(box, obj, "cameraVolumeFunction", "Camera Function") - box.prop(obj, "cameraVolumeGlobal") - box.box().label(text="Only vertical axis rotation allowed.") + prop_split(col, obj, "cameraVolumeFunction", "Camera Function") + col.prop(obj, "cameraVolumeGlobal") + col.box().label(text="Only vertical axis rotation allowed.") elif obj.sm64_obj_type == "Puppycam Volume": puppycamProp = obj.puppycamProp - prop_split(column, puppycamProp, "puppycamVolumeFunction", "Puppycam Function") - column.prop(puppycamProp, "puppycamVolumePermaswap") - column.prop(puppycamProp, "puppycamUseFlags") + prop_split(col, puppycamProp, "puppycamVolumeFunction", "Puppycam Function") + col.prop(puppycamProp, "puppycamVolumePermaswap") + col.prop(puppycamProp, "puppycamUseFlags") - column.prop(puppycamProp, "puppycamUseEmptiesForPos") + col.prop(puppycamProp, "puppycamUseEmptiesForPos") if puppycamProp.puppycamUseEmptiesForPos: - column.label(text="Fixed Camera Position (Optional)") - column.prop_search(puppycamProp, "puppycamCamPos", bpy.data, "objects", text="") + col.label(text="Fixed Camera Position (Optional)") + col.prop_search(puppycamProp, "puppycamCamPos", bpy.data, "objects", text="") - column.label(text="Fixed Camera Focus (Optional)") - column.prop_search(puppycamProp, "puppycamCamFocus", bpy.data, "objects", text="") + col.label(text="Fixed Camera Focus (Optional)") + col.prop_search(puppycamProp, "puppycamCamFocus", bpy.data, "objects", text="") else: - column.label(text="Fixed Camera Position (Optional)") - column.prop(puppycamProp, "puppycamCamera") + col.label(text="Fixed Camera Position (Optional)") + col.prop(puppycamProp, "puppycamCamera") if puppycamProp.puppycamCamera is not None: - column.box().label(text="FOV not exported, only for preview camera.") - prop_split(column, puppycamProp, "puppycamFOV", "Camera FOV") - column.operator("mesh.puppycam_setup_camera", text="Setup Camera", icon="VIEW_CAMERA") + col.box().label(text="FOV not exported, only for preview camera.") + prop_split(col, puppycamProp, "puppycamFOV", "Camera FOV") + col.operator("mesh.puppycam_setup_camera", text="Setup Camera", icon="VIEW_CAMERA") if puppycamProp.puppycamUseFlags: for i, flagSet in enumerate(enumPuppycamFlags): - column.prop(puppycamProp, flagSet[0]) + col.prop(puppycamProp, flagSet[0]) else: - prop_split(column, puppycamProp, "puppycamMode", "Camera Mode") + prop_split(col, puppycamProp, "puppycamMode", "Camera Mode") if puppycamProp.puppycamMode == "Custom": - prop_split(column, puppycamProp, "puppycamType", "") + prop_split(col, puppycamProp, "puppycamType", "") - column.box().label(text="No rotation allowed.") + col.box().label(text="No rotation allowed.") elif obj.sm64_obj_type == "Switch": - prop_split(box, obj, "switchFunc", "Function") - prop_split(box, obj, "switchParam", "Parameter") - box.box().label(text="Children will ordered alphabetically.") + prop_split(col, obj, "switchFunc", "Function") + prop_split(col, obj, "switchParam", "Parameter") + col.box().label(text="Children will ordered alphabetically.") elif obj.sm64_obj_type in inlineGeoLayoutObjects: - self.draw_inline_obj(box, obj) + self.draw_inline_obj(col, obj) elif obj.sm64_obj_type == "None": - box.box().label(text="This can be used as an empty transform node in a geolayout hierarchy.") + multilineLabel(col, "This can be used as an empty transform\nnode in a geolayout hierarchy.", icon="INFO") def draw_acts(self, obj, layout): layout.label(text="Acts") diff --git a/fast64_internal/sm64/sm64_spline.py b/fast64_internal/sm64/sm64_spline.py index 334edd7f3..a77aeb4f2 100644 --- a/fast64_internal/sm64/sm64_spline.py +++ b/fast64_internal/sm64/sm64_spline.py @@ -121,10 +121,10 @@ def execute(self, context): class SM64SplinePanel(bpy.types.Panel): bl_label = "Spline Inspector" bl_idname = "OBJECT_PT_SM64_Spline_Inspector" + bl_parent_id = "OBJECT_PT_context_object" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -133,18 +133,17 @@ def poll(cls, context): ) def draw(self, context): - box = self.layout.box() - box.box().label(text="SM64 Spline Inspector") + col = self.layout.column() curve = context.object.data if curve.splines[0].type != "NURBS": - box.label(text="Only NURBS curves are compatible.") + col.label(text="Only NURBS curves are compatible.") else: - prop_split(box, curve, "sm64_spline_type", "Spline Type") + prop_split(col, curve, "sm64_spline_type", "Spline Type") if curve.sm64_spline_type == "Cutscene" or curve.sm64_spline_type == "Vector": pointIndex = 0 for point in curve.splines.active.points: if point.select: - prop_split(box.box(), point, "radius", "Point " + str(pointIndex) + " Speed") + prop_split(col.box(), point, "radius", "Point " + str(pointIndex) + " Speed") pointIndex += 1 diff --git a/fast64_internal/z64/__init__.py b/fast64_internal/z64/__init__.py index dc0af7a69..f0566efec 100644 --- a/fast64_internal/z64/__init__.py +++ b/fast64_internal/z64/__init__.py @@ -1,4 +1,5 @@ import bpy +from bpy.types import Panel from pathlib import Path from bpy.utils import register_class, unregister_class @@ -151,10 +152,51 @@ def is_z64sceneh_present(self): ) +class OOT_MaterialPanel(Panel): + bl_label = "OOT Material Inspector" + bl_idname = "MATERIAL_PT_OOT_Material_Inspector" + bl_parent_id = "EEVEE_MATERIAL_PT_context_material" + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "material" + + @classmethod + def poll(cls, context): + return ( + context.material is not None and context.material.is_f3d and context.scene.gameEditorMode in {"OOT", "MM"} + ) + + def draw(self, context): + pass + + +class OOT_ArmaturePanel(Panel): + bl_label = "OOT Armature" + bl_idname = "ARMATURE_PT_OOT_Inspector" + bl_parent_id = "OBJECT_PT_context_object" + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "object" + + @classmethod + def poll(cls, context): + return ( + context.object is not None + and context.object.type == "ARMATURE" + and context.scene.gameEditorMode in {"OOT", "MM"} + ) + + def draw(self, context): + pass + + +panels = (OOT_MaterialPanel, OOT_ArmaturePanel) oot_classes = (OOT_Properties,) def oot_panel_register(): + for cls in panels: + register_class(cls) oot_operator_panel_register() cutscene_panels_register() scene_panels_register() @@ -164,9 +206,12 @@ def oot_panel_register(): spline_panels_register() anim_panels_register() skeleton_panels_register() + csMotion_panels_register() def oot_panel_unregister(): + for cls in reversed(panels): + unregister_class(cls) oot_operator_panel_unregister() cutscene_panels_unregister() collision_panels_unregister() @@ -176,6 +221,7 @@ def oot_panel_unregister(): f3d_panels_unregister() anim_panels_unregister() skeleton_panels_unregister() + csMotion_panels_unregister() def oot_register(registerPanels): @@ -203,7 +249,6 @@ def oot_register(registerPanels): csMotion_ops_register() csMotion_props_register() - csMotion_panels_register() csMotion_preview_register() cutscene_preview_register() @@ -242,7 +287,6 @@ def oot_unregister(unregisterPanels): cutscene_preview_unregister() csMotion_preview_unregister() - csMotion_panels_unregister() csMotion_props_unregister() csMotion_ops_unregister() diff --git a/fast64_internal/z64/animation/panels.py b/fast64_internal/z64/animation/panels.py index e40a8991e..d1f933ba9 100644 --- a/fast64_internal/z64/animation/panels.py +++ b/fast64_internal/z64/animation/panels.py @@ -7,26 +7,16 @@ class OOT_LinkAnimPanel(Panel): - bl_idname = "OOT_PT_link_anim" - bl_label = "OOT Link Animation Properties" + bl_idname = "Z64_PT_link_anim" + bl_parent_id = "ARMATURE_PT_OOT_Inspector" + bl_label = "Link Animation Properties" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" - bl_options = {"HIDE_HEADER"} - - @classmethod - def poll(cls, context): - return ( - context.scene.gameEditorMode in {"OOT", "MM"} - and hasattr(context, "object") - and context.object is not None - and isinstance(context.object.data, Armature) - ) # called every frame def draw(self, context): - col = self.layout.box().column() - col.box().label(text="OOT Link Animation Inspector") + col = self.layout.column() linkTextureAnim: OOTLinkTextureAnimProperty = context.object.ootLinkTextureAnim linkTextureAnim.draw_props(col) col.label(text="Index 0 is for auto, flipbook starts at index 1.", icon="INFO") diff --git a/fast64_internal/z64/collision/panels.py b/fast64_internal/z64/collision/panels.py index b0cf54fe2..a8ce6e9b4 100644 --- a/fast64_internal/z64/collision/panels.py +++ b/fast64_internal/z64/collision/panels.py @@ -6,43 +6,40 @@ class OOT_CameraPosPanel(Panel): - bl_label = "Camera Position Inspector" + bl_label = "OOT Camera Position Inspector" bl_idname = "OBJECT_PT_OOT_Camera_Position_Inspector" + bl_parent_id = "OBJECT_PT_context_object" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): return context.scene.gameEditorMode in {"OOT", "MM"} and isinstance(context.object.data, Camera) def draw(self, context): - box = self.layout.box().column() + col = self.layout.column() obj = context.object - box.box().label(text="Camera Data") camPosProps: OOTCameraPositionProperty = obj.ootCameraPositionProperty - camPosProps.draw_props(box, obj) + camPosProps.draw_props(col, obj) class OOT_CollisionPanel(Panel): - bl_label = "Collision Inspector" + bl_label = "Collision" bl_idname = "MATERIAL_PT_OOT_Collision_Inspector" + bl_parent_id = "MATERIAL_PT_OOT_Material_Inspector" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "material" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): return context.scene.gameEditorMode in {"OOT", "MM"} and context.material is not None def draw(self, context): - box = self.layout.box().column() - collisionProp: OOTMaterialCollisionProperty = context.material.ootCollisionProperty - collisionProp.draw_props(box) + collisionProp.draw_props(self.layout.column()) class OOT_ExportCollisionPanel(OOT_Panel): diff --git a/fast64_internal/z64/collision/properties.py b/fast64_internal/z64/collision/properties.py index 47980d2c7..b920d98a6 100644 --- a/fast64_internal/z64/collision/properties.py +++ b/fast64_internal/z64/collision/properties.py @@ -58,8 +58,6 @@ def draw_props(self, layout: UILayout, cameraObj: Object): class OOTMaterialCollisionProperty(PropertyGroup): - expandTab: BoolProperty() - ignoreCameraCollision: BoolProperty() ignoreActorCollision: BoolProperty() ignoreProjectileCollision: BoolProperty() @@ -89,38 +87,31 @@ class OOTMaterialCollisionProperty(PropertyGroup): sound: EnumProperty(items=ootEnumCollisionSound, default="0x00") def draw_props(self, layout: UILayout): - layout.prop( - self, - "expandTab", - text="OOT Collision Properties", - icon="TRIA_DOWN" if self.expandTab else "TRIA_RIGHT", - ) - if self.expandTab: - prop_split(layout, self, "exitID", "Exit ID") - prop_split(layout, self, "cameraID", "Camera ID") - prop_split(layout, self, "echo", "Echo") - prop_split(layout, self, "lightingSetting", "Lighting") - drawEnumWithCustom(layout, self, "terrain", "Terrain", "") - drawEnumWithCustom(layout, self, "sound", "Sound", "") - - layout.prop(self, "eponaBlock", text="Blocks Epona") - layout.prop(self, "decreaseHeight", text="Decrease Height 1 Unit") - layout.prop(self, "isWallDamage", text="Is Wall Damage") - layout.prop(self, "hookshotable", text="Hookshotable") - - drawEnumWithCustom(layout, self, "floorSetting", "Floor Property", "") - drawEnumWithCustom(layout, self, "wallSetting", "Wall Setting", "") - drawEnumWithCustom(layout, self, "floorProperty", "Floor Type", "") - - layout.prop(self, "ignoreCameraCollision", text="Ignore Camera Collision") - layout.prop(self, "ignoreActorCollision", text="Ignore Actor Collision") - layout.prop(self, "ignoreProjectileCollision", text="Ignore Projectile Collision") - prop_split(layout, self, "conveyorOption", "Conveyor Option") - if self.conveyorOption != "None": - prop_split(layout, self, "conveyorRotation", "Conveyor Rotation") - drawEnumWithCustom(layout, self, "conveyorSpeed", "Conveyor Speed", "") - if self.conveyorSpeed != "Custom": - layout.prop(self, "conveyorKeepMomentum", text="Keep Momentum") + prop_split(layout, self, "exitID", "Exit ID") + prop_split(layout, self, "cameraID", "Camera ID") + prop_split(layout, self, "echo", "Echo") + prop_split(layout, self, "lightingSetting", "Lighting") + drawEnumWithCustom(layout, self, "terrain", "Terrain", "") + drawEnumWithCustom(layout, self, "sound", "Sound", "") + + layout.prop(self, "eponaBlock", text="Blocks Epona") + layout.prop(self, "decreaseHeight", text="Decrease Height 1 Unit") + layout.prop(self, "isWallDamage", text="Is Wall Damage") + layout.prop(self, "hookshotable", text="Hookshotable") + + drawEnumWithCustom(layout, self, "floorSetting", "Floor Property", "") + drawEnumWithCustom(layout, self, "wallSetting", "Wall Setting", "") + drawEnumWithCustom(layout, self, "floorProperty", "Floor Type", "") + + layout.prop(self, "ignoreCameraCollision", text="Ignore Camera Collision") + layout.prop(self, "ignoreActorCollision", text="Ignore Actor Collision") + layout.prop(self, "ignoreProjectileCollision", text="Ignore Projectile Collision") + prop_split(layout, self, "conveyorOption", "Conveyor Option") + if self.conveyorOption != "None": + prop_split(layout, self, "conveyorRotation", "Conveyor Rotation") + drawEnumWithCustom(layout, self, "conveyorSpeed", "Conveyor Speed", "") + if self.conveyorSpeed != "Custom": + layout.prop(self, "conveyorKeepMomentum", text="Keep Momentum") class OOTWaterBoxProperty(PropertyGroup): diff --git a/fast64_internal/z64/cutscene/motion/panels.py b/fast64_internal/z64/cutscene/motion/panels.py index 35a7a52d4..422aeb9b4 100644 --- a/fast64_internal/z64/cutscene/motion/panels.py +++ b/fast64_internal/z64/cutscene/motion/panels.py @@ -6,35 +6,33 @@ class OOT_CSMotionCameraShotPanel(OOT_Panel): bl_label = "Cutscene Motion Camera Shot Controls" bl_idname = "Z64_PT_camera_shot_panel" + bl_parent_id = "ARMATURE_PT_OOT_Inspector" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" - bl_options = {"HIDE_HEADER"} def draw(self, context): obj = context.view_layer.objects.active - layout = self.layout - - if obj.type == "ARMATURE": - camShotProp: CutsceneCmdCameraShotProperty = obj.data.ootCamShotProp - camShotPointProp: CutsceneCmdCameraShotPointProperty = None - activeBone = editBone = None - - box = layout.box() - camShotProp.draw_props(box, self.bl_label) - - if obj.mode == "POSE": - box.label(text="Warning: You can't be in 'Pose' mode to edit camera bones!") - elif obj.mode == "OBJECT": - activeBone = obj.data.bones.active - if activeBone is not None: - camShotPointProp = activeBone.ootCamShotPointProp - camShotPointProp.draw_props(box) - elif obj.mode == "EDIT": - editBone = obj.data.edit_bones.active - if editBone is not None: - camShotPointProp = editBone.ootCamShotPointProp - camShotPointProp.draw_props(box) + col = self.layout.column() + + camShotProp: CutsceneCmdCameraShotProperty = obj.data.ootCamShotProp + camShotPointProp: CutsceneCmdCameraShotPointProperty = None + activeBone = editBone = None + + camShotProp.draw_props(col) + + if obj.mode == "POSE": + col.label(text="Warning: You can't be in 'Pose' mode to edit camera bones!") + elif obj.mode == "OBJECT": + activeBone = obj.data.bones.active + if activeBone is not None: + camShotPointProp = activeBone.ootCamShotPointProp + camShotPointProp.draw_props(col) + elif obj.mode == "EDIT": + editBone = obj.data.edit_bones.active + if editBone is not None: + camShotPointProp = editBone.ootCamShotPointProp + camShotPointProp.draw_props(col) classes = (OOT_CSMotionCameraShotPanel,) diff --git a/fast64_internal/z64/cutscene/motion/properties.py b/fast64_internal/z64/cutscene/motion/properties.py index fbc0de3ec..2eab3e2b2 100644 --- a/fast64_internal/z64/cutscene/motion/properties.py +++ b/fast64_internal/z64/cutscene/motion/properties.py @@ -157,14 +157,13 @@ def getEndFrame(self, camShotObj: Object = None): return self.shotStartFrame + max(2, sum(frame for frame in boneFrameList)) + 1 return -1 - def draw_props(self, layout: UILayout, label: str): - box = layout.box() - box.label(text=label) - split = box.split(factor=0.5) + def draw_props(self, layout: UILayout): + col = layout.column() + split = col.split(factor=0.5) split.prop(self, "shotStartFrame") split.prop(self, "shotEndFrame") - box.row().prop(self, "shotCamMode", expand=True) - box.operator(CutsceneCmdAddBone.bl_idname) + col.row().prop(self, "shotCamMode", expand=True) + col.operator(CutsceneCmdAddBone.bl_idname) class CutsceneCmdCameraShotPointProperty(PropertyGroup): @@ -224,13 +223,13 @@ def setValue(self, value, propName: str): activeObj.data.bones.active = bone def draw_props(self, layout: UILayout): - box = layout.box() - box.label(text="Bone / Key point:") - row = box.row() + col = layout.column() + col.label(text="Bone / Key point:") + row = col.row() for propName in ["shotPointFrame", "shotPointViewAngle", "shotPointRoll"]: row.prop(self, propName) - row = box.row() + row = col.row() row.operator(CutsceneCmdMoveBone.bl_idname, text="Move Up", icon="TRIA_UP").direction = "UP" row.operator(CutsceneCmdMoveBone.bl_idname, text="Move Down", icon="TRIA_DOWN").direction = "DOWN" diff --git a/fast64_internal/z64/f3d/panels.py b/fast64_internal/z64/f3d/panels.py index 3c10eded6..5327a2c85 100644 --- a/fast64_internal/z64/f3d/panels.py +++ b/fast64_internal/z64/f3d/panels.py @@ -13,12 +13,12 @@ class OOT_DisplayListPanel(Panel): - bl_label = "Display List Inspector" + bl_label = "OOT Display List Inspector" bl_idname = "OBJECT_PT_OOT_DL_Inspector" + bl_parent_id = "OBJECT_PT_context_object" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -27,20 +27,19 @@ def poll(cls, context): ) def draw(self, context): - box = self.layout.box().column() - box.box().label(text="OOT DL Inspector") + col = self.layout.column() obj = context.object # prop_split(box, obj, "ootDrawLayer", "Draw Layer") - box.prop(obj, "ignore_render") - box.prop(obj, "ignore_collision") + col.prop(obj, "ignore_render") + col.prop(obj, "ignore_collision") if bpy.context.scene.f3d_type == "F3DEX3": - box.prop(obj, "is_occlusion_planes") + col.prop(obj, "is_occlusion_planes") if obj.is_occlusion_planes and (not obj.ignore_render or not obj.ignore_collision): - box.label(icon="INFO", text="Suggest Ignore Render & Ignore Collision.") + col.label(icon="INFO", text="Suggest Ignore Render & Ignore Collision.") if not (obj.parent is not None and isinstance(obj.parent.data, Armature)): - actorScaleBox = box.box().column() + actorScaleBox = col.box().column() prop_split(actorScaleBox, obj, "ootActorScale", "Actor Scale") actorScaleBox.label(text="This applies to actor exports only.", icon="INFO") @@ -48,13 +47,13 @@ def draw(self, context): # box.prop(obj.ootDynamicTransform, "billboard") -class OOT_MaterialPanel(Panel): - bl_label = "OOT Material" - bl_idname = "MATERIAL_PT_OOT_Material_Inspector" +class OOT_DynamicPropertiesPanel(Panel): + bl_label = "Dynamic Properties" + bl_idname = "MATERIAL_PT_OOT_Dynamic_Properties" + bl_parent_id = "MATERIAL_PT_OOT_Material_Inspector" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "material" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -78,16 +77,16 @@ def draw(self, context): drawLayer = mat.f3d_mat.draw_layer.oot dynMatProps: OOTDynamicMaterialProperty = mat.ootMaterial - dynMatProps.draw_props(col.box().column(), mat, drawLayer) + dynMatProps.draw_props(col, mat, drawLayer) class OOT_DrawLayersPanel(Panel): - bl_label = "OOT Draw Layers" + bl_label = "OOT Default Render Modes" bl_idname = "WORLD_PT_OOT_Draw_Layers_Panel" + bl_parent_id = "WORLD_PT_context_world" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "world" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -120,7 +119,7 @@ def draw(self, context): oot_dl_writer_panel_classes = ( OOT_DisplayListPanel, - OOT_MaterialPanel, + OOT_DynamicPropertiesPanel, OOT_DrawLayersPanel, OOT_ExportDLPanel, ) diff --git a/fast64_internal/z64/f3d/properties.py b/fast64_internal/z64/f3d/properties.py index f2f1ca742..9bb58c5d5 100644 --- a/fast64_internal/z64/f3d/properties.py +++ b/fast64_internal/z64/f3d/properties.py @@ -141,7 +141,7 @@ def draw_props(self, layout: UILayout, mat: Object, drawLayer: str): return suffix = "(" + drawLayerSuffix[drawLayer] + ")" - layout.box().column().label(text="OOT Dynamic Material Properties " + suffix) + layout.label(text=drawLayerSuffix[drawLayer] + " Draw Layer", icon="INFO") layout.label(text="See gSPSegment calls in z_scene_table.c.") layout.label(text="Based off draw config index in gSceneTable.") dynMatLayerProp: OOTDynamicMaterialDrawLayerProperty = getattr(self, drawLayer.lower()) @@ -162,19 +162,12 @@ class OOTDefaultRenderModesProperty(PropertyGroup): def draw_props(self, layout: UILayout): inputGroup = layout.column() - inputGroup.prop( - self, - "expandTab", - text="Default Render Modes", - icon="TRIA_DOWN" if self.expandTab else "TRIA_RIGHT", - ) - if self.expandTab: - prop_split(inputGroup, self, "opaqueCycle1", "Opaque Cycle 1") - prop_split(inputGroup, self, "opaqueCycle2", "Opaque Cycle 2") - prop_split(inputGroup, self, "transparentCycle1", "Transparent Cycle 1") - prop_split(inputGroup, self, "transparentCycle2", "Transparent Cycle 2") - prop_split(inputGroup, self, "overlayCycle1", "Overlay Cycle 1") - prop_split(inputGroup, self, "overlayCycle2", "Overlay Cycle 2") + prop_split(inputGroup, self, "opaqueCycle1", "Opaque Cycle 1") + prop_split(inputGroup, self, "opaqueCycle2", "Opaque Cycle 2") + prop_split(inputGroup, self, "transparentCycle1", "Transparent Cycle 1") + prop_split(inputGroup, self, "transparentCycle2", "Transparent Cycle 2") + prop_split(inputGroup, self, "overlayCycle1", "Overlay Cycle 1") + prop_split(inputGroup, self, "overlayCycle2", "Overlay Cycle 2") oot_dl_writer_classes = ( diff --git a/fast64_internal/z64/props_panel_main.py b/fast64_internal/z64/props_panel_main.py index 5a3663d1f..35e258352 100644 --- a/fast64_internal/z64/props_panel_main.py +++ b/fast64_internal/z64/props_panel_main.py @@ -108,12 +108,12 @@ def execute(self, context): class OOTObjectPanel(bpy.types.Panel): - bl_label = "Object Inspector" + bl_label = "OOT Empty Inspector" bl_idname = "OBJECT_PT_OOT_Object_Inspector" + bl_parent_id = "OBJECT_PT_context_object" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -122,12 +122,10 @@ def poll(cls, context): ) def draw(self, context): - prop_split(self.layout, context.scene, "gameEditorMode", "Game") - box = self.layout.box() - box.box().label(text="OOT Object Inspector") + col = self.layout.column() obj = context.object objName = obj.name - prop_split(box, obj, "ootEmptyType", "Object Type") + prop_split(col, obj, "ootEmptyType", "Object Type") sceneObj = getSceneObj(obj) roomObj = getRoomObj(obj) @@ -137,40 +135,40 @@ def draw(self, context): if obj.ootEmptyType == "Actor": actorProp: OOTActorProperty = obj.ootActorProperty - actorProp.draw_props(box, altRoomProp, obj) + actorProp.draw_props(col, altRoomProp, obj) elif obj.ootEmptyType == "Transition Actor": transActorProp: OOTTransitionActorProperty = obj.ootTransitionActorProperty - transActorProp.draw_props(box, altSceneProp, roomObj, objName) + transActorProp.draw_props(col, altSceneProp, roomObj, objName) elif obj.ootEmptyType == "Water Box": waterBoxProps: OOTWaterBoxProperty = obj.ootWaterBoxProperty - waterBoxProps.draw_props(box) + waterBoxProps.draw_props(col) elif obj.ootEmptyType == "Scene": - drawSceneHeader(box, obj) + drawSceneHeader(col, obj) elif obj.ootEmptyType == "Room": roomProp: OOTRoomHeaderProperty = obj.ootRoomHeader - roomProp.draw_props(box, None, None, objName) + roomProp.draw_props(col, None, None, objName) if obj.ootRoomHeader.menuTab == "Alternate": roomAltProp: OOTAlternateRoomHeaderProperty = obj.ootAlternateRoomHeaders - roomAltProp.draw_props(box, objName) + roomAltProp.draw_props(col, objName) elif obj.ootEmptyType == "Entrance": entranceProp: OOTEntranceProperty = obj.ootEntranceProperty - entranceProp.draw_props(box, obj, altSceneProp, objName) + entranceProp.draw_props(col, obj, altSceneProp, objName) elif obj.ootEmptyType == "Cull Group": cullGroupProp: OOTCullGroupProperty = obj.ootCullGroupProperty - cullGroupProp.draw_props(box) + cullGroupProp.draw_props(col) elif obj.ootEmptyType == "LOD": - drawLODProperty(box, obj) + drawLODProperty(col, obj) elif obj.ootEmptyType == "Cutscene": csProp: OOTCutsceneProperty = obj.ootCutsceneProperty - csProp.draw_props(box, obj) + csProp.draw_props(col, obj) elif obj.ootEmptyType in [ "CS Actor Cue List", @@ -180,15 +178,15 @@ def draw(self, context): ]: labelPrefix = "Player" if "Player" in obj.ootEmptyType else "Actor" actorCueListProp: CutsceneCmdActorCueListProperty = obj.ootCSMotionProperty.actorCueListProp - actorCueListProp.draw_props(box, obj.ootEmptyType == f"CS {labelPrefix} Cue Preview", labelPrefix, obj.name) + actorCueListProp.draw_props(col, obj.ootEmptyType == f"CS {labelPrefix} Cue Preview", labelPrefix, obj.name) elif obj.ootEmptyType in ["CS Actor Cue", "CS Player Cue", "CS Dummy Cue"]: labelPrefix = "Player" if obj.parent.ootEmptyType == "CS Player Cue List" else "Actor" actorCueProp: CutsceneCmdActorCueProperty = obj.ootCSMotionProperty.actorCueProp - actorCueProp.draw_props(box, labelPrefix, obj.ootEmptyType == "CS Dummy Cue", obj.name) + actorCueProp.draw_props(col, labelPrefix, obj.ootEmptyType == "CS Dummy Cue", obj.name) elif obj.ootEmptyType == "None": - box.label(text="Geometry can be parented to this.") + col.label(text="Geometry can be parented to this.") class OOT_ObjectProperties(bpy.types.PropertyGroup): diff --git a/fast64_internal/z64/skeleton/panels.py b/fast64_internal/z64/skeleton/panels.py index 891bba7f0..22e037fb8 100644 --- a/fast64_internal/z64/skeleton/panels.py +++ b/fast64_internal/z64/skeleton/panels.py @@ -7,26 +7,16 @@ class OOT_SkeletonPanel(Panel): - bl_idname = "OOT_PT_skeleton" - bl_label = "OOT Skeleton Properties" + bl_idname = "Z64_PT_skeleton" + bl_parent_id = "ARMATURE_PT_OOT_Inspector" + bl_label = "Skeleton Properties" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" - bl_options = {"HIDE_HEADER"} - - @classmethod - def poll(cls, context): - return ( - context.scene.gameEditorMode in {"OOT", "MM"} - and hasattr(context, "object") - and context.object is not None - and isinstance(context.object.data, Armature) - ) # called every frame def draw(self, context): - col = self.layout.box().column() - col.box().label(text="OOT Skeleton Inspector") + col = self.layout.column() prop_split(col, context.object, "ootDrawLayer", "Draw Layer") context.object.ootSkeleton.draw_props(col) @@ -34,12 +24,12 @@ def draw(self, context): class OOT_BonePanel(Panel): - bl_idname = "OOT_PT_bone" + bl_idname = "Z64_PT_bone" + bl_parent_id = "BONE_PT_context_bone" bl_label = "OOT Bone Properties" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "bone" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -47,8 +37,7 @@ def poll(cls, context): # called every frame def draw(self, context): - col = self.layout.box().column() - col.box().label(text="OOT Bone Inspector") + col = self.layout.column() context.bone.ootBone.draw_props(col) diff --git a/fast64_internal/z64/spline/panels.py b/fast64_internal/z64/spline/panels.py index 6e9b1c543..7984a7d6f 100644 --- a/fast64_internal/z64/spline/panels.py +++ b/fast64_internal/z64/spline/panels.py @@ -9,10 +9,10 @@ class OOTSplinePanel(Panel): bl_label = "Spline Inspector" bl_idname = "OBJECT_PT_OOT_Spline_Inspector" + bl_parent_id = "OBJECT_PT_context_object" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" - bl_options = {"HIDE_HEADER"} @classmethod def poll(cls, context): @@ -21,16 +21,15 @@ def poll(cls, context): ) def draw(self, context): - box = self.layout.box().column() - box.box().label(text="OOT Spline Inspector") + col = self.layout.column() curve = context.object.data if curve.splines[0].type != "NURBS": - box.label(text="Only NURBS curves are compatible.") + col.label(text="Only NURBS curves are compatible.") else: sceneObj = getSceneObj(context.object) altSceneProp = sceneObj.ootAlternateSceneHeaders if sceneObj is not None else None splineProp: OOTSplineProperty = context.object.ootSplineProperty - splineProp.draw_props(box, altSceneProp, context.object.name) + splineProp.draw_props(col, altSceneProp, context.object.name) oot_spline_panel_classes = (OOTSplinePanel,)