Turret child object - #47
Conversation
…veturretset and update clang format to never wrap
There was a problem hiding this comment.
Pull request overview
This PR introduces an EveChildTurret space-object child implementation and adds supporting animation hooks/APIs to enable turret-specific pose modification and animation stopping behavior, along with a few related fixes and build/config updates.
Changes:
- Add
EveChildTurret(new child type) with firing/tracking state logic, Blue exposure, and cached geometry/animation integration. - Add
ITr2PoseModifierand integrate it intoTr2GrannyAnimationso external components can modify a sampled CMF pose (e.g., turret tracking bone edits). - Add
StopAnimations(delay)to animation layers / updater and expose it to Blue; plus minor comment/spelling and formatting/config updates.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| trinity/Tr2GrannyAnimationLayer.h | Adds StopAnimations(delay) API to the layer interface. |
| trinity/Tr2GrannyAnimationLayer.cpp | Implements StopAnimations(delay) and ensures finished CMF animations are removed. |
| trinity/Tr2GrannyAnimation.h | Adds pose-modifier plumbing (ITr2PoseModifier*) and StopAnimations(delay) on the updater. |
| trinity/Tr2GrannyAnimation.cpp | Wires StopAnimations to the base layer and calls pose modifier during CMF pose sampling. |
| trinity/Tr2GrannyAnimation_Blue.cpp | Exposes StopAnimations(delay) to Blue. |
| trinity/Include/ITr2PoseModifier.h | New interface for skeletal pose modification. |
| trinity/Eve/Turret/EveTurretTarget.h | Adds SetImpactBehaviour API. |
| trinity/Eve/Turret/EveTurretTarget.cpp | Implements SetImpactBehaviour and reuses it from SetBehaviour. |
| trinity/Eve/Turret/EveTurretSet.cpp | Comment spelling fixes (and minor documentation cleanups). |
| trinity/Eve/SpaceObject/EveSpaceObject2.cpp | Initializes runtime-inserted children that implement IInitialize. |
| trinity/Eve/SpaceObject/Children/EveChildTurret.h | New turret child declaration; implements ITr2PoseModifier. |
| trinity/Eve/SpaceObject/Children/EveChildTurret.cpp | New turret child implementation: state machine, firing FX, tracking pose edits, animation control. |
| trinity/Eve/SpaceObject/Children/EveChildTurret_Blue.cpp | Blue exposure for EveChildTurret API and attributes. |
| trinity/Eve/SpaceObject/Children/EveChildMesh.h | Adds override markers for update methods; makes InitializeAnimation() virtual. |
| trinity/CMakeLists.txt | Adds new source/header files to the build. |
| .clang-format | Sets ObjC ColumnLimit: 0 with rationale comment to avoid unwanted wrapping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,19 @@ | |||
| // Copyright © 2026 Fenris Creations ehf. | |||
| if( int closestLocator = m_target->FindClosestLocator( &source, &position ) ) | ||
| { | ||
| if( closestLocator != m_target->GetLocator() ) | ||
| { | ||
| // Set up the firing states correctly | ||
| SetupFiringState(); | ||
| } | ||
| } |
| GrannyColumnMatrixMultiply4x3Transpose( | ||
| (granny_real32*)( (granny_matrix_3x4*)m_boneTransforms.get() )[i], | ||
| (granny_real32*)m_meshSkeleton->Bones[meshToBone[i]].InverseWorld4x4, | ||
| (granny_real32*)m_meshSkeleton -> Bones[meshToBone[i]].InverseWorld4x4, |
| MAP_METHOD_AND_WRAP( | ||
| "GetFiringBoneWorldTransform", | ||
| GetFiringBoneWorldTransform, | ||
| "Returns the world transform matrix of the specfified firing bone in the currently firing turret." |
|
|
||
| // -------------------------------------------------------------------------------- | ||
| // Description: | ||
| // Initialize data members, set everything to inlavid/empty and call |
There was a problem hiding this comment.
This has been spun out into their own PR and ill be merging it in and this should get removed once you updated latest on main when that other PR is in
| # Kept at 0 to match the Cpp section: some tools (e.g. CLion's ClangFormat | ||
| # integration) misclassify C++ .h files as ObjC and would otherwise re-wrap | ||
| # lines at the column limit. | ||
| ColumnLimit: 0 |
There was a problem hiding this comment.
This has been spun out into their own PR and ill be merging it in and this should get removed once you updated latest on main when that other PR is in
| bool PlayAnimation( const Tr2GrannyAnimation* grannyAnimation, const char* animName, bool replace, int loopCount, float delay, float speed, bool clearWhenDone ); | ||
| void QueueAnimation( const char* animName, bool replace, int loopCount, float delay, float speed, bool clearWhenDone ); | ||
| void EndAnimation(); | ||
| void StopAnimations( float delay ); |
There was a problem hiding this comment.
blue optional for the delay is something i wanted to do
| } | ||
| #endif | ||
|
|
||
| void Tr2GrannyAnimationLayer::StopAnimations( float delay ) |
There was a problem hiding this comment.
this is buggy and spins the turret around if there is no animation set, works fine in the turret class as it does stop -> nextanimation
| ClearAnimations, | ||
| "ClearAnimations()\n\n" | ||
| "Abruptly ends all animations." ) | ||
| MAP_METHOD_AND_WRAP( |
There was a problem hiding this comment.
blue optional for the delay parameter maybe?
|
|
||
| if( m_poseModifier ) | ||
| { | ||
| m_poseModifier->ModifyPose( skeleton, m_pose ); |
There was a problem hiding this comment.
still not super sure what this does, but it was needed from eveturretset which had its own animation handling logic
|
|
||
| // hit/miss | ||
| void SetBehaviour( bool laserMiss, bool projectileMiss, float impactSize, ImpactBehaviour::Type impactBehaviour ); | ||
| void SetImpactBehaviour( float impactSize, ImpactBehaviour::Type impactBehaviour ); |
There was a problem hiding this comment.
didnt need lasermiss and projectilemiss in evechildturret so split into two functions
| @@ -0,0 +1,182 @@ | |||
| // Copyright © 2026 Fenris Creations ehf. | |||
|
|
|||
| #pragma once | |||
There was a problem hiding this comment.
mostly a copy of eveturretset but simplified greatly and inherits from evechildmesh
There was a problem hiding this comment.
just needed inheritance logic, simple as
…ping (carbonengine#47) Co-authored-by: rebecca <1+rebecca@noreply.localhost>
No description provided.