From b0e0f93ccb99ee956271610da4b8593ab93491db Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Fri, 16 Dec 2022 12:14:24 +0100 Subject: [PATCH 01/15] hackeroot fixes --- .../oot/scene/exporter/to_c/scene_table_c.py | 49 +++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py index aa6a3dd..8f4aa4d 100644 --- a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py +++ b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py @@ -9,25 +9,39 @@ def getSceneTable(exportPath): dataList = [] sceneNames = [] fileHeader = "" + isHackerOoT = False # read the scene table try: with open(os.path.join(exportPath, "include/tables/scene_table.h")) as fileData: # keep the relevant data and do some formatting for i, line in enumerate(fileData): - if not line.startswith("// "): - if not (line.startswith("/**") or line.startswith(" *")): - dataList.append(line[(line.find("(") + 1) :].rstrip(")\n").replace(" ", "").split(",")) - else: - fileHeader += line - if line.startswith("/* 0x"): - startIndex = line.find("SCENE_") - sceneNames.append(line[startIndex : line.find(",", startIndex)]) + # exclude elements present in HackerOoT's codebase + if ( + line != "\n" + and '#include "config.h"\n' not in line + and "#ifdef INCLUDE_TEST_SCENES" not in line + and "#endif" not in line + ): + if not line.startswith("// "): + if not (line.startswith("/**") or line.startswith(" *")): + dataList.append(line[(line.find("(") + 1) :].rstrip(")\n").replace(" ", "").split(",")) + else: + fileHeader += line + if line.startswith("/* 0x"): + startIndex = line.find("SCENE_") + sceneNames.append(line[startIndex : line.find(",", startIndex)]) + else: + isHackerOoT = True except FileNotFoundError: raise PluginError("ERROR: Can't find scene_table.h!") + # if the repo is HackerOoT add the includein the file header + if isHackerOoT: + fileHeader = '#include "config.h"\n\n' + fileHeader + # return the parsed data, the header comment and the comment mentionning debug scenes - return dataList, fileHeader, sceneNames + return dataList, fileHeader, sceneNames, isHackerOoT def getSceneIndex(sceneNameList, sceneName): @@ -115,7 +129,7 @@ def getSceneParams(scene, exportInfo, sceneNames): return sceneName, sceneTitle, sceneID, sceneUnk10, sceneUnk12, sceneIndex -def sceneTableToC(data, header, sceneNames, scene): +def sceneTableToC(data, header, sceneNames, scene, isHackerOoT: bool): """Converts the Scene Table to C code""" # start the data with the header comment explaining the format of the file fileData = header @@ -128,28 +142,35 @@ def sceneTableToC(data, header, sceneNames, scene): lastSceneIdx = getInsertionIndex(sceneNames, "SCENE_TESTROOM", None, mode) # add the actual lines with the same formatting + # add the ifdef if this is HackerOoT for i in range(len(data)): # adds the "// Debug-only scenes" # if both lastScene indexes are the same values this means there's no debug scene if ((i - 1) == lastNonDebugSceneIdx) and (lastSceneIdx != lastNonDebugSceneIdx): + if isHackerOoT: + fileData += "\n#ifdef INCLUDE_TEST_SCENES\n" + fileData += "// Debug-only scenes\n" # add a comment to show when it's new scenes if (i - 1) == lastSceneIdx: - fileData += "// Added scenes\n" + fileData += "\n// Added scenes\n" fileData += f"/* 0x{i:02X} */ DEFINE_SCENE(" fileData += ", ".join(str(d) for d in data[i]) fileData += ")\n" + if isHackerOoT and i == lastSceneIdx: + fileData += "#endif\n" + # return the string containing the file data to write return fileData def getDrawConfig(sceneName: str): """Read draw config from scene table""" - fileData, header, sceneNames = getSceneTable(bpy.path.abspath(bpy.context.scene.ootDecompPath)) + fileData, header, sceneNames, isHackerOoT = getSceneTable(bpy.path.abspath(bpy.context.scene.ootDecompPath)) for sceneEntry in fileData: if sceneEntry[0] == f"{sceneName}_scene": @@ -162,7 +183,7 @@ def modifySceneTable(scene, exportInfo: ExportInfo): """Edit the scene table with the new data""" exportPath = exportInfo.exportPath # the list ``sceneNames`` needs to be synced with ``fileData`` - fileData, header, sceneNames = getSceneTable(exportPath) + fileData, header, sceneNames, isHackerOoT = getSceneTable(exportPath) sceneName, sceneTitle, sceneID, sceneUnk10, sceneUnk12, sceneIndex = getSceneParams(scene, exportInfo, sceneNames) if scene is None: @@ -227,5 +248,5 @@ def modifySceneTable(scene, exportInfo: ExportInfo): # write the file with the final data writeFile( - os.path.join(exportPath, "include/tables/scene_table.h"), sceneTableToC(fileData, header, sceneNames, scene) + os.path.join(exportPath, "include/tables/scene_table.h"), sceneTableToC(fileData, header, sceneNames, scene, isHackerOoT) ) From 7734b203f482687a9549a95967eedb9540e2f3f1 Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Fri, 16 Dec 2022 12:14:41 +0100 Subject: [PATCH 02/15] black --- fast64_internal/oot/scene/exporter/to_c/scene_table_c.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py index 8f4aa4d..f71c9a7 100644 --- a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py +++ b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py @@ -248,5 +248,6 @@ def modifySceneTable(scene, exportInfo: ExportInfo): # write the file with the final data writeFile( - os.path.join(exportPath, "include/tables/scene_table.h"), sceneTableToC(fileData, header, sceneNames, scene, isHackerOoT) + os.path.join(exportPath, "include/tables/scene_table.h"), + sceneTableToC(fileData, header, sceneNames, scene, isHackerOoT), ) From 54ff54e722f404446b4fd419942daa922c13fdac Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Fri, 13 Jan 2023 18:38:22 +0100 Subject: [PATCH 03/15] changed how it works --- .../oot/scene/exporter/to_c/scene_table_c.py | 78 +++++++++++-------- 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py index f71c9a7..d3ff110 100644 --- a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py +++ b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py @@ -9,39 +9,31 @@ def getSceneTable(exportPath): dataList = [] sceneNames = [] fileHeader = "" - isHackerOoT = False # read the scene table try: with open(os.path.join(exportPath, "include/tables/scene_table.h")) as fileData: # keep the relevant data and do some formatting for i, line in enumerate(fileData): - # exclude elements present in HackerOoT's codebase if ( line != "\n" and '#include "config.h"\n' not in line and "#ifdef INCLUDE_TEST_SCENES" not in line and "#endif" not in line + and not line.startswith("// ") ): - if not line.startswith("// "): - if not (line.startswith("/**") or line.startswith(" *")): - dataList.append(line[(line.find("(") + 1) :].rstrip(")\n").replace(" ", "").split(",")) - else: - fileHeader += line - if line.startswith("/* 0x"): - startIndex = line.find("SCENE_") - sceneNames.append(line[startIndex : line.find(",", startIndex)]) - else: - isHackerOoT = True + if not (line.startswith("/**") or line.startswith(" *")): + dataList.append(line[(line.find("(") + 1) :].rstrip(")\n").replace(" ", "").split(",")) + else: + fileHeader += line + if line.startswith("/* 0x"): + startIndex = line.find("SCENE_") + sceneNames.append(line[startIndex : line.find(",", startIndex)]) except FileNotFoundError: raise PluginError("ERROR: Can't find scene_table.h!") - # if the repo is HackerOoT add the includein the file header - if isHackerOoT: - fileHeader = '#include "config.h"\n\n' + fileHeader - # return the parsed data, the header comment and the comment mentionning debug scenes - return dataList, fileHeader, sceneNames, isHackerOoT + return dataList, fileHeader, sceneNames def getSceneIndex(sceneNameList, sceneName): @@ -129,7 +121,7 @@ def getSceneParams(scene, exportInfo, sceneNames): return sceneName, sceneTitle, sceneID, sceneUnk10, sceneUnk12, sceneIndex -def sceneTableToC(data, header, sceneNames, scene, isHackerOoT: bool): +def sceneTableToC(data, header, sceneNames, scene): """Converts the Scene Table to C code""" # start the data with the header comment explaining the format of the file fileData = header @@ -142,35 +134,28 @@ def sceneTableToC(data, header, sceneNames, scene, isHackerOoT: bool): lastSceneIdx = getInsertionIndex(sceneNames, "SCENE_TESTROOM", None, mode) # add the actual lines with the same formatting - # add the ifdef if this is HackerOoT for i in range(len(data)): # adds the "// Debug-only scenes" # if both lastScene indexes are the same values this means there's no debug scene if ((i - 1) == lastNonDebugSceneIdx) and (lastSceneIdx != lastNonDebugSceneIdx): - if isHackerOoT: - fileData += "\n#ifdef INCLUDE_TEST_SCENES\n" - fileData += "// Debug-only scenes\n" # add a comment to show when it's new scenes if (i - 1) == lastSceneIdx: - fileData += "\n// Added scenes\n" + fileData += "// Added scenes\n" fileData += f"/* 0x{i:02X} */ DEFINE_SCENE(" fileData += ", ".join(str(d) for d in data[i]) fileData += ")\n" - if isHackerOoT and i == lastSceneIdx: - fileData += "#endif\n" - # return the string containing the file data to write return fileData def getDrawConfig(sceneName: str): """Read draw config from scene table""" - fileData, header, sceneNames, isHackerOoT = getSceneTable(bpy.path.abspath(bpy.context.scene.ootDecompPath)) + fileData, header, sceneNames = getSceneTable(bpy.path.abspath(bpy.context.scene.ootDecompPath)) for sceneEntry in fileData: if sceneEntry[0] == f"{sceneName}_scene": @@ -179,11 +164,30 @@ def getDrawConfig(sceneName: str): raise PluginError(f"Scene name {sceneName} not found in scene table.") +def addHackerOoTData(fileData: str): + """Reads the file and adds HackerOoT's modifications to the scene table file""" + newFileData = '#include "config.h"\n\n' + + for line in fileData.split("\n"): + if "// Debug-only scenes" in line: + newFileData += "\n#ifdef INCLUDE_TEST_SCENES\n" + + if "// Added scenes" in line: + newFileData += "#endif\n\n" + + newFileData += f"{line}\n" + + if not "// Added scenes" in fileData: + newFileData = newFileData[:-1] + "#endif\n\n" + + return newFileData[:-1] + + def modifySceneTable(scene, exportInfo: ExportInfo): """Edit the scene table with the new data""" exportPath = exportInfo.exportPath # the list ``sceneNames`` needs to be synced with ``fileData`` - fileData, header, sceneNames, isHackerOoT = getSceneTable(exportPath) + fileData, header, sceneNames = getSceneTable(exportPath) sceneName, sceneTitle, sceneID, sceneUnk10, sceneUnk12, sceneIndex = getSceneParams(scene, exportInfo, sceneNames) if scene is None: @@ -246,8 +250,18 @@ def modifySceneTable(scene, exportInfo: ExportInfo): else: raise PluginError("ERROR: Scene not found in ``scene_table.h``!") + # get the new file data + newFileData = sceneTableToC(fileData, header, sceneNames, scene) + + # apply HackerOoT changes if needed + isHackerOoT = False + + with open(os.path.join(exportPath, "include/tables/scene_table.h"), "r") as file: + if '#include "config.h"' in file.read(): + isHackerOoT = True + + if isHackerOoT: + newFileData = addHackerOoTData(newFileData) + # write the file with the final data - writeFile( - os.path.join(exportPath, "include/tables/scene_table.h"), - sceneTableToC(fileData, header, sceneNames, scene, isHackerOoT), - ) + writeFile(os.path.join(exportPath, "include/tables/scene_table.h"), newFileData) From 6705834d89b618dc872f7a7c309a7c3fda56a835 Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Fri, 13 Jan 2023 19:03:46 +0100 Subject: [PATCH 04/15] fixed scene table using the wrong scene settings props for removing a scene --- .../oot/scene/exporter/to_c/scene_table_c.py | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py index d3ff110..e093885 100644 --- a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py +++ b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py @@ -4,6 +4,13 @@ from ....oot_constants import ootEnumSceneID, ootSceneNameToID from ....oot_utility import getCustomProperty, ExportInfo +def getSceneSettingsOption(scene): + if scene is not None: + return bpy.context.scene.ootSceneExportSettings.option + else: + return bpy.context.scene.ootSceneRemoveSettings.option + + def getSceneTable(exportPath): """Read and remove unwanted stuff from ``scene_table.h``""" dataList = [] @@ -67,7 +74,7 @@ def getOriginalIndex(sceneName): raise PluginError("ERROR: Scene Index not found!") -def getInsertionIndex(sceneNames, sceneName, index, mode): +def getInsertionIndex(scene, sceneNames, sceneName, index, mode): """Returns the index to know where to insert data""" # special case where the scene is "Inside the Great Deku Tree" # since it's the first scene simply return 0 @@ -90,7 +97,7 @@ def getInsertionIndex(sceneNames, sceneName, index, mode): elif mode == "EXPORT": return ( i - if not sceneName in sceneNames and sceneName != bpy.context.scene.ootSceneExportSettings.option + if not sceneName in sceneNames and sceneName != getSceneSettingsOption(scene) else i + 1 ) # same but don't check for chosen scene @@ -100,14 +107,14 @@ def getInsertionIndex(sceneNames, sceneName, index, mode): raise NotImplementedError # if the index hasn't been found yet, do it again but decrement the index - return getInsertionIndex(sceneNames, sceneName, currentIndex - 1, mode) + return getInsertionIndex(scene, sceneNames, sceneName, currentIndex - 1, mode) def getSceneParams(scene, exportInfo, sceneNames): """Returns the parameters that needs to be set in ``DEFINE_SCENE()``""" # in order to replace the values of ``unk10``, ``unk12`` and basically every parameters from ``DEFINE_SCENE``, # you just have to make it return something other than None, not necessarily a string - sceneIndex = getSceneIndex(sceneNames, bpy.context.scene.ootSceneExportSettings.option) + sceneIndex = getSceneIndex(sceneNames, getSceneSettingsOption(scene)) sceneName = sceneTitle = sceneID = sceneUnk10 = sceneUnk12 = None name = scene.name if scene is not None else exportInfo.name @@ -130,8 +137,8 @@ def sceneTableToC(data, header, sceneNames, scene): mode = "EXPORT" if scene is not None else "REMOVE" # get the index of the last non-debug scene - lastNonDebugSceneIdx = getInsertionIndex(sceneNames, "SCENE_OUTSIDE_GANONS_CASTLE", None, mode) - lastSceneIdx = getInsertionIndex(sceneNames, "SCENE_TESTROOM", None, mode) + lastNonDebugSceneIdx = getInsertionIndex(scene, sceneNames, "SCENE_OUTSIDE_GANONS_CASTLE", None, mode) + lastSceneIdx = getInsertionIndex(scene, sceneNames, "SCENE_TESTROOM", None, mode) # add the actual lines with the same formatting for i in range(len(data)): @@ -203,7 +210,7 @@ def modifySceneTable(scene, exportInfo: ExportInfo): # that means the selected scene has been removed from the table # however if the scene variable is not None # set it to "INSERT" because we need to insert the scene in the right place - if sceneIndex is None and bpy.context.scene.ootSceneExportSettings.option == "Custom": + if sceneIndex is None and getSceneSettingsOption(scene) == "Custom": mode = "CUSTOM" elif sceneIndex is None and scene is not None: mode = "INSERT" @@ -238,7 +245,7 @@ def modifySceneTable(scene, exportInfo: ExportInfo): # if this the user chose a vanilla scene, removed it and want to export # insert the data in the normal location # shifted index = vanilla index - (vanilla last scene index - new last scene index) - index = getInsertionIndex(sceneNames, sceneID, None, mode) + index = getInsertionIndex(scene, sceneNames, sceneID, None, mode) sceneNames.insert(index, sceneParams[2]) fileData.insert(index, sceneParams) From df54a2461eba9277a2282dc5fb35b307efd13fcc Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:30:41 +0100 Subject: [PATCH 05/15] review --- .../oot/scene/exporter/to_c/scene_table_c.py | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py index e093885..bea5158 100644 --- a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py +++ b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py @@ -4,7 +4,7 @@ from ....oot_constants import ootEnumSceneID, ootSceneNameToID from ....oot_utility import getCustomProperty, ExportInfo -def getSceneSettingsOption(scene): +def getSceneNameSettings(scene): if scene is not None: return bpy.context.scene.ootSceneExportSettings.option else: @@ -97,7 +97,7 @@ def getInsertionIndex(scene, sceneNames, sceneName, index, mode): elif mode == "EXPORT": return ( i - if not sceneName in sceneNames and sceneName != getSceneSettingsOption(scene) + if not sceneName in sceneNames and sceneName != getSceneNameSettings(scene) else i + 1 ) # same but don't check for chosen scene @@ -114,7 +114,7 @@ def getSceneParams(scene, exportInfo, sceneNames): """Returns the parameters that needs to be set in ``DEFINE_SCENE()``""" # in order to replace the values of ``unk10``, ``unk12`` and basically every parameters from ``DEFINE_SCENE``, # you just have to make it return something other than None, not necessarily a string - sceneIndex = getSceneIndex(sceneNames, getSceneSettingsOption(scene)) + sceneIndex = getSceneIndex(sceneNames, getSceneNameSettings(scene)) sceneName = sceneTitle = sceneID = sceneUnk10 = sceneUnk12 = None name = scene.name if scene is not None else exportInfo.name @@ -173,21 +173,21 @@ def getDrawConfig(sceneName: str): def addHackerOoTData(fileData: str): """Reads the file and adds HackerOoT's modifications to the scene table file""" - newFileData = '#include "config.h"\n\n' + newFileData = ['#include "config.h"\n\n'] - for line in fileData.split("\n"): + for line in fileData.splitlines(): if "// Debug-only scenes" in line: - newFileData += "\n#ifdef INCLUDE_TEST_SCENES\n" + newFileData.append("\n#ifdef INCLUDE_TEST_SCENES\n") if "// Added scenes" in line: - newFileData += "#endif\n\n" + newFileData.append("#endif\n\n") - newFileData += f"{line}\n" + newFileData.append(f"{line}\n") if not "// Added scenes" in fileData: - newFileData = newFileData[:-1] + "#endif\n\n" + newFileData.append("#endif\n") - return newFileData[:-1] + return "".join(newFileData) def modifySceneTable(scene, exportInfo: ExportInfo): @@ -210,7 +210,7 @@ def modifySceneTable(scene, exportInfo: ExportInfo): # that means the selected scene has been removed from the table # however if the scene variable is not None # set it to "INSERT" because we need to insert the scene in the right place - if sceneIndex is None and getSceneSettingsOption(scene) == "Custom": + if sceneIndex is None and getSceneNameSettings(scene) == "Custom": mode = "CUSTOM" elif sceneIndex is None and scene is not None: mode = "INSERT" @@ -261,13 +261,7 @@ def modifySceneTable(scene, exportInfo: ExportInfo): newFileData = sceneTableToC(fileData, header, sceneNames, scene) # apply HackerOoT changes if needed - isHackerOoT = False - - with open(os.path.join(exportPath, "include/tables/scene_table.h"), "r") as file: - if '#include "config.h"' in file.read(): - isHackerOoT = True - - if isHackerOoT: + if bpy.context.scene.fast64.oot.hackerFeaturesEnabled: newFileData = addHackerOoTData(newFileData) # write the file with the final data From 02eb11c419234953d246cd723150dd3dae7f98b9 Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:31:09 +0100 Subject: [PATCH 06/15] random fix: fixed missing \n for wind cmd --- fast64_internal/oot/scene/exporter/to_c/room_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fast64_internal/oot/scene/exporter/to_c/room_commands.py b/fast64_internal/oot/scene/exporter/to_c/room_commands.py index 21f3f06..1b0ccf5 100644 --- a/fast64_internal/oot/scene/exporter/to_c/room_commands.py +++ b/fast64_internal/oot/scene/exporter/to_c/room_commands.py @@ -30,7 +30,7 @@ def getTimeSettingsCmd(outRoom: OOTRoom): def getWindSettingsCmd(outRoom: OOTRoom): return ( - indent + f"SCENE_CMD_WIND_SETTINGS({', '.join(f'{dir}' for dir in outRoom.windVector)}, {outRoom.windStrength})" + indent + f"SCENE_CMD_WIND_SETTINGS({', '.join(f'{dir}' for dir in outRoom.windVector)}, {outRoom.windStrength})\n" ) From dcd14eda7af5190abc185115238b56cecacd1ece Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:31:34 +0100 Subject: [PATCH 07/15] black --- fast64_internal/oot/scene/exporter/to_c/room_commands.py | 3 ++- fast64_internal/oot/scene/exporter/to_c/scene_table_c.py | 6 +----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/fast64_internal/oot/scene/exporter/to_c/room_commands.py b/fast64_internal/oot/scene/exporter/to_c/room_commands.py index 1b0ccf5..755c5e4 100644 --- a/fast64_internal/oot/scene/exporter/to_c/room_commands.py +++ b/fast64_internal/oot/scene/exporter/to_c/room_commands.py @@ -30,7 +30,8 @@ def getTimeSettingsCmd(outRoom: OOTRoom): def getWindSettingsCmd(outRoom: OOTRoom): return ( - indent + f"SCENE_CMD_WIND_SETTINGS({', '.join(f'{dir}' for dir in outRoom.windVector)}, {outRoom.windStrength})\n" + indent + + f"SCENE_CMD_WIND_SETTINGS({', '.join(f'{dir}' for dir in outRoom.windVector)}, {outRoom.windStrength})\n" ) diff --git a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py index bea5158..40aec7b 100644 --- a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py +++ b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py @@ -95,11 +95,7 @@ def getInsertionIndex(scene, sceneNames, sceneName, index, mode): return i + 1 # return an index to insert a comment elif mode == "EXPORT": - return ( - i - if not sceneName in sceneNames and sceneName != getSceneNameSettings(scene) - else i + 1 - ) + return i if not sceneName in sceneNames and sceneName != getSceneNameSettings(scene) else i + 1 # same but don't check for chosen scene elif mode == "REMOVE": return i if not sceneName in sceneNames else i + 1 From 0363b61e5e5289bdf3844b552fc7344ee7c383ee Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:36:28 +0100 Subject: [PATCH 08/15] forgot the comma --- fast64_internal/oot/scene/exporter/to_c/room_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fast64_internal/oot/scene/exporter/to_c/room_commands.py b/fast64_internal/oot/scene/exporter/to_c/room_commands.py index 755c5e4..7ef5459 100644 --- a/fast64_internal/oot/scene/exporter/to_c/room_commands.py +++ b/fast64_internal/oot/scene/exporter/to_c/room_commands.py @@ -31,7 +31,7 @@ def getTimeSettingsCmd(outRoom: OOTRoom): def getWindSettingsCmd(outRoom: OOTRoom): return ( indent - + f"SCENE_CMD_WIND_SETTINGS({', '.join(f'{dir}' for dir in outRoom.windVector)}, {outRoom.windStrength})\n" + + f"SCENE_CMD_WIND_SETTINGS({', '.join(f'{dir}' for dir in outRoom.windVector)}, {outRoom.windStrength}),\n" ) From 47767e47aef39baf06a9a2988532303a19f0bbed Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Tue, 17 Jan 2023 21:20:25 +0100 Subject: [PATCH 09/15] review 2 --- .../oot/scene/exporter/to_c/scene_table_c.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py index 40aec7b..67bf6a7 100644 --- a/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py +++ b/fast64_internal/oot/scene/exporter/to_c/scene_table_c.py @@ -11,6 +11,16 @@ def getSceneNameSettings(scene): return bpy.context.scene.ootSceneRemoveSettings.option +def getHackerOoTCheck(line: str): + return ( + line != "\n" + and '#include "config.h"\n' not in line + and "#ifdef INCLUDE_TEST_SCENES" not in line + and "#endif" not in line + and not line.startswith("// ") + ) + + def getSceneTable(exportPath): """Read and remove unwanted stuff from ``scene_table.h``""" dataList = [] @@ -22,13 +32,7 @@ def getSceneTable(exportPath): with open(os.path.join(exportPath, "include/tables/scene_table.h")) as fileData: # keep the relevant data and do some formatting for i, line in enumerate(fileData): - if ( - line != "\n" - and '#include "config.h"\n' not in line - and "#ifdef INCLUDE_TEST_SCENES" not in line - and "#endif" not in line - and not line.startswith("// ") - ): + if not bpy.context.scene.fast64.oot.hackerFeaturesEnabled or getHackerOoTCheck(line): if not (line.startswith("/**") or line.startswith(" *")): dataList.append(line[(line.find("(") + 1) :].rstrip(")\n").replace(" ", "").split(",")) else: From 194dab48284a401a9503350eca6eedfc00e033ed Mon Sep 17 00:00:00 2001 From: scut Date: Mon, 20 Feb 2023 13:46:10 -0500 Subject: [PATCH 10/15] added tooltips --- fast64_internal/f3d/f3d_enums.py | 46 ++++++++++++++--------------- fast64_internal/f3d/f3d_material.py | 33 +++++++++++++++++++++ 2 files changed, 56 insertions(+), 23 deletions(-) diff --git a/fast64_internal/f3d/f3d_enums.py b/fast64_internal/f3d/f3d_enums.py index 918987a..9bde292 100644 --- a/fast64_internal/f3d/f3d_enums.py +++ b/fast64_internal/f3d/f3d_enums.py @@ -165,20 +165,20 @@ enumRGBDither = [ ] enumCombKey = [ - ("G_CK_NONE", "None", "None"), - ("G_CK_KEY", "Key", "Key"), + ("G_CK_NONE", "None", "Disables chroma key."), + ("G_CK_KEY", "Key", "Enables chroma key."), ] enumTextConv = [ - ("G_TC_CONV", "Convert", "Convert"), - ("G_TC_FILTCONV", "Filter And Convert", "Filter And Convert"), - ("G_TC_FILT", "Filter", "Filter"), + ("G_TC_CONV", "Convert", "Convert, used for YUV to RGB conversion."), + ("G_TC_FILTCONV", "Filter And Convert", "Filter And Convert, used for YUV to RGB conversion."), + ("G_TC_FILT", "Filter", "Filter, used for default textures."), ] enumTextFilt = [ - ("G_TF_POINT", "Point", "Point"), - ("G_TF_AVERAGE", "Average", "Average"), - ("G_TF_BILERP", "Bilinear", "Bilinear"), + ("G_TF_POINT", "Point", "Point filtering."), + ("G_TF_AVERAGE", "Average", "Average filter, not recommended except for pixel aligned texrects."), + ("G_TF_BILERP", "Bilinear", "Bilinear, standard N64 filtering with 3 point sample."), ] enumTextLUT = [ @@ -188,14 +188,14 @@ enumTextLUT = [ ] enumTextLOD = [ - ("G_TL_TILE", "Tile", "Tile"), - ("G_TL_LOD", "LOD", "LOD"), + ("G_TL_TILE", "Tile", "Shows selected color combiner tiles"), + ("G_TL_LOD", "LoD", "Enables LoD calculations"), ] enumTextDetail = [ - ("G_TD_CLAMP", "Clamp", "Clamp"), - ("G_TD_SHARPEN", "Sharpen", "Sharpen"), - ("G_TD_DETAIL", "Detail", "Detail"), + ("G_TD_CLAMP", "Clamp", "Clamp, shows base tile for texel0 and texel 1 when magnifying (>1 texel/pixel)"), + ("G_TD_SHARPEN", "Sharpen", "Sharpen, sharpens pixel colors when magnifying (>1 texel/pixel)"), + ("G_TD_DETAIL", "Detail", "Detail, shows base tile when magnifying (>1 texel/pixel), else shows base tile+1"), ] enumTextPersp = [ @@ -206,8 +206,8 @@ enumTextPersp = [ enumCycleType = [ ("G_CYC_1CYCLE", "1 Cycle", "1 Cycle"), ("G_CYC_2CYCLE", "2 Cycle", "2 Cycle"), - ("G_CYC_COPY", "Copy", "Copy"), - ("G_CYC_FILL", "Fill", "Fill"), + ("G_CYC_COPY", "Copy", "Copies texture values to framebuffer with no perspective correction or blending"), + ("G_CYC_FILL", "Fill", "Uses blend color to fill primitve"), ] enumColorDither = [("G_CD_DISABLE", "Disable", "Disable"), ("G_CD_ENABLE", "Enable", "Enable")] @@ -219,20 +219,20 @@ enumPipelineMode = [ enumAlphaCompare = [ ("G_AC_NONE", "None", "None"), - ("G_AC_THRESHOLD", "Threshold", "Threshold"), - ("G_AC_DITHER", "Dither", "Dither"), + ("G_AC_THRESHOLD", "Threshold", "Threshold, writes if alpha is greater than blend color alpha"), + ("G_AC_DITHER", "Dither", "Dither, writes if alpha is greater than random value"), ] enumDepthSource = [ - ("G_ZS_PIXEL", "Pixel", "Pixel"), - ("G_ZS_PRIM", "Primitive", "Primitive"), + ("G_ZS_PIXEL", "Pixel", "Z value is calculated per primitive pixel"), + ("G_ZS_PRIM", "Primitive", "Primitive, use prim depth to set Z value"), ] enumCoverage = [ - ("CVG_DST_CLAMP", "Clamp", "Clamp"), - ("CVG_DST_WRAP", "Wrap", "Wrap"), - ("CVG_DST_FULL", "Full", "Full"), - ("CVG_DST_SAVE", "Save", "Save"), + ("CVG_DST_CLAMP", "Clamp", "Clamp if blending, else use new pixel coverage"), + ("CVG_DST_WRAP", "Wrap", "Wrap coverage"), + ("CVG_DST_FULL", "Full", "Force to full coverage"), + ("CVG_DST_SAVE", "Save", "Don't overwrite previous framebuffer coverage value"), ] enumZMode = [ diff --git a/fast64_internal/f3d/f3d_material.py b/fast64_internal/f3d/f3d_material.py index 62cbb07..1cf705b 100644 --- a/fast64_internal/f3d/f3d_material.py +++ b/fast64_internal/f3d/f3d_material.py @@ -2460,45 +2460,54 @@ class RDPSettings(bpy.types.PropertyGroup): name="Z Buffer", default=True, update=update_node_values_with_preset, + description="Turns on/off Z-Buffer. Z-Buffer set to 0 if disabled." ) g_shade: bpy.props.BoolProperty( name="Shading", default=True, update=update_node_values_with_preset, + description="Turns on/off shading. Shade register set to 0 if disabled." ) # v1/2 difference g_cull_front: bpy.props.BoolProperty( name="Cull Front", update=update_node_values_with_preset, + description="Turns on/off drawing of front faces" ) # v1/2 difference g_cull_back: bpy.props.BoolProperty( name="Cull Back", default=True, update=update_node_values_with_preset, + description="Turns on/off drawing of back faces" ) g_fog: bpy.props.BoolProperty( name="Fog", update=update_node_values_with_preset, + description="Turns on/off fog calculation. Fog variable gets stored into shade alpha" ) g_lighting: bpy.props.BoolProperty( name="Lighting", default=True, update=update_node_values_with_preset, + description="Enables calculation of shade values from lights and vertex normals. Turn off for vertex colors" ) g_tex_gen: bpy.props.BoolProperty( name="Texture UV Generate", update=update_node_values_with_preset, + description="Generates texture coordinates that maps from norm x/y to [0-1]x/y" ) g_tex_gen_linear: bpy.props.BoolProperty( name="Texture UV Generate Linear", update=update_node_values_with_preset, + description="Generates texture coordinates that linearly maps from cos/sin(norm) to [0-1]x/y" ) # v1/2 difference g_shade_smooth: bpy.props.BoolProperty( name="Smooth Shading", default=True, update=update_node_values_with_preset, + description="Shades primitive smoothly using interpolation between shade values for each vertex(Gouraud shading)" ) # f3dlx2 only g_clipping: bpy.props.BoolProperty( @@ -2513,6 +2522,7 @@ class RDPSettings(bpy.types.PropertyGroup): items=enumAlphaDither, default="G_AD_NOISE", update=update_node_values_with_preset, + description="Applies your choice dithering type to output frambuffer alpha" ) # v2 only g_mdsft_rgb_dither: bpy.props.EnumProperty( @@ -2520,35 +2530,41 @@ class RDPSettings(bpy.types.PropertyGroup): items=enumRGBDither, default="G_CD_MAGICSQ", update=update_node_values_with_preset, + description="Applies your choice dithering type to output frambuffer color" ) g_mdsft_combkey: bpy.props.EnumProperty( name="Chroma Key", items=enumCombKey, default="G_CK_NONE", update=update_node_values_with_preset, + description="Turns on/off the chroma key. Chroma key requires a special setup to work properly" ) g_mdsft_textconv: bpy.props.EnumProperty( name="Texture Convert", items=enumTextConv, default="G_TC_FILT", update=update_node_values_with_preset, + description="Turns on/off the converter for texture color. Can convert color space from YUV into RGB" ) g_mdsft_text_filt: bpy.props.EnumProperty( name="Texture Filter", items=enumTextFilt, default="G_TF_BILERP", update=update_node_values_without_preset, + description="Applies your choice of filtering to texels" ) g_mdsft_textlut: bpy.props.EnumProperty( name="Texture LUT", items=enumTextLUT, default="G_TT_NONE", + description="Changes texture look up table (LUT) behavior. This property is auto set if you choose a CI texture" ) g_mdsft_textlod: bpy.props.EnumProperty( name="Texture LOD", items=enumTextLOD, default="G_TL_TILE", update=update_node_values_with_preset, + description="Turns on/off the use of LoD on textures. LoD textures change the used tile based on the texel/pixel ratio" ) num_textures_mipmapped: bpy.props.IntProperty( name="Number of Mipmaps", @@ -2562,18 +2578,21 @@ class RDPSettings(bpy.types.PropertyGroup): items=enumTextDetail, default="G_TD_CLAMP", update=update_node_values_with_preset, + description="Changes type of LoD usage. Affects how tiles are selected based on texel magnification. Only works when G_TL_LOD is selected" ) g_mdsft_textpersp: bpy.props.EnumProperty( name="Texture Perspective Correction", items=enumTextPersp, default="G_TP_PERSP", update=update_node_values_with_preset, + description="Turns on/off texture perspective correction" ) g_mdsft_cycletype: bpy.props.EnumProperty( name="Cycle Type", items=enumCycleType, default="G_CYC_1CYCLE", update=update_node_values_with_preset, + description="Changes RDP pipeline configuration. For normal textured triangles use one or two cycle mode" ) # v1 only g_mdsft_color_dither: bpy.props.EnumProperty( @@ -2581,12 +2600,14 @@ class RDPSettings(bpy.types.PropertyGroup): items=enumColorDither, default="G_CD_ENABLE", update=update_node_values_with_preset, + description="Applies your choice dithering type to output frambuffer" ) g_mdsft_pipeline: bpy.props.EnumProperty( name="Pipeline Span Buffer Coherency", items=enumPipelineMode, default="G_PM_1PRIMITIVE", update=update_node_values_with_preset, + description="Changes primitive rasterization timing. For games besides SM64, N-prim is optimal" ) # lower half mode @@ -2595,12 +2616,14 @@ class RDPSettings(bpy.types.PropertyGroup): items=enumAlphaCompare, default="G_AC_NONE", update=update_node_values_with_preset, + description="Uses alpha comparisons to decide if a pixel should be written. Applies before blending" ) g_mdsft_zsrcsel: bpy.props.EnumProperty( name="Z Source Selection", items=enumDepthSource, default="G_ZS_PIXEL", update=update_node_values_with_preset, + description="Changes screen-space Z value source used for Z-Buffer calculations" ) prim_depth: bpy.props.PointerProperty( @@ -2639,37 +2662,47 @@ class RDPSettings(bpy.types.PropertyGroup): ) aa_en: bpy.props.BoolProperty( update=update_node_values_with_preset, + description="Enables anti-aliasing to rasterized primitive edges. Uses coverage to determine edges" ) z_cmp: bpy.props.BoolProperty( update=update_node_values_with_preset, + description="Checks pixel Z value against Z-Buffer to test writing" ) z_upd: bpy.props.BoolProperty( update=update_node_values_with_preset, + description="Updates the Z-Buffer with the most recently written pixel Z value" ) im_rd: bpy.props.BoolProperty( update=update_node_values_with_preset, + description="Enables reading from framebuffer for blending calculations" ) clr_on_cvg: bpy.props.BoolProperty( update=update_node_values_with_preset, + description="Only draw on coverage (amount primitive covers target pixel) overflow" ) cvg_dst: bpy.props.EnumProperty( name="Coverage Destination", items=enumCoverage, update=update_node_values_with_preset, + description="Changes how coverage (amount primitive covers target pixel) gets retrieved/stored" ) zmode: bpy.props.EnumProperty( name="Z Mode", items=enumZMode, update=update_node_values_with_preset, + description="Changes Z calculation for different types of primitives" ) cvg_x_alpha: bpy.props.BoolProperty( update=update_node_values_with_preset, + description="Multiply coverage (amount primitive covers target pixel) with alpha and store result as coverage" ) alpha_cvg_sel: bpy.props.BoolProperty( update=update_node_values_with_preset, + description="Use coverage (amount primitive covers target pixel) as alpha instead of color combiner alpha" ) force_bl: bpy.props.BoolProperty( update=update_node_values_with_preset, + description="Always uses blending on. Default blending is conditionally based on depth. Always used when Z Buffering is off" ) # cycle dependent - (P * A + M - B) / (A + B) From 4daad9695baa1335c06405c451f200e72ced4c53 Mon Sep 17 00:00:00 2001 From: scut Date: Mon, 20 Feb 2023 13:56:07 -0500 Subject: [PATCH 11/15] clarified tooltips --- fast64_internal/f3d/f3d_enums.py | 14 +++++++------- fast64_internal/f3d/f3d_material.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fast64_internal/f3d/f3d_enums.py b/fast64_internal/f3d/f3d_enums.py index 9bde292..8ba0ba3 100644 --- a/fast64_internal/f3d/f3d_enums.py +++ b/fast64_internal/f3d/f3d_enums.py @@ -176,9 +176,9 @@ enumTextConv = [ ] enumTextFilt = [ - ("G_TF_POINT", "Point", "Point filtering."), - ("G_TF_AVERAGE", "Average", "Average filter, not recommended except for pixel aligned texrects."), - ("G_TF_BILERP", "Bilinear", "Bilinear, standard N64 filtering with 3 point sample."), + ("G_TF_POINT", "Point", "Point filtering"), + ("G_TF_AVERAGE", "Average", "Average filter, not recommended except for pixel aligned texrects"), + ("G_TF_BILERP", "Bilinear", "Bilinear, standard N64 filtering with 3 point sample"), ] enumTextLUT = [ @@ -189,13 +189,13 @@ enumTextLUT = [ enumTextLOD = [ ("G_TL_TILE", "Tile", "Shows selected color combiner tiles"), - ("G_TL_LOD", "LoD", "Enables LoD calculations"), + ("G_TL_LOD", "LoD", "Enables LoD calculations, LoD tile is base tile + log2(texel/pixel) ratio"), ] enumTextDetail = [ - ("G_TD_CLAMP", "Clamp", "Clamp, shows base tile for texel0 and texel 1 when magnifying (>1 texel/pixel)"), - ("G_TD_SHARPEN", "Sharpen", "Sharpen, sharpens pixel colors when magnifying (>1 texel/pixel)"), - ("G_TD_DETAIL", "Detail", "Detail, shows base tile when magnifying (>1 texel/pixel), else shows base tile+1"), + ("G_TD_CLAMP", "Clamp", "Shows base tile for texel0 and texel 1 when magnifying (>1 texel/pixel), else shows LoD tiles"), + ("G_TD_SHARPEN", "Sharpen", "Sharpens pixel colors when magnifying (>1 texel/pixel), always shows LoD tiles"), + ("G_TD_DETAIL", "Detail", "Shows base tile when magnifying (>1 texel/pixel), else shows base tile+1 as LoD tiles"), ] enumTextPersp = [ diff --git a/fast64_internal/f3d/f3d_material.py b/fast64_internal/f3d/f3d_material.py index 1cf705b..fe6c660 100644 --- a/fast64_internal/f3d/f3d_material.py +++ b/fast64_internal/f3d/f3d_material.py @@ -2507,7 +2507,7 @@ class RDPSettings(bpy.types.PropertyGroup): name="Smooth Shading", default=True, update=update_node_values_with_preset, - description="Shades primitive smoothly using interpolation between shade values for each vertex(Gouraud shading)" + description="Shades primitive smoothly using interpolation between shade values for each vertex (Gouraud shading)" ) # f3dlx2 only g_clipping: bpy.props.BoolProperty( From 3e929d56f92b9ef0296d0b2d7861e6ef2aa091f4 Mon Sep 17 00:00:00 2001 From: scut Date: Mon, 20 Feb 2023 14:04:10 -0500 Subject: [PATCH 12/15] more detail on LoD tooltips --- fast64_internal/f3d/f3d_enums.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fast64_internal/f3d/f3d_enums.py b/fast64_internal/f3d/f3d_enums.py index 8ba0ba3..f748960 100644 --- a/fast64_internal/f3d/f3d_enums.py +++ b/fast64_internal/f3d/f3d_enums.py @@ -189,13 +189,13 @@ enumTextLUT = [ enumTextLOD = [ ("G_TL_TILE", "Tile", "Shows selected color combiner tiles"), - ("G_TL_LOD", "LoD", "Enables LoD calculations, LoD tile is base tile + log2(texel/pixel) ratio"), + ("G_TL_LOD", "LoD", "Enables LoD calculations, LoD tile is base tile + clamp(log2(texel/pixel)), remainder of log2(texel/pixel) ratio gets stored to LoD Fraction in the color combiner"), ] enumTextDetail = [ ("G_TD_CLAMP", "Clamp", "Shows base tile for texel0 and texel 1 when magnifying (>1 texel/pixel), else shows LoD tiles"), ("G_TD_SHARPEN", "Sharpen", "Sharpens pixel colors when magnifying (>1 texel/pixel), always shows LoD tiles"), - ("G_TD_DETAIL", "Detail", "Shows base tile when magnifying (>1 texel/pixel), else shows base tile+1 as LoD tiles"), + ("G_TD_DETAIL", "Detail", "Shows base tile when magnifying (>1 texel/pixel), else shows LoD tiles + 1"), ] enumTextPersp = [ From c2120d6eab07d9335e6b770eb62c5bc2eb8a5e9c Mon Sep 17 00:00:00 2001 From: scut Date: Mon, 20 Feb 2023 19:13:55 -0500 Subject: [PATCH 13/15] increase accuracy and clarity of tooltips --- fast64_internal/f3d/f3d_enums.py | 28 ++++++++++++++-------------- fast64_internal/f3d/f3d_material.py | 24 ++++++++++++------------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/fast64_internal/f3d/f3d_enums.py b/fast64_internal/f3d/f3d_enums.py index f748960..edc53c4 100644 --- a/fast64_internal/f3d/f3d_enums.py +++ b/fast64_internal/f3d/f3d_enums.py @@ -170,15 +170,15 @@ enumCombKey = [ ] enumTextConv = [ - ("G_TC_CONV", "Convert", "Convert, used for YUV to RGB conversion."), - ("G_TC_FILTCONV", "Filter And Convert", "Filter And Convert, used for YUV to RGB conversion."), - ("G_TC_FILT", "Filter", "Filter, used for default textures."), + ("G_TC_CONV", "Convert", "Convert YUV to RGB"), + ("G_TC_FILTCONV", "Filter And Convert", "Applies chosen filter on cycle 1 and converts YUB to RGB in the second cycle"), + ("G_TC_FILT", "Filter", "Applies chosen filter on textures with no color conversion"), ] enumTextFilt = [ ("G_TF_POINT", "Point", "Point filtering"), - ("G_TF_AVERAGE", "Average", "Average filter, not recommended except for pixel aligned texrects"), - ("G_TF_BILERP", "Bilinear", "Bilinear, standard N64 filtering with 3 point sample"), + ("G_TF_AVERAGE", "Average", "Four sample filter, not recommended except for pixel aligned texrects"), + ("G_TF_BILERP", "Bilinear", "Standard N64 filtering with 3 point sample"), ] enumTextLUT = [ @@ -194,8 +194,8 @@ enumTextLOD = [ enumTextDetail = [ ("G_TD_CLAMP", "Clamp", "Shows base tile for texel0 and texel 1 when magnifying (>1 texel/pixel), else shows LoD tiles"), - ("G_TD_SHARPEN", "Sharpen", "Sharpens pixel colors when magnifying (>1 texel/pixel), always shows LoD tiles"), - ("G_TD_DETAIL", "Detail", "Shows base tile when magnifying (>1 texel/pixel), else shows LoD tiles + 1"), + ("G_TD_SHARPEN", "Sharpen", "Sharpens pixel colors when magnifying (<1 texel/pixel), always shows LoD tiles"), + ("G_TD_DETAIL", "Detail", "Shows base tile when magnifying (<1 texel/pixel), else shows LoD tiles + 1"), ] enumTextPersp = [ @@ -207,25 +207,25 @@ enumCycleType = [ ("G_CYC_1CYCLE", "1 Cycle", "1 Cycle"), ("G_CYC_2CYCLE", "2 Cycle", "2 Cycle"), ("G_CYC_COPY", "Copy", "Copies texture values to framebuffer with no perspective correction or blending"), - ("G_CYC_FILL", "Fill", "Uses blend color to fill primitve"), + ("G_CYC_FILL", "Fill", "Uses fill color to fill primitve"), ] enumColorDither = [("G_CD_DISABLE", "Disable", "Disable"), ("G_CD_ENABLE", "Enable", "Enable")] enumPipelineMode = [ - ("G_PM_1PRIMITIVE", "1 Primitive", "1 Primitive"), - ("G_PM_NPRIMITIVE", "N Primitive", "N Primitive"), + ("G_PM_1PRIMITIVE", "1 Primitive", "Adds in pipe sync after every tri draw. Adds significant amounts of lag. Only use in vanilla SM64 hacking projects"), + ("G_PM_NPRIMITIVE", "N Primitive", "No additional syncs are added after tri draws. Default option for every game but vanilla SM64"), ] enumAlphaCompare = [ - ("G_AC_NONE", "None", "None"), - ("G_AC_THRESHOLD", "Threshold", "Threshold, writes if alpha is greater than blend color alpha"), - ("G_AC_DITHER", "Dither", "Dither, writes if alpha is greater than random value"), + ("G_AC_NONE", "None", "No alpha comparison is made, writing is based on coverage"), + ("G_AC_THRESHOLD", "Threshold", "Writes if alpha is greater than blend color alpha"), + ("G_AC_DITHER", "Dither", "Writes if alpha is greater than random value"), ] enumDepthSource = [ ("G_ZS_PIXEL", "Pixel", "Z value is calculated per primitive pixel"), - ("G_ZS_PRIM", "Primitive", "Primitive, use prim depth to set Z value"), + ("G_ZS_PRIM", "Primitive", "Uses prim depth to set Z value, does not work on HLE emulation"), ] enumCoverage = [ diff --git a/fast64_internal/f3d/f3d_material.py b/fast64_internal/f3d/f3d_material.py index fe6c660..57f99f9 100644 --- a/fast64_internal/f3d/f3d_material.py +++ b/fast64_internal/f3d/f3d_material.py @@ -2460,26 +2460,26 @@ class RDPSettings(bpy.types.PropertyGroup): name="Z Buffer", default=True, update=update_node_values_with_preset, - description="Turns on/off Z-Buffer. Z-Buffer set to 0 if disabled." + 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, update=update_node_values_with_preset, - description="Turns on/off shading. Shade register set to 0 if disabled." + description="Computes shade coordinates for primitives. Disable if not using lighting, vertex colors or fog" ) # v1/2 difference g_cull_front: bpy.props.BoolProperty( name="Cull Front", update=update_node_values_with_preset, - description="Turns on/off drawing of front faces" + description="Disables drawing of front faces" ) # v1/2 difference g_cull_back: bpy.props.BoolProperty( name="Cull Back", default=True, update=update_node_values_with_preset, - description="Turns on/off drawing of back faces" + description="Disables drawing of back faces" ) g_fog: bpy.props.BoolProperty( name="Fog", @@ -2490,17 +2490,17 @@ class RDPSettings(bpy.types.PropertyGroup): name="Lighting", default=True, update=update_node_values_with_preset, - description="Enables calculation of shade values from lights and vertex normals. Turn off for vertex colors" + description="Enables calculation shade color using lights. Turn off for vertex colors as shade color" ) g_tex_gen: bpy.props.BoolProperty( name="Texture UV Generate", update=update_node_values_with_preset, - description="Generates texture coordinates that maps from norm x/y to [0-1]x/y" + description="Generates texture coordinates for reflection mapping based on vertex normals and lookat direction. On a skybox texture, maps the sky to the center of the texture and the ground to a cirlce inscribed in the border. Requires lighting enabled to use" ) g_tex_gen_linear: bpy.props.BoolProperty( name="Texture UV Generate Linear", update=update_node_values_with_preset, - description="Generates texture coordinates that linearly maps from cos/sin(norm) to [0-1]x/y" + description="Modifies the texgen mapping; enable with texgen. Use a normal panorama image for the texture, with the sky at the top and the ground at the bottom. Requires lighting enabled to use" ) # v1/2 difference g_shade_smooth: bpy.props.BoolProperty( @@ -2522,7 +2522,7 @@ class RDPSettings(bpy.types.PropertyGroup): items=enumAlphaDither, default="G_AD_NOISE", update=update_node_values_with_preset, - description="Applies your choice dithering type to output frambuffer alpha" + description="Applies your choice dithering type to output framebuffer alpha. Dithering is used to convert high precision source colors into lower precision framebuffer values" ) # v2 only g_mdsft_rgb_dither: bpy.props.EnumProperty( @@ -2530,7 +2530,7 @@ class RDPSettings(bpy.types.PropertyGroup): items=enumRGBDither, default="G_CD_MAGICSQ", update=update_node_values_with_preset, - description="Applies your choice dithering type to output frambuffer color" + description="Applies your choice dithering type to output framebuffer color. Dithering is used to convert high precision source colors into lower precision framebuffer values" ) g_mdsft_combkey: bpy.props.EnumProperty( name="Chroma Key", @@ -2544,7 +2544,7 @@ class RDPSettings(bpy.types.PropertyGroup): items=enumTextConv, default="G_TC_FILT", update=update_node_values_with_preset, - description="Turns on/off the converter for texture color. Can convert color space from YUV into RGB" + 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", @@ -2607,7 +2607,7 @@ class RDPSettings(bpy.types.PropertyGroup): items=enumPipelineMode, default="G_PM_1PRIMITIVE", update=update_node_values_with_preset, - description="Changes primitive rasterization timing. For games besides SM64, N-prim is optimal" + 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" ) # lower half mode @@ -2702,7 +2702,7 @@ class RDPSettings(bpy.types.PropertyGroup): ) force_bl: bpy.props.BoolProperty( update=update_node_values_with_preset, - description="Always uses blending on. Default blending is conditionally based on depth. Always used when Z Buffering is off" + description="Always uses blending on. Default blending is conditionally only applied during partial coverage. Forcing blending will disable division step of the blender, so B input must be 1-A or there may be rendering issues. Always use this option when Z Buffering is off" ) # cycle dependent - (P * A + M - B) / (A + B) From a7aca9f27c14bbd7db3a6daab5993016735290c0 Mon Sep 17 00:00:00 2001 From: scut Date: Wed, 22 Feb 2023 10:36:19 -0500 Subject: [PATCH 14/15] changed material bleed name and tooltip --- __init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/__init__.py b/__init__.py index df1259c..45db801 100644 --- a/__init__.py +++ b/__init__.py @@ -164,7 +164,7 @@ class F3D_GlobalSettingsPanel(bpy.types.Panel): col.prop(context.scene, "saveTextures") col.prop(context.scene, "f3d_simple", text="Simple Material UI") col.prop(context.scene, "generateF3DNodeGraph", text="Generate F3D Node Graph For Materials") - col.prop(context.scene, "exportInlineF3D", text="Export Mesh F3D as single DL") + col.prop(context.scene, "exportInlineF3D", text="Bleed and Inline Material Exports") col.prop(context.scene, "decomp_compatible", invert_checkbox=True, text="Homebrew Compatibility") col.prop(context.scene, "ignoreTextureRestrictions") if context.scene.ignoreTextureRestrictions: @@ -469,9 +469,8 @@ def register(): bpy.types.Scene.saveTextures = bpy.props.BoolProperty(name="Save Textures As PNGs (Breaks CI Textures)") bpy.types.Scene.generateF3DNodeGraph = bpy.props.BoolProperty(name="Generate F3D Node Graph", default=True) bpy.types.Scene.exportHiddenGeometry = bpy.props.BoolProperty(name="Export Hidden Geometry", default=True) - bpy.types.Scene.exportInlineF3D = bpy.props.BoolProperty(name="Export Inline F3D", \ - description = "F3D for each mesh will be one Gfx list instead of having different Gfx lists for each component of the mesh.\n\ -This will cause repeated F3D cmds. This option does not work on armature exports.", default=False) + bpy.types.Scene.exportInlineF3D = bpy.props.BoolProperty(name="Bleed and Inline Material Exports", \ + description = "Inlines and bleeds materials in a single mesh. GeoLayout + Armature exports bleed over entire model", default=False) bpy.types.Scene.blenderF3DScale = bpy.props.FloatProperty( name="F3D Blender Scale", default=100, update=on_update_render_settings ) From 094ec8b9f98594247bc3c601aa7e73e4188e9e41 Mon Sep 17 00:00:00 2001 From: Sauraen Date: Fri, 24 Feb 2023 10:31:16 -0800 Subject: [PATCH 15/15] Fixed typo in tooltip --- 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 57f99f9..47ad59f 100644 --- a/fast64_internal/f3d/f3d_material.py +++ b/fast64_internal/f3d/f3d_material.py @@ -2495,7 +2495,7 @@ class RDPSettings(bpy.types.PropertyGroup): g_tex_gen: bpy.props.BoolProperty( name="Texture UV Generate", update=update_node_values_with_preset, - description="Generates texture coordinates for reflection mapping based on vertex normals and lookat direction. On a skybox texture, maps the sky to the center of the texture and the ground to a cirlce inscribed in the border. Requires lighting enabled to use" + description="Generates texture coordinates for reflection mapping based on vertex normals and lookat direction. On a skybox texture, maps the sky to the center of the texture and the ground to a circle inscribed in the border. Requires lighting enabled to use" ) g_tex_gen_linear: bpy.props.BoolProperty( name="Texture UV Generate Linear",