Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into ootcollision_reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanis002 committed Jan 26, 2024
2 parents 3c88683 + dcb1891 commit e5ad225
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 72 deletions.
18 changes: 0 additions & 18 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,23 +177,6 @@ def draw(self, context):
col.box().label(text="Width/height must be < 1024. Must be png format.")


class Fast64_GlobalObjectPanel(bpy.types.Panel):
bl_label = "Global Object Inspector"
bl_idname = "OBJECT_PT_OOT_Global_Object_Inspector"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "object"
bl_options = {"HIDE_HEADER"}

@classmethod
def poll(cls, context):
return context.object is not None and context.object.type == "EMPTY"

def draw(self, context):
box = self.layout
prop_split(box, context.scene, "gameEditorMode", "Game")


class Fast64_GlobalSettingsPanel(bpy.types.Panel):
bl_idname = "FAST64_PT_global_settings"
bl_label = "Fast64 Global Settings"
Expand Down Expand Up @@ -391,7 +374,6 @@ def draw(self, context):
AddBoneGroups,
CreateMetarig,
SM64_AddWaterBox,
# Fast64_GlobalObjectPanel,
F3D_GlobalSettingsPanel,
Fast64_GlobalSettingsPanel,
SM64_ArmatureToolsPanel,
Expand Down
4 changes: 2 additions & 2 deletions fast64_internal/f3d/f3d_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -2297,8 +2297,8 @@ def createF3DMat(obj: Object | None, preset="Shaded Solid", index=None):
# link all node_groups + material from addon's data .blend
link_f3d_material_library()

# beefwashere is a linked material containing the default layout for all the linked node_groups
mat = bpy.data.materials["beefwashere"]
# a linked material containing the default layout for all the linked node_groups
mat = bpy.data.materials["fast64_f3d_material_library_beefwashere"]
# duplicate and rename the linked material
material = mat.copy()
material.name = "f3dlite_material"
Expand Down
Binary file modified fast64_internal/f3d/f3d_material_library.blend
Binary file not shown.
2 changes: 1 addition & 1 deletion fast64_internal/f3d/f3d_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def cmdToPositiveInt(cmd):


def parseF3DBinary(romfile, startAddress, scene, bMesh, obj, transformMatrix, groupName, segmentData, vertexBuffer):
f3d = F3D("F3D", False)
f3d = F3D("F3D")
currentAddress = startAddress
romfile.seek(currentAddress)
command = romfile.read(8)
Expand Down
19 changes: 13 additions & 6 deletions fast64_internal/f3d/f3d_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,21 @@ def saveStaticModel(

# checkForF3DMaterial(obj)

facesByMat = {}
faces_by_mat = {}
for face in obj.data.loop_triangles:
if face.material_index not in facesByMat:
facesByMat[face.material_index] = []
facesByMat[face.material_index].append(face)
if face.material_index not in faces_by_mat:
faces_by_mat[face.material_index] = []
faces_by_mat[face.material_index].append(face)

# sort by material slot
faces_by_mat = {
mat_index: faces_by_mat[mat_index]
for mat_index, _ in enumerate(obj.material_slots)
if mat_index in faces_by_mat
}

fMeshes = {}
for material_index, faces in facesByMat.items():
for material_index, faces in faces_by_mat.items():
material = obj.material_slots[material_index].material

if drawLayerField is not None and material.mat_ver > 3:
Expand Down Expand Up @@ -1111,7 +1118,7 @@ def getLoopNormal(loop: bpy.types.MeshLoop) -> Vector:

@functools.lru_cache(0)
def is3_2_or_above():
return bpy.app.version[0] >= 3 and bpy.app.version[1] >= 2
return bpy.app.version >= (3, 2, 0)


def getLoopColor(loop: bpy.types.MeshLoop, mesh: bpy.types.Mesh) -> Vector:
Expand Down
3 changes: 0 additions & 3 deletions fast64_internal/f3d_material_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ def convertBSDFtoF3D(obj, index, material, materialDict):

elif "Principled BSDF" in material.node_tree.nodes:
tex0Node = material.node_tree.nodes["Principled BSDF"].inputs["Base Color"]
tex1Node = material.node_tree.nodes["Principled BSDF"].inputs["Subsurface Color"]
if len(tex0Node.links) == 0:
newMaterial = createF3DMat(obj, preset=getDefaultMaterialPreset("Shaded Solid"), index=index)
f3dMat = newMaterial.f3d_mat if newMaterial.mat_ver > 3 else newMaterial
Expand All @@ -226,8 +225,6 @@ def convertBSDFtoF3D(obj, index, material, materialDict):
newMaterial = createF3DMat(obj, preset=presetName, index=index)
f3dMat = newMaterial.f3d_mat if newMaterial.mat_ver > 3 else newMaterial
f3dMat.tex0.tex = tex0Node.links[0].from_node.image
if len(tex1Node.links) > 0 and isinstance(tex1Node.links[0].from_node, bpy.types.ShaderNodeTexImage):
f3dMat.tex1.tex = tex1Node.links[0].from_node.image
updateMatWithName(newMaterial, material, materialDict)
else:
print("Principled BSDF material does not have an Image Node attached to its Base Color.")
Expand Down
1 change: 0 additions & 1 deletion fast64_internal/oot/collision/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class OOTCollisionExportSettings(PropertyGroup):
)
filename: StringProperty(name="Filename")
exportPath: StringProperty(name="Directory", subtype="FILE_PATH")
exportLevel: EnumProperty(items=ootEnumSceneID, name="Level Used By Collision", default="SCENE_DEKU_TREE")
includeChildren: BoolProperty(name="Include child objects", default=True)
levelName: StringProperty(name="Name", default="SCENE_DEKU_TREE")
customExport: BoolProperty(
Expand Down
13 changes: 0 additions & 13 deletions fast64_internal/oot/cutscene/motion/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@
)


def getActorCueList(operator: Operator, context: Context) -> Object | None:
cueListObj = activeObj = context.view_layer.objects.active

if activeObj.ootEmptyType == "CS Actor Cue" and activeObj.parent.ootEmptyType == "CS Actor Cue List":
cueListObj = activeObj.parent

if not cueListObj.ootEmptyType == "CS Actor Cue List" and cueListObj.parent.ootEmptyType == "Cutscene":
operator.report({"WARNING"}, "Select an action list or action point.")
return None

return cueListObj


def createNewActorCueList(csObj: Object, isPlayer: bool):
"""Creates a new Actor or Player Cue List and adds one basic cue and the dummy one"""
objFactory = CutsceneObjectFactory()
Expand Down
4 changes: 2 additions & 2 deletions fast64_internal/oot/cutscene/motion/panels.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from bpy.types import Panel
from bpy.utils import register_class, unregister_class
from ....panels import OOT_Panel
from .properties import CutsceneCmdCameraShotProperty, CutsceneCmdCameraShotPointProperty


class OOT_CSMotionCameraShotPanel(Panel):
class OOT_CSMotionCameraShotPanel(OOT_Panel):
bl_label = "Cutscene Motion Camera Shot Controls"
bl_idname = "OOT_PT_camera_shot_panel"
bl_space_type = "PROPERTIES"
Expand Down
3 changes: 0 additions & 3 deletions fast64_internal/oot/oot_level_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,6 @@ def __init__(self, index, name, model, roomShape):
self.showInvisibleActors = False
self.linkIdleMode = None

self.customBehaviourX = None
self.customBehaviourY = None

# Wind
self.setWind = False
self.windVector = [0, 0, 0]
Expand Down
11 changes: 0 additions & 11 deletions fast64_internal/oot/oot_model_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,6 @@ def onAddMesh(self, fMesh, contextObj):
fMesh.draw.commands.append(SPMatrix("0x01000000", "G_MTX_MODELVIEW | G_MTX_NOPUSH | G_MTX_MUL"))


class OOTDynamicMaterialDrawLayer:
def __init__(self, opaque, transparent):
self.opaque = opaque
self.transparent = transparent


class OOTGfxFormatter(GfxFormatter):
def __init__(self, scrollMethod):
GfxFormatter.__init__(self, scrollMethod, 64, None)
Expand Down Expand Up @@ -508,8 +502,3 @@ def clearOOTFlipbookProperty(flipbookProp):
flipbookProp.name = "sFlipbookTextures"
flipbookProp.exportMode = "Array"
flipbookProp.textures.clear()


def clearOOTMaterialDrawLayerProperty(matDrawLayerProp):
for i in range(0x08, 0x0E):
setattr(matDrawLayerProp, "segment" + format(i, "X"), False)
7 changes: 0 additions & 7 deletions fast64_internal/oot/room/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,6 @@ class OOTRoomHeaderProperty(PropertyGroup):
default=False,
)

useCustomBehaviourX: BoolProperty(name="Use Custom Behaviour X")
useCustomBehaviourY: BoolProperty(name="Use Custom Behaviour Y")

customBehaviourX: StringProperty(name="Custom Behaviour X", default="0x00")

customBehaviourY: StringProperty(name="Custom Behaviour Y", default="0x00")

setWind: BoolProperty(name="Set Wind")
windVector: IntVectorProperty(name="Wind Vector", size=3, min=-127, max=127)
windStrength: IntProperty(name="Wind Strength", min=0, max=255)
Expand Down
6 changes: 1 addition & 5 deletions fast64_internal/sm64/sm64_anim.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,10 @@ def convertAnimationData(anim, armatureObj, *, frame_start, frame_count):
currentFrame = bpy.context.scene.frame_current
for frame in range(frame_start, frame_start + frame_count):
bpy.context.scene.frame_set(frame)
rootBone = armatureObj.data.bones[animBones[0]]
rootPoseBone = armatureObj.pose.bones[animBones[0]]

# Hacky solution to handle Z-up to Y-up conversion
translation = (
rootBone.matrix.to_4x4().inverted()
@ mathutils.Matrix.Scale(bpy.context.scene.blenderToSM64Scale, 4)
@ rootPoseBone.matrix
mathutils.Matrix.Scale(bpy.context.scene.blenderToSM64Scale, 4) @ rootPoseBone.matrix_basis
).decompose()[0]
saveTranslationFrame(translationData, translation)

Expand Down
Binary file modified images/mario_running.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e5ad225

Please sign in to comment.