@@ -1029,37 +1029,10 @@ void LabUi::build_secondary_weapon_combobox(SCP_string& text, weapon_info* wip,
10291029 }
10301030}
10311031
1032- void LabUi::reset_animations (ship* shipp, ship_info* sip) const
1032+ void LabUi::reset_animations ()
10331033{
1034- polymodel_instance* shipp_pmi = model_get_instance (shipp->model_instance_num );
1035-
1036- for (auto i = 0 ; i < MAX_SHIP_PRIMARY_BANKS ; ++i) {
1037- if (triggered_primary_banks[i]) {
1038- sip->animations .getAll (shipp_pmi, animation::ModelAnimationTriggerType::PrimaryBank, i)
1039- .start (animation::ModelAnimationDirection::RWD );
1040- triggered_primary_banks[i] = false ;
1041- }
1042- }
1043-
1044- for (auto i = 0 ; i < MAX_SHIP_SECONDARY_BANKS ; ++i) {
1045- if (triggered_secondary_banks[i]) {
1046- sip->animations .getAll (shipp_pmi, animation::ModelAnimationTriggerType::SecondaryBank, i)
1047- .start (animation::ModelAnimationDirection::RWD );
1048- triggered_secondary_banks[i] = false ;
1049- }
1050- }
1051-
1052- for (auto & entry : manual_animations) {
1053- if (entry.second ) {
1054- sip->animations .getAll (shipp_pmi, entry.first ).start (animation::ModelAnimationDirection::RWD );
1055- entry.second = false ;
1056- }
1057- }
1058-
1059- for (const auto & entry : manual_animation_triggers) {
1060- auto animation_type = entry.first ;
1061- sip->animations .getAll (shipp_pmi, animation_type).start (animation::ModelAnimationDirection::RWD );
1062- }
1034+ // With full animation support for docking stages and fighter bays it's honestly just easier to reload the current object
1035+ getLabManager ()->changeDisplayedObject (getLabManager ()->CurrentMode , getLabManager ()->CurrentClass , getLabManager ()->CurrentSubtype );
10631036}
10641037
10651038void LabUi::maybe_show_animation_category (const SCP_vector<animation::ModelAnimationSet::RegisteredTrigger>& anim_triggers,
@@ -1070,10 +1043,35 @@ void LabUi::maybe_show_animation_category(const SCP_vector<animation::ModelAnima
10701043 })) {
10711044 with_TreeNode (label.c_str ())
10721045 {
1046+ int count = 1 ;
10731047 for (const auto & anim_trigger : anim_triggers) {
10741048 if (anim_trigger.type == trigger_type) {
10751049
1076- if (Button (anim_trigger.name .c_str ())) {
1050+ SCP_string button_label = anim_trigger.name ;
1051+ switch (trigger_type) {
1052+ case animation::ModelAnimationTriggerType::DockBayDoor:
1053+ button_label += " Trigger Bay Door Animation " + std::to_string (count++);
1054+ break ;
1055+ case animation::ModelAnimationTriggerType::Docking_Stage1:
1056+ button_label += " Trigger Docking Stage 1 Animation " + std::to_string (count++);
1057+ break ;
1058+ case animation::ModelAnimationTriggerType::Docking_Stage2:
1059+ button_label += " Trigger Docking Stage 2 Animation " + std::to_string (count++);
1060+ break ;
1061+ case animation::ModelAnimationTriggerType::Docking_Stage3:
1062+ button_label += " Trigger Docking Stage 3 Animation " + std::to_string (count++);
1063+ break ;
1064+ case animation::ModelAnimationTriggerType::Docked:
1065+ button_label += " Trigger Docked Animation " + std::to_string (count++);
1066+ break ;
1067+ default :
1068+ // We really shouldn't be here, but just in case
1069+ Assertion (false , " Unexpected animation trigger type %d" , static_cast <int >(trigger_type));
1070+ button_label += " Trigger Animation " + std::to_string (count++);
1071+ break ;
1072+ }
1073+
1074+ if (Button (button_label.c_str ())) {
10771075 auto & scripted_triggers = manual_animation_triggers[trigger_type];
10781076 auto direction = scripted_triggers[anim_trigger.name ];
10791077 do_triggered_anim (trigger_type,
@@ -1095,7 +1093,7 @@ void LabUi::build_animation_options(ship* shipp, ship_info* sip) const
10951093 const auto & anim_triggers = sip->animations .getRegisteredTriggers ();
10961094
10971095 if (Button (" Reset animations" )) {
1098- reset_animations (shipp, sip );
1096+ reset_animations ();
10991097 }
11001098
11011099 if (shipp->weapons .num_primary_banks > 0 ) {
@@ -1135,6 +1133,9 @@ void LabUi::build_animation_options(ship* shipp, ship_info* sip) const
11351133 maybe_show_animation_category (anim_triggers,
11361134 animation::ModelAnimationTriggerType::Docking_Stage3,
11371135 " Docking stage 3##anims" );
1136+ maybe_show_animation_category (anim_triggers,
1137+ animation::ModelAnimationTriggerType::Docked,
1138+ " Docked animations##anims" );
11381139 }
11391140}
11401141
0 commit comments