Skip to content

Commit

Permalink
[OOT] Detailed Actor Panel (Actors, Transition Actors, Entrance Actor…
Browse files Browse the repository at this point in the history
…s) (#242)

* parsed parameters for actor data

* removed paramsByType

* main logic

* fixed issues and export

* operators

* black

* fixes, transition actor list

* upgrade logic

* fixes

* black

* review

* review

* fixed export issues

* format

* kure's review part 1

* fixed upgrade issues (custom not handled yet)

* snake case-ify functions, tiny xml docs/fixes, completed upgrade stuff

* add custom values for enums

* added custom values for string props

* small fix and default to custom in upgrade

* fixed custom values not working

* fixed issues related to custom value for Chest/Navi Msg

* fixed issue where 'get_param_value' can return None in some cases

* latest review from kure
  • Loading branch information
Yanis002 authored Jan 1, 2025
1 parent 60bdf25 commit dac0a8f
Show file tree
Hide file tree
Showing 13 changed files with 2,048 additions and 1,392 deletions.
2 changes: 2 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from .fast64_internal.oot import OOT_Properties, oot_register, oot_unregister
from .fast64_internal.oot.oot_constants import oot_world_defaults
from .fast64_internal.oot.props_panel_main import OOT_ObjectProperties
from .fast64_internal.oot.actor.properties import initOOTActorProperties
from .fast64_internal.utility_anim import utility_anim_register, utility_anim_unregister, ArmatureApplyWithMeshOperator

from .fast64_internal.mk64 import MK64_Properties, mk64_register, mk64_unregister
Expand Down Expand Up @@ -430,6 +431,7 @@ def register():
register_class(ExampleAddonPreferences)
addon_updater_ops.register(bl_info)

initOOTActorProperties()
utility_anim_register()
mat_register()
render_engine_register()
Expand Down
73 changes: 59 additions & 14 deletions fast64_internal/oot/actor/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,82 @@
from ..oot_constants import ootData


class OOT_SearchChestContentEnumOperator(Operator):
bl_idname = "object.oot_search_chest_content_enum_operator"
bl_label = "Select Chest Content"
bl_property = "chest_content"
bl_options = {"REGISTER", "UNDO"}

chest_content: EnumProperty(items=ootData.actorData.ootEnumChestContent, default="item_heart")
obj_name: StringProperty()
prop_name: StringProperty()

def execute(self, context):
setattr(bpy.data.objects[self.obj_name].ootActorProperty, self.prop_name, self.chest_content)
context.region.tag_redraw()
self.report({"INFO"}, f"Selected: {self.chest_content}")
return {"FINISHED"}

def invoke(self, context, event):
context.window_manager.invoke_search_popup(self)
return {"RUNNING_MODAL"}


class OOT_SearchNaviMsgIDEnumOperator(Operator):
bl_idname = "object.oot_search_navi_msg_id_enum_operator"
bl_label = "Select Message ID"
bl_property = "navi_msg_id"
bl_options = {"REGISTER", "UNDO"}

navi_msg_id: EnumProperty(items=ootData.actorData.ootEnumNaviMessageData, default="msg_00")
obj_name: StringProperty()
prop_name: StringProperty()

def execute(self, context):
setattr(bpy.data.objects[self.obj_name].ootActorProperty, self.prop_name, self.navi_msg_id)
context.region.tag_redraw()
self.report({"INFO"}, f"Selected: {self.navi_msg_id}")
return {"FINISHED"}

def invoke(self, context, event):
context.window_manager.invoke_search_popup(self)
return {"RUNNING_MODAL"}


class OOT_SearchActorIDEnumOperator(Operator):
bl_idname = "object.oot_search_actor_id_enum_operator"
bl_label = "Select Actor ID"
bl_property = "actorID"
bl_property = "actor_id"
bl_options = {"REGISTER", "UNDO"}

actorID: EnumProperty(items=ootData.actorData.ootEnumActorID, default="ACTOR_PLAYER")
actorUser: StringProperty(default="Actor")
objName: StringProperty()
actor_id: EnumProperty(items=lambda self, context: ootData.actorData.getItems(self.actor_user))
actor_user: StringProperty(default="Actor")
obj_name: StringProperty()

def execute(self, context):
obj = bpy.data.objects[self.objName]
if self.actorUser == "Transition Actor":
obj.ootTransitionActorProperty.actor.actorID = self.actorID
elif self.actorUser == "Actor":
obj.ootActorProperty.actorID = self.actorID
elif self.actorUser == "Entrance":
obj.ootEntranceProperty.actor.actorID = self.actorID
obj = bpy.data.objects[self.obj_name]

if self.actor_user == "Transition Actor":
obj.ootTransitionActorProperty.actor.actor_id = self.actor_id
elif self.actor_user == "Actor":
obj.ootActorProperty.actor_id = self.actor_id
else:
raise PluginError("Invalid actor user for search: " + str(self.actorUser))
raise PluginError("Invalid actor user for search: " + str(self.actor_user))

context.region.tag_redraw()
self.report({"INFO"}, "Selected: " + self.actorID)
self.report({"INFO"}, f"Selected: {self.actor_id}")
return {"FINISHED"}

def invoke(self, context, event):
context.window_manager.invoke_search_popup(self)
return {"RUNNING_MODAL"}


classes = (OOT_SearchActorIDEnumOperator,)
classes = (
OOT_SearchActorIDEnumOperator,
OOT_SearchChestContentEnumOperator,
OOT_SearchNaviMsgIDEnumOperator,
)


def actor_ops_register():
Expand Down
Loading

0 comments on commit dac0a8f

Please sign in to comment.