Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OoT] Fixed door upgrade #287

Merged
merged 6 commits into from
Jan 27, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions fast64_internal/oot/oot_upgrade.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import bpy

from dataclasses import dataclass
from typing import TYPE_CHECKING
from bpy.types import Object, CollectionProperty
Expand Down Expand Up @@ -313,16 +315,23 @@ def upgradeActors(actorObj: Object):
break
elif actorObj.ootEmptyType == "Transition Actor":
transActorProp = actorObj.ootTransitionActorProperty
transActorProp.isRoomTransition = actorObj["ootTransitionActorProperty"]["dontTransition"] == False
del actorObj["ootTransitionActorProperty"]["dontTransition"]

if transActorProp.isRoomTransition:
if "dontTransition" in transActorProp or "roomIndex" in transActorProp:
for obj in bpy.data.objects:
if obj.type == "EMPTY":
if obj.ootEmptyType == "Room":
if actorObj in obj.children_recursive:
transActorProp.fromRoom = obj

if obj.ootRoomHeader.roomIndex == actorObj["ootTransitionActorProperty"]["roomIndex"]:
transActorProp.toRoom = obj
del actorObj["ootTransitionActorProperty"]["roomIndex"]
if obj.type == "EMPTY" and obj.ootEmptyType == "Room" and actorObj in obj.children_recursive:
transActorProp.fromRoom = obj
break

if "dontTransition" in transActorProp:
transActorProp.isRoomTransition = transActorProp["dontTransition"] == False
del transActorProp["dontTransition"]
elif transActorProp.fromRoom is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the second block under an else now? (elif)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump

Copy link
Contributor Author

@Yanis002 Yanis002 Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this case is most likely impossible but I thought the for loop may not find an object to set to transActorProp.fromRoom, so if this is still None on the block you highlighted it will raise an error (I think I should just assert this idk)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean if "dontTransition" in transActorProp: is likely to pass if upgrading a blend
then that means transActorProp.toRoom won't be set based on upgrading from transActorProp["roomIndex"]

for obj in bpy.data.objects:
if (
obj != transActorProp.fromRoom
and obj.type == "EMPTY"
and obj.ootEmptyType == "Room"
and obj.ootRoomHeader.roomIndex == transActorProp["roomIndex"]
):
transActorProp.toRoom = obj
del transActorProp["roomIndex"]
break