From ee3b92dba23fa57dc68a6220360c653b045e1306 Mon Sep 17 00:00:00 2001 From: Lila Date: Wed, 10 Jul 2024 07:58:35 +0100 Subject: [PATCH 1/8] [F3D] Default to G_AD_DISABLE over G_AD_NOISE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the ucode default, so having this set to NOISE is a weird choice that also breaks SM64 (please confirm this doesn´t affect OOT please) --- fast64_internal/f3d/f3d_material.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fast64_internal/f3d/f3d_material.py b/fast64_internal/f3d/f3d_material.py index 957430d49..8da1b6943 100644 --- a/fast64_internal/f3d/f3d_material.py +++ b/fast64_internal/f3d/f3d_material.py @@ -3172,7 +3172,7 @@ class RDPSettings(PropertyGroup): g_mdsft_alpha_dither: bpy.props.EnumProperty( name="Alpha Dither", items=enumAlphaDither, - default="G_AD_NOISE", + default="G_AD_DISABLE", update=update_node_values_with_preset, description="Applies your choice dithering type to output framebuffer alpha. Dithering is used to convert high precision source colors into lower precision framebuffer values", ) From 445d8f6dc303267092edad700f81a33ca5bcdc16 Mon Sep 17 00:00:00 2001 From: Lila Date: Wed, 10 Jul 2024 07:58:35 +0100 Subject: [PATCH 2/8] (Idea, may be reverted) Set rdp settings to ucode defaults. then update based on game mode --- __init__.py | 16 ++++++++++++++-- fast64_internal/f3d/f3d_material.py | 24 ++++++++++++------------ fast64_internal/oot/oot_constants.py | 17 +++++++++++++++++ fast64_internal/sm64/sm64_constants.py | 16 ++++++++++++++++ 4 files changed, 59 insertions(+), 14 deletions(-) diff --git a/__init__.py b/__init__.py index 7623a5148..f74b6adc1 100644 --- a/__init__.py +++ b/__init__.py @@ -14,11 +14,13 @@ ) from .fast64_internal.sm64 import sm64_register, sm64_unregister +from .fast64_internal.sm64.sm64_constants import sm64_world_defaults from .fast64_internal.sm64.settings.properties import SM64_Properties from .fast64_internal.sm64.sm64_geolayout_bone import SM64_BoneProperties from .fast64_internal.sm64.sm64_objects import SM64_ObjectProperties from .fast64_internal.oot import OOT_Properties, oot_register, oot_unregister +from .fast64_internal.oot.oot_constants import oot_world_defaults from .fast64_internal.oot.props_panel_main import OOT_ObjectProperties from .fast64_internal.utility_anim import utility_anim_register, utility_anim_unregister, ArmatureApplyWithMeshOperator @@ -200,6 +202,8 @@ class Fast64Settings_Properties(bpy.types.PropertyGroup): default=True, ) + internal_game_update_ver: bpy.props.IntProperty(default=0) # Internal + class Fast64_Properties(bpy.types.PropertyGroup): """ @@ -333,6 +337,9 @@ def upgrade_changed_props(): SM64_ObjectProperties.upgrade_changed_props() OOT_ObjectProperties.upgrade_changed_props() for scene in bpy.data.scenes: + if scene.fast64.settings.internal_game_update_ver != 1: + gameEditorUpdate(scene, bpy.context) + scene.fast64.settings.internal_game_update_ver = 1 if scene.get("decomp_compatible", False): scene.gameEditorMode = "Homebrew" del scene["decomp_compatible"] @@ -355,10 +362,15 @@ def after_load(_a, _b): def gameEditorUpdate(self, context): + world_defaults = {} if self.gameEditorMode == "SM64": - self.f3d_type = "F3D" + self.f3d_type, world_defaults = "F3D", sm64_world_defaults elif self.gameEditorMode == "OOT": - self.f3d_type = "F3DEX2/LX2" + self.f3d_type, world_defaults = "F3DEX2/LX2", oot_world_defaults + elif self.gameEditorMode == "Homebrew": + self.f3d_type, world_defaults = "F3D", {} # This will set some pretty bad defaults, but trust the user + if self.world: + self.world.rdp_defaults.from_dict(world_defaults) # called on add-on enabling diff --git a/fast64_internal/f3d/f3d_material.py b/fast64_internal/f3d/f3d_material.py index 8da1b6943..e3198dfda 100644 --- a/fast64_internal/f3d/f3d_material.py +++ b/fast64_internal/f3d/f3d_material.py @@ -3052,13 +3052,13 @@ def key(self): class RDPSettings(PropertyGroup): g_zbuffer: bpy.props.BoolProperty( name="Z Buffer", - default=True, + default=False, update=update_node_values_with_preset, description="Enables calculation of Z value for primitives. Disable if not reading or writing Z-Buffer in the blender", ) g_shade: bpy.props.BoolProperty( name="Shading", - default=True, + default=False, update=update_node_values_with_preset, description="Computes shade coordinates for primitives. Disable if not using lighting, vertex colors or fog", ) @@ -3090,7 +3090,7 @@ class RDPSettings(PropertyGroup): # v1/2 difference g_cull_back: bpy.props.BoolProperty( name="Cull Back", - default=True, + default=False, update=update_node_values_with_preset, description="Disables drawing of back faces", ) @@ -3132,7 +3132,7 @@ class RDPSettings(PropertyGroup): ) g_lighting: bpy.props.BoolProperty( name="Lighting", - default=True, + default=False, update=update_node_values_with_preset, description="Enables calculating shade color using lights. Turn off for vertex colors as shade color", ) @@ -3156,13 +3156,13 @@ class RDPSettings(PropertyGroup): ) g_shade_smooth: bpy.props.BoolProperty( name="Smooth Shading", - default=True, + default=False, update=update_node_values_with_preset, description="Shades primitive smoothly using interpolation between shade values for each vertex (Gouraud shading)", ) g_clipping: bpy.props.BoolProperty( name="Clipping", - default=False, + default=True, update=update_node_values_with_preset, description="F3DEX1/LX only, exact function unknown", ) @@ -3194,14 +3194,14 @@ class RDPSettings(PropertyGroup): g_mdsft_textconv: bpy.props.EnumProperty( name="Texture Convert", items=enumTextConv, - default="G_TC_FILT", + default="G_TC_CONV", update=update_node_values_with_preset, description="Sets the function of the texture convert unit, to do texture filtering, YUV to RGB conversion, or both", ) g_mdsft_text_filt: bpy.props.EnumProperty( name="Texture Filter", items=enumTextFilt, - default="G_TF_BILERP", + default="G_TF_POINT", update=update_node_values_without_preset, description="Applies your choice of filtering to texels", ) @@ -3235,7 +3235,7 @@ class RDPSettings(PropertyGroup): g_mdsft_textpersp: bpy.props.EnumProperty( name="Texture Perspective Correction", items=enumTextPersp, - default="G_TP_PERSP", + default="G_TP_NONE", update=update_node_values_with_preset, description="Turns on/off texture perspective correction", ) @@ -3257,7 +3257,7 @@ class RDPSettings(PropertyGroup): g_mdsft_pipeline: bpy.props.EnumProperty( name="Pipeline Span Buffer Coherency", items=enumPipelineMode, - default="G_PM_1PRIMITIVE", + default="G_PM_NPRIMITIVE", update=update_node_values_with_preset, description="Changes primitive rasterization timing by adding syncs after tri draws. Vanilla SM64 has synchronization issues which could cause a crash if not using 1 prim. For any modern SM64 hacking project or other game N-prim should always be used", ) @@ -3443,7 +3443,7 @@ def attributes_from_dict(self, data: dict, info: dict): ] geo_mode_f3dex_attributes = [ - ("clipping", "g_clipping", False), + ("clipping", "g_clipping", True), ] geo_mode_f3dex3_attributes = [ @@ -3471,7 +3471,7 @@ def geo_mode_from_dict(self, data: dict): self.attributes_from_dict(data, self.geo_mode_attributes) other_mode_h_attributes = [ - ("alphaDither", "g_mdsft_alpha_dither", "G_AD_PATTERN"), + ("alphaDither", "g_mdsft_alpha_dither", "G_AD_DISABLE"), ("colorDither", "g_mdsft_rgb_dither", "G_CD_MAGICSQ"), ("chromaKey", "g_mdsft_combkey", "G_CK_NONE"), ("textureConvert", "g_mdsft_textconv", "G_TC_CONV"), diff --git a/fast64_internal/oot/oot_constants.py b/fast64_internal/oot/oot_constants.py index 6c1fbcc66..5c6de85e9 100644 --- a/fast64_internal/oot/oot_constants.py +++ b/fast64_internal/oot/oot_constants.py @@ -602,3 +602,20 @@ ("SDC_GANONS_TOWER_COLLAPSE_INTERIOR", "Ganon's Tower (Collapsing) (Ganon Sonogo)", "Ganon Sonogo"), ("SDC_INSIDE_GANONS_CASTLE_COLLAPSE", "Inside Ganon's Castle (Collapsing) (Ganontika Sonogo)", "Ganontika Sonogo"), ] + +oot_world_defaults = { + "geometryMode": { + "zBuffer": True, + "shade": True, + "cullBack": True, + "lighting": True, + "shadeSmooth": True, + }, + "otherModeH": { + "alphaDither": "G_AD_NOISE", + "textureFilter": "G_TF_BILERP", + "pipelineMode": "G_PM_NPRIMITIVE", + "perspectiveCorrection": "G_TP_PERSP", + "textureConvert": "G_TC_FILT", + }, +} diff --git a/fast64_internal/sm64/sm64_constants.py b/fast64_internal/sm64/sm64_constants.py index 8f714c771..09d779196 100644 --- a/fast64_internal/sm64/sm64_constants.py +++ b/fast64_internal/sm64/sm64_constants.py @@ -2005,3 +2005,19 @@ def __init__(self, geoAddr, level, switchDict): (5737600, "207 - Forwards spinning flip"), (5740584, "208 - Triple jump fly"), ] + +sm64_world_defaults = { + "geometryMode": { + "zBuffer": True, + "shade": True, + "cullBack": True, + "lighting": True, + "shadeSmooth": True, + }, + "otherModeH": { + "textureFilter": "G_TF_BILERP", + "pipelineMode": "G_PM_1PRIMITIVE", + "perspectiveCorrection": "G_TP_PERSP", + "textureConvert": "G_TC_FILT", + }, +} From 6fcfdbb1f3c48b9c48cb531c6e479e6f57397986 Mon Sep 17 00:00:00 2001 From: Lila Date: Wed, 10 Jul 2024 18:14:07 +0100 Subject: [PATCH 3/8] remove comment --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index f74b6adc1..080e1d9b6 100644 --- a/__init__.py +++ b/__init__.py @@ -202,7 +202,7 @@ class Fast64Settings_Properties(bpy.types.PropertyGroup): default=True, ) - internal_game_update_ver: bpy.props.IntProperty(default=0) # Internal + internal_game_update_ver: bpy.props.IntProperty(default=0) class Fast64_Properties(bpy.types.PropertyGroup): From 648d5a52b8fc3154de826f6ae713ccf3a794ad12 Mon Sep 17 00:00:00 2001 From: Lila Date: Wed, 10 Jul 2024 18:04:51 +0100 Subject: [PATCH 4/8] use disable for default, other commits assume every geo mode is off for oot formatting and grammar fix Make world defaults draw into one function, add better text and homebrew mode warning two cycle in oot --- fast64_internal/f3d/f3d_material.py | 34 ++++++++++++++++++++------ fast64_internal/oot/oot_constants.py | 10 ++------ fast64_internal/repo_settings.py | 11 ++------- fast64_internal/sm64/sm64_constants.py | 2 +- 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/fast64_internal/f3d/f3d_material.py b/fast64_internal/f3d/f3d_material.py index e3198dfda..43b38e31a 100644 --- a/fast64_internal/f3d/f3d_material.py +++ b/fast64_internal/f3d/f3d_material.py @@ -3596,6 +3596,31 @@ def key(self): return str(self.to_dict().items()) +def draw_rdp_world_defaults(layout: UILayout, scene: Scene): + world = scene.world + if not world: + layout.box().label(text="No World Selected In Scene", icon="WORLD") + return + rdp_defaults = world.rdp_defaults + col = layout.column() + col.box().label(text="RDP Default Settings", icon="WORLD") + multilineLabel( + col, + text="If a material setting is the same as the default setting\n" + "it won't be set, otherwise a revert will be added.", + ) + if scene.gameEditorMode == "Homebrew": + multilineLabel( + col.box(), + text="Homebrew mode defaults to ucode defaults,\nmake sure to set your own.", + icon="INFO", + ) + ui_geo_mode(rdp_defaults, world, col, True) + ui_upper_mode(rdp_defaults, world, col, True) + ui_lower_mode(rdp_defaults, world, col, True) + ui_other(rdp_defaults, world, col, True) + + class DefaultRDPSettingsPanel(Panel): bl_label = "RDP Default Settings" bl_idname = "WORLD_PT_RDP_Default_Inspector" @@ -3605,14 +3630,7 @@ class DefaultRDPSettingsPanel(Panel): bl_options = {"HIDE_HEADER"} def draw(self, context): - world = context.scene.world - layout = self.layout - layout.box().label(text="RDP Default Settings") - layout.label(text="If a material setting is a same as a default setting, then it won't be set.") - ui_geo_mode(world.rdp_defaults, world, layout, True) - ui_upper_mode(world.rdp_defaults, world, layout, True) - ui_lower_mode(world.rdp_defaults, world, layout, True) - ui_other(world.rdp_defaults, world, layout, True) + draw_rdp_world_defaults(self.layout, context.scene) class CelLevelProperty(PropertyGroup): diff --git a/fast64_internal/oot/oot_constants.py b/fast64_internal/oot/oot_constants.py index 5c6de85e9..a54333bb0 100644 --- a/fast64_internal/oot/oot_constants.py +++ b/fast64_internal/oot/oot_constants.py @@ -604,18 +604,12 @@ ] oot_world_defaults = { - "geometryMode": { - "zBuffer": True, - "shade": True, - "cullBack": True, - "lighting": True, - "shadeSmooth": True, - }, "otherModeH": { "alphaDither": "G_AD_NOISE", "textureFilter": "G_TF_BILERP", - "pipelineMode": "G_PM_NPRIMITIVE", "perspectiveCorrection": "G_TP_PERSP", "textureConvert": "G_TC_FILT", + "cycleType": "G_CYC_2CYCLE", + "pipelineMode": "G_PM_NPRIMITIVE", }, } diff --git a/fast64_internal/repo_settings.py b/fast64_internal/repo_settings.py index e8a0d3a8e..04418e821 100644 --- a/fast64_internal/repo_settings.py +++ b/fast64_internal/repo_settings.py @@ -8,7 +8,7 @@ from .utility import filepath_checks, prop_split, filepath_ui_warnings, draw_and_check_tab from .operators import OperatorBase -from .f3d.f3d_material import ui_geo_mode, ui_upper_mode, ui_lower_mode, ui_other +from .f3d.f3d_material import draw_rdp_world_defaults from .sm64.settings.repo_settings import load_sm64_repo_settings, save_sm64_repo_settings from typing import TYPE_CHECKING @@ -126,14 +126,7 @@ def draw_repo_settings(layout: UILayout, context: Context): col.prop(fast64_settings, "prefer_rgba_over_ci") col.separator() - world = scene.world - rdp_defaults = world.rdp_defaults - col.box().label(text="RDP Default Settings", icon="WORLD") - col.label(text="If a material setting is a same as a default setting, then it won't be set.") - ui_geo_mode(rdp_defaults, world, col, True) - ui_upper_mode(rdp_defaults, world, col, True) - ui_lower_mode(rdp_defaults, world, col, True) - ui_other(rdp_defaults, world, col, True) + draw_rdp_world_defaults(col, scene) classes = (SaveRepoSettings, LoadRepoSettings) diff --git a/fast64_internal/sm64/sm64_constants.py b/fast64_internal/sm64/sm64_constants.py index 09d779196..b829c55eb 100644 --- a/fast64_internal/sm64/sm64_constants.py +++ b/fast64_internal/sm64/sm64_constants.py @@ -2016,8 +2016,8 @@ def __init__(self, geoAddr, level, switchDict): }, "otherModeH": { "textureFilter": "G_TF_BILERP", - "pipelineMode": "G_PM_1PRIMITIVE", "perspectiveCorrection": "G_TP_PERSP", "textureConvert": "G_TC_FILT", + "pipelineMode": "G_PM_1PRIMITIVE", }, } From c66f4b6857b1e17f7b38f534fbe6c4d5d241efd6 Mon Sep 17 00:00:00 2001 From: Lila Date: Fri, 12 Jul 2024 15:54:33 +0100 Subject: [PATCH 5/8] change oot cycle default to FILL --- fast64_internal/oot/oot_constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fast64_internal/oot/oot_constants.py b/fast64_internal/oot/oot_constants.py index a54333bb0..49dfb2015 100644 --- a/fast64_internal/oot/oot_constants.py +++ b/fast64_internal/oot/oot_constants.py @@ -609,7 +609,7 @@ "textureFilter": "G_TF_BILERP", "perspectiveCorrection": "G_TP_PERSP", "textureConvert": "G_TC_FILT", - "cycleType": "G_CYC_2CYCLE", + "cycleType": "G_CYC_FILL", "pipelineMode": "G_PM_NPRIMITIVE", }, } From cb7b151e51318b5b35f29bc1726b2c946abd9dbe Mon Sep 17 00:00:00 2001 From: Lila Date: Fri, 12 Jul 2024 16:36:17 +0100 Subject: [PATCH 6/8] Revert "change oot cycle default to FILL" This reverts commit c66f4b6857b1e17f7b38f534fbe6c4d5d241efd6. --- fast64_internal/oot/oot_constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fast64_internal/oot/oot_constants.py b/fast64_internal/oot/oot_constants.py index 49dfb2015..a54333bb0 100644 --- a/fast64_internal/oot/oot_constants.py +++ b/fast64_internal/oot/oot_constants.py @@ -609,7 +609,7 @@ "textureFilter": "G_TF_BILERP", "perspectiveCorrection": "G_TP_PERSP", "textureConvert": "G_TC_FILT", - "cycleType": "G_CYC_FILL", + "cycleType": "G_CYC_2CYCLE", "pipelineMode": "G_PM_NPRIMITIVE", }, } From 8ea75994aa92668077c9a6eeb3a35e281e510dc2 Mon Sep 17 00:00:00 2001 From: Lila Date: Fri, 2 Aug 2024 15:57:05 +0100 Subject: [PATCH 7/8] yanis review changes --- __init__.py | 13 ++++++++----- fast64_internal/f3d/f3d_material.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/__init__.py b/__init__.py index 080e1d9b6..7607605a8 100644 --- a/__init__.py +++ b/__init__.py @@ -362,14 +362,17 @@ def after_load(_a, _b): def gameEditorUpdate(self, context): - world_defaults = {} + world_defaults = None if self.gameEditorMode == "SM64": - self.f3d_type, world_defaults = "F3D", sm64_world_defaults + self.f3d_type = "F3D" + world_defaults = sm64_world_defaults elif self.gameEditorMode == "OOT": - self.f3d_type, world_defaults = "F3DEX2/LX2", oot_world_defaults + self.f3d_type = "F3DEX2/LX2" + world_defaults = oot_world_defaults elif self.gameEditorMode == "Homebrew": - self.f3d_type, world_defaults = "F3D", {} # This will set some pretty bad defaults, but trust the user - if self.world: + self.f3d_type = "F3D" + world_defaults = {} # This will set some pretty bad defaults, but trust the user + if self.world is not None: self.world.rdp_defaults.from_dict(world_defaults) diff --git a/fast64_internal/f3d/f3d_material.py b/fast64_internal/f3d/f3d_material.py index 43b38e31a..d605030e8 100644 --- a/fast64_internal/f3d/f3d_material.py +++ b/fast64_internal/f3d/f3d_material.py @@ -3598,7 +3598,7 @@ def key(self): def draw_rdp_world_defaults(layout: UILayout, scene: Scene): world = scene.world - if not world: + if world is None: layout.box().label(text="No World Selected In Scene", icon="WORLD") return rdp_defaults = world.rdp_defaults From 4d877f0d08239b398b1df517ae16a044a7e79173 Mon Sep 17 00:00:00 2001 From: Lila Date: Mon, 5 Aug 2024 13:34:52 +0100 Subject: [PATCH 8/8] Fixed issue yanis brought up --- fast64_internal/oot/oot_constants.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fast64_internal/oot/oot_constants.py b/fast64_internal/oot/oot_constants.py index a54333bb0..a0b33813c 100644 --- a/fast64_internal/oot/oot_constants.py +++ b/fast64_internal/oot/oot_constants.py @@ -604,12 +604,18 @@ ] oot_world_defaults = { + "geometryMode": { + "zBuffer": True, + "shade": True, + "cullBack": True, + "lighting": True, + "shadeSmooth": True, + }, "otherModeH": { "alphaDither": "G_AD_NOISE", "textureFilter": "G_TF_BILERP", "perspectiveCorrection": "G_TP_PERSP", "textureConvert": "G_TC_FILT", "cycleType": "G_CYC_2CYCLE", - "pipelineMode": "G_PM_NPRIMITIVE", }, }