Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Pepe20129 committed May 3, 2024
1 parent 874d9fc commit 56296f7
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 31 deletions.
15 changes: 11 additions & 4 deletions fast64_internal/f3d/f3d_gbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2137,6 +2137,7 @@ def to_c(self):
data.source += "};\n\n"
return data


def empty_logging_func(a, b):
pass

Expand Down Expand Up @@ -2206,13 +2207,12 @@ def to_c_dynamic(self):
return data

def to_soh_xml(self, modelDirPath, objectPath, *args, **kwargs):
logging_func = kwargs.get('logging_func', empty_logging_func)
logging_func = kwargs.get("logging_func", empty_logging_func)

logging_func({"INFO"}, "GfxList to_soh_xml 1")

data = '<DisplayList Version="0">\n'
for command in self.commands:

logging_func({"INFO"}, "GfxList to_soh_xml 2 command=" + (str(command) if command is not None else "None"))

if isinstance(command, (SPDisplayList, SPBranchList, SPVertex, DPSetTextureImage)):
Expand Down Expand Up @@ -3254,8 +3254,15 @@ def to_soh_xml(self, modelDirPath, objectPath, logging_func):
vtxData += self.vertexList.to_soh_xml()
# vtxData += "<!-- VertexList End -->\n"

logging_func({"INFO"}, "FTriGroup.to_soh_xml 1.1 modelDirPath=" + (str(modelDirPath) if modelDirPath is not None else "None"))
logging_func({"INFO"}, "FTriGroup.to_soh_xml 1.2 self.vertexList.name=" + (str(self.vertexList.name) if self.vertexList.name is not None else "None"))
logging_func(
{"INFO"},
"FTriGroup.to_soh_xml 1.1 modelDirPath=" + (str(modelDirPath) if modelDirPath is not None else "None"),
)
logging_func(
{"INFO"},
"FTriGroup.to_soh_xml 1.2 self.vertexList.name="
+ (str(self.vertexList.name) if self.vertexList.name is not None else "None"),
)

# writeXMLData(vtxData, os.path.join(modelDirPath, self.vertexList.name))

Expand Down
25 changes: 18 additions & 7 deletions fast64_internal/f3d/f3d_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,18 @@ def empty_logging_func(a, b):
# Make sure to set original_name before calling this
# used when duplicating an object
def saveStaticModel(
triConverterInfo, fModel, obj, transformMatrix, ownerName, convertTextureData, revertMatAtEnd, drawLayerField, *args, **kwargs
triConverterInfo,
fModel,
obj,
transformMatrix,
ownerName,
convertTextureData,
revertMatAtEnd,
drawLayerField,
*args,
**kwargs,
):
logging_func = kwargs.get('logging_func', empty_logging_func)
logging_func = kwargs.get("logging_func", empty_logging_func)

logging_func({"INFO"}, "saveStaticModel 1")

Expand Down Expand Up @@ -464,10 +473,12 @@ def saveStaticModel(
logging_func({"INFO"}, "saveStaticModel 7")

if drawLayer not in fMeshes:
logging_func({"INFO"}, "saveStaticModel 7.11 " + (obj.original_name if obj.original_name is not None else "None" ))
logging_func({"INFO"}, "saveStaticModel 7.12 " + (ownerName if ownerName is not None else "None" ))
logging_func({"INFO"}, "saveStaticModel 7.13 " + (drawLayerName if drawLayerName is not None else "None" ))
logging_func({"INFO"}, "saveStaticModel 7.14 " + (str(obj) if obj is not None else "None" ))
logging_func(
{"INFO"}, "saveStaticModel 7.11 " + (obj.original_name if obj.original_name is not None else "None")
)
logging_func({"INFO"}, "saveStaticModel 7.12 " + (ownerName if ownerName is not None else "None"))
logging_func({"INFO"}, "saveStaticModel 7.13 " + (drawLayerName if drawLayerName is not None else "None"))
logging_func({"INFO"}, "saveStaticModel 7.14 " + (str(obj) if obj is not None else "None"))
fMesh = fModel.addMesh(obj.original_name, ownerName, drawLayerName, False, obj)
logging_func({"INFO"}, "saveStaticModel 7.2")
fMeshes[drawLayer] = fMesh
Expand Down Expand Up @@ -527,7 +538,7 @@ def saveStaticModel(
revertMatAndEndDraw(fMesh.draw, [])
else:
fModel.endDraw(fMesh, obj)

logging_func({"INFO"}, "saveStaticModel 12")

logging_func({"INFO"}, "saveStaticModel 13")
Expand Down
6 changes: 3 additions & 3 deletions fast64_internal/oot/animation/importer/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def getFrameData(filepath, animData, frameDataName):
raise PluginError("Cannot find animation frame data named " + frameDataName + " in " + filepath)
data = matchResult.group(1)

#fixes the "invalid literal for int() with base 16: 'x0'" error
# fixes the "invalid literal for int() with base 16: 'x0'" error
frameData = []
for value in data.split(","):
value = value.strip()
Expand All @@ -42,11 +42,11 @@ def getFrameData(filepath, animData, frameDataName):
valueInt = int.from_bytes([int(value[2:4], 16), int(value[4:6], 16)], "big", signed=True)
frameData.append(-valueInt if isNegative else valueInt)

#frameData = [
# frameData = [
# int.from_bytes([int(value.strip()[2:4], 16), int(value.strip()[4:6], 16)], "big", signed=True)
# for value in data.split(",")
# if value.strip() != ""
#]
# ]

return frameData

Expand Down
39 changes: 22 additions & 17 deletions fast64_internal/oot/f3d/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def ootConvertMeshToC(
DLFormat: DLFormat,
saveTextures: bool,
settings: OOTDLExportSettings,
logging_func
logging_func,
):
folderName = settings.folder
exportPath = bpy.path.abspath(settings.customPath)
Expand Down Expand Up @@ -99,7 +99,7 @@ def ootConvertMeshToXML(
DLFormat: DLFormat,
saveTextures: bool,
settings: OOTDLExportSettings,
logging_func
logging_func,
):
logging_func({"INFO"}, "ootConvertMeshToXML 1")

Expand Down Expand Up @@ -129,15 +129,23 @@ def ootConvertMeshToXML(
logging_func({"INFO"}, "ootConvertMeshToXML 5")

fMeshes = saveStaticModel(
triConverterInfo, fModel, obj, finalTransform, fModel.name, not saveTextures, False, "oot", logging_func=logging_func
triConverterInfo,
fModel,
obj,
finalTransform,
fModel.name,
not saveTextures,
False,
"oot",
logging_func=logging_func,
)

logging_func({"INFO"}, "ootConvertMeshToXML 6")

# Since we provide a draw layer override, there should only be one fMesh.
for drawLayer, fMesh in fMeshes.items():
fMesh.draw.name = name

logging_func({"INFO"}, "ootConvertMeshToXML 7")

ootCleanupScene(originalObj, allObjs)
Expand All @@ -148,8 +156,14 @@ def ootConvertMeshToXML(
ootCleanupScene(originalObj, allObjs)
raise Exception(str(e))

logging_func({"INFO"}, "ootConvertMeshToXML 9 exportPath=" + (str(exportPath) if exportPath is not None else "None"))
logging_func({"INFO"}, "ootConvertMeshToXML 9 settings.customAssetIncludeDir=" + (str(settings.customAssetIncludeDir) if settings.customAssetIncludeDir is not None else "None"))
logging_func(
{"INFO"}, "ootConvertMeshToXML 9 exportPath=" + (str(exportPath) if exportPath is not None else "None")
)
logging_func(
{"INFO"},
"ootConvertMeshToXML 9 settings.customAssetIncludeDir="
+ (str(settings.customAssetIncludeDir) if settings.customAssetIncludeDir is not None else "None"),
)

path = ootGetPath(exportPath, isCustomExport, "assets/objects/", folderName, False, True)

Expand All @@ -159,9 +173,7 @@ def ootConvertMeshToXML(

logging_func({"INFO"}, "ootConvertMeshToXML 11")

data = fModel.to_soh_xml(
path, path, logging_func
)
data = fModel.to_soh_xml(path, path, logging_func)

logging_func({"INFO"}, "ootConvertMeshToXML 12")

Expand Down Expand Up @@ -284,14 +296,7 @@ def execute(self, context):
self.report({"INFO"}, "OOT_ExportDL execute 4")

if context.scene.fast64.oot.featureSet == "SoH":
ootConvertMeshToXML(
obj,
finalTransform,
DLFormat.Static,
saveTextures,
exportSettings,
self.report
)
ootConvertMeshToXML(obj, finalTransform, DLFormat.Static, saveTextures, exportSettings, self.report)
else:
ootConvertMeshToC(
obj,
Expand Down

0 comments on commit 56296f7

Please sign in to comment.