Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
scut committed Jan 9, 2024
1 parent b1ca3f0 commit 9ccca22
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 39 deletions.
8 changes: 1 addition & 7 deletions fast64_internal/f3d/f3d_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,7 @@ def addCullCommand(obj, fMesh, transformMatrix, matWriteMethod):
# if the object has a specifically set culling bounds, use that instead
for vertexPos in obj.get("culling_bounds", obj.bound_box):
fMesh.cullVertexList.vertices.append(
F3DVert(
Vector(vertexPos),
[0, 0],
Vector([0, 0, 0]),
None,
0.0,
).toVtx(
F3DVert(Vector(vertexPos), [0, 0], Vector([0, 0, 0]), None, 0.0,).toVtx(
obj.data,
[32, 32],
transformMatrix,
Expand Down
10 changes: 5 additions & 5 deletions fast64_internal/sm64/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class SM64_Properties(PropertyGroup):
showImportingMenus: BoolProperty(name="Show Importing Menus", default=False)
exportType: EnumProperty(items=enumExportType, name="Export Type", default="C")
goal: EnumProperty(items=sm64GoalTypeEnum, name="Export Goal", default="All")

combined_export: bpy.props.PointerProperty(type=SM64_CombinedObjectProperties)

# TODO: Utilize these across all exports
Expand Down Expand Up @@ -304,10 +304,10 @@ def sm64_register(registerPanels):
sm64_dl_writer_register()
sm64_dl_parser_register()
sm64_anim_register()

for cls in sm64_classes:
register_class(cls)

if registerPanels:
sm64_panel_register()

Expand Down Expand Up @@ -348,10 +348,10 @@ def sm64_unregister(unregisterPanels):
sm64_dl_writer_unregister()
sm64_dl_parser_unregister()
sm64_anim_unregister()

for cls in reversed(sm64_classes):
unregister_class(cls)

if unregisterPanels:
sm64_panel_unregister()

Expand Down
80 changes: 58 additions & 22 deletions fast64_internal/sm64/sm64_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -1909,63 +1909,99 @@ def __init__(self, geoAddr, level, switchDict):
]

behaviorPresetContents = {
'Static Solid Object': (
"Static Solid Object": (
("BEGIN", ("OBJ_LIST_SURFACE",)),
("OR_INT", ("oFlags", "OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE",)),
(
"OR_INT",
(
"oFlags",
"OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE",
),
),
("LOAD_COLLISION_DATA", ("inherit",)),
("BEGIN_LOOP", ()),
("CALL_NATIVE", ("load_object_collision_model",)),
("CALL_NATIVE", ("load_object_collision_model",)),
("END_LOOP", ("")),
),
'Rotating Solid Object': (
"Rotating Solid Object": (
("BEGIN", ("OBJ_LIST_SURFACE",)),
("OR_INT", ("oFlags", "OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE",)),
(
"OR_INT",
(
"oFlags",
"OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE",
),
),
("LOAD_COLLISION_DATA", ("inherit",)),
("BEGIN_LOOP", ()),
("ADD_INT", ("oFaceAngleYaw", "200")),
("CALL_NATIVE", ("load_object_collision_model",)),
("ADD_INT", ("oFaceAngleYaw", "200")),
("CALL_NATIVE", ("load_object_collision_model",)),
("END_LOOP", ("")),
),
'Moving Solid Object': (
"Moving Solid Object": (
("BEGIN", ("OBJ_LIST_SURFACE",)),
("OR_INT", ("oFlags", "OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE",)),
(
"OR_INT",
(
"oFlags",
"OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE",
),
),
("LOAD_COLLISION_DATA", ("inherit",)),
("BEGIN_LOOP", ()),
("CALL_NATIVE", ("bhv_ssl_moving_pyramid_wall_loop",)),
("CALL_NATIVE", ("bhv_ssl_moving_pyramid_wall_loop",)),
("END_LOOP", ("")),
),
'Pole-like': (
"Pole-like": (
("BEGIN", ("OBJ_LIST_POLELIKE",)),
("OR_INT", ("oFlags", "OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE",)),
(
"OR_INT",
(
"oFlags",
"OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE",
),
),
("SET_INTERACT_TYPE", ("INTERACT_POLE",)),
("SET_HITBOX", ("inherit", "inherit")),
("CALL_NATIVE", ("bhv_pole_init",)),
("SET_INT", ("oIntangibleTimer", "0")),
("BEGIN_LOOP", ()),
("CALL_NATIVE", ("bhv_pole_base_loop",)),
("CALL_NATIVE", ("bhv_pole_base_loop",)),
("END_LOOP", ("")),
),
'Flame-like': (
"Flame-like": (
("BEGIN", ("OBJ_LIST_LEVEL",)),
("BILLBOARD", ()),
("OR_INT", ("oFlags", "OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE",)),
(
"OR_INT",
(
"oFlags",
"OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE",
),
),
("SET_INTERACT_TYPE", ("INTERACT_FLAME",)),
("SET_HITBOX", ("inherit", "inherit")),
("SET_INT", ("oIntangibleTimer", "0")),
("BEGIN_LOOP", ()),
("SET_INT", ("oInteractStatus", "0")),
("ANIMATE_TEXTURE", ("oAnimState", "2")),
("SET_INT", ("oInteractStatus", "0")),
("ANIMATE_TEXTURE", ("oAnimState", "2")),
("END_LOOP", ("")),
),
'Talking NPC': (
"Talking NPC": (
("BEGIN", ("OBJ_LIST_GENACTOR",)),
("OR_INT", ("oFlags", "OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO | OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE")),
(
"OR_INT",
(
"oFlags",
"OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO | OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE",
),
),
("SET_INTERACT_TYPE", ("INTERACT_TEXT",)),
("SET_HITBOX", ("inherit", "inherit")),
("SET_INT", ("oInteractionSubtype", "INT_SUBTYPE_SIGN")),
("BEGIN_LOOP", ()),
("SET_INT", ("oIntangibleTimer", "0")),
("SET_INT", ("oInteractStatus", "0")),
("SET_INT", ("oIntangibleTimer", "0")),
("SET_INT", ("oInteractStatus", "0")),
("END_LOOP", ("")),
),
}
Expand Down Expand Up @@ -2020,7 +2056,7 @@ def __init__(self, geoAddr, level, switchDict):
("group15", "group15", "Castle Objects (MIPS, Toad etc.)"),
("group16", "group16", "Ice Objects (Chill Bully, Moneybags)"),
("group17", "group17", "Cave Objects (Swoop, Scuttlebug, Dorrie etc.)"),
("Custom", "Custom", "Custom")
("Custom", "Custom", "Custom"),
]

marioAnimations = [
Expand Down
4 changes: 2 additions & 2 deletions fast64_internal/sm64/sm64_geolayout_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def has_data(self):
if node.has_data():
return True
return False

def to_binary(self, segmentData):
endCmd = GEO_END if self.isStartGeo else GEO_RETURN
data = bytearray(0)
Expand Down Expand Up @@ -347,7 +347,7 @@ def has_data(self):
if child.has_data():
return True
return False

def size(self):
size = self.node.size() if self.node is not None else 0
if len(self.children) > 0 and type(self.node) in nodeGroupClasses:
Expand Down
7 changes: 6 additions & 1 deletion fast64_internal/sm64/sm64_level_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,12 @@ def add_subscript(self, name: str):

def sub_script_to_c(self, root_persistent_block):
result = ""
if not any([f"const LevelScript {self.name}[]" in line for line in root_persistent_block.get(PersistentBlocks.scripts, [])]):
if not any(
[
f"const LevelScript {self.name}[]" in line
for line in root_persistent_block.get(PersistentBlocks.scripts, [])
]
):
result = f"const LevelScript {self.name}[] = {{\n{macrosToString(self.macros)}\n}};\n"
for sub_script in self.sub_scripts:
result += sub_script.sub_script_to_c(result, root_persistent_block)
Expand Down
3 changes: 1 addition & 2 deletions fast64_internal/sm64/sm64_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,7 @@ def export_behavior_script(self, context, props):
# make sure you have a bhv script
if len(props.behavior_script) == 0:
raise PluginError("Behavior must have more than 0 cmds to export")

# exporting bhv header
self.export_behavior_header(context, props)
# export the behavior script itself
Expand Down Expand Up @@ -1839,7 +1839,6 @@ def execute(self, context):
raisePluginError(self, e)
return {"CANCELLED"}


props.context_obj = None
# you've done it!~
self.report({"INFO"}, "Success!")
Expand Down

0 comments on commit 9ccca22

Please sign in to comment.