Skip to content

Commit

Permalink
default fromRoom to the parented room is it's parented to a room
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanis002 committed Jan 9, 2024
1 parent 3eed0ee commit 52193ec
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions fast64_internal/oot/actor/properties.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import bpy

from bpy.types import Object, PropertyGroup, UILayout
from bpy.utils import register_class, unregister_class
from bpy.props import EnumProperty, StringProperty, IntProperty, BoolProperty, CollectionProperty, PointerProperty
Expand Down Expand Up @@ -165,8 +167,23 @@ class OOTTransitionActorProperty(PropertyGroup):
cameraTransitionBackCustom: StringProperty(default="0x00")
isRoomTransition: BoolProperty(name="Is Room Transition", default=True)

# internal usage only
isFromRoomSet: BoolProperty(name="isFromRoomSet", default=False, get=lambda self: self.updateFromRoom())

actor: PointerProperty(type=OOTActorProperty)

def updateFromRoom(self):
if self.fromRoom is None:
for obj in bpy.data.objects:
if (
obj.type == "EMPTY"
and obj.ootEmptyType == "Room"
and bpy.context.view_layer.objects.active in obj.children_recursive
):
self.fromRoom = obj
return True
return False

def isRoomEmptyObject(self, obj: Object):
return obj.type == "EMPTY" and obj.ootEmptyType == "Room"

Expand Down Expand Up @@ -204,6 +221,9 @@ def draw_props(
headerProps: OOTActorHeaderProperty = self.actor.headerSettings
headerProps.draw_props(actorIDBox, "Transition Actor", altSceneProp, objName)

# execute fromRoom get function
_ = self.isFromRoomSet


class OOTEntranceProperty(PropertyGroup):
# This is also used in entrance list.
Expand Down

0 comments on commit 52193ec

Please sign in to comment.