From a0d04a0ac495aa55a622d6ed0d8a897f7c4876b9 Mon Sep 17 00:00:00 2001 From: Filipp Pavlov Date: Fri, 17 Jul 2026 15:25:56 +0000 Subject: [PATCH 01/12] Refactor IEveSpaceObjectChild interface into a base class The new base class has support "owner", "parent" and "part tag" shared attributes. --- trinity/CMakeLists.txt | 3 + .../Actions/Tr2ActionChildEffect.cpp | 4 +- .../Actions/Tr2ActionChildEffect.h | 4 +- .../Actions/Tr2ActionPlayCurveSet.cpp | 1 - trinity/Eve/EveEffectRoot2.cpp | 29 ++++- trinity/Eve/EveEffectRoot2.h | 12 +- .../Eve/Renderable/Stretch/EveStretch3.cpp | 52 ++++---- trinity/Eve/Renderable/Stretch/EveStretch3.h | 32 ++--- .../SpaceObject/Children/EveChildAudio.cpp | 41 +------ .../Eve/SpaceObject/Children/EveChildAudio.h | 15 +-- .../Children/EveChildAudio_Blue.cpp | 4 + .../Children/EveChildBehaviorSystem.cpp | 20 +-- .../Children/EveChildBehaviorSystem.h | 10 +- .../Children/EveChildBehaviorSystem_Blue.cpp | 4 + .../Children/EveChildBulletStorm.cpp | 28 ----- .../Children/EveChildBulletStorm.h | 15 +-- .../Children/EveChildBulletStorm_Blue.cpp | 4 + .../SpaceObject/Children/EveChildCloud.cpp | 10 -- .../Eve/SpaceObject/Children/EveChildCloud.h | 13 +- .../SpaceObject/Children/EveChildCloud2.cpp | 18 --- .../Eve/SpaceObject/Children/EveChildCloud2.h | 17 +-- .../Children/EveChildCloud2_Blue.cpp | 4 + .../Children/EveChildCloud_Blue.cpp | 4 + .../Children/EveChildContainer.cpp | 48 +++++--- .../SpaceObject/Children/EveChildContainer.h | 20 ++- .../Children/EveChildContainer_Blue.cpp | 10 +- .../Children/EveChildEffectPropagator.cpp | 6 +- .../Children/EveChildEffectPropagator.h | 1 - .../EveChildEffectPropagator_Blue.cpp | 4 + .../Children/EveChildExplosion.cpp | 8 +- .../SpaceObject/Children/EveChildExplosion.h | 12 +- .../Children/EveChildExplosion_Blue.cpp | 4 + .../Children/EveChildFogVolume.cpp | 20 +-- .../SpaceObject/Children/EveChildFogVolume.h | 14 +-- .../Children/EveChildFogVolume_Blue.cpp | 5 +- .../Children/EveChildInstanceContainer.cpp | 116 +++++++++++------- .../Children/EveChildInstanceContainer.h | 31 +++-- .../EveChildInstanceContainer_Blue.cpp | 95 +++++++------- .../Children/EveChildInstanceMeshRenderer.h | 2 +- .../EveChildInstanceMeshRenderer_Blue.cpp | 4 + .../Children/EveChildInstancedMeshes.cpp | 14 --- .../Children/EveChildInstancedMeshes.h | 10 +- .../Children/EveChildInstancedMeshes_Blue.cpp | 4 + .../Children/EveChildLightingOverride.cpp | 14 --- .../Children/EveChildLightingOverride.h | 15 +-- .../EveChildLightingOverride_Blue.cpp | 4 + .../SpaceObject/Children/EveChildLineSet.cpp | 10 -- .../SpaceObject/Children/EveChildLineSet.h | 11 +- .../Children/EveChildLineSet_Blue.cpp | 4 + .../Eve/SpaceObject/Children/EveChildLink.h | 2 +- .../Eve/SpaceObject/Children/EveChildMesh.cpp | 10 -- .../Eve/SpaceObject/Children/EveChildMesh.h | 11 +- .../Children/EveChildMesh_Blue.cpp | 5 + .../Children/EveChildParticleSphere.cpp | 12 -- .../Children/EveChildParticleSphere.h | 11 +- .../Children/EveChildParticleSphere_Blue.cpp | 4 + .../Children/EveChildParticleSystem.cpp | 10 -- .../Children/EveChildParticleSystem.h | 10 +- .../Children/EveChildParticleSystem_Blue.cpp | 4 + .../Eve/SpaceObject/Children/EveChildPlug.cpp | 47 ++++--- .../Eve/SpaceObject/Children/EveChildPlug.h | 20 ++- .../Children/EveChildPlug_Blue.cpp | 4 + .../Children/EveChildPostProcessVolume.cpp | 19 +-- .../Children/EveChildPostProcessVolume.h | 14 +-- .../EveChildPostProcessVolume_Blue.cpp | 4 + .../Eve/SpaceObject/Children/EveChildQuad.cpp | 14 --- .../Eve/SpaceObject/Children/EveChildQuad.h | 11 +- .../Children/EveChildQuad_Blue.cpp | 4 + .../Eve/SpaceObject/Children/EveChildRef.cpp | 49 +++++--- .../Eve/SpaceObject/Children/EveChildRef.h | 21 ++-- .../SpaceObject/Children/EveChildRef_Blue.cpp | 4 + .../SpaceObject/Children/EveChildSocket.cpp | 44 ++++--- .../Eve/SpaceObject/Children/EveChildSocket.h | 19 ++- .../Children/EveChildSocket_Blue.cpp | 4 + .../SpaceObject/Children/EveChildSpherePin.h | 2 +- .../Children/IEveEffectChildrenOwner.h | 8 +- .../Children/IEveSpaceObjectChild.h | 57 ++------- .../EveChildProceduralContainer.cpp | 39 ++++-- .../EveChildProceduralContainer.h | 16 ++- .../EveChildProceduralContainer_Blue.cpp | 4 + .../SmartLightSets/EveChildSmartLightSet.cpp | 10 -- .../SmartLightSets/EveChildSmartLightSet.h | 14 +-- .../EveChildSmartLightSet_Blue.cpp | 4 + .../EveSmartLightBaseAttributeModifier.h | 2 +- trinity/Eve/SpaceObject/EveSpaceObject2.cpp | 29 ++++- trinity/Eve/SpaceObject/EveSpaceObject2.h | 10 +- .../fxAttributes/EveCameraFxAttributes.h | 2 +- trinity/Eve/SpaceObjectFactory/EveSOF.cpp | 22 ++-- trinity/Eve/Turret/EveTurretFiringFX.h | 4 +- trinity/Eve/Turret/EveTurretSet.cpp | 8 +- trinity/Eve/Turret/EveTurretSet.h | 8 +- trinity/Eve/UI/EveEllipseSet.cpp | 14 --- trinity/Eve/UI/EveEllipseSet.h | 10 +- trinity/Eve/UI/EveEllipseSet_Blue.cpp | 4 + trinity/trinity.cpp | 6 +- 95 files changed, 653 insertions(+), 807 deletions(-) diff --git a/trinity/CMakeLists.txt b/trinity/CMakeLists.txt index 606b971e0..13c53c2f8 100644 --- a/trinity/CMakeLists.txt +++ b/trinity/CMakeLists.txt @@ -572,6 +572,9 @@ set(_SOURCES Eve/SpaceObject/Children/EveCloudEditableVolume.cpp Eve/SpaceObject/Children/EveCloudEditableVolume.h Eve/SpaceObject/Children/EveCloudEditableVolume_Blue.cpp + Eve/SpaceObject/Children/EveSpaceObjectChild.cpp + Eve/SpaceObject/Children/EveSpaceObjectChild.h + Eve/SpaceObject/Children/EveSpaceObjectChild_Blue.cpp Eve/SpaceObject/Children/IEveEffectChildrenOwner.h Eve/SpaceObject/Children/IEveSpaceObjectChild.h Eve/SpaceObject/Utils/EveDistributionMethods/DistributionAttributeModifiers/EveDistributionModifierProcessLifetime.cpp diff --git a/trinity/Controllers/Actions/Tr2ActionChildEffect.cpp b/trinity/Controllers/Actions/Tr2ActionChildEffect.cpp index 637e4b83d..2ff61cfb4 100644 --- a/trinity/Controllers/Actions/Tr2ActionChildEffect.cpp +++ b/trinity/Controllers/Actions/Tr2ActionChildEffect.cpp @@ -4,7 +4,7 @@ #include "Tr2ActionChildEffect.h" #include "Controllers/Tr2Controller.h" #include "Eve/SpaceObject/Children/IEveEffectChildrenOwner.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Eve/EveMultiEffect.h" #include "Eve/EveMultiEffectParameter.h" #include "Eve/Renderable/Stretch/EveStretch3.h" @@ -115,7 +115,7 @@ void Tr2ActionChildEffect::Start( ITr2ActionController& controller ) } if( m_addOnStart && !m_child && !m_path.empty() ) { - m_child = BeResMan->LoadObject( m_path.c_str() ); + m_child = BeResMan->LoadObject( m_path.c_str() ); if( m_child ) { if( !m_childName.empty() ) diff --git a/trinity/Controllers/Actions/Tr2ActionChildEffect.h b/trinity/Controllers/Actions/Tr2ActionChildEffect.h index 10efcb47e..77f53a5b0 100644 --- a/trinity/Controllers/Actions/Tr2ActionChildEffect.h +++ b/trinity/Controllers/Actions/Tr2ActionChildEffect.h @@ -4,7 +4,7 @@ #include "ITr2ControllerAction.h" -BLUE_DECLARE_INTERFACE( IEveSpaceObjectChild ); +BLUE_DECLARE( EveSpaceObjectChild ); BLUE_CLASS( Tr2ActionChildEffect ) : @@ -21,7 +21,7 @@ BLUE_CLASS( Tr2ActionChildEffect ) : private: std::string m_path; std::string m_childName; - IEveSpaceObjectChildPtr m_child; + EveSpaceObjectChildPtr m_child; bool m_addOnStart; bool m_removeOnStop; BlueSharedString m_targetAnotherOwner; diff --git a/trinity/Controllers/Actions/Tr2ActionPlayCurveSet.cpp b/trinity/Controllers/Actions/Tr2ActionPlayCurveSet.cpp index eed76b4ac..ca8b094d5 100644 --- a/trinity/Controllers/Actions/Tr2ActionPlayCurveSet.cpp +++ b/trinity/Controllers/Actions/Tr2ActionPlayCurveSet.cpp @@ -7,7 +7,6 @@ #include "Curves/TriCurveSet.h" #include "Eve/SpaceObject/EveSpaceObject2.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" #include "Eve/EveEffectRoot2.h" diff --git a/trinity/Eve/EveEffectRoot2.cpp b/trinity/Eve/EveEffectRoot2.cpp index b37c60d85..70eb1bdf3 100644 --- a/trinity/Eve/EveEffectRoot2.cpp +++ b/trinity/Eve/EveEffectRoot2.cpp @@ -49,10 +49,18 @@ EveEffectRoot2::~EveEffectRoot2() { controller->Unlink( UnlinkReason::DELETING ); } + for( auto& child : m_effectChildren ) + { + child->SetOwner( nullptr ); + } } bool EveEffectRoot2::Initialize() { + for( auto& child : m_effectChildren ) + { + child->SetOwner( this ); + } for( auto& controller : m_controllers ) { if( !controller->IsLinked() ) @@ -113,8 +121,9 @@ void EveEffectRoot2::OnListModified( long event, ssize_t key, ssize_t key2, IRoo switch( event & BELIST_EVENTMASK ) { case BELIST_INSERTED: - if( IEveSpaceObjectChildPtr child = BlueCastPtr( value ) ) + if( EveSpaceObjectChildPtr child = BlueCastPtr( value ) ) { + child->SetOwner( this ); for( auto it = begin( m_controllerVariables ); it != end( m_controllerVariables ); ++it ) { child->SetControllerVariable( it->first.c_str(), it->second ); @@ -137,6 +146,10 @@ void EveEffectRoot2::OnListModified( long event, ssize_t key, ssize_t key2, IRoo entity->UnRegister( GetComponentRegistry() ); } } + if( EveSpaceObjectChildPtr child = BlueCastPtr( value ) ) + { + child->SetOwner( nullptr ); + } break; case BELIST_UNLOADSTART: if( IsInRegistry() ) @@ -149,6 +162,10 @@ void EveEffectRoot2::OnListModified( long event, ssize_t key, ssize_t key2, IRoo } } } + for( auto& child : m_effectChildren ) + { + child->SetOwner( nullptr ); + } default: break; } @@ -668,7 +685,7 @@ void EveEffectRoot2::GetMissPosition( const Vector3* hit, const Vector3* source, } // ----------------------------------------------------------------------------- -PIEveSpaceObjectChildVector& EveEffectRoot2::GetChildren() +PEveSpaceObjectChildVector& EveEffectRoot2::GetChildren() { return m_effectChildren; } @@ -884,7 +901,7 @@ void EveEffectRoot2::StartControllers() } // -------------------------------------------------------------------------------- -IEveSpaceObjectChildPtr EveEffectRoot2::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveEffectRoot2::GetEffectChildByName( const char* name ) const { for( auto it = begin( m_effectChildren ); it != end( m_effectChildren ); ++it ) { @@ -898,7 +915,7 @@ IEveSpaceObjectChildPtr EveEffectRoot2::GetEffectChildByName( const char* name ) } // -------------------------------------------------------------------------------- -void EveEffectRoot2::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveEffectRoot2::AddToEffectChildrenList( EveSpaceObjectChild* child ) { if( IsInRegistry() && m_display ) { @@ -911,7 +928,7 @@ void EveEffectRoot2::AddToEffectChildrenList( IEveSpaceObjectChild* child ) } // -------------------------------------------------------------------------------- -void EveEffectRoot2::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveEffectRoot2::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { auto index = m_effectChildren.FindKey( child ); if( index >= 0 ) @@ -931,7 +948,7 @@ void EveEffectRoot2::SetShaderOption( const BlueSharedString& name, const BlueSh { for( auto it = m_effectChildren.begin(); it != m_effectChildren.end(); ++it ) { - IEveSpaceObjectChild* child = *it; + EveSpaceObjectChild* child = *it; child->SetShaderOption( name, value ); } } diff --git a/trinity/Eve/EveEffectRoot2.h b/trinity/Eve/EveEffectRoot2.h index 2f49183c5..7114339a1 100644 --- a/trinity/Eve/EveEffectRoot2.h +++ b/trinity/Eve/EveEffectRoot2.h @@ -9,7 +9,7 @@ #include "EveTransform.h" #include "EveLODHelper.h" #include "IEveSpaceObject2.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Eve/SpaceObject/Children/IEveEffectChildrenOwner.h" #include "Tr2ShLightingManager.h" #include "Include/ITriTargetable.h" @@ -134,9 +134,9 @@ BLUE_CLASS( EveEffectRoot2 ) : ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) override; ///////////////////////////////////////////////////////////////////////////////////// @@ -160,7 +160,7 @@ BLUE_CLASS( EveEffectRoot2 ) : void Start(); void Stop(); - PIEveSpaceObjectChildVector& GetChildren(); + PEveSpaceObjectChildVector& GetChildren(); void SetTransform( const Matrix& transform ); @@ -204,7 +204,7 @@ BLUE_CLASS( EveEffectRoot2 ) : std::string m_name; bool m_display; bool m_mute; - PIEveSpaceObjectChildVector m_effectChildren; + PEveSpaceObjectChildVector m_effectChildren; Vector3 m_scaling; Quaternion m_rotation; diff --git a/trinity/Eve/Renderable/Stretch/EveStretch3.cpp b/trinity/Eve/Renderable/Stretch/EveStretch3.cpp index ef4a5711e..f518ca15e 100644 --- a/trinity/Eve/Renderable/Stretch/EveStretch3.cpp +++ b/trinity/Eve/Renderable/Stretch/EveStretch3.cpp @@ -13,7 +13,7 @@ #include "Lights/Tr2PointLight.h" #include "Controllers/ITr2Controller.h" #include "Eve/SpaceObject/Children/TransformModifiers/EveChildModifierStretch.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Audio/Tr2AudioStretchAuto.h" #include "Audio/Tr2AudioStretchBase.h" @@ -123,7 +123,7 @@ void EveStretch3::Rebind( bool onlyUpdateBindings ) } } -void EveStretch3::RunOnComponents( std::function func ) const +void EveStretch3::RunOnComponents( std::function func ) const { if( m_sourceObject ) { @@ -146,7 +146,7 @@ void EveStretch3::RunOnComponents( std::function } } -float EveStretch3::RunOnComponentsGetMax( std::function func ) const +float EveStretch3::RunOnComponentsGetMax( std::function func ) const { float ret = -1.f; if( m_sourceObject ) @@ -211,12 +211,12 @@ std::unordered_map EveStretch3::GetParameterMap() const return parameterMap; } -IEveSpaceObjectChild* EveStretch3::GetSourceObject() +EveSpaceObjectChild* EveStretch3::GetSourceObject() { return m_sourceObject; } -void EveStretch3::SetSourceObject( IEveSpaceObjectChild* sourceObject ) +void EveStretch3::SetSourceObject( EveSpaceObjectChild* sourceObject ) { auto registry = GetComponentRegistry(); if( EveEntityPtr entity = BlueCastPtr( m_sourceObject ) ) @@ -230,12 +230,12 @@ void EveStretch3::SetSourceObject( IEveSpaceObjectChild* sourceObject ) } } -IEveSpaceObjectChild* EveStretch3::GetDestObject() +EveSpaceObjectChild* EveStretch3::GetDestObject() { return m_destObject; } -void EveStretch3::SetDestObject( IEveSpaceObjectChild* destObject ) +void EveStretch3::SetDestObject( EveSpaceObjectChild* destObject ) { auto registry = GetComponentRegistry(); if( EveEntityPtr entity = BlueCastPtr( m_destObject ) ) @@ -249,12 +249,12 @@ void EveStretch3::SetDestObject( IEveSpaceObjectChild* destObject ) } } -IEveSpaceObjectChild* EveStretch3::GetStretchObject() +EveSpaceObjectChild* EveStretch3::GetStretchObject() { return m_stretchObject; } -void EveStretch3::SetStretchObject( IEveSpaceObjectChild* stretchObject ) +void EveStretch3::SetStretchObject( EveSpaceObjectChild* stretchObject ) { auto registry = GetComponentRegistry(); if( EveEntityPtr entity = BlueCastPtr( m_stretchObject ) ) @@ -280,12 +280,12 @@ void EveStretch3::SetStretchObject( IEveSpaceObjectChild* stretchObject ) } } -IEveSpaceObjectChild* EveStretch3::GetMoveObject() +EveSpaceObjectChild* EveStretch3::GetMoveObject() { return m_moveObject; } -void EveStretch3::SetMoveObject( IEveSpaceObjectChild* moveObject ) +void EveStretch3::SetMoveObject( EveSpaceObjectChild* moveObject ) { auto registry = GetComponentRegistry(); if( EveEntityPtr entity = BlueCastPtr( m_moveObject ) ) @@ -605,7 +605,7 @@ void EveStretch3::GetRenderables( std::vector& renderables, Tr2 return; } - RunOnComponents( [&renderables]( IEveSpaceObjectChild* c ) { c->GetRenderables( renderables ); } ); + RunOnComponents( [&renderables]( EveSpaceObjectChild* c ) { c->GetRenderables( renderables ); } ); } void EveStretch3::SetDisplay( bool display ) @@ -724,7 +724,7 @@ void EveStretch3::RegisterComponents() if( registry && m_display ) { RunOnComponents( - [this]( IEveSpaceObjectChild* c ) { + [this]( EveSpaceObjectChild* c ) { if( EveEntityPtr entity = BlueCastPtr( c ) ) { entity->Register( GetComponentRegistry() ); @@ -739,7 +739,7 @@ void EveStretch3::UnRegisterComponents() if( registry ) { RunOnComponents( - [this]( IEveSpaceObjectChild* c ) { + [this]( EveSpaceObjectChild* c ) { if( EveEntityPtr entity = BlueCastPtr( c ) ) { entity->UnRegister( GetComponentRegistry() ); @@ -763,7 +763,7 @@ void EveStretch3::GetBindingRoots( std::unordered_map& vari void EveStretch3::SetControllerVariable( const char* name, float value ) { - RunOnComponents( [name, value]( IEveSpaceObjectChild* c ) { c->SetControllerVariable( name, value ); } ); + RunOnComponents( [name, value]( EveSpaceObjectChild* c ) { c->SetControllerVariable( name, value ); } ); for( auto it = begin( m_controllers ); it != end( m_controllers ); ++it ) { @@ -774,7 +774,7 @@ void EveStretch3::SetControllerVariable( const char* name, float value ) void EveStretch3::HandleControllerEvent( const char* name ) { - RunOnComponents( [name]( IEveSpaceObjectChild* c ) { c->HandleControllerEvent( name ); } ); + RunOnComponents( [name]( EveSpaceObjectChild* c ) { c->HandleControllerEvent( name ); } ); for( auto it = begin( m_controllers ); it != end( m_controllers ); ++it ) { @@ -784,7 +784,7 @@ void EveStretch3::HandleControllerEvent( const char* name ) void EveStretch3::StartControllers() { - RunOnComponents( []( IEveSpaceObjectChild* c ) { c->StartControllers(); } ); + RunOnComponents( []( EveSpaceObjectChild* c ) { c->StartControllers(); } ); for( auto it = begin( m_controllers ); it != end( m_controllers ); ++it ) { @@ -799,7 +799,7 @@ void EveStretch3::RegisterWithQuadRenderer( Tr2QuadRenderer& quadRenderer ) { return; } - RunOnComponents( [&quadRenderer]( IEveSpaceObjectChild* c ) { c->RegisterWithQuadRenderer( quadRenderer ); } ); + RunOnComponents( [&quadRenderer]( EveSpaceObjectChild* c ) { c->RegisterWithQuadRenderer( quadRenderer ); } ); } void EveStretch3::AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) @@ -809,7 +809,7 @@ void EveStretch3::AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRend return; } - RunOnComponents( [&frustum, &quadRenderer]( IEveSpaceObjectChild* c ) { c->AddQuadsToQuadRenderer( frustum, quadRenderer ); } ); + RunOnComponents( [&frustum, &quadRenderer]( EveSpaceObjectChild* c ) { c->AddQuadsToQuadRenderer( frustum, quadRenderer ); } ); } void EveStretch3::UpdateModelCenterWorldPosition( Vector3& position, Be::Time t ) @@ -837,7 +837,7 @@ void EveStretch3::SetDestObjectScale( float scale ) void EveStretch3::GetDebugOptions( Tr2DebugRendererOptions& options ) { options.insert( "Lights" ); - RunOnComponents( [&options]( IEveSpaceObjectChild* c ) { + RunOnComponents( [&options]( EveSpaceObjectChild* c ) { auto debugRenderable = dynamic_cast( c ); if( debugRenderable ) { @@ -862,7 +862,7 @@ void EveStretch3::RenderDebugInfo( ITr2DebugRenderer2& renderer ) { return; } - RunOnComponents( [&renderer]( IEveSpaceObjectChild* c ) { + RunOnComponents( [&renderer]( EveSpaceObjectChild* c ) { auto debugRenderable = dynamic_cast( c ); if( debugRenderable ) { @@ -904,7 +904,7 @@ void EveStretch3::PlayCurveSet( const std::string& name, const std::string& rang } } - RunOnComponents( [name, rangeName]( IEveSpaceObjectChild* c ) { + RunOnComponents( [name, rangeName]( EveSpaceObjectChild* c ) { auto curveSetOwner = dynamic_cast( c ); if( curveSetOwner ) { @@ -928,7 +928,7 @@ void EveStretch3::StopCurveSet( const std::string& name ) } } - RunOnComponents( [name]( IEveSpaceObjectChild* c ) { + RunOnComponents( [name]( EveSpaceObjectChild* c ) { auto curveSetOwner = dynamic_cast( c ); if( curveSetOwner ) { @@ -947,7 +947,7 @@ void EveStretch3::UpdateCurveSet( const std::string& name, Be::Time time ) } } - RunOnComponents( [name, time]( IEveSpaceObjectChild* c ) { + RunOnComponents( [name, time]( EveSpaceObjectChild* c ) { auto curveSetOwner = dynamic_cast( c ); if( curveSetOwner ) { @@ -971,7 +971,7 @@ float EveStretch3::GetCurveSetDuration( const std::string& name ) const maxDuration = max( maxDuration, ( *it )->GetMaxCurveDuration() ); } } - float componentMax = RunOnComponentsGetMax( [name]( IEveSpaceObjectChild* c ) -> float { + float componentMax = RunOnComponentsGetMax( [name]( EveSpaceObjectChild* c ) -> float { auto curveSetOwner = dynamic_cast( c ); if( curveSetOwner ) { @@ -999,7 +999,7 @@ float EveStretch3::GetRangeDuration( const std::string& name, const std::string& } } - float componentMax = RunOnComponentsGetMax( [name, rangeName]( IEveSpaceObjectChild* c ) -> float { + float componentMax = RunOnComponentsGetMax( [name, rangeName]( EveSpaceObjectChild* c ) -> float { auto curveSetOwner = dynamic_cast( c ); if( curveSetOwner ) { diff --git a/trinity/Eve/Renderable/Stretch/EveStretch3.h b/trinity/Eve/Renderable/Stretch/EveStretch3.h index 1040a537d..75b47d7d9 100644 --- a/trinity/Eve/Renderable/Stretch/EveStretch3.h +++ b/trinity/Eve/Renderable/Stretch/EveStretch3.h @@ -12,13 +12,13 @@ #include "Controllers/ITr2ControllerOwner.h" #include "Lights/ITr2LightOwner.h" #include "Lights/Tr2Light.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" BLUE_DECLARE( EveStretch3 ); BLUE_DECLARE( TriFloat ); BLUE_DECLARE( EveChildModifierStretch ); -BLUE_DECLARE_INTERFACE( IEveSpaceObjectChild ); +BLUE_DECLARE( EveSpaceObjectChild ); BLUE_DECLARE_INTERFACE( ITr2Controller ); BLUE_DECLARE_INTERFACE( ITriVectorFunction ); @@ -126,14 +126,14 @@ BLUE_CLASS( EveStretch3 ) : // ITr2SoundEmitterOwner ITr2AudEmitterPtr FindSoundEmitter( const char* name ) override; - IEveSpaceObjectChild* GetSourceObject(); - void SetSourceObject( IEveSpaceObjectChild * sourceObject ); - IEveSpaceObjectChild* GetDestObject(); - void SetDestObject( IEveSpaceObjectChild * destObject ); - IEveSpaceObjectChild* GetStretchObject(); - void SetStretchObject( IEveSpaceObjectChild * stretchObject ); - IEveSpaceObjectChild* GetMoveObject(); - void SetMoveObject( IEveSpaceObjectChild * moveObject ); + EveSpaceObjectChild* GetSourceObject(); + void SetSourceObject( EveSpaceObjectChild * sourceObject ); + EveSpaceObjectChild* GetDestObject(); + void SetDestObject( EveSpaceObjectChild * destObject ); + EveSpaceObjectChild* GetStretchObject(); + void SetStretchObject( EveSpaceObjectChild * stretchObject ); + EveSpaceObjectChild* GetMoveObject(); + void SetMoveObject( EveSpaceObjectChild * moveObject ); private: enum StretchState @@ -144,8 +144,8 @@ BLUE_CLASS( EveStretch3 ) : STRETCH_STATE_STOPPING }; - void RunOnComponents( std::function func ) const; - float RunOnComponentsGetMax( std::function func ) const; + void RunOnComponents( std::function func ) const; + float RunOnComponentsGetMax( std::function func ) const; void SetSourceSpaceObject( IEveSpaceObject2 * spaceObject ); void SetDestSpaceObject( IEveSpaceObject2 * spaceObject ); @@ -169,10 +169,10 @@ BLUE_CLASS( EveStretch3 ) : BlueWeakRef m_sourceSpaceObject; BlueWeakRef m_destSpaceObject; - IEveSpaceObjectChildPtr m_sourceObject; - IEveSpaceObjectChildPtr m_destObject; - IEveSpaceObjectChildPtr m_stretchObject; - IEveSpaceObjectChildPtr m_moveObject; + EveSpaceObjectChildPtr m_sourceObject; + EveSpaceObjectChildPtr m_destObject; + EveSpaceObjectChildPtr m_stretchObject; + EveSpaceObjectChildPtr m_moveObject; PTriCurveSetVector m_curveSets; Be::Time m_startTime; diff --git a/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp b/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp index 0e8c8b2f9..0e7f9b9a0 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp @@ -5,10 +5,10 @@ EveChildAudio::EveChildAudio( IRoot* lockobj ) : - m_name( "EveChildAudio" ), m_mute( false ), m_worldTransform( IdentityMatrix() ) { + m_name = BlueSharedString( "EveChildAudio" ); } bool EveChildAudio::Initialize() @@ -30,7 +30,7 @@ bool EveChildAudio::Initialize() } else { - emitterName = m_name; + emitterName = m_name.c_str(); } m_audioEmitter->Initialize( emitterName, L"", position ); @@ -68,40 +68,17 @@ bool EveChildAudio::OnModified( Be::Var* val ) } else { - SetEmitterName( m_name ); + SetEmitterName( m_name.c_str() ); } } return true; } -const char* EveChildAudio::GetName() const -{ - return m_name.c_str(); -} - -void EveChildAudio::SetName( const char* name ) -{ - m_name = name; -} - void EveChildAudio::GetLocalToWorldTransform( Matrix& transform ) const { transform = m_worldTransform; } -void EveChildAudio::Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) -{ -} - -void EveChildAudio::GetRenderables( std::vector& renderables ) -{ -} - -bool EveChildAudio::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const -{ - return false; -} - void EveChildAudio::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) { Matrix localToWorldTransform; @@ -130,10 +107,6 @@ void EveChildAudio::UpdateSyncronous( const EveUpdateContext& updateContext, con } } -void EveChildAudio::UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) -{ -} - void EveChildAudio::SetEmitterName( const std::string& name ) { if( m_audioEmitter ) @@ -142,14 +115,6 @@ void EveChildAudio::SetEmitterName( const std::string& name ) } } -void EveChildAudio::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) -{ -} - -void EveChildAudio::ChangeLOD( Tr2Lod lod ) -{ -} - void EveChildAudio::GetDebugOptions( Tr2DebugRendererOptions& options ) { if( ITr2DebugRenderablePtr tmp = BlueCastPtr( m_audioEmitter ) ) diff --git a/trinity/Eve/SpaceObject/Children/EveChildAudio.h b/trinity/Eve/SpaceObject/Children/EveChildAudio.h index cbabd87cb..3b626c383 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildAudio.h +++ b/trinity/Eve/SpaceObject/Children/EveChildAudio.h @@ -3,7 +3,7 @@ #ifndef EVE_CHILD_AUDIO_H #define EVE_CHILD_AUDIO_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #ifdef BLUE_USE_LOCAL_ITr2DebugRenderer2 @@ -27,7 +27,7 @@ BLUE_DECLARE( EveChildAudio ); * @brief Audio emitter that can be added as a child to EveChildContainer. */ BLUE_CLASS( EveChildAudio ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public IInitialize, public INotify, @@ -73,24 +73,15 @@ BLUE_CLASS( EveChildAudio ) : */ void SetEmitterName( const std::string& name ); - // Implementing the IEveSpaceObjectChild interface - const char* GetName() const; - void SetName( const char* name ); - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); - void GetRenderables( std::vector & renderables ); - bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; + // Implementing the EveSpaceObjectChild interface void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); - void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void GetLocalToWorldTransform( Matrix & transform ) const; - void ChangeLOD( Tr2Lod lod ); - void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); // ITr2DebugRenderable virtual void GetDebugOptions( Tr2DebugRendererOptions & options ) override; virtual void RenderDebugInfo( ITr2DebugRenderer2 & renderer ) override; private: - std::string m_name; ///< The name identifier for this audio child. Matrix m_worldTransform; ///< Cached world transformation matrix. bool m_mute; ///< Whether audio playback is muted. ITr2AudEmitterPtr m_audioEmitter; ///< The audio emitter instance. diff --git a/trinity/Eve/SpaceObject/Children/EveChildAudio_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildAudio_Blue.cpp index a156c15ed..1aeb552ad 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildAudio_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildAudio_Blue.cpp @@ -10,6 +10,7 @@ const Be::ClassInfo* EveChildAudio::ExposeToBlue() EXPOSURE_BEGIN( EveChildAudio, "Audio emitter space object child" ) MAP_INTERFACE( EveChildAudio ) MAP_INTERFACE( IEveSpaceObjectChild ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IInitialize ) MAP_INTERFACE( INotify ) @@ -20,5 +21,8 @@ const Be::ClassInfo* EveChildAudio::ExposeToBlue() MAP_METHOD_AND_WRAP( "SetEmitterName", SetEmitterName, "Sets emitter name" ) MAP_METHOD_AND_WRAP( "__init__", py__init__, "Initialize the audio emitter after contruction/deserialization" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.cpp b/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.cpp index 0a2c09176..2cb9b827f 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.cpp @@ -578,7 +578,7 @@ std::vector> EveChildBehaviorSystem::GetVertexElementAddedTh ///////////////////////////////////////////////////////////////////////////////////// -// IEveSpaceObjectChild +// EveSpaceObjectChild void EveChildBehaviorSystem::UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) { Matrix localToWorldTransform; @@ -615,11 +615,6 @@ void EveChildBehaviorSystem::UpdateAsyncronous( const EveUpdateContext& updateCo m_hasUpdated = true; } -const char* EveChildBehaviorSystem::GetName() const -{ - return m_name; -} - void EveChildBehaviorSystem::Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) { EveChildTransform::Setup( scale, rotation, translation, lowestLodVisible ); @@ -648,10 +643,6 @@ void EveChildBehaviorSystem::GetRenderables( std::vector& rende } } -void EveChildBehaviorSystem::SetName( const char* name ) -{ -} - void EveChildBehaviorSystem::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) { if( !m_display ) @@ -665,11 +656,6 @@ void EveChildBehaviorSystem::UpdateVisibility( const EveUpdateContext& updateCon } } -bool EveChildBehaviorSystem::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const -{ - return true; -} - bool EveChildBehaviorSystem::GetInstanceBufferBoundingBox( unsigned int bufferIndex, Vector3& minBounds, Vector3& maxBounds ) const { return false; @@ -679,10 +665,6 @@ void EveChildBehaviorSystem::GetLocalToWorldTransform( Matrix& transform ) const { } -void EveChildBehaviorSystem::ChangeLOD( Tr2Lod lod ) -{ -} - void EveChildBehaviorSystem::RegisterComponents() { if( !m_display ) diff --git a/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.h b/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.h index a5a4b4fe3..dcbbac7be 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.h +++ b/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.h @@ -8,7 +8,7 @@ #include "Behaviors/BehaviorGroup.h" #include "Behaviors/SplineTunnelGroup.h" #include "Tr2DeviceResource.h" -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "TriRenderBatch.h" #include "ITr2Renderable.h" @@ -22,7 +22,7 @@ BLUE_DECLARE_VECTOR( BehaviorGroup ); BLUE_CLASS( EveChildBehaviorSystem ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public Tr2DeviceResource, public ITr2Renderable, public IInitialize, @@ -70,16 +70,11 @@ BLUE_CLASS( EveChildBehaviorSystem ) : { } - const char* GetName() const; - void SetName( const char* name ); - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); - bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void GetLocalToWorldTransform( Matrix & transform ) const; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); - void ChangeLOD( Tr2Lod lod ); ////////////////////////////////////////////////////////////////////////////////////// // EveEntity @@ -112,7 +107,6 @@ BLUE_CLASS( EveChildBehaviorSystem ) : bool OnPrepareResources(); void PassInVertexesToBehaviorGroups(); void PassInTunnelFunctionsToBehaviorGroups(); - char* m_name; bool m_behaviorGroupLoaded; bool m_behaviorGroupLoadedForTunnel; diff --git a/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem_Blue.cpp index 7737739c7..1f34f4581 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem_Blue.cpp @@ -8,6 +8,7 @@ const Be::ClassInfo* EveChildBehaviorSystem::ExposeToBlue() { EXPOSURE_BEGIN( EveChildBehaviorSystem, "" ) MAP_INTERFACE( EveChildBehaviorSystem ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( INotify ) @@ -30,5 +31,8 @@ const Be::ClassInfo* EveChildBehaviorSystem::ExposeToBlue() GetVertexElementAddedThroughCode, "for validation and objects requiring vertex elements added to the shader through code\n:jessica-hidden: True" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.cpp b/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.cpp index ddb989ae1..062f2e4d2 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.cpp @@ -77,18 +77,6 @@ bool EveChildBulletStorm::OnModified( Be::Var* val ) return true; } -// -------------------------------------------------------------------------------- -const char* EveChildBulletStorm::GetName() const -{ - return m_name.c_str(); -} - -// -------------------------------------------------------------------------------- -void EveChildBulletStorm::SetName( const char* name ) -{ - m_name = name; -} - // -------------------------------------------------------------------------------- // Description: // Trinity's way of rendering @@ -223,14 +211,6 @@ bool EveChildBulletStorm::GetBoundingSphere( Vector4& sphere, BoundingSphereQuer return true; } -// -------------------------------------------------------------------------------- -// Description: -// Syncronous updates happen here -// -------------------------------------------------------------------------------- -void EveChildBulletStorm::UpdateSyncronous( const EveUpdateContext&, const EveChildUpdateParams& ) -{ -} - void EveChildBulletStorm::StartEffect() { m_clipShereMul = 1.0f; @@ -317,14 +297,6 @@ void EveChildBulletStorm::GetLocalToWorldTransform( Matrix& transform ) const transform = m_worldTransform; } -// -------------------------------------------------------------------------------- -// Description: -// Used by state machine to animate state-related stuff -// -------------------------------------------------------------------------------- -void EveChildBulletStorm::Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) -{ -} - // -------------------------------------------------------------------------------- // Description: // Nothing transparent here, all additive! diff --git a/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.h b/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.h index f78c16289..52f1c3df3 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.h +++ b/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.h @@ -4,7 +4,7 @@ #ifndef EveChildBulletStorm_H #define EveChildBulletStorm_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "ITr2Renderable.h" #include "Eve/SpaceObject/EveSpaceObject2.h" @@ -34,7 +34,7 @@ class EveChildBulletStormPerObjectData : public Tr2PerObjectData // A spaceobject child for rendering swarm like bullets // -------------------------------------------------------------------------------- BLUE_CLASS( EveChildBulletStorm ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public ITr2Renderable, public Tr2DeviceResource, public INotify, @@ -55,19 +55,11 @@ BLUE_CLASS( EveChildBulletStorm ) : bool OnModified( Be::Var * val ); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) - { - } + // EveSpaceObjectChild void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; - void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void GetLocalToWorldTransform( Matrix & transform ) const; - void ChangeLOD( Tr2Lod lod ) {}; - void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); ///////////////////////////////////////////////////////////////////////////////////// // ITr2Renderable @@ -93,7 +85,6 @@ BLUE_CLASS( EveChildBulletStorm ) : private: // general data - std::string m_name; bool m_display; // Has UpdateSyncronous/UpdateAsyncronous been called: until it has, the object cannot be rendered bool m_hasUpdated = false; diff --git a/trinity/Eve/SpaceObject/Children/EveChildBulletStorm_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildBulletStorm_Blue.cpp index 86ba7b4a1..8b51cae94 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildBulletStorm_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildBulletStorm_Blue.cpp @@ -9,6 +9,7 @@ const Be::ClassInfo* EveChildBulletStorm::ExposeToBlue() { EXPOSURE_BEGIN( EveChildBulletStorm, "" ) MAP_INTERFACE( EveChildBulletStorm ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( INotify ) @@ -35,5 +36,8 @@ const Be::ClassInfo* EveChildBulletStorm::ExposeToBlue() MAP_METHOD_AND_WRAP( "StopEffect", StopEffect, "Stop Effect" ) MAP_METHOD_AND_WRAP( "CanChangeState", CanChangeState, "Can start or stop the effect without visual errors?" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildCloud.cpp b/trinity/Eve/SpaceObject/Children/EveChildCloud.cpp index c80462793..83fb8f5ca 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildCloud.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildCloud.cpp @@ -208,16 +208,6 @@ bool EveChildCloud::OnModified( Be::Var* value ) return true; } -const char* EveChildCloud::GetName() const -{ - return m_name.c_str(); -} - -void EveChildCloud::SetName( const char* name ) -{ - m_name = name; -} - void EveChildCloud::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) { auto& frustum = updateContext.GetFrustum(); diff --git a/trinity/Eve/SpaceObject/Children/EveChildCloud.h b/trinity/Eve/SpaceObject/Children/EveChildCloud.h index f6c107e28..27bfa4671 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildCloud.h +++ b/trinity/Eve/SpaceObject/Children/EveChildCloud.h @@ -6,7 +6,7 @@ #include "ITr2Renderable.h" #include "Eve/IEveSpaceObject2.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Tr2ShLightingManager.h" #include "Tr2DebugRenderer.h" @@ -24,7 +24,7 @@ BLUE_CLASS( EveChildCloud ) : public Tr2DeviceResource, public IInitialize, public INotify, - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public ITr2DebugRenderable { public: @@ -42,19 +42,13 @@ BLUE_CLASS( EveChildCloud ) : virtual bool OnModified( Be::Var * value ); ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - virtual const char* GetName() const; - virtual void SetName( const char* name ); + // EveSpaceObjectChild virtual void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); virtual void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); virtual void GetLocalToWorldTransform( Matrix & transform ) const; virtual void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); virtual void GetRenderables( std::vector & renderables ); virtual bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; - virtual void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) - { - } - virtual void ChangeLOD( Tr2Lod lod ) {}; ///////////////////////////////////////////////////////////////////////////////////// // ITr2Renderable @@ -94,7 +88,6 @@ BLUE_CLASS( EveChildCloud ) : Tr2BufferAL m_vertexBuffer; TrackableStdVector m_indexBuffers; - std::string m_name; bool m_display; bool m_isVisible; // Has UpdateSyncronous/UpdateAsyncronous been called: until it has, the object cannot be rendered diff --git a/trinity/Eve/SpaceObject/Children/EveChildCloud2.cpp b/trinity/Eve/SpaceObject/Children/EveChildCloud2.cpp index 3e48803ae..ba6334b74 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildCloud2.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildCloud2.cpp @@ -205,24 +205,6 @@ bool EveChildCloud2::OnModified( Be::Var* value ) return true; } -const char* EveChildCloud2::GetName() const -{ - return m_name.c_str(); -} - -void EveChildCloud2::SetName( const char* name ) -{ - m_name = name; -} - -void EveChildCloud2::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) -{ -} - -void EveChildCloud2::GetRenderables( std::vector& ) -{ -} - bool EveChildCloud2::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery ) const { sphere = Vector4( m_boundingSphere.center, m_boundingSphere.radius ); diff --git a/trinity/Eve/SpaceObject/Children/EveChildCloud2.h b/trinity/Eve/SpaceObject/Children/EveChildCloud2.h index 9dce9cbbb..d641b48f4 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildCloud2.h +++ b/trinity/Eve/SpaceObject/Children/EveChildCloud2.h @@ -4,7 +4,7 @@ #include "ITr2Renderable.h" #include "Eve/IEveSpaceObject2.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Tr2DebugRenderer.h" #include "Tr2DepthStencil.h" #include "TriFrustumOrtho.h" @@ -27,12 +27,12 @@ BLUE_DECLARE( Tr2TextureAnimation ); // plane at the back of the object's bounding sphere using provided effect. // -------------------------------------------------------------------------------- BLUE_CLASS( EveChildCloud2 ) : + public EveSpaceObjectChild, public ITr2VolumetricRenderable, public Tr2DeviceResource, public IInitialize, public INotify, public IListNotify, - public IEveSpaceObjectChild, public ITr2DebugRenderable, public ITr2Renderable, public ITr2LightOwner, @@ -57,21 +57,11 @@ BLUE_CLASS( EveChildCloud2 ) : void OnListModified( long event, ssize_t key, ssize_t key2, IRoot* value, const struct IList* theList ) override; ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - virtual const char* GetName() const override; - virtual void SetName( const char* name ) override; + // EveSpaceObjectChild virtual void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; virtual void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; virtual void GetLocalToWorldTransform( Matrix & transform ) const override; - virtual void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override; - virtual void GetRenderables( std::vector & renderables ) override; virtual bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const override; - virtual void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) override - { - } - virtual void ChangeLOD( Tr2Lod lod ) override - { - } ////////////////////////////////////////////////////////////////////////////////////// // ITr2LightOwner @@ -189,7 +179,6 @@ BLUE_CLASS( EveChildCloud2 ) : Tr2DepthStencilPtr m_shadowMapDS; TriVariable* m_depthShadowMapHandle; - std::string m_name; bool m_display; bool m_castShadows; bool m_receiveShadows; diff --git a/trinity/Eve/SpaceObject/Children/EveChildCloud2_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildCloud2_Blue.cpp index c4245e970..b9b921289 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildCloud2_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildCloud2_Blue.cpp @@ -15,6 +15,7 @@ const Be::ClassInfo* EveChildCloud2::ExposeToBlue() MAP_INTERFACE( IInitialize ) MAP_INTERFACE( INotify ) MAP_INTERFACE( IListNotify ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( ITr2LightOwner ) @@ -65,5 +66,8 @@ const Be::ClassInfo* EveChildCloud2::ExposeToBlue() MAP_ATTRIBUTE( "mapOffset1", m_mapOffsets[1], "Texture offset 1. Used for debugging camera-attached clouds.\n:jessica-group: Tiling", Be::READ ) MAP_ATTRIBUTE( "mapOffset2", m_mapOffsets[2], "Texture offset 2. Used for debugging camera-attached clouds.\n:jessica-group: Tiling", Be::READ ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildCloud_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildCloud_Blue.cpp index be2b2c06b..7e02f2205 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildCloud_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildCloud_Blue.cpp @@ -13,6 +13,7 @@ const Be::ClassInfo* EveChildCloud::ExposeToBlue() MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( IInitialize ) MAP_INTERFACE( INotify ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_ATTRIBUTE( "name", m_name, "The name of the cloud", Be::READWRITE | Be::PERSIST ) @@ -36,5 +37,8 @@ const Be::ClassInfo* EveChildCloud::ExposeToBlue() MAP_ATTRIBUTE( "cellScreenSize", m_cellScreenSize, "Target size of a single cell in a grid on the screen (in pixels)", Be::READWRITE | Be::PERSIST ) MAP_ATTRIBUTE( "currentLod", m_currentIB, "Current cloud LOD", Be::READ ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp b/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp index a0641cb6b..5f29c6b90 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp @@ -59,10 +59,12 @@ EveChildContainer::~EveChildContainer() { controller->Unlink( UnlinkReason::DELETING ); } + UnregisterChildren( m_objects ); } bool EveChildContainer::Initialize() { + RegisterChildren( m_objects ); for( auto& controller : m_controllers ) { if( !controller->IsLinked() ) @@ -142,6 +144,8 @@ void EveChildContainer::OnListModified( long event, ssize_t key, ssize_t key2, I } else if( list == &m_objects && ( event & BELIST_LOADING ) == 0 ) { + HandleChildrenListModified( event, value, m_objects ); + if( IsInRegistry() ) { switch( event & BELIST_EVENTMASK ) @@ -314,7 +318,7 @@ void EveChildContainer::SetShaderOption( const BlueSharedString& name, const Blu { for( auto it = m_objects.begin(); it != m_objects.end(); ++it ) { - IEveSpaceObjectChild* child = *it; + EveSpaceObjectChild* child = *it; child->SetShaderOption( name, value ); } @@ -366,16 +370,6 @@ bool EveChildContainer::IsUpdating() const return ( m_display || !m_updateOnDisplay ) && ( IsRendering() || m_displayFilter == ONLY_REFLECTIONS ); } -const char* EveChildContainer::GetName() const -{ - return m_name.c_str(); -} - -void EveChildContainer::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - void EveChildContainer::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) { if( !m_display ) @@ -442,7 +436,7 @@ bool EveChildContainer::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery Vector4 bSphere( 0.f, 0.f, 0.f, -1.f ); for( auto it = m_objects.begin(); it != m_objects.end(); it++ ) { - if( ( *it )->GetBoundingSphere( bSphere ) ) + if( ( *it )->GetBoundingSphere( bSphere, EVE_BOUNDS_NORMAL ) ) { BoundingSphereSetOrUpdate( bSphere, sphere, success ); success = true; @@ -966,7 +960,7 @@ void EveChildContainer::StartControllers() } } -IEveSpaceObjectChildPtr EveChildContainer::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveChildContainer::GetEffectChildByName( const char* name ) const { for( auto it = begin( m_objects ); it != end( m_objects ); ++it ) { @@ -979,7 +973,7 @@ IEveSpaceObjectChildPtr EveChildContainer::GetEffectChildByName( const char* nam return nullptr; } -void EveChildContainer::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildContainer::AddToEffectChildrenList( EveSpaceObjectChild* child ) { auto childRoot = child->GetRootObject(); m_objects.Append( childRoot ); @@ -993,7 +987,7 @@ void EveChildContainer::AddToEffectChildrenList( IEveSpaceObjectChild* child ) } } -void EveChildContainer::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildContainer::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { auto index = m_objects.FindKey( child ); if( index >= 0 ) @@ -1111,6 +1105,30 @@ void EveChildContainer::SetProceduralContainerVariable( const char* name, float } } +void EveChildContainer::SetOwner( IEveSpaceObject2* owner ) +{ + if( GetOwner() != owner ) + { + EveSpaceObjectChild::SetOwner( owner ); + for( auto& child : m_objects ) + { + child->SetOwner( owner ); + } + } +} + +void EveChildContainer::SetPartTag( PartTag tag ) +{ + if( GetPartTag() != tag ) + { + EveSpaceObjectChild::SetPartTag( tag ); + for( auto& child : m_objects ) + { + child->SetPartTag( tag ); + } + } +} + void EveChildContainer::SetAnimationOwner( ITr2GrannyAnimationOwner* animationOwner ) { m_animationOwner = animationOwner; diff --git a/trinity/Eve/SpaceObject/Children/EveChildContainer.h b/trinity/Eve/SpaceObject/Children/EveChildContainer.h index e8bdeac85..7fa1faa73 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildContainer.h +++ b/trinity/Eve/SpaceObject/Children/EveChildContainer.h @@ -4,7 +4,7 @@ #ifndef EveChildContainer_H #define EveChildContainer_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "IEveEffectChildrenOwner.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" @@ -31,7 +31,7 @@ BLUE_DECLARE_INTERFACE( IEveFxAttribute ); BLUE_DECLARE_IVECTOR( IEveFxAttribute ); BLUE_CLASS( EveChildContainer ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2Renderable, public ITr2CurveSetOwner, @@ -66,17 +66,19 @@ BLUE_CLASS( EveChildContainer ) : virtual bool OnModified( Be::Var * val ); ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild + // EveSpaceObjectChild void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) override; bool IsAlwaysOn() const override; void AddTransformModifier( IEveChildTransformModifier * modifier ) override; void SetProceduralContainerVariable( const char* name, float value ) override; + void SetOwner( IEveSpaceObject2 * owner ) override; + void SetPartTag( PartTag tag ) override; ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); ///////////////////////////////////////////////////////////////////////////////////// // ITr2ControllerOwner @@ -111,9 +113,6 @@ BLUE_CLASS( EveChildContainer ) : uint32_t GetPerObjectDataSize( Tr2RenderContextEnum::ShaderType shaderType ) const; void UpdatePerObjectBuffer( Tr2RenderContextEnum::ShaderType shaderType, uint32_t size, void* ); - const char* GetName() const; - void SetName( const char* name ); - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -171,7 +170,7 @@ BLUE_CLASS( EveChildContainer ) : bool Empty() const; - PIEveSpaceObjectChildVector m_objects; + PEveSpaceObjectChildVector m_objects; protected: void DoUpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); @@ -183,7 +182,6 @@ BLUE_CLASS( EveChildContainer ) : bool HasRenderables() const; - BlueSharedString m_name; PTriCurveSetVector m_curveSets; PTriObserverLocalVector m_observers; PTr2LightVector m_lights; diff --git a/trinity/Eve/SpaceObject/Children/EveChildContainer_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildContainer_Blue.cpp index 9e345bbf3..42ac5b7c3 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildContainer_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildContainer_Blue.cpp @@ -5,11 +5,11 @@ Be::VarChooser EveSpaceObjectChildOriginChooser[] = { - { "SPACE", BeCast( IEveSpaceObjectChild::SPACE ), "Origin in Space" }, - { "SOF", BeCast( IEveSpaceObjectChild::SOF ), "Origin in SOF" }, + { "SPACE", BeCast( EveSpaceObjectChild::SPACE ), "Origin in Space" }, + { "SOF", BeCast( EveSpaceObjectChild::SOF ), "Origin in SOF" }, { 0 } }; -BLUE_REGISTER_ENUM_EX( "EveSpaceObjectChildOrigin", IEveSpaceObjectChild::Origin, EveSpaceObjectChildOriginChooser, ENUM_REG_ENUM_OBJECT_ON_MODULE ); +BLUE_REGISTER_ENUM_EX( "EveSpaceObjectChildOrigin", EveSpaceObjectChild::Origin, EveSpaceObjectChildOriginChooser, ENUM_REG_ENUM_OBJECT_ON_MODULE ); Be::VarChooser EveChildContainerDataSetShaderChooser[] = { { "None_", BeCast( EveChildContainer::SHADER_ALL ), "Visible to users with all shader settings" }, @@ -33,6 +33,7 @@ const Be::ClassInfo* EveChildContainer::ExposeToBlue() MAP_INTERFACE( EveChildContainer ) MAP_INTERFACE( EveEntity ) MAP_INTERFACE( ITr2LightOwner ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2CurveSetOwner ) MAP_INTERFACE( IInitialize ) @@ -106,5 +107,8 @@ const Be::ClassInfo* EveChildContainer::ExposeToBlue() StartControllers, "Start all controllers" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.cpp b/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.cpp index dc5824371..a2091ca8c 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.cpp @@ -39,6 +39,7 @@ EveChildEffectPropagator::EveChildEffectPropagator( IRoot* lockobj ) : EveChildEffectPropagator::~EveChildEffectPropagator() { + UnregisterChild( m_effect ); } @@ -130,6 +131,7 @@ void EveChildEffectPropagator::Stop() bool EveChildEffectPropagator::Initialize() { + RegisterChild( m_effect ); if( m_effect != nullptr ) { m_effect->DisableEditMode( true ); @@ -168,7 +170,7 @@ void EveChildEffectPropagator::ManageTriggers() // -------------------------------------------- // Description: -// Implements IEveSpaceObjectChild interface. +// Implements EveSpaceObjectChild interface. // -------------------------------------------- void EveChildEffectPropagator::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) { @@ -646,10 +648,12 @@ void EveChildEffectPropagator::SetEffect( EveChildInstanceContainer* effect ) { // unregister the current effect UnRegisterComponents(); + UnregisterChild( m_effect ); m_effect = effect; // register again + RegisterChild( m_effect ); RegisterComponents(); } diff --git a/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.h b/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.h index 12deb0d46..f4287aafe 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.h +++ b/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.h @@ -98,7 +98,6 @@ BLUE_CLASS( EveChildEffectPropagator ) : float m_playTime; EveChildInstanceContainerPtr m_effect; // Child containing trigger effect - IEveSpaceObjectChildPtr m_effectShared; // Child containing shared parts of the effect (particle systems etc.) Vector3 m_effectScaling; float m_randScaleMin; diff --git a/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator_Blue.cpp index 2391292dc..deca8722c 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator_Blue.cpp @@ -27,6 +27,7 @@ const Be::ClassInfo* EveChildEffectPropagator::ExposeToBlue() EXPOSURE_BEGIN( EveChildEffectPropagator, "Specialized explosion propagator object child" ) MAP_INTERFACE( EveChildEffectPropagator ) MAP_INTERFACE( EveChildContainer ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( INotify ) MAP_INTERFACE( EveEntity ) @@ -72,5 +73,8 @@ const Be::ClassInfo* EveChildEffectPropagator::ExposeToBlue() MAP_METHOD_AND_WRAP( "RebuildLocalTransform", RebuildLocalTransform, "Rebuilds local transform." ) MAP_METHOD_AND_WRAP( "Stop", Stop, "Stops effect playback.\n:jessica-favorite:\n:jessica-icon: timeline/stop.png" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildExplosion.cpp b/trinity/Eve/SpaceObject/Children/EveChildExplosion.cpp index a252e4579..a08bd47bb 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildExplosion.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildExplosion.cpp @@ -174,7 +174,7 @@ void EveChildExplosion::SetGlobalExplosionOffset( const Vector3& offset ) // -------------------------------------------------------------------------------------- // Description: -// Implements IEveSpaceObjectChild interface. If the effect is playing this function +// Implements EveSpaceObjectChild interface. If the effect is playing this function // spawns explosions. // -------------------------------------------------------------------------------------- void EveChildExplosion::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) @@ -224,7 +224,7 @@ void EveChildExplosion::UpdateSyncronous( const EveUpdateContext& updateContext, { if( m_globalExplosionInstances.empty() ) { - IEveSpaceObjectChildPtr instance; + EveSpaceObjectChildPtr instance; if( BeClasses->CopyTo( m_globalExplosion, (IRoot**)&instance.p ) ) { Quaternion rotation = Quaternion( 0.0, 0.0, 0.0, 1.0 ); @@ -261,7 +261,7 @@ void EveChildExplosion::UpdateSyncronous( const EveUpdateContext& updateContext, for( auto it = m_globalExplosions.begin(); it != m_globalExplosions.end(); ++it ) { auto globalExplosion = ( *it ); - IEveSpaceObjectChildPtr instance; + EveSpaceObjectChildPtr instance; if( BeClasses->CopyTo( globalExplosion, (IRoot**)&instance.p ) ) { m_globalExplosionContainer->m_objects.Append( instance ); @@ -460,7 +460,7 @@ void EveChildExplosion::SpawnLocalExplosion( const Matrix& transform ) { return; } - IEveSpaceObjectChildPtr instance; + EveSpaceObjectChildPtr instance; Transform t; Vector3 scale; diff --git a/trinity/Eve/SpaceObject/Children/EveChildExplosion.h b/trinity/Eve/SpaceObject/Children/EveChildExplosion.h index 42953d774..4362c0319 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildExplosion.h +++ b/trinity/Eve/SpaceObject/Children/EveChildExplosion.h @@ -74,14 +74,14 @@ BLUE_CLASS( EveChildExplosion ) : // Child containing local explosion effect - IEveSpaceObjectChildPtr m_localExplosion; - PIEveSpaceObjectChildVector m_localExplosions; + EveSpaceObjectChildPtr m_localExplosion; + PEveSpaceObjectChildVector m_localExplosions; // Child containing shared parts of the local explosion effect (particle systems etc.) - IEveSpaceObjectChildPtr m_localExplosionShared; + EveSpaceObjectChildPtr m_localExplosionShared; // Child containing global explosion effect - IEveSpaceObjectChildPtr m_globalExplosion; - PIEveSpaceObjectChildVector m_globalExplosions; - PIEveSpaceObjectChildVector m_globalExplosionInstances; + EveSpaceObjectChildPtr m_globalExplosion; + PEveSpaceObjectChildVector m_globalExplosions; + PEveSpaceObjectChildVector m_globalExplosionInstances; EveChildContainerPtr m_globalExplosionContainer; // Transforms for local explosions diff --git a/trinity/Eve/SpaceObject/Children/EveChildExplosion_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildExplosion_Blue.cpp index 4a8777e78..e694d8237 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildExplosion_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildExplosion_Blue.cpp @@ -12,6 +12,7 @@ const Be::ClassInfo* EveChildExplosion::ExposeToBlue() MAP_INTERFACE( EveChildExplosion ) MAP_INTERFACE( EveChildContainer ) MAP_INTERFACE( EveEntity ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_ATTRIBUTE( "name", m_name, "", Be::READWRITE | Be::PERSIST ) @@ -141,5 +142,8 @@ const Be::ClassInfo* EveChildExplosion::ExposeToBlue() "Sets the global explosion offset.\n" ":param offset: Vector3 that to be used as the global explosion offset should be in local coordinates" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildFogVolume.cpp b/trinity/Eve/SpaceObject/Children/EveChildFogVolume.cpp index 15f13fbe3..92f9dafbd 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildFogVolume.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildFogVolume.cpp @@ -77,21 +77,7 @@ void EveChildFogVolume::UnRegisterComponents() } ///////////////////////////////////////////////////////////////////////////////////// -// IEveSpaceObjectChild -const char* EveChildFogVolume::GetName() const -{ - return m_name.c_str(); -} - -void EveChildFogVolume::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - -void EveChildFogVolume::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) -{ -} - +// EveSpaceObjectChild bool EveChildFogVolume::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const { sphere.GetXYZ() = m_boundingSphere.center; @@ -100,10 +86,6 @@ bool EveChildFogVolume::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery return true; } -void EveChildFogVolume::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) -{ -} - void EveChildFogVolume::UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) { UpdateTransformFromParent( params ); diff --git a/trinity/Eve/SpaceObject/Children/EveChildFogVolume.h b/trinity/Eve/SpaceObject/Children/EveChildFogVolume.h index 9e1d49362..86293a9f2 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildFogVolume.h +++ b/trinity/Eve/SpaceObject/Children/EveChildFogVolume.h @@ -2,7 +2,7 @@ #pragma once -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "ITr2Renderable.h" #include "Tr2DebugRenderer.h" @@ -14,7 +14,7 @@ BLUE_DECLARE_IVECTOR( IEveVolume ); BLUE_CLASS( EveChildFogVolume ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public IInitialize, public ITr2DebugRenderable, @@ -29,19 +29,12 @@ BLUE_CLASS( EveChildFogVolume ) : void RebuildBoundingSphere(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const override; - void SetName( const char* name ) override; - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override; - void GetRenderables( std::vector & renderables ) override{}; + // EveSpaceObjectChild bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query ) const override; - void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void GetLocalToWorldTransform( Matrix & transform ) const override; - void ChangeLOD( Tr2Lod lod ) override {}; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) override; bool IsAlwaysOn() const override; - void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) override {}; void RegisterComponents() override; void UnRegisterComponents() override; @@ -62,7 +55,6 @@ BLUE_CLASS( EveChildFogVolume ) : private: void UpdateTransformFromParent( const EveChildUpdateParams& params ); - BlueSharedString m_name; PIEveVolumeVector m_volumes; float m_intensity; diff --git a/trinity/Eve/SpaceObject/Children/EveChildFogVolume_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildFogVolume_Blue.cpp index 76f0c2582..cf5c6097c 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildFogVolume_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildFogVolume_Blue.cpp @@ -11,6 +11,7 @@ const Be::ClassInfo* EveChildFogVolume::ExposeToBlue() EXPOSURE_BEGIN( EveChildFogVolume, "" ) MAP_INTERFACE( ITr2FroxelFogSettings ) MAP_INTERFACE( EveEntity ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( IInitialize ) @@ -54,6 +55,8 @@ const Be::ClassInfo* EveChildFogVolume::ExposeToBlue() MAP_ATTRIBUTE( "boundingSphereCenter", m_boundingSphere.center, "", Be::READ ) MAP_ATTRIBUTE( "boundingSphereRadius", m_boundingSphere.radius, "", Be::READ ) MAP_ATTRIBUTE( "volumes", m_volumes, "", Be::READ | Be::PERSIST ) - + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp index 0d67cf3f0..e20b56091 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp @@ -54,16 +54,8 @@ EveChildInstanceContainer::EveChildInstanceContainer( IRoot* lockobj ) : EveChildInstanceContainer::~EveChildInstanceContainer() { -} - -const char* EveChildInstanceContainer::GetName() const -{ - return m_name.c_str(); -} - -void EveChildInstanceContainer::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); + UnregisterChildren( m_instances ); + UnregisterChild( m_source ); } bool EveChildInstanceContainer::OnModified( Be::Var* value ) @@ -121,25 +113,27 @@ void EveChildInstanceContainer::UnRegisterComponents() } } -void EveChildInstanceContainer::SetSourceEffect( IEveSpaceObjectChildPtr sourceEffect ) +void EveChildInstanceContainer::SetSourceEffect( EveSpaceObjectChildPtr sourceEffect ) { SetSource( sourceEffect ); m_reset = true; } -IEveSpaceObjectChildPtr EveChildInstanceContainer::GetSource() +EveSpaceObjectChildPtr EveChildInstanceContainer::GetSource() { return m_source; } -void EveChildInstanceContainer::SetSource( IEveSpaceObjectChild* source ) +void EveChildInstanceContainer::SetSource( EveSpaceObjectChild* source ) { auto registry = GetComponentRegistry(); if( EveEntityPtr entity = BlueCastPtr( m_source ) ) { entity->UnRegister( registry ); } + UnregisterChild( m_source ); m_source = source; + RegisterChild( m_source ); if( m_instances.empty() && !m_disableEditMode ) { if( EveEntityPtr entity = BlueCastPtr( m_source ) ) @@ -247,7 +241,7 @@ void EveChildInstanceContainer::CreateInstance( const Vector3& scale, const Quat EveChildContainerPtr translationParent; translationParent.CreateInstance(); - IEveSpaceObjectChildPtr instance; + EveSpaceObjectChildPtr instance; if( !BeClasses->CopyTo( m_source, (IRoot**)&instance ) ) { @@ -280,14 +274,20 @@ void EveChildInstanceContainer::CreateInstance( const Vector3& scale, const Quat boneParent->AddToEffectChildrenList( translationParent ); boneParent->RegisterWithQuadRenderer( *Tr2QuadRenderer::Instance() ); boneParent->Register( GetComponentRegistry() ); + boneParent->SetOwner( GetOwner() ); + boneParent->SetParent( this ); + boneParent->SetPartTag( GetPartTag() ); - m_instances.Append( (IEveSpaceObjectChildPtr)boneParent ); + m_instances.Append( boneParent->GetRawRoot() ); } else { translationParent->RegisterWithQuadRenderer( *Tr2QuadRenderer::Instance() ); translationParent->Register( GetComponentRegistry() ); - m_instances.Append( (IEveSpaceObjectChildPtr)translationParent ); + translationParent->SetOwner( GetOwner() ); + translationParent->SetParent( this ); + translationParent->SetPartTag( GetPartTag() ); + m_instances.Append( translationParent->GetRawRoot() ); } return; @@ -300,7 +300,7 @@ void EveChildInstanceContainer::CreateInstance( const Vector3& scale, const Quat // -------------------------------------------------------------------------------------- void EveChildInstanceContainer::UpdateInstance( const uint32_t index, const Vector3& scale, const Quaternion& rotation, const Vector3& translation ) { - auto instance = (IEveSpaceObjectChild*)m_instances.GetAt( index ); + auto instance = static_cast( m_instances.GetAt( index ) ); if( instance == nullptr ) { return; @@ -313,9 +313,9 @@ void EveChildInstanceContainer::UpdateInstance( const uint32_t index, const Vect // A helper method to run a function on the source (if the instances are not valid) or // on the instances // Arguments: -// func - The function to run, takes a single parameter which is an IEveSpaceObjectChild* +// func - The function to run, takes a single parameter which is an EveSpaceObjectChild* // -------------------------------------------------------------------------------------- -void EveChildInstanceContainer::RunOnInstances( std::function func ) const +void EveChildInstanceContainer::RunOnInstances( std::function func ) const { if( m_instances.empty() && m_source && !m_disableEditMode ) { @@ -339,6 +339,7 @@ void EveChildInstanceContainer::DisableEditMode( bool disable ) void EveChildInstanceContainer::ClearInstanceList() { UnRegisterComponents(); + UnregisterChildren( m_instances ); m_instances.Clear(); } @@ -353,7 +354,8 @@ void EveChildInstanceContainer::PopFront() front->UnRegister( GetComponentRegistry() ); } } - + m_instances[0]->SetOwner( nullptr ); + m_instances[0]->SetParent( nullptr ); m_instances.Remove( 0 ); } } @@ -370,7 +372,7 @@ void EveChildInstanceContainer::GetRenderables( std::vector& re return; } - RunOnInstances( [&renderables]( IEveSpaceObjectChild* c ) { c->GetRenderables( renderables ); } ); + RunOnInstances( [&renderables]( EveSpaceObjectChild* c ) { c->GetRenderables( renderables ); } ); } @@ -381,7 +383,7 @@ void EveChildInstanceContainer::UpdateVisibility( const EveUpdateContext& update return; } - RunOnInstances( [&updateContext, &parentTransform, parentLod]( IEveSpaceObjectChild* c ) { c->UpdateVisibility( updateContext, parentTransform, parentLod ); } ); + RunOnInstances( [&updateContext, &parentTransform, parentLod]( EveSpaceObjectChild* c ) { c->UpdateVisibility( updateContext, parentTransform, parentLod ); } ); } void EveChildInstanceContainer::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) @@ -405,7 +407,7 @@ void EveChildInstanceContainer::UpdateSyncronous( const EveUpdateContext& update newParams.childParent = this; newParams.localToWorldTransform = m_worldTransform; - RunOnInstances( [&updateContext, &newParams]( IEveSpaceObjectChild* c ) { c->UpdateSyncronous( updateContext, newParams ); } ); + RunOnInstances( [&updateContext, &newParams]( EveSpaceObjectChild* c ) { c->UpdateSyncronous( updateContext, newParams ); } ); } void EveChildInstanceContainer::AddTransformModifier( IEveChildTransformModifier* modifier ) @@ -430,7 +432,7 @@ void EveChildInstanceContainer::UpdateAsyncronous( const EveUpdateContext& updat newParams.childParent = this; newParams.localToWorldTransform = m_worldTransform; - RunOnInstances( [&updateContext, &newParams]( IEveSpaceObjectChild* c ) { c->UpdateAsyncronous( updateContext, newParams ); } ); + RunOnInstances( [&updateContext, &newParams]( EveSpaceObjectChild* c ) { c->UpdateAsyncronous( updateContext, newParams ); } ); if( params.spaceObjectParent && !params.childParent ) @@ -458,7 +460,7 @@ bool EveChildInstanceContainer::GetBoundingSphere( Vector4& sphere, BoundingSphe return true; } - RunOnInstances( [&sphere, &query]( IEveSpaceObjectChild* c ) { c->GetBoundingSphere( sphere, query ); } ); + RunOnInstances( [&sphere, &query]( EveSpaceObjectChild* c ) { c->GetBoundingSphere( sphere, query ); } ); return true; } @@ -473,12 +475,12 @@ void EveChildInstanceContainer::RegisterWithQuadRenderer( Tr2QuadRenderer& quadR void EveChildInstanceContainer::AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) const { - RunOnInstances( [&frustum, &quadRenderer]( IEveSpaceObjectChild* c ) { c->AddQuadsToQuadRenderer( frustum, quadRenderer ); } ); + RunOnInstances( [&frustum, &quadRenderer]( EveSpaceObjectChild* c ) { c->AddQuadsToQuadRenderer( frustum, quadRenderer ); } ); } void EveChildInstanceContainer::ChangeLOD( Tr2Lod lod ) { - RunOnInstances( [&lod]( IEveSpaceObjectChild* c ) { c->ChangeLOD( lod ); } ); + RunOnInstances( [&lod]( EveSpaceObjectChild* c ) { c->ChangeLOD( lod ); } ); } void EveChildInstanceContainer::SetOrigin( Origin origin ) @@ -488,7 +490,7 @@ void EveChildInstanceContainer::SetOrigin( Origin origin ) void EveChildInstanceContainer::SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) { - RunOnInstances( [&name, &value]( IEveSpaceObjectChild* c ) { c->SetShaderOption( name, value ); } ); + RunOnInstances( [&name, &value]( EveSpaceObjectChild* c ) { c->SetShaderOption( name, value ); } ); } bool EveChildInstanceContainer::IsAlwaysOn() const @@ -509,18 +511,18 @@ void EveChildInstanceContainer::GetWorldVelocity( Vector3& velocity ) const velocity = m_worldVelocity; } -IEveSpaceObjectChildPtr EveChildInstanceContainer::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveChildInstanceContainer::GetEffectChildByName( const char* name ) const { // don't really know what to do here... return nullptr; } -void EveChildInstanceContainer::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildInstanceContainer::AddToEffectChildrenList( EveSpaceObjectChild* child ) { // do nothing for now } -void EveChildInstanceContainer::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildInstanceContainer::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { // do nothing for now } @@ -540,17 +542,17 @@ void EveChildInstanceContainer::SetControllerVariable( const char* name, float v { found->second = value; } - RunOnInstances( [&name, &value]( IEveSpaceObjectChild* c ) { c->SetControllerVariable( name, value ); } ); + RunOnInstances( [&name, &value]( EveSpaceObjectChild* c ) { c->SetControllerVariable( name, value ); } ); } void EveChildInstanceContainer::HandleControllerEvent( const char* name ) { - RunOnInstances( [name]( IEveSpaceObjectChild* c ) { c->HandleControllerEvent( name ); } ); + RunOnInstances( [name]( EveSpaceObjectChild* c ) { c->HandleControllerEvent( name ); } ); } void EveChildInstanceContainer::StartControllers() { - RunOnInstances( []( IEveSpaceObjectChild* c ) { c->StartControllers(); } ); + RunOnInstances( []( EveSpaceObjectChild* c ) { c->StartControllers(); } ); } void EveChildInstanceContainer::SetControllerVariableForInstance( const uint32_t index, const char* name, float value ) @@ -577,7 +579,7 @@ void EveChildInstanceContainer::HandleControllerEventForInstance( const uint32_t void EveChildInstanceContainer::PlayCurveSet( const std::string& name, const std::string& rangeName ) { - RunOnInstances( [&name, &rangeName]( IEveSpaceObjectChild* c ) { + RunOnInstances( [&name, &rangeName]( EveSpaceObjectChild* c ) { ITr2CurveSetOwnerPtr cso = BlueCastPtr( c->GetRootObject() ); if( cso != nullptr ) { @@ -588,7 +590,7 @@ void EveChildInstanceContainer::PlayCurveSet( const std::string& name, const std void EveChildInstanceContainer::StopCurveSet( const std::string& name ) { - RunOnInstances( [&name]( IEveSpaceObjectChild* c ) { + RunOnInstances( [&name]( EveSpaceObjectChild* c ) { ITr2CurveSetOwnerPtr cso = BlueCastPtr( c->GetRootObject() ); if( cso != nullptr ) @@ -600,7 +602,7 @@ void EveChildInstanceContainer::StopCurveSet( const std::string& name ) void EveChildInstanceContainer::UpdateCurveSet( const std::string& name, Be::Time time ) { - RunOnInstances( [&name, time]( IEveSpaceObjectChild* c ) { + RunOnInstances( [&name, time]( EveSpaceObjectChild* c ) { ITr2CurveSetOwnerPtr cso = BlueCastPtr( c->GetRootObject() ); if( cso != nullptr ) { @@ -635,7 +637,7 @@ float EveChildInstanceContainer::GetRangeDuration( const std::string& name, cons void EveChildInstanceContainer::PlayAllCurveSets() { - RunOnInstances( []( IEveSpaceObjectChild* c ) { + RunOnInstances( []( EveSpaceObjectChild* c ) { EveChildContainerPtr cc = BlueCastPtr( c->GetRootObject() ); if( cc != nullptr ) { @@ -646,7 +648,7 @@ void EveChildInstanceContainer::PlayAllCurveSets() void EveChildInstanceContainer::StopAllCurveSets() { - RunOnInstances( []( IEveSpaceObjectChild* c ) { + RunOnInstances( []( EveSpaceObjectChild* c ) { EveChildContainerPtr cc = BlueCastPtr( c->GetRootObject() ); if( cc != nullptr ) { @@ -657,7 +659,7 @@ void EveChildInstanceContainer::StopAllCurveSets() void EveChildInstanceContainer::GetDebugOptions( Tr2DebugRendererOptions& options ) { - RunOnInstances( [&options]( IEveSpaceObjectChild* c ) { + RunOnInstances( [&options]( EveSpaceObjectChild* c ) { if( auto dr = dynamic_cast( c ) ) { dr->GetDebugOptions( options ); @@ -667,10 +669,42 @@ void EveChildInstanceContainer::GetDebugOptions( Tr2DebugRendererOptions& option void EveChildInstanceContainer::RenderDebugInfo( ITr2DebugRenderer2& renderer ) { - RunOnInstances( [&renderer]( IEveSpaceObjectChild* c ) { + RunOnInstances( [&renderer]( EveSpaceObjectChild* c ) { if( auto dr = dynamic_cast( c ) ) { dr->RenderDebugInfo( renderer ); } } ); } + +void EveChildInstanceContainer::SetOwner( IEveSpaceObject2* owner ) +{ + if( GetOwner() != owner ) + { + EveSpaceObjectChild::SetOwner( owner ); + for( auto& child : m_instances ) + { + child->SetOwner( owner ); + } + if( m_source ) + { + m_source->SetOwner( owner ); + } + } +} + +void EveChildInstanceContainer::SetPartTag( PartTag tag ) +{ + if( GetPartTag() != tag ) + { + EveSpaceObjectChild::SetPartTag( tag ); + for( auto& child : m_instances ) + { + child->SetPartTag( tag ); + } + if( m_source ) + { + m_source->SetPartTag( tag ); + } + } +} diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.h b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.h index 42fce1a86..9da27de71 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.h +++ b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.h @@ -2,7 +2,7 @@ #pragma once -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "IEveEffectChildrenOwner.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" @@ -28,11 +28,11 @@ BLUE_DECLARE( EveChildInheritProperties ); // -------------------------------------------------------------------------------------- // Description: -// A child container that copies a source IEveSpaceObjectChild across locatorsets +// A child container that copies a source EveSpaceObjectChild across locatorsets // and or transforms // -------------------------------------------------------------------------------------- BLUE_CLASS( EveChildInstanceContainer ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public ITr2CurveSetOwner, public INotify, public IEveEffectChildrenOwner, @@ -53,9 +53,7 @@ BLUE_CLASS( EveChildInstanceContainer ) : float GetOwnerMaxSpeed() const; ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -73,12 +71,14 @@ BLUE_CLASS( EveChildInstanceContainer ) : void GetWorldVelocity( Vector3 & velocity ) const; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); void AddTransformModifier( IEveChildTransformModifier * modifier ) override; + void SetOwner( IEveSpaceObject2 * owner ) override; + void SetPartTag( PartTag tag ) override; ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); ///////////////////////////////////////////////////////////////////////////////////// // ITr2ControllerOwner @@ -125,19 +125,18 @@ BLUE_CLASS( EveChildInstanceContainer ) : void PopFront(); void DisableEditMode( bool disable ); - void SetSourceEffect( IEveSpaceObjectChildPtr sourceEffect ); + void SetSourceEffect( EveSpaceObjectChildPtr sourceEffect ); void AddInstanceTransform( const Vector3& scale, const Quaternion& rotation, const Vector3& translation, int32_t boneIndex = -1 ); void UpdateInstance( const uint32_t index, const Vector3& scale, const Quaternion& rotation, const Vector3& translation ); - IEveSpaceObjectChildPtr GetSource(); - void SetSource( IEveSpaceObjectChild * source ); + EveSpaceObjectChildPtr GetSource(); + void SetSource( EveSpaceObjectChild * source ); protected: void CreateInstances( IEveSpaceObject2 * parent ); - void RunOnInstances( std::function func ) const; + void RunOnInstances( std::function func ) const; protected: - BlueSharedString m_name; Vector3 m_worldVelocity; float m_ownerMaxSpeed; bool m_display; @@ -152,8 +151,8 @@ BLUE_CLASS( EveChildInstanceContainer ) : Origin m_origin; std::vector> m_controllerVariables; - IEveSpaceObjectChildPtr m_source; - PIEveSpaceObjectChildVector m_instances; + EveSpaceObjectChildPtr m_source; + PEveSpaceObjectChildVector m_instances; bool m_reset; BlueSharedString m_locatorSetName; diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer_Blue.cpp index 1dd3207d2..4dc4f8e1e 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer_Blue.cpp @@ -6,61 +6,66 @@ BLUE_DEFINE( EveChildInstanceContainer ); BLUE_DECLARE_INTERFACE( ITr2DebugRenderable ); -const Be::ClassInfo* EveChildInstanceContainer::ExposeToBlue() { +const Be::ClassInfo* EveChildInstanceContainer::ExposeToBlue() +{ EXPOSURE_BEGIN( EveChildInstanceContainer, "" ) MAP_INTERFACE( EveChildInstanceContainer ) - MAP_INTERFACE( IEveSpaceObjectChild ) - MAP_INTERFACE( ITr2CurveSetOwner ) - MAP_INTERFACE( INotify ) - MAP_INTERFACE( IEveEffectChildrenOwner ) - MAP_INTERFACE( IShaderConfigurer ) - MAP_INTERFACE( ITr2ControllerOwner ) - MAP_INTERFACE( IListNotify ) - MAP_INTERFACE( EveEntity ) + MAP_INTERFACE( EveSpaceObjectChild ) + MAP_INTERFACE( IEveSpaceObjectChild ) + MAP_INTERFACE( ITr2CurveSetOwner ) + MAP_INTERFACE( INotify ) + MAP_INTERFACE( IEveEffectChildrenOwner ) + MAP_INTERFACE( IShaderConfigurer ) + MAP_INTERFACE( ITr2ControllerOwner ) + MAP_INTERFACE( IListNotify ) + MAP_INTERFACE( EveEntity ) - MAP_ATTRIBUTE( "name", m_name, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "display", m_display, "", Be::READWRITE | Be::PERSIST | Be::NOTIFY ) - MAP_ATTRIBUTE( "alwaysOn", m_isAlwaysOn, "If false this will be hidden if a spaceobjects activation strength < 0.5. If True then it is always on.", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "name", m_name, "", Be::READWRITE | Be::PERSIST ); + MAP_ATTRIBUTE( "display", m_display, "", Be::READWRITE | Be::PERSIST | Be::NOTIFY ) + MAP_ATTRIBUTE( "alwaysOn", m_isAlwaysOn, "If false this will be hidden if a spaceobjects activation strength < 0.5. If True then it is always on.", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "inheritProperties", m_inheritProperties, "Properties inherited from the parent ship when loaded through SOF", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "origin", m_origin, "Where did this effect originate from", Be::READ ) + MAP_ATTRIBUTE( "inheritProperties", m_inheritProperties, "Properties inherited from the parent ship when loaded through SOF", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "origin", m_origin, "Where did this effect originate from", Be::READ ) - MAP_ATTRIBUTE( "translation", m_translation, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "scaling", m_scaling, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "rotation", m_rotation, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "localTransform", m_localTransform, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "worldTransform", m_worldTransform, "", Be::READ ) + MAP_ATTRIBUTE( "translation", m_translation, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "scaling", m_scaling, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "rotation", m_rotation, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "localTransform", m_localTransform, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "worldTransform", m_worldTransform, "", Be::READ ) - MAP_ATTRIBUTE( "staticTransform", m_staticTransform, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "useSRT", m_useSRT, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "useStaticRotation", m_useStaticRotation, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "staticTransform", m_staticTransform, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "useSRT", m_useSRT, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "useStaticRotation", m_useStaticRotation, "", Be::READWRITE | Be::PERSIST ) - MAP_METHOD_AND_WRAP( - "SetControllerVariable", - SetControllerVariable, - "Set variable for all applicable controllers\n" - ":param name: variable name\n" - ":param value: new variable value\n" ) + MAP_METHOD_AND_WRAP( + "SetControllerVariable", + SetControllerVariable, + "Set variable for all applicable controllers\n" + ":param name: variable name\n" + ":param value: new variable value\n" ) - MAP_METHOD_AND_WRAP( - "HandleControllerEvent", - HandleControllerEvent, - "Pass an event to controllers\n" - ":param name: event name" ) + MAP_METHOD_AND_WRAP( + "HandleControllerEvent", + HandleControllerEvent, + "Pass an event to controllers\n" + ":param name: event name" ) - MAP_METHOD_AND_WRAP( - "StartControllers", - StartControllers, - "Start all controllers" ) + MAP_METHOD_AND_WRAP( + "StartControllers", + StartControllers, + "Start all controllers" ) - MAP_ATTRIBUTE( "source", m_source, "The sourceObject to instance", Be::PERSISTONLY ) - MAP_PROPERTY( "source", GetSource, SetSource, "The sourceObject to instance" ) + MAP_ATTRIBUTE( "source", m_source, "The sourceObject to instance", Be::PERSISTONLY ) + MAP_PROPERTY( "source", GetSource, SetSource, "The sourceObject to instance" ) - MAP_ATTRIBUTE( "locatorSet", m_locatorSetName, "The name of the locatorset to distribute across", Be::READWRITE | Be::PERSIST | Be::NOTIFY ) - MAP_ATTRIBUTE( "reset", m_reset, "Redistributes the source", Be::READWRITE ) - MAP_ATTRIBUTE( "instances", m_instances, "The generated instances\n:jessica-skip-validation:", Be::READ ) - MAP_ATTRIBUTE( "transforms", m_transforms, "", Be::READ | Be::PERSIST ) - MAP_ATTRIBUTE( "transformModifiers", m_transformModifiers, "", Be::READ | Be::PERSIST | Be::NOTIFY ) + MAP_ATTRIBUTE( "locatorSet", m_locatorSetName, "The name of the locatorset to distribute across", Be::READWRITE | Be::PERSIST | Be::NOTIFY ) + MAP_ATTRIBUTE( "reset", m_reset, "Redistributes the source", Be::READWRITE ) + MAP_ATTRIBUTE( "instances", m_instances, "The generated instances\n:jessica-skip-validation:", Be::READ ) + MAP_ATTRIBUTE( "transforms", m_transforms, "", Be::READ | Be::PERSIST ) + MAP_ATTRIBUTE( "transformModifiers", m_transformModifiers, "", Be::READ | Be::PERSIST | Be::NOTIFY ) - EXPOSURE_END() + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) + EXPOSURE_END() }; diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer.h b/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer.h index 0a9c2929d..b08878313 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer.h +++ b/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer.h @@ -2,7 +2,7 @@ #pragma once -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" #include "TriRenderBatch.h" diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer_Blue.cpp index cb209e33b..4a97f370d 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer_Blue.cpp @@ -21,6 +21,7 @@ const Be::ClassInfo* EveChildInstanceMeshRenderer::ExposeToBlue() MAP_INTERFACE( EveChildInstanceMeshRenderer ) MAP_INTERFACE( EveEntity ) MAP_INTERFACE( EveChildMesh ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( IInitialize ) @@ -42,5 +43,8 @@ const Be::ClassInfo* EveChildInstanceMeshRenderer::ExposeToBlue() MAP_METHOD_AND_WRAP( "RefreshStaticGeometry", RefreshStaticGeometry, "if static geo parameters were changed during authoring: refresh here\n:jessica-placement: TOOLBAR" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.cpp b/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.cpp index 4bc9ddbef..cc6915557 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.cpp @@ -170,16 +170,6 @@ void EveChildInstancedMeshes::PushRtGeometry( Tr2RaytracingManager& rtManager ) } -const char* EveChildInstancedMeshes::GetName() const -{ - return m_name.c_str(); -} - -void EveChildInstancedMeshes::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - void EveChildInstancedMeshes::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) { m_lastCameraFrustum = updateContext.GetFrustum(); @@ -336,10 +326,6 @@ void EveChildInstancedMeshes::Setup( const Vector3* scale, const Quaternion* rot { } -void EveChildInstancedMeshes::ChangeLOD( Tr2Lod lod ) -{ -} - void EveChildInstancedMeshes::SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) { for( auto& mesh : m_meshes ) diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.h b/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.h index 5a25e441d..6248b4aa8 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.h +++ b/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.h @@ -2,7 +2,7 @@ #pragma once -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "../../EveInstancedMeshManager.h" BLUE_DECLARE( TriGeometryRes ); @@ -10,7 +10,7 @@ BLUE_DECLARE( Tr2Effect ); BLUE_CLASS( EveChildInstancedMeshes ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveEntity, public IBlueAsyncResNotifyTarget, public IEveShadowCaster, @@ -25,9 +25,7 @@ BLUE_CLASS( EveChildInstancedMeshes ) : ~EveChildInstancedMeshes(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const override; - void SetName( const char* name ) override; + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override; void GetRenderables( std::vector & renderables ) override; bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const override; @@ -35,7 +33,6 @@ BLUE_CLASS( EveChildInstancedMeshes ) : void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void GetLocalToWorldTransform( Matrix & transform ) const override; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) override; - void ChangeLOD( Tr2Lod lod ) override; void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) override; @@ -137,7 +134,6 @@ BLUE_CLASS( EveChildInstancedMeshes ) : void ReleaseResources( TriStorage s ) override; bool OnPrepareResources() override; - BlueSharedString m_name; Matrix m_worldTransform = IdentityMatrix(); EveSpacePerObjectData m_perObjectData; EveInstancedMeshManager::PerObjectDataHandle m_perObjectDataHandle; diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes_Blue.cpp index 59c4d83b7..0cd88e865 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes_Blue.cpp @@ -11,6 +11,7 @@ const Be::ClassInfo* EveChildInstancedMeshes::ExposeToBlue() { EXPOSURE_BEGIN( EveChildInstancedMeshes, "" ) MAP_INTERFACE( EveChildInstancedMeshes ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( EveEntity ) MAP_INTERFACE( IEveShadowCaster ) @@ -59,5 +60,8 @@ const Be::ClassInfo* EveChildInstancedMeshes::ExposeToBlue() ":param display: True to render the mesh, False to hide it\n" ":rtype: None" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.cpp b/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.cpp index 23bfe5459..3283e2fc4 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.cpp @@ -90,16 +90,6 @@ void EveChildLightingOverride::RebuildBoundingSphere() } } -const char* EveChildLightingOverride::GetName() const -{ - return m_name.c_str(); -} - -void EveChildLightingOverride::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - bool EveChildLightingOverride::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const { sphere.GetXYZ() = m_boundingSphere.center; @@ -108,10 +98,6 @@ bool EveChildLightingOverride::GetBoundingSphere( Vector4& sphere, BoundingSpher return true; } -void EveChildLightingOverride::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) -{ -} - void EveChildLightingOverride::UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) { Matrix localToWorldTransform = params.localToWorldTransform; diff --git a/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.h b/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.h index c786b7f34..a6a4980ac 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.h +++ b/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.h @@ -2,7 +2,7 @@ #pragma once -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "Eve/EveEntity.h" #include "PostProcess/Tr2PostProcessEnums.h" @@ -37,7 +37,7 @@ REGISTER_COMPONENT_TYPE( "EveLightingOverride", IEveLightingOverride ); BLUE_CLASS( EveChildLightingOverride ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public IEveLightingOverride, public IInitialize, public ITr2DebugRenderable, @@ -52,19 +52,12 @@ BLUE_CLASS( EveChildLightingOverride ) : OverrideInfo GetOverrides() const override; ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const override; - void SetName( const char* name ) override; - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override {}; - void GetRenderables( std::vector & renderables ) override{}; + // EveSpaceObjectChild bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query ) const override; - void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void GetLocalToWorldTransform( Matrix & transform ) const override; - void ChangeLOD( Tr2Lod lod ) override {}; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) override; bool IsAlwaysOn() const override; - void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) override {}; void RegisterComponents() override; void UnRegisterComponents() override; @@ -82,8 +75,6 @@ BLUE_CLASS( EveChildLightingOverride ) : private: void RebuildBoundingSphere(); - BlueSharedString m_name; - OverrideInfo m_overrides; PIEveVolumeVector m_volumes; float m_intensity; diff --git a/trinity/Eve/SpaceObject/Children/EveChildLightingOverride_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildLightingOverride_Blue.cpp index 737d043e7..6c6dbe5f8 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLightingOverride_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildLightingOverride_Blue.cpp @@ -13,6 +13,7 @@ const Be::ClassInfo* EveChildLightingOverride::ExposeToBlue() { EXPOSURE_BEGIN( EveChildLightingOverride, "" ) MAP_INTERFACE( EveEntity ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( IEveLightingOverride ) MAP_INTERFACE( IInitialize ) @@ -56,5 +57,8 @@ const Be::ClassInfo* EveChildLightingOverride::ExposeToBlue() m_volumes, "The volumes that affect the light overrides", Be::READ | Be::PERSIST ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildLineSet.cpp b/trinity/Eve/SpaceObject/Children/EveChildLineSet.cpp index 843db76dd..7ccd6c3ed 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLineSet.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildLineSet.cpp @@ -186,16 +186,6 @@ void EveChildLineSet::UpdateBoundingSphere( bool reCalculateChildren ) m_boundingSphere = sphere; } -const char* EveChildLineSet::GetName() const -{ - return m_name.c_str(); -} - -void EveChildLineSet::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - void EveChildLineSet::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) { if( !m_display ) diff --git a/trinity/Eve/SpaceObject/Children/EveChildLineSet.h b/trinity/Eve/SpaceObject/Children/EveChildLineSet.h index 56146263b..61e1d2afe 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLineSet.h +++ b/trinity/Eve/SpaceObject/Children/EveChildLineSet.h @@ -2,7 +2,7 @@ #pragma once -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" #include "TriRenderBatch.h" @@ -17,8 +17,8 @@ class ChildLineSetInstancingBatch; BLUE_CLASS( EveChildLineSet ) : + public EveSpaceObjectChild, public IInitialize, - public IEveSpaceObjectChild, public Tr2DeviceResource, public ITr2Renderable, public EveChildTransform, @@ -40,9 +40,7 @@ BLUE_CLASS( EveChildLineSet ) : bool OnModified( Be::Var * value ) override; ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const override; - void SetName( const char* name ) override; + // EveSpaceObjectChild void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) override; bool IsAlwaysOn() const override; @@ -51,9 +49,7 @@ BLUE_CLASS( EveChildLineSet ) : bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const override; void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override; - void AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) const override {}; void GetRenderables( std::vector & renderables ) override; - void RegisterWithQuadRenderer( Tr2QuadRenderer & quadRenderer ) override{}; ///////////////////////////////////////////////////////////////////////////////////// // Tr2DeviceResource @@ -105,7 +101,6 @@ BLUE_CLASS( EveChildLineSet ) : void GenerateManagedPoints(); void UpdateBoundingSphere( bool reCalculateChildren = true ); - BlueSharedString m_name; Vector3 m_worldVelocity; float m_ownerMaxSpeed; diff --git a/trinity/Eve/SpaceObject/Children/EveChildLineSet_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildLineSet_Blue.cpp index 63fd188f8..b6eb83374 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLineSet_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildLineSet_Blue.cpp @@ -18,6 +18,7 @@ const Be::ClassInfo* EveChildLineSet::ExposeToBlue() { EXPOSURE_BEGIN( EveChildLineSet, "" ) MAP_INTERFACE( EveChildLineSet ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( IInitialize ) MAP_INTERFACE( INotify ) @@ -48,5 +49,8 @@ const Be::ClassInfo* EveChildLineSet::ExposeToBlue() MAP_ATTRIBUTE( "lineSet", m_lineSet, ":jessica-hidden: True", Be::READWRITE | Be::PERSIST ) MAP_ATTRIBUTE( "mesh", m_mesh, "the rendered mesh", Be::READWRITE | Be::PERSIST | Be::NOTIFY ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildLink.h b/trinity/Eve/SpaceObject/Children/EveChildLink.h index bcfeb78a3..00509a37c 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLink.h +++ b/trinity/Eve/SpaceObject/Children/EveChildLink.h @@ -22,7 +22,7 @@ BLUE_CLASS( EveChildLink ) : ~EveChildLink(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild + // EveSpaceObjectChild void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); diff --git a/trinity/Eve/SpaceObject/Children/EveChildMesh.cpp b/trinity/Eve/SpaceObject/Children/EveChildMesh.cpp index a9efa903e..2593a7ac4 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildMesh.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildMesh.cpp @@ -204,16 +204,6 @@ bool EveChildMesh::OnModified( Be::Var* val ) return true; } -const char* EveChildMesh::GetName() const -{ - return m_name.c_str(); -} - -void EveChildMesh::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - void EveChildMesh::InitializeAnimation() { if( m_animationUpdater && m_animationUpdater->GetResPath().empty() ) diff --git a/trinity/Eve/SpaceObject/Children/EveChildMesh.h b/trinity/Eve/SpaceObject/Children/EveChildMesh.h index 54d5e1b52..23fa6116a 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildMesh.h +++ b/trinity/Eve/SpaceObject/Children/EveChildMesh.h @@ -4,7 +4,7 @@ #ifndef EveChildMesh_H #define EveChildMesh_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "Eve/SpaceObject/EveSpaceObject2.h" #include "Eve/SpaceObject/Attachments/EveSpaceObjectDecal.h" @@ -54,7 +54,7 @@ enum class MorphTargetAnimationFilter : uint8_t }; BLUE_CLASS( EveChildMesh ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2Renderable, public IInitialize, @@ -78,9 +78,7 @@ BLUE_CLASS( EveChildMesh ) : ~EveChildMesh(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -205,9 +203,6 @@ BLUE_CLASS( EveChildMesh ) : std::pair GetMorphTargets( MorphTargetAnimationFilter filter ); void UpdateMorphAnimationBuffer(); - // general data - BlueSharedString m_name; - // the mesh Tr2MeshBasePtr m_mesh; Tr2InstancedMeshPtr m_instancedMesh; // Cached downcast of m_mesh diff --git a/trinity/Eve/SpaceObject/Children/EveChildMesh_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildMesh_Blue.cpp index de99e6f6a..69816dd72 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildMesh_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildMesh_Blue.cpp @@ -3,6 +3,7 @@ #include "StdAfx.h" #include "EveChildMesh.h" +BLUE_DEFINE_INTERFACE( IMultiPartObjectElement ); BLUE_DEFINE( EveChildMesh ); const Be::ClassInfo* EveChildMesh::ExposeToBlue() @@ -11,6 +12,7 @@ const Be::ClassInfo* EveChildMesh::ExposeToBlue() MAP_INTERFACE( EveChildMesh ) MAP_INTERFACE( EveEntity ) MAP_INTERFACE( IEveSpaceObjectDecalOwner ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( IInitialize ) @@ -88,5 +90,8 @@ const Be::ClassInfo* EveChildMesh::ExposeToBlue() "GetMorphTargetWeight( name )\n\n" "Returns the weight of the morph target. Returns 0 if no morph target with that name was found.\n" ":param name: morph target name\n" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.cpp b/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.cpp index 6d01b4d4e..828333e46 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.cpp @@ -68,18 +68,6 @@ EveChildParticleSphere::EveChildParticleSphere( IRoot* lockobj ) : { } -// -------------------------------------------------------------------------------- -const char* EveChildParticleSphere::GetName() const -{ - return m_name.c_str(); -} - -// -------------------------------------------------------------------------------- -void EveChildParticleSphere::SetName( const char* name ) -{ - m_name = name; -} - // ----------------------------------------------------------------------------- void EveChildParticleSphere::GetRenderables( std::vector& renderables ) { diff --git a/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.h b/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.h index 975b379a2..a771f2b60 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.h +++ b/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.h @@ -2,7 +2,7 @@ #pragma once -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "ITr2Renderable.h" #include "Particle/Tr2ParticleElementDeclaration.h" @@ -13,7 +13,7 @@ BLUE_DECLARE( Tr2ParticleSystem ); class EveUpdateContext; BLUE_CLASS( EveChildParticleSphere ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public ITr2Renderable { public: @@ -23,9 +23,7 @@ BLUE_CLASS( EveChildParticleSphere ) : ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); + // EveSpaceObjectChild void GetRenderables( std::vector & renderables ); void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -33,7 +31,6 @@ BLUE_CLASS( EveChildParticleSphere ) : void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void GetLocalToWorldTransform( Matrix & transform ) const; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); - void ChangeLOD( Tr2Lod lod ) {}; ///////////////////////////////////////////////////////////////////////////////////// // ITr2Renderable @@ -66,8 +63,6 @@ BLUE_CLASS( EveChildParticleSphere ) : Matrix m_worldTransform; Vector4 m_boundingSphere; - std::string m_name; - enum { BIND_PENDING, diff --git a/trinity/Eve/SpaceObject/Children/EveChildParticleSphere_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildParticleSphere_Blue.cpp index eb533845c..d28a976bc 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildParticleSphere_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildParticleSphere_Blue.cpp @@ -9,6 +9,7 @@ const Be::ClassInfo* EveChildParticleSphere::ExposeToBlue() { EXPOSURE_BEGIN( EveChildParticleSphere, "" ) MAP_INTERFACE( EveChildParticleSphere ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) @@ -35,5 +36,8 @@ const Be::ClassInfo* EveChildParticleSphere::ExposeToBlue() MAP_ATTRIBUTE( "useSpaceObjectData", m_useSpaceObjectData, "", Be::READWRITE | Be::PERSIST ) MAP_METHOD_AND_WRAP( "Refresh", Refresh, "Re-binds particle system and re-adds particles" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.cpp b/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.cpp index 1fe57bbf2..500721824 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.cpp @@ -77,16 +77,6 @@ bool EveChildParticleSystem::OnModified( Be::Var* value ) return true; } -const char* EveChildParticleSystem::GetName() const -{ - return m_name.c_str(); -} - -void EveChildParticleSystem::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - // -------------------------------------------------------------------------------- // Description: // Setup function to set data from outside, in this case just pass it to diff --git a/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.h b/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.h index d3197edac..79012e5ff 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.h +++ b/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.h @@ -4,7 +4,7 @@ #ifndef EveChildParticleSystem_H #define EveChildParticleSystem_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "ITr2Renderable.h" @@ -25,7 +25,7 @@ BLUE_DECLARE_INTERFACE( ITr2GenericEmitter ); BLUE_DECLARE_IVECTOR( ITr2GenericEmitter ); BLUE_CLASS( EveChildParticleSystem ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2Renderable, public IInitialize, @@ -40,9 +40,7 @@ BLUE_CLASS( EveChildParticleSystem ) : ~EveChildParticleSystem(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -85,8 +83,6 @@ BLUE_CLASS( EveChildParticleSystem ) : PITr2GenericEmitterVector m_particleEmitters; private: - BlueSharedString m_name; - Vector4 m_boundingSphere; Vector4 m_lodSphere; diff --git a/trinity/Eve/SpaceObject/Children/EveChildParticleSystem_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildParticleSystem_Blue.cpp index 66bdaa945..dadda5153 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildParticleSystem_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildParticleSystem_Blue.cpp @@ -10,6 +10,7 @@ const Be::ClassInfo* EveChildParticleSystem::ExposeToBlue() EXPOSURE_BEGIN( EveChildParticleSystem, "" ) MAP_INTERFACE( EveChildParticleSystem ) MAP_INTERFACE( EveEntity ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( IInitialize ) @@ -70,5 +71,8 @@ const Be::ClassInfo* EveChildParticleSystem::ExposeToBlue() MAP_ATTRIBUTE( "currentScreenSize", m_currentScreenSize, "Screen size for last frame\n:jessica-group: LOD", Be::READ ) MAP_METHOD_AND_WRAP( "RebuildLocalTransform", RebuildLocalTransform, "Rebuilds local transform if useSRT is set." ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildPlug.cpp b/trinity/Eve/SpaceObject/Children/EveChildPlug.cpp index 90ab0a190..b0db45722 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildPlug.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildPlug.cpp @@ -25,10 +25,12 @@ EveChildPlug::~EveChildPlug() { controller->Unlink( UnlinkReason::DELETING ); } + UnregisterChildren( m_objects ); } bool EveChildPlug::Initialize() { + RegisterChildren( m_objects ); for( auto& controller : m_controllers ) { if( !controller->IsLinked() ) @@ -73,6 +75,7 @@ void EveChildPlug::OnListModified( long event, ssize_t key, ssize_t key2, IRoot* } else if( list == &m_objects && ( event & BELIST_LOADING ) == 0 ) { + HandleChildrenListModified( event, value, m_objects ); if( IsInRegistry() ) { switch( event & BELIST_EVENTMASK ) @@ -153,16 +156,6 @@ void EveChildPlug::UnRegisterComponents() } } -const char* EveChildPlug::GetName() const -{ - return m_name.c_str(); -} - -void EveChildPlug::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - void EveChildPlug::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) { if( !m_display ) @@ -195,7 +188,7 @@ bool EveChildPlug::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query Vector4 bSphere( 0.f, 0.f, 0.f, -1.f ); for( auto it = m_objects.begin(); it != m_objects.end(); it++ ) { - if( ( *it )->GetBoundingSphere( bSphere ) ) + if( ( *it )->GetBoundingSphere( bSphere, EVE_BOUNDS_NORMAL ) ) { BoundingSphereSetOrUpdate( bSphere, sphere, success ); success = true; @@ -271,7 +264,7 @@ void EveChildPlug::SetShaderOption( const BlueSharedString& name, const BlueShar { for( auto it = m_objects.begin(); it != m_objects.end(); ++it ) { - IEveSpaceObjectChild* child = *it; + EveSpaceObjectChild* child = *it; child->SetShaderOption( name, value ); } } @@ -426,7 +419,7 @@ void EveChildPlug::StartControllers() } } -IEveSpaceObjectChildPtr EveChildPlug::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveChildPlug::GetEffectChildByName( const char* name ) const { for( auto it = begin( m_objects ); it != end( m_objects ); ++it ) { @@ -439,7 +432,7 @@ IEveSpaceObjectChildPtr EveChildPlug::GetEffectChildByName( const char* name ) c return nullptr; } -void EveChildPlug::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildPlug::AddToEffectChildrenList( EveSpaceObjectChild* child ) { if( IsInRegistry() ) { @@ -451,7 +444,7 @@ void EveChildPlug::AddToEffectChildrenList( IEveSpaceObjectChild* child ) m_objects.Append( child->GetRootObject() ); } -void EveChildPlug::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildPlug::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { auto index = m_objects.FindKey( child ); if( index >= 0 ) @@ -505,3 +498,27 @@ ITr2AudEmitterPtr EveChildPlug::FindSoundEmitter( const char* name ) } return nullptr; } + +void EveChildPlug::SetOwner( IEveSpaceObject2* owner ) +{ + if( GetOwner() != owner ) + { + EveSpaceObjectChild::SetOwner( owner ); + for( auto& child : m_objects ) + { + child->SetOwner( owner ); + } + } +} + +void EveChildPlug::SetPartTag( PartTag tag ) +{ + if( GetPartTag() != tag ) + { + EveSpaceObjectChild::SetPartTag( tag ); + for( auto& child : m_objects ) + { + child->SetPartTag( tag ); + } + } +} diff --git a/trinity/Eve/SpaceObject/Children/EveChildPlug.h b/trinity/Eve/SpaceObject/Children/EveChildPlug.h index efdabcfb8..37b228850 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildPlug.h +++ b/trinity/Eve/SpaceObject/Children/EveChildPlug.h @@ -5,7 +5,7 @@ #define EveChildPlug_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "IEveEffectChildrenOwner.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" @@ -19,7 +19,7 @@ BLUE_DECLARE_VECTOR( Tr2ExternalParameter ); BLUE_CLASS( EveChildPlug ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2CurveSetOwner, public IInitialize, @@ -51,18 +51,15 @@ BLUE_CLASS( EveChildPlug ) : ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); ////////////////////////////////////////////////////////////////////////////////////// // EveEntity void RegisterComponents() override; void UnRegisterComponents() override; - const char* GetName() const; - void SetName( const char* name ); - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -77,6 +74,9 @@ BLUE_CLASS( EveChildPlug ) : void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); + void SetOwner( IEveSpaceObject2 * owner ) override; + void SetPartTag( PartTag tag ) override; + void PlayAllCurveSets(); void StopAllCurveSets(); void PlayCurveSet( const std::string& name, const std::string& rangeName ); @@ -102,9 +102,7 @@ BLUE_CLASS( EveChildPlug ) : ITr2AudEmitterPtr FindSoundEmitter( const char* name ) override; protected: - PIEveSpaceObjectChildVector m_objects; - - BlueSharedString m_name; + PEveSpaceObjectChildVector m_objects; PITr2ControllerVector m_controllers; std::vector> m_controllerVariables; diff --git a/trinity/Eve/SpaceObject/Children/EveChildPlug_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildPlug_Blue.cpp index 97d8b9cd5..1ce9a4105 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildPlug_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildPlug_Blue.cpp @@ -10,6 +10,7 @@ const Be::ClassInfo* EveChildPlug::ExposeToBlue() { EXPOSURE_BEGIN( EveChildPlug, "\n:jessica-icon: plug\n:jessica-icon-color: (123, 28, 212)\n:jessica-help-url: https://wiki.ccpgames.com/pages/viewpage.action?spaceKey=TTL&title=Plugs+and+Sockets \n" ) MAP_INTERFACE( EveChildPlug ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2CurveSetOwner ) MAP_INTERFACE( IInitialize ) @@ -44,5 +45,8 @@ const Be::ClassInfo* EveChildPlug::ExposeToBlue() StartControllers, "Start all controllers" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.cpp b/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.cpp index d82375bf8..af7e266ce 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.cpp @@ -70,20 +70,7 @@ void EveChildPostProcessVolume::UnRegisterComponents() } ///////////////////////////////////////////////////////////////////////////////////// -// IEveSpaceObjectChild -const char* EveChildPostProcessVolume::GetName() const -{ - return m_name.c_str(); -} - -void EveChildPostProcessVolume::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - -void EveChildPostProcessVolume::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) -{ -} +// EveSpaceObjectChild bool EveChildPostProcessVolume::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const { @@ -93,10 +80,6 @@ bool EveChildPostProcessVolume::GetBoundingSphere( Vector4& sphere, BoundingSphe return true; } -void EveChildPostProcessVolume::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) -{ -} - void EveChildPostProcessVolume::UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) { CCP_STATS_ZONE( __FUNCTION__ ); diff --git a/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.h b/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.h index 10d33b44a..8e45a3058 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.h +++ b/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.h @@ -3,7 +3,7 @@ #pragma once #include "StdAfx.h" -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "ITr2Renderable.h" #include "Tr2DebugRenderer.h" @@ -17,7 +17,7 @@ BLUE_DECLARE_IVECTOR( IEveVolume ); BLUE_CLASS( EveChildPostProcessVolume ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public IInitialize, public ITr2DebugRenderable, @@ -33,19 +33,12 @@ BLUE_CLASS( EveChildPostProcessVolume ) : void RebuildBoundingSphere(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); - void GetRenderables( std::vector & renderables ){}; + // EveSpaceObjectChild bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; - void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void GetLocalToWorldTransform( Matrix & transform ) const; - void ChangeLOD( Tr2Lod lod ) {}; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) override; bool IsAlwaysOn() const; - void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) {}; virtual void RegisterComponents(); virtual void UnRegisterComponents(); @@ -66,7 +59,6 @@ BLUE_CLASS( EveChildPostProcessVolume ) : private: void UpdateTransformFromParent( const EveChildUpdateParams& params ); - BlueSharedString m_name; PIEveVolumeVector m_volumes; PIEveVolumeVector m_exclusionVolumes; diff --git a/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume_Blue.cpp index 32907e00a..d0ffb1142 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume_Blue.cpp @@ -14,6 +14,7 @@ const Be::ClassInfo* EveChildPostProcessVolume::ExposeToBlue() EXPOSURE_BEGIN( EveChildPostProcessVolume, "" ) MAP_INTERFACE( ITr2PostProcessOwner ) MAP_INTERFACE( EveEntity ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( IInitialize ) @@ -24,5 +25,8 @@ const Be::ClassInfo* EveChildPostProcessVolume::ExposeToBlue() MAP_ATTRIBUTE( "exclusionVolumes", m_exclusionVolumes, "", Be::READ | Be::PERSIST ) MAP_ATTRIBUTE( "postProcessAttributes", m_postProcessAttributes, "", Be::READWRITE | Be::PERSIST ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildQuad.cpp b/trinity/Eve/SpaceObject/Children/EveChildQuad.cpp index a4a8eea7e..d7f8ea48d 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildQuad.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildQuad.cpp @@ -64,16 +64,6 @@ bool EveChildQuad::Initialize() return true; } -const char* EveChildQuad::GetName() const -{ - return m_name.c_str(); -} - -void EveChildQuad::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - // -------------------------------------------------------------------------------- // Description: // Setup function to set data from outside, in this case just pass it to @@ -100,10 +90,6 @@ void EveChildQuad::AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRen } } -void EveChildQuad::GetRenderables( std::vector& renderables ) -{ -} - bool EveChildQuad::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const { sphere = Vector4( 0.f, 0.f, 0.f, std::sqrt( 2.f ) ); diff --git a/trinity/Eve/SpaceObject/Children/EveChildQuad.h b/trinity/Eve/SpaceObject/Children/EveChildQuad.h index 926bf64e1..2c072a079 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildQuad.h +++ b/trinity/Eve/SpaceObject/Children/EveChildQuad.h @@ -4,7 +4,7 @@ #ifndef EveChildQuad_H #define EveChildQuad_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "ITr2Renderable.h" @@ -12,7 +12,7 @@ BLUE_DECLARE( Tr2Effect ); BLUE_CLASS( EveChildQuad ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2Renderable, public IInitialize @@ -26,18 +26,14 @@ BLUE_CLASS( EveChildQuad ) : static Tr2VertexDefinition& GetQuadDefinition(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); - void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; void RegisterWithQuadRenderer( Tr2QuadRenderer & quadRenderer ); void AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) const; void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void GetLocalToWorldTransform( Matrix & transform ) const; - void ChangeLOD( Tr2Lod lod ) {}; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); ///////////////////////////////////////////////////////////////////////////////////// @@ -66,7 +62,6 @@ BLUE_CLASS( EveChildQuad ) : Float_16 m_brightness[2]; }; - BlueSharedString m_name; Tr2EffectPtr m_effect; unsigned m_effectKey; Quad m_quad; diff --git a/trinity/Eve/SpaceObject/Children/EveChildQuad_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildQuad_Blue.cpp index 1e9f446a0..6bfc4db89 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildQuad_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildQuad_Blue.cpp @@ -9,6 +9,7 @@ const Be::ClassInfo* EveChildQuad::ExposeToBlue() { EXPOSURE_BEGIN( EveChildQuad, "" ) MAP_INTERFACE( EveChildQuad ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( IInitialize ) @@ -34,5 +35,8 @@ const Be::ClassInfo* EveChildQuad::ExposeToBlue() Be::READWRITE | Be::PERSIST ) MAP_ATTRIBUTE( "currentScreenSize", m_currentScreenSize, "Screen size for last frame\n:jessica-group: LOD", Be::READ ) MAP_METHOD_AND_WRAP( "RebuildLocalTransform", RebuildLocalTransform, "Rebuilds local transform if useSRT is set." ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildRef.cpp b/trinity/Eve/SpaceObject/Children/EveChildRef.cpp index 23a00cdd8..299fdb622 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildRef.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildRef.cpp @@ -16,6 +16,7 @@ EveChildRef::EveChildRef( IRoot* lockobj ) : EveChildRef::~EveChildRef() { + UnregisterChild( m_child ); } const char* EveChildRef::GetResPath() const @@ -74,16 +75,6 @@ bool EveChildRef::OnModified( Be::Var* value ) return true; } -const char* EveChildRef::GetName() const -{ - return m_name.c_str(); -} - -void EveChildRef::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - void EveChildRef::RegisterComponents() { if( IsInRegistry() && m_child != nullptr && m_display ) @@ -106,7 +97,7 @@ void EveChildRef::UnRegisterComponents() } } -IEveSpaceObjectChildPtr EveChildRef::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveChildRef::GetEffectChildByName( const char* name ) const { if( auto ref = dynamic_cast( m_child.p ) ) { @@ -115,7 +106,7 @@ IEveSpaceObjectChildPtr EveChildRef::GetEffectChildByName( const char* name ) co return nullptr; } -void EveChildRef::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildRef::AddToEffectChildrenList( EveSpaceObjectChild* child ) { if( auto ref = dynamic_cast( m_child.p ) ) { @@ -123,7 +114,7 @@ void EveChildRef::AddToEffectChildrenList( IEveSpaceObjectChild* child ) } } -void EveChildRef::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildRef::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { if( auto ref = dynamic_cast( m_child.p ) ) { @@ -163,7 +154,7 @@ bool EveChildRef::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query { bool success = false; Vector4 bSphere( 0.f, 0.f, 0.f, -1.f ); - if( m_child && m_child->GetBoundingSphere( bSphere ) ) + if( m_child && m_child->GetBoundingSphere( bSphere, EVE_BOUNDS_NORMAL ) ) { BoundingSphereSetOrUpdate( bSphere, sphere, success ); success = true; @@ -352,14 +343,16 @@ bool EveChildRef::LoadChild() { // unregister the old child UnRegisterComponents(); + UnregisterChild( m_child ); CCP_LOG( "Loading child red file %s", m_resPath.c_str() ); - m_child = BeResMan->LoadObject( m_resPath.c_str() ); + m_child = BeResMan->LoadObject( m_resPath.c_str() ); if( !m_child ) { CCP_LOGERR( "Red file %s is invalid or not an Eve Child type.", m_resPath.c_str() ); return false; } + RegisterChild( m_child ); RegisterComponents(); @@ -373,4 +366,28 @@ ITr2AudEmitterPtr EveChildRef::FindSoundEmitter( const char* name ) return owner->FindSoundEmitter( name ); } return nullptr; -} \ No newline at end of file +} + +void EveChildRef::SetOwner( IEveSpaceObject2* owner ) +{ + if( GetOwner() != owner ) + { + EveSpaceObjectChild::SetOwner( owner ); + if( m_child ) + { + m_child->SetOwner( owner ); + } + } +} + +void EveChildRef::SetPartTag( PartTag tag ) +{ + if( GetPartTag() != tag ) + { + EveSpaceObjectChild::SetPartTag( tag ); + if( m_child ) + { + m_child->SetPartTag( tag ); + } + } +} diff --git a/trinity/Eve/SpaceObject/Children/EveChildRef.h b/trinity/Eve/SpaceObject/Children/EveChildRef.h index 1ef6ca39d..20b241190 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildRef.h +++ b/trinity/Eve/SpaceObject/Children/EveChildRef.h @@ -5,7 +5,7 @@ #define EveChildRef_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "IEveEffectChildrenOwner.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" @@ -16,7 +16,7 @@ BLUE_CLASS( EveChildRef ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2CurveSetOwner, public IInitialize, @@ -52,16 +52,11 @@ BLUE_CLASS( EveChildRef ) : void RegisterComponents() override; void UnRegisterComponents() override; - ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); - ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); void SetProceduralContainerVariable( const char* name, float value ) override; void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); @@ -79,6 +74,9 @@ BLUE_CLASS( EveChildRef ) : void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); + void SetOwner( IEveSpaceObject2 * owner ) override; + void SetPartTag( PartTag tag ) override; + void PlayCurveSet( const std::string& name, const std::string& rangeName ); void StopCurveSet( const std::string& name ); void UpdateCurveSet( const std::string& name, Be::Time time ); @@ -104,8 +102,7 @@ BLUE_CLASS( EveChildRef ) : protected: bool LoadChild(); - IEveSpaceObjectChildPtr m_child; - BlueSharedString m_name; + EveSpaceObjectChildPtr m_child; std::string m_resPath; bool m_loadChildAutomatically; diff --git a/trinity/Eve/SpaceObject/Children/EveChildRef_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildRef_Blue.cpp index ed5256332..9a6999058 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildRef_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildRef_Blue.cpp @@ -10,6 +10,7 @@ const Be::ClassInfo* EveChildRef::ExposeToBlue() { EXPOSURE_BEGIN( EveChildRef, "\n:jessica-icon: alicorn\n:jessica-icon-color: (123, 28, 212)\n:jessica-help-url: https://wiki.ccpgames.com/pages/viewpage.action?spaceKey=TTL&title=Plugs+and+Sockets \n" ) MAP_INTERFACE( EveChildRef ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2CurveSetOwner ) MAP_INTERFACE( IInitialize ) @@ -62,5 +63,8 @@ const Be::ClassInfo* EveChildRef::ExposeToBlue() Reload, 1, "Reload the effect child.\n" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildSocket.cpp b/trinity/Eve/SpaceObject/Children/EveChildSocket.cpp index 8c89fb919..e35db336c 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildSocket.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildSocket.cpp @@ -15,7 +15,6 @@ EveChildSocket::EveChildSocket( IRoot* lockobj ) : PARENTLOCK( m_parameters ), m_plug(), - m_name(), m_plugResPath(), m_display( true ) { @@ -23,6 +22,7 @@ EveChildSocket::EveChildSocket( IRoot* lockobj ) : EveChildSocket::~EveChildSocket() { + UnregisterChild( m_plug ); } const char* EveChildSocket::GetPlugResPath() const @@ -236,17 +236,7 @@ void EveChildSocket::UnRegisterComponents() } -const char* EveChildSocket::GetName() const -{ - return m_name.c_str(); -} - -void EveChildSocket::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - -IEveSpaceObjectChildPtr EveChildSocket::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveChildSocket::GetEffectChildByName( const char* name ) const { if( m_plug ) { @@ -255,11 +245,11 @@ IEveSpaceObjectChildPtr EveChildSocket::GetEffectChildByName( const char* name ) return nullptr; } -void EveChildSocket::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildSocket::AddToEffectChildrenList( EveSpaceObjectChild* child ) { } -void EveChildSocket::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildSocket::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { } @@ -490,6 +480,7 @@ bool EveChildSocket::LoadChild() { // unregister the current child UnRegisterComponents(); + UnregisterChild( m_plug ); CCP_LOG( "Loading child red file %s", m_plugResPath.c_str() ); m_plug = BeResMan->LoadObject( m_plugResPath.c_str() ); @@ -498,6 +489,7 @@ bool EveChildSocket::LoadChild() CCP_LOGERR( "Red file %s is invalid or not an Eve Child type.", m_plugResPath.c_str() ); return false; } + RegisterChild( m_plug ); RegisterComponents(); @@ -512,3 +504,27 @@ ITr2AudEmitterPtr EveChildSocket::FindSoundEmitter( const char* name ) } return nullptr; } + +void EveChildSocket::SetOwner( IEveSpaceObject2* owner ) +{ + if( GetOwner() != owner ) + { + EveSpaceObjectChild::SetOwner( owner ); + if( m_plug ) + { + m_plug->SetOwner( owner ); + } + } +} + +void EveChildSocket::SetPartTag( PartTag tag ) +{ + if( GetPartTag() != tag ) + { + EveSpaceObjectChild::SetPartTag( tag ); + if( m_plug ) + { + m_plug->SetPartTag( tag ); + } + } +} diff --git a/trinity/Eve/SpaceObject/Children/EveChildSocket.h b/trinity/Eve/SpaceObject/Children/EveChildSocket.h index 0827ae425..225de887f 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildSocket.h +++ b/trinity/Eve/SpaceObject/Children/EveChildSocket.h @@ -4,7 +4,7 @@ #ifndef EveChildSocket_H #define EveChildSocket_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "IEveEffectChildrenOwner.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" @@ -19,7 +19,7 @@ BLUE_DECLARE_IVECTOR( IEveSocketParameter ); BLUE_CLASS( EveChildSocket ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2CurveSetOwner, public IInitialize, @@ -52,16 +52,11 @@ BLUE_CLASS( EveChildSocket ) : // INotify virtual bool OnModified( Be::Var * value ); - ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); - ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); ////////////////////////////////////////////////////////////////////////////////////// // EveEntity @@ -82,6 +77,9 @@ BLUE_CLASS( EveChildSocket ) : void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); + void SetOwner( IEveSpaceObject2 * owner ) override; + void SetPartTag( PartTag tag ) override; + void PlayAllCurveSets(); void StopAllCurveSets(); void PlayCurveSet( const std::string& name, const std::string& rangeName ); @@ -109,7 +107,6 @@ BLUE_CLASS( EveChildSocket ) : EveChildPlugPtr m_plug; - BlueSharedString m_name; std::string m_plugResPath; bool m_display; diff --git a/trinity/Eve/SpaceObject/Children/EveChildSocket_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildSocket_Blue.cpp index 109731c0e..2aaf872c1 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildSocket_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildSocket_Blue.cpp @@ -10,6 +10,7 @@ const Be::ClassInfo* EveChildSocket::ExposeToBlue() { EXPOSURE_BEGIN( EveChildSocket, "\n:jessica-icon:blender-phone\n:jessica-icon-color: (123, 28, 212)\n:jessica-help-url: https://wiki.ccpgames.com/pages/viewpage.action?spaceKey=TTL&title=Plugs+and+Sockets \n" ) MAP_INTERFACE( EveChildSocket ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2CurveSetOwner ) MAP_INTERFACE( IInitialize ) @@ -69,5 +70,8 @@ const Be::ClassInfo* EveChildSocket::ExposeToBlue() ":jessica-placement:\n" ":jessica-icon: far-sync\n" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildSpherePin.h b/trinity/Eve/SpaceObject/Children/EveChildSpherePin.h index 3b9f501a3..0317a23b5 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildSpherePin.h +++ b/trinity/Eve/SpaceObject/Children/EveChildSpherePin.h @@ -37,7 +37,7 @@ BLUE_CLASS( EveChildSpherePin ) : ~EveChildSpherePin(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild + // EveSpaceObjectChild void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; Tr2PerObjectData* GetPerObjectData( ITriRenderBatchAccumulator * accumulator ); diff --git a/trinity/Eve/SpaceObject/Children/IEveEffectChildrenOwner.h b/trinity/Eve/SpaceObject/Children/IEveEffectChildrenOwner.h index b7a510709..d5aa1b5f9 100644 --- a/trinity/Eve/SpaceObject/Children/IEveEffectChildrenOwner.h +++ b/trinity/Eve/SpaceObject/Children/IEveEffectChildrenOwner.h @@ -3,13 +3,13 @@ #pragma once -BLUE_DECLARE_INTERFACE( IEveSpaceObjectChild ); +BLUE_DECLARE( EveSpaceObjectChild ); BLUE_INTERFACE( IEveEffectChildrenOwner ) : public IRoot { - virtual IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const = 0; - virtual void AddToEffectChildrenList( IEveSpaceObjectChild * child ) = 0; - virtual void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ) = 0; + virtual EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const = 0; + virtual void AddToEffectChildrenList( EveSpaceObjectChild * child ) = 0; + virtual void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ) = 0; }; \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h b/trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h index 8a8cd6c73..9f635f921 100644 --- a/trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h +++ b/trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h @@ -12,6 +12,7 @@ class EveUpdateContext; class Tr2LightManager; BLUE_DECLARE_INTERFACE( IEveSpaceObjectChild ); +BLUE_DECLARE( EveSpaceObjectChild ); BLUE_DECLARE_INTERFACE( IEveChildTransformModifier ); struct EveChildUpdateParams @@ -31,7 +32,7 @@ struct EveChildUpdateParams } IEveSpaceObject2* spaceObjectParent; - IEveSpaceObjectChild* childParent; + EveSpaceObjectChild* childParent; size_t boneCount; const Float4x3* bones; float ownerMaxSpeed; @@ -42,56 +43,12 @@ struct EveChildUpdateParams Vector3 worldVelocity; }; +/** + * @brief Deprecated interface for EveSpaceObjectChild. Classes deriving from EveSpaceObjectChild should still declare + * this interface in MAP_INTERFACE macro for backward compatibility with Python code, but otherwise this interface should not be used directly. + */ BLUE_INTERFACE( IEveSpaceObjectChild ) : - public IRoot -{ - enum Origin - { - SPACE, - SOF, - }; - - virtual const char* GetName() const = 0; - virtual void SetName( const char* name ) = 0; - - virtual void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) = 0; - virtual void GetRenderables( std::vector & renderables ) = 0; - virtual bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const = 0; - virtual void RegisterWithQuadRenderer( Tr2QuadRenderer & quadRenderer ) - { - } - virtual void AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) const - { - } - - virtual void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) = 0; - virtual void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) = 0; - - virtual void GetLocalToWorldTransform( Matrix & transform ) const = 0; - - virtual bool IsAlwaysOn() const - { - return false; - }; - - virtual void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) = 0; - - virtual void ChangeLOD( Tr2Lod lod ) = 0; - - virtual void SetControllerVariable( const char* name, float value ) {}; - virtual void HandleControllerEvent( const char* name ) {}; - virtual void StartControllers() {}; - - virtual void SetProceduralContainerVariable( const char* name, float value ) {}; - - virtual void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) {}; - - virtual void SetOrigin( Origin origin ) {}; - - virtual void AddTransformModifier( IEveChildTransformModifier * modifier ){}; - - virtual void SetMute( bool isMuted ) {}; -}; + public IRoot{}; BLUE_DECLARE_IVECTOR( IEveSpaceObjectChild ); diff --git a/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.cpp b/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.cpp index d47fb4bb0..fdcc10596 100644 --- a/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.cpp +++ b/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.cpp @@ -14,16 +14,7 @@ EveChildProceduralContainer::EveChildProceduralContainer( IRoot* lockobj ) : EveChildProceduralContainer::~EveChildProceduralContainer() { -} - -const char* EveChildProceduralContainer::GetName() const -{ - return m_name.c_str(); -} - -void EveChildProceduralContainer::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); + UnregisterChild( m_selectedObject ); } bool EveChildProceduralContainer::Initialize() @@ -60,7 +51,7 @@ bool EveChildProceduralContainer::GetBoundingSphere( Vector4& sphere, BoundingSp { bool success = false; Vector4 bSphere( 0.f, 0.f, 0.f, -1.f ); - if( m_selectedObject && m_selectedObject->GetBoundingSphere( bSphere ) ) + if( m_selectedObject && m_selectedObject->GetBoundingSphere( bSphere, EVE_BOUNDS_NORMAL ) ) { BoundingSphereSetOrUpdate( bSphere, sphere, success ); success = true; @@ -148,7 +139,9 @@ void EveChildProceduralContainer::ConfigureSelectedObject() { entity->UnRegister( registry ); } + UnregisterChild( m_selectedObject ); m_selectedObject = child; + RegisterChild( m_selectedObject ); if( EveEntityPtr entity = BlueCastPtr( m_selectedObject ) ) { entity->Register( registry ); @@ -388,4 +381,28 @@ void EveChildProceduralContainer::RenderDebugInfo( ITr2DebugRenderer2& renderer } } } +} + +void EveChildProceduralContainer::SetOwner( IEveSpaceObject2* owner ) +{ + if( GetOwner() != owner ) + { + EveSpaceObjectChild::SetOwner( owner ); + if( m_selectedObject ) + { + m_selectedObject->SetOwner( owner ); + } + } +} + +void EveChildProceduralContainer::SetPartTag( PartTag tag ) +{ + if( GetPartTag() != tag ) + { + EveSpaceObjectChild::SetPartTag( tag ); + if( m_selectedObject ) + { + m_selectedObject->SetPartTag( tag ); + } + } } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.h b/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.h index 122ee0afc..8a370b44c 100644 --- a/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.h +++ b/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.h @@ -2,7 +2,7 @@ #pragma once -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Eve/SpaceObject/Children/IEveEffectChildrenOwner.h" #include "Eve/SpaceObject/Children/EveChildTransform.h" #include "Eve/SpaceObject/Children/TransformModifiers/IEveChildTransformModifier.h" @@ -13,7 +13,7 @@ BLUE_CLASS( EveChildProceduralContainer ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public ITr2CurveSetOwner, public IEveInheritPropertiesOwner, public EveChildTransform, @@ -31,9 +31,6 @@ BLUE_CLASS( EveChildProceduralContainer ) : EveChildProceduralContainer( IRoot* lockobj = NULL ); ~EveChildProceduralContainer(); - const char* GetName() const override; - void SetName( const char* name ) override; - void ConfigureSelectedObject(); const char* GetMethodVariableName(); @@ -50,7 +47,7 @@ BLUE_CLASS( EveChildProceduralContainer ) : void OnListModified( long event, ssize_t key, ssize_t key2, IRoot* value, const IList* list ) override; ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChildOwner + // EveSpaceObjectChildOwner void AddTransformModifier( IEveChildTransformModifier * modifier ) override; void SetProceduralContainerVariable( const char* name, float value ); @@ -71,7 +68,7 @@ BLUE_CLASS( EveChildProceduralContainer ) : void StopAllCurveSets() override; ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override; void GetRenderables( std::vector & renderables ) override; bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -84,6 +81,8 @@ BLUE_CLASS( EveChildProceduralContainer ) : void ChangeLOD( Tr2Lod lod ) override; ITr2AudEmitterPtr FindSoundEmitter( const char* name ) override; void SetInheritProperties( const Color* colorSet ) override; + void SetOwner( IEveSpaceObject2 * owner ) override; + void SetPartTag( PartTag tag ) override; ////////////////////////////////////////////////////////////////////////////////////// // EveEntity @@ -100,10 +99,9 @@ BLUE_CLASS( EveChildProceduralContainer ) : void RenderDebugInfo( ITr2DebugRenderer2 & renderer ) override; protected: - IEveSpaceObjectChildPtr m_selectedObject; + EveSpaceObjectChildPtr m_selectedObject; IEveProceduralSelectionMethodPtr m_selectionMethod; - BlueSharedString m_name; PIEveChildTransformModifierVector m_transformModifiers; TrackableStdUnorderedMap m_proceduralContainerVariables; bool m_display; diff --git a/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer_Blue.cpp b/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer_Blue.cpp index e86efdcb0..3bbe124cf 100644 --- a/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer_Blue.cpp @@ -8,6 +8,7 @@ const Be::ClassInfo* EveChildProceduralContainer::ExposeToBlue() { EXPOSURE_BEGIN( EveChildProceduralContainer, "" ) MAP_INTERFACE( EveChildProceduralContainer ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2CurveSetOwner ) MAP_INTERFACE( IInitialize ) @@ -42,5 +43,8 @@ const Be::ClassInfo* EveChildProceduralContainer::ExposeToBlue() MAP_METHOD_AND_WRAP( "StartControllers", StartControllers, "Start all controllers" ) MAP_METHOD_AND_WRAP( "GetMethodVariableName", GetMethodVariableName, "Get the name of the seed variable being utilized" ) MAP_METHOD_AND_WRAP( "SetProceduralContainerVariable", SetProceduralContainerVariable, "Set variable for all applicable ProceduralContainers\n:param name: variable name\n:param value: new variable value\n" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.cpp b/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.cpp index 2cba8fc94..6060c1338 100644 --- a/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.cpp +++ b/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.cpp @@ -13,16 +13,6 @@ EveChildSmartLightSet::EveChildSmartLightSet( IRoot* lockobj ) : m_lightGroups.SetNotify( this ); } -const char* EveChildSmartLightSet::GetName() const -{ - return m_name.c_str(); -} - -void EveChildSmartLightSet::SetName( const char* name ) -{ - m_name = name; -} - void EveChildSmartLightSet::OnListModified( long event, ssize_t key, ssize_t key2, IRoot* value, const IList* list ) { if( list == &m_lightGroups && ( event & BELIST_EVENTMASK ) == BELIST_INSERTED ) diff --git a/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.h b/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.h index a5b1b1ea2..6e87d569a 100644 --- a/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.h +++ b/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.h @@ -3,6 +3,7 @@ #pragma once #include "../EveChildTransform.h" +#include "../EveSpaceObjectChild.h" #include "../EveChildInheritProperties.h" #include "../IEveInheritPropertiesOwner.h" #include "attributeModifiers/IEveSmartLightGroupAttributeModifier.h" @@ -14,7 +15,7 @@ BLUE_DECLARE_INTERFACE( IEveSmartLightGroup ); BLUE_DECLARE_IVECTOR( IEveSmartLightGroup ); BLUE_CLASS( EveChildSmartLightSet ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2DebugRenderable, public IEveInheritPropertiesOwner, @@ -31,22 +32,14 @@ BLUE_CLASS( EveChildSmartLightSet ) : void RenderDebugInfo( ITr2DebugRenderer2 & renderer ) override; void GetDebugOptions( Tr2DebugRendererOptions & options ) override; - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); - bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const - { - return false; - }; void RegisterWithQuadRenderer( Tr2QuadRenderer & quadRenderer ); void AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) const; void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void GetLocalToWorldTransform( Matrix & transform ) const; - void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) {}; - void ChangeLOD( Tr2Lod lod ) {}; void SetControllerVariable( const char* name, float value ) override; ////////////////////////////////////////////////////////////////////////////////////// @@ -65,7 +58,6 @@ BLUE_CLASS( EveChildSmartLightSet ) : private: bool m_display; - std::string m_name; IEveDistributionMethodPtr m_distribution; PIEveSmartLightGroupVector m_lightGroups; diff --git a/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet_Blue.cpp b/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet_Blue.cpp index cddf27441..24220044c 100644 --- a/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet_Blue.cpp @@ -9,6 +9,7 @@ const Be::ClassInfo* EveChildSmartLightSet::ExposeToBlue() { EXPOSURE_BEGIN( EveChildSmartLightSet, "\n:jessica-icon: lightbulb-gear\n:jessica-icon-color: (255, 207, 50)\n:jessica-help-url: https://ccpgames.atlassian.net/wiki/spaces/TTL/pages/1308393505/SmartLightSets\n" ) MAP_INTERFACE( EveChildSmartLightSet ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2DebugRenderable ) MAP_INTERFACE( INotify ) @@ -22,5 +23,8 @@ const Be::ClassInfo* EveChildSmartLightSet::ExposeToBlue() MAP_ATTRIBUTE( "distribution", m_distribution, "distributionMethod for entities\n:jessica-icon: map-location-dot\n:jessica-help-url: https://ccpgames.atlassian.net/wiki/spaces/TTL/pages/1311441160/Distributions\n", Be::READWRITE | Be::PERSIST ) MAP_ATTRIBUTE( "lightGroups", m_lightGroups, "list of lights and light-renderables", Be::READ | Be::PERSIST ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/SmartLightSets/attributeModifiers/EveSmartLightBaseAttributeModifier.h b/trinity/Eve/SpaceObject/Children/SmartLightSets/attributeModifiers/EveSmartLightBaseAttributeModifier.h index 34f63f71e..d7abc3278 100644 --- a/trinity/Eve/SpaceObject/Children/SmartLightSets/attributeModifiers/EveSmartLightBaseAttributeModifier.h +++ b/trinity/Eve/SpaceObject/Children/SmartLightSets/attributeModifiers/EveSmartLightBaseAttributeModifier.h @@ -5,7 +5,7 @@ #include "IEveSmartLightGroupAttributeModifier.h" #include "Lights/Tr2PointLight.h" #include -#include +#include #include "Curves/Tr2CurveScalar.h" BLUE_DECLARE( Tr2CurveScalar ); diff --git a/trinity/Eve/SpaceObject/EveSpaceObject2.cpp b/trinity/Eve/SpaceObject/EveSpaceObject2.cpp index c580579b1..a5c179100 100644 --- a/trinity/Eve/SpaceObject/EveSpaceObject2.cpp +++ b/trinity/Eve/SpaceObject/EveSpaceObject2.cpp @@ -239,6 +239,11 @@ EveSpaceObject2::~EveSpaceObject2() } UnregisterAudioGeometry(); + + for( auto& child : m_effectChildren ) + { + child->SetOwner( nullptr ); + } } bool EveSpaceObject2::Initialize() @@ -249,6 +254,11 @@ bool EveSpaceObject2::Initialize() PrepareForAnimation(); } + for( auto& child : m_effectChildren ) + { + child->SetOwner( this ); + } + for( auto& controller : m_controllers ) { if( !controller->IsLinked() ) @@ -307,8 +317,9 @@ void EveSpaceObject2::OnListModified( long event, ssize_t key, ssize_t key2, IRo switch( event & BELIST_EVENTMASK ) { case BELIST_INSERTED: - if( IEveSpaceObjectChildPtr child = BlueCastPtr( value ) ) + if( EveSpaceObjectChildPtr child = BlueCastPtr( value ) ) { + child->SetOwner( this ); for( auto it = begin( m_controllerVariables ); it != end( m_controllerVariables ); ++it ) { child->SetControllerVariable( it->first.c_str(), it->second ); @@ -327,6 +338,10 @@ void EveSpaceObject2::OnListModified( long event, ssize_t key, ssize_t key2, IRo { entity->UnRegister( this->GetComponentRegistry() ); } + if( EveSpaceObjectChildPtr child = BlueCastPtr( value ) ) + { + child->SetOwner( nullptr ); + } break; case BELIST_UNLOADSTART: if( IsInRegistry() ) @@ -339,6 +354,10 @@ void EveSpaceObject2::OnListModified( long event, ssize_t key, ssize_t key2, IRo } } } + for( auto& child : m_effectChildren ) + { + child->SetOwner( nullptr ); + } break; default: break; @@ -3005,7 +3024,7 @@ void EveSpaceObject2::AddObserver( TriObserverLocalPtr observer ) } // -------------------------------------------------------------------------------- -IEveSpaceObjectChildPtr EveSpaceObject2::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveSpaceObject2::GetEffectChildByName( const char* name ) const { for( auto it = begin( m_effectChildren ); it != end( m_effectChildren ); ++it ) { @@ -3022,7 +3041,7 @@ IEveSpaceObjectChildPtr EveSpaceObject2::GetEffectChildByName( const char* name // Description: // Add a child to the effectChildren list // -------------------------------------------------------------------------------- -void EveSpaceObject2::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveSpaceObject2::AddToEffectChildrenList( EveSpaceObjectChild* child ) { if( m_inheritProperties ) { @@ -3036,7 +3055,7 @@ void EveSpaceObject2::AddToEffectChildrenList( IEveSpaceObjectChild* child ) } // -------------------------------------------------------------------------------- -void EveSpaceObject2::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveSpaceObject2::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { auto index = m_effectChildren.FindKey( child ); if( index >= 0 ) @@ -3858,7 +3877,7 @@ void EveSpaceObject2::SetShaderOption( const BlueSharedString& name, const BlueS for( auto it = m_effectChildren.begin(); it != m_effectChildren.end(); ++it ) { - IEveSpaceObjectChild* child = *it; + EveSpaceObjectChild* child = *it; child->SetShaderOption( name, value ); } } diff --git a/trinity/Eve/SpaceObject/EveSpaceObject2.h b/trinity/Eve/SpaceObject/EveSpaceObject2.h index 19ded272d..d06f06f95 100644 --- a/trinity/Eve/SpaceObject/EveSpaceObject2.h +++ b/trinity/Eve/SpaceObject/EveSpaceObject2.h @@ -21,7 +21,7 @@ #include "Eve/SpaceObject/Attachments/EveMeshOverlayEffect.h" #include "Eve/SpaceObject/Attachments/EveSpaceObjectDecal.h" #include "Eve/SpaceObject/Attachments/EveImpactOverlay.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Eve/SpaceObject/Children/IEveEffectChildrenOwner.h" #include "Eve/SpaceObject/Children/IEveInheritPropertiesOwner.h" #include "Eve/SpaceObject/Attachments/IEveSpaceObjectDecalOwner.h" @@ -385,9 +385,9 @@ BLUE_CLASS( EveSpaceObject2 ) : ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); ///////////////////////////////////////////////////////////////////////////////////// // ITr2ControllerOwner @@ -704,7 +704,7 @@ BLUE_CLASS( EveSpaceObject2 ) : ///////////////////////////////////////////////////////////////////////////////////// // Effect children - PIEveSpaceObjectChildVector m_effectChildren; + PEveSpaceObjectChildVector m_effectChildren; EveChildInheritPropertiesPtr m_inheritProperties; ///////////////////////////////////////////////////////////////////////////////////// diff --git a/trinity/Eve/SpaceObject/Utils/fxAttributes/EveCameraFxAttributes.h b/trinity/Eve/SpaceObject/Utils/fxAttributes/EveCameraFxAttributes.h index db557831e..576624e18 100644 --- a/trinity/Eve/SpaceObject/Utils/fxAttributes/EveCameraFxAttributes.h +++ b/trinity/Eve/SpaceObject/Utils/fxAttributes/EveCameraFxAttributes.h @@ -3,7 +3,7 @@ #pragma once #include "Eve/EveUpdateContext.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "IEveFxAttribute.h" diff --git a/trinity/Eve/SpaceObjectFactory/EveSOF.cpp b/trinity/Eve/SpaceObjectFactory/EveSOF.cpp index b809f11a4..788a34064 100644 --- a/trinity/Eve/SpaceObjectFactory/EveSOF.cpp +++ b/trinity/Eve/SpaceObjectFactory/EveSOF.cpp @@ -273,7 +273,7 @@ IRootPtr EveSOF::BuildFromDNA( const char* dnaString ) EveChildContainerPtr layoutContainer; layoutContainer.CreateInstance(); layoutContainer->SetName( "layouts" ); - layoutContainer->SetOrigin( IEveSpaceObjectChild::SOF ); + layoutContainer->SetOrigin( EveSpaceObjectChild::SOF ); layoutContainer->SetIsPlacementRoot( true ); layoutContainer->SetAlwaysOn( true ); SetupLayout( newObj, layoutContainer, sharedMeshes, dna, centerOffset ); @@ -1719,7 +1719,7 @@ void RecursiveBindParticleEmitters( EveTransform* transform, TriCurveSet* curveS } } -void RecursiveBindParticleEmitters( IEveSpaceObjectChild* child, TriCurveSet* curveSet, Tr2CurveScalar* curve ) +void RecursiveBindParticleEmitters( EveSpaceObjectChild* child, TriCurveSet* curveSet, Tr2CurveScalar* curve ) { if( EveChildContainerPtr container = BlueCastPtr( child ) ) { @@ -1757,7 +1757,7 @@ void EveSOF::SetupChildrenAndAnimations( EveSpaceObject2Ptr obj, IEveEffectChild auto postCopy = m_editorMode ? &PostCopyMetadata : nullptr; std::map> childrenToBindTo; - std::map> soChildrenToBindTo; + std::map> soChildrenToBindTo; const std::vector& hullChildren = dna->GetHullChildren(); for( auto childIt = hullChildren.begin(); childIt != hullChildren.end(); ++childIt ) @@ -1805,12 +1805,12 @@ void EveSOF::SetupChildrenAndAnimations( EveSpaceObject2Ptr obj, IEveEffectChild obj->AddToChildrenList( transformedChild ); } } - else if( IEveSpaceObjectChildPtr effectChild = BlueCastPtr( p ) ) + else if( EveSpaceObjectChildPtr effectChild = BlueCastPtr( p ) ) { size_t index = 0; for( auto& offset : offsets ) { - IEveSpaceObjectChildPtr transformedChild; + EveSpaceObjectChildPtr transformedChild; if( ++index < offsets.size() ) { CCP_STATS_ZONE( "Child Copy" ); @@ -1829,7 +1829,7 @@ void EveSOF::SetupChildrenAndAnimations( EveSpaceObject2Ptr obj, IEveEffectChild transformedChild->Setup( &childIt->scaling, &rot, &pos, childIt->lowestLodVisible ); - transformedChild->SetOrigin( IEveSpaceObjectChild::SOF ); + transformedChild->SetOrigin( EveSpaceObjectChild::SOF ); childOwner->AddToEffectChildrenList( transformedChild ); if( childIt->id != -1 ) { @@ -1866,7 +1866,7 @@ void EveSOF::SetupChildrenAndAnimations( EveSpaceObject2Ptr obj, IEveEffectChild { RecursiveBindParticleEmitters( ( *transformIt ), curveSet, scalarCurve ); } - std::vector childVector = soChildrenToBindTo[animIt->id]; + std::vector childVector = soChildrenToBindTo[animIt->id]; for( auto childIt = childVector.begin(); childIt != childVector.end(); ++childIt ) { RecursiveBindParticleEmitters( ( *childIt ), curveSet, scalarCurve ); @@ -1971,11 +1971,11 @@ void EveSOF::SetupEffectChildren( EveSpaceObject2Ptr newObj, IEveEffectChildrenO newObj->AddToChildrenList( transformedChild ); } } - else if( IEveSpaceObjectChildPtr effectChild = BlueCastPtr( p ) ) + else if( EveSpaceObjectChildPtr effectChild = BlueCastPtr( p ) ) { for( auto& offset : offsets ) { - IEveSpaceObjectChildPtr transformedChild; + EveSpaceObjectChildPtr transformedChild; if( &offset != &offsets.back() ) { BeClasses->CopyTo( effectChild->GetRootObject(), (IRoot**)&transformedChild ); @@ -1993,7 +1993,7 @@ void EveSOF::SetupEffectChildren( EveSpaceObject2Ptr newObj, IEveEffectChildrenO transformedChild->Setup( &childSetItem.scaling, &rot, &pos, childSetItem.lowestLodVisible ); - transformedChild->SetOrigin( IEveSpaceObjectChild::SOF ); + transformedChild->SetOrigin( EveSpaceObjectChild::SOF ); childOwner->AddToEffectChildrenList( transformedChild ); } } @@ -3624,7 +3624,7 @@ void EveSOF::CreatePlacement( { sharedMeshes.CreateInstance(); sharedMeshes->SetName( "SharedInstancedMeshes" ); - sharedMeshes->SetOrigin( IEveSpaceObjectChild::SOF ); + sharedMeshes->SetOrigin( EveSpaceObjectChild::SOF ); parent->AddToEffectChildrenList( sharedMeshes ); } diff --git a/trinity/Eve/Turret/EveTurretFiringFX.h b/trinity/Eve/Turret/EveTurretFiringFX.h index 016359445..667b06389 100644 --- a/trinity/Eve/Turret/EveTurretFiringFX.h +++ b/trinity/Eve/Turret/EveTurretFiringFX.h @@ -15,8 +15,8 @@ BLUE_DECLARE_INTERFACE( IEveFiringEffectElement ); BLUE_DECLARE_IVECTOR( IEveFiringEffectElement ); BLUE_DECLARE_INTERFACE( IEveEffectChildrenOwner ); -BLUE_DECLARE_INTERFACE( IEveSpaceObjectChild ); -BLUE_DECLARE_IVECTOR( IEveSpaceObjectChild ); +BLUE_DECLARE( EveSpaceObjectChild ); +BLUE_DECLARE_VECTOR( EveSpaceObjectChild ); BLUE_DECLARE( TriCurveSet ); BLUE_DECLARE( TriObserverLocal ); BLUE_DECLARE( Tr2QuadRenderer ); diff --git a/trinity/Eve/Turret/EveTurretSet.cpp b/trinity/Eve/Turret/EveTurretSet.cpp index 87efc0812..d6107a0d8 100644 --- a/trinity/Eve/Turret/EveTurretSet.cpp +++ b/trinity/Eve/Turret/EveTurretSet.cpp @@ -18,7 +18,7 @@ #include "EveTurretFiringFX.h" #include "include/TriMath.h" #include "Tr2QuadRenderer.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" CCP_STATS_DECLARED_ELSEWHERE( primitiveCount ); @@ -461,7 +461,7 @@ bool EveTurretSet::IsAmbientVisible() const } -IEveSpaceObjectChild* EveTurretSet::GetAmbientEffectOrGeneratedEffect() const +EveSpaceObjectChild* EveTurretSet::GetAmbientEffectOrGeneratedEffect() const { if( m_ambientEffectEditingMode ) { @@ -3654,12 +3654,12 @@ void EveTurretSet::SetFiringEffect( EveTurretFiringFX* firingEffect ) InitializeFiringEffect(); } -IEveSpaceObjectChild* EveTurretSet::GetAmbientEffect() +EveSpaceObjectChild* EveTurretSet::GetAmbientEffect() { return m_ambientEffect; } -void EveTurretSet::SetAmbientEffect( IEveSpaceObjectChild* ambientEffect ) +void EveTurretSet::SetAmbientEffect( EveSpaceObjectChild* ambientEffect ) { auto registry = GetComponentRegistry(); if( EveEntityPtr entity = BlueCastPtr( m_ambientEffect ) ) diff --git a/trinity/Eve/Turret/EveTurretSet.h b/trinity/Eve/Turret/EveTurretSet.h index baa640760..169157903 100644 --- a/trinity/Eve/Turret/EveTurretSet.h +++ b/trinity/Eve/Turret/EveTurretSet.h @@ -283,7 +283,7 @@ BLUE_CLASS( EveTurretSet ) : void InitializeFiringEffect(); // setup the attached ambient effect void InitializeAmbientEffect(); - IEveSpaceObjectChild* GetAmbientEffectOrGeneratedEffect() const; + EveSpaceObjectChild* GetAmbientEffectOrGeneratedEffect() const; void SetAmbientEffectControllerVariableOnInstance( int index, const char* name, float value ); bool IsAmbientVisible() const; @@ -323,8 +323,8 @@ BLUE_CLASS( EveTurretSet ) : EveTurretFiringFX* GetFiringEffect(); void SetFiringEffect( EveTurretFiringFX * firingEffect ); - IEveSpaceObjectChild* GetAmbientEffect(); - void SetAmbientEffect( IEveSpaceObjectChild * ambientEffect ); + EveSpaceObjectChild* GetAmbientEffect(); + void SetAmbientEffect( EveSpaceObjectChild * ambientEffect ); // name std::string m_name; @@ -491,7 +491,7 @@ BLUE_CLASS( EveTurretSet ) : bool m_randomizeExplosionRotation; // ambient effects - IEveSpaceObjectChildPtr m_ambientEffect; + EveSpaceObjectChildPtr m_ambientEffect; EveChildInstanceContainerPtr m_generatedDistributedAmbientEffect; Matrix m_ambientOffsetMatrix; // used while editing bool m_ambientEffectEditingMode; // used for editing diff --git a/trinity/Eve/UI/EveEllipseSet.cpp b/trinity/Eve/UI/EveEllipseSet.cpp index 4e04b6070..3fde5324b 100644 --- a/trinity/Eve/UI/EveEllipseSet.cpp +++ b/trinity/Eve/UI/EveEllipseSet.cpp @@ -127,16 +127,6 @@ bool EveEllipseSet::AddEllipse( const Vector3& center, float semiMajor, float se return true; } -const char* EveEllipseSet::GetName() const -{ - return m_name.c_str(); -} - -void EveEllipseSet::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - EveEllipseSet::~EveEllipseSet() { // Specs may outlive via Python references @@ -400,10 +390,6 @@ void EveEllipseSet::Setup( const Vector3* scale, const Quaternion* rotation, con m_lowestLodVisible = lowestLodVisible; } -void EveEllipseSet::ChangeLOD( Tr2Lod lod ) -{ -} - IRoot* EveEllipseSet::GetID( uint16_t ) { return GetRawRoot(); diff --git a/trinity/Eve/UI/EveEllipseSet.h b/trinity/Eve/UI/EveEllipseSet.h index 2c1639d16..7a8b516e2 100644 --- a/trinity/Eve/UI/EveEllipseSet.h +++ b/trinity/Eve/UI/EveEllipseSet.h @@ -11,12 +11,12 @@ #include "Shader/Tr2EffectStateManager.h" #include "Tr2BufferAL.h" #include "EveEllipseDefinition.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" BLUE_DECLARE( EveEllipseSet ); BLUE_CLASS( EveEllipseSet ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2Renderable, public IListNotify, @@ -36,9 +36,7 @@ BLUE_CLASS( EveEllipseSet ) : bool AddEllipse( const Vector3& center, float semiMajor, float semiMinor, const Vector3& planeNormal, float rotationDegrees ); ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const override; - void SetName( const char* name ) override; + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override; void GetRenderables( std::vector & renderables ) override; bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const override; @@ -46,7 +44,6 @@ BLUE_CLASS( EveEllipseSet ) : void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void GetLocalToWorldTransform( Matrix & transform ) const override; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) override; - void ChangeLOD( Tr2Lod lod ) override; ////////////////////////////////////////////////////////////////////////////////////// // ITr2Pickable @@ -72,7 +69,6 @@ BLUE_CLASS( EveEllipseSet ) : // INotify bool OnModified( Be::Var * val ) override; - BlueSharedString m_name; bool m_display = true; bool m_enablePicking = true; float m_depthOffset = 0.f; diff --git a/trinity/Eve/UI/EveEllipseSet_Blue.cpp b/trinity/Eve/UI/EveEllipseSet_Blue.cpp index ade0c2f04..5de0c8c52 100644 --- a/trinity/Eve/UI/EveEllipseSet_Blue.cpp +++ b/trinity/Eve/UI/EveEllipseSet_Blue.cpp @@ -9,6 +9,7 @@ const Be::ClassInfo* EveEllipseSet::ExposeToBlue() { EXPOSURE_BEGIN( EveEllipseSet, "" ) MAP_INTERFACE( EveEllipseSet ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( ITr2Pickable ) @@ -33,5 +34,8 @@ const Be::ClassInfo* EveEllipseSet::ExposeToBlue() AddEllipse, "Adds a closed elliptical orbit in the given plane (center, semiMajor, semiMinor, planeNormal, rotationDegrees)" ); MAP_METHOD_AND_WRAP( "__init__", py__init__, "Initializes the EveEllipseSet" ); + MAP_ATTRIBUTE( "partTag", m_partTag, "Part tag for multi-part space objects", Be::READ ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/trinity.cpp b/trinity/trinity.cpp index 11142507b..8e0380eb6 100644 --- a/trinity/trinity.cpp +++ b/trinity/trinity.cpp @@ -34,7 +34,7 @@ BLUE_DEFINE_INTERFACE( IBlueObjectProxy ); #include "TriSettingsRegistrar.h" #include "Eve/IEveSpaceObject2.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #ifndef TRINITYNAME #error Please add TRINITYNAME= to compiler preprocessor definitions (/D) @@ -400,7 +400,7 @@ MAP_FUNCTION_AND_WRAP( "GetGrannyProductVersion", GetGrannyProductVersion, "Retu static BlueStdResult GetObjectWorldTransform( IRoot* object, Matrix& result ) { - if( IEveSpaceObjectChildPtr child = BlueCastPtr( object ) ) + if( EveSpaceObjectChildPtr child = BlueCastPtr( object ) ) { child->GetLocalToWorldTransform( result ); return BlueStdResult( BLUE_STD_RESULT_OK ); @@ -418,7 +418,7 @@ MAP_FUNCTION_AND_WRAP( "GetObjectWorldTransform", GetObjectWorldTransform, "Returns world transform for some supported object interfaces. Currently only\n" - "IEveSpaceObject2 and IEveSpaceObjectChild interfaces are supported.\n" + "IEveSpaceObject2 and EveSpaceObjectChild interfaces are supported.\n" ":param obj: blue object to get world transform from\n" ":raies TypeError: if the function does not support the object type" ); From cf19ad9f1301800e030a4c66e4ba91ffdad44ae1 Mon Sep 17 00:00:00 2001 From: Filipp Pavlov Date: Mon, 20 Jul 2026 09:02:11 +0000 Subject: [PATCH 02/12] Add the important files --- .../Children/EveSpaceObjectChild.cpp | 151 +++++++++ .../Children/EveSpaceObjectChild.h | 319 ++++++++++++++++++ .../Children/EveSpaceObjectChild_Blue.cpp | 19 ++ 3 files changed, 489 insertions(+) create mode 100644 trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp create mode 100644 trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h create mode 100644 trinity/Eve/SpaceObject/Children/EveSpaceObjectChild_Blue.cpp diff --git a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp new file mode 100644 index 000000000..26c34fa10 --- /dev/null +++ b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp @@ -0,0 +1,151 @@ +// Copyright © 2026 CCP ehf. + +#include "StdAfx.h" +#include "EveSpaceObjectChild.h" + + +EveSpaceObjectChild::EveSpaceObjectChild( IRoot* ) +{ +} + +const char* EveSpaceObjectChild::GetName() const +{ + return m_name.c_str(); +} + +void EveSpaceObjectChild::SetName( const char* name ) +{ + m_name = BlueSharedString( name ); +} + +void EveSpaceObjectChild::UpdateVisibility( const EveUpdateContext&, const Matrix&, Tr2Lod ) +{ +} + +void EveSpaceObjectChild::GetRenderables( std::vector& ) +{ +} + +bool EveSpaceObjectChild::GetBoundingSphere( Vector4&, BoundingSphereQuery ) const +{ + return false; +} + +void EveSpaceObjectChild::RegisterWithQuadRenderer( Tr2QuadRenderer& ) +{ +} + +void EveSpaceObjectChild::AddQuadsToQuadRenderer( const TriFrustum&, Tr2QuadRenderer& ) const +{ +} + +void EveSpaceObjectChild::UpdateSyncronous( const EveUpdateContext&, const EveChildUpdateParams& ) +{ +} + +void EveSpaceObjectChild::UpdateAsyncronous( const EveUpdateContext&, const EveChildUpdateParams& ) +{ +} + +void EveSpaceObjectChild::GetLocalToWorldTransform( Matrix& ) const +{ +} + +bool EveSpaceObjectChild::IsAlwaysOn() const +{ + return false; +}; + +void EveSpaceObjectChild::Setup( const Vector3*, const Quaternion*, const Vector3*, Tr2Lod ) +{ +} + +void EveSpaceObjectChild::ChangeLOD( Tr2Lod ) +{ +} + +void EveSpaceObjectChild::SetControllerVariable( const char*, float ) +{ +} + +void EveSpaceObjectChild::HandleControllerEvent( const char* ) +{ +} + +void EveSpaceObjectChild::StartControllers() +{ +} + +void EveSpaceObjectChild::SetProceduralContainerVariable( const char*, float ) +{ +} + +void EveSpaceObjectChild::SetShaderOption( const BlueSharedString&, const BlueSharedString& ) +{ +} + +void EveSpaceObjectChild::SetOrigin( Origin ) +{ +} + +void EveSpaceObjectChild::AddTransformModifier( IEveChildTransformModifier* ) +{ +} + +void EveSpaceObjectChild::SetMute( bool isMuted ) +{ +} + +EveSpaceObjectChild::PartTag EveSpaceObjectChild::GetPartTag() const +{ + return m_partTag; +} + +void EveSpaceObjectChild::SetPartTag( PartTag tag ) +{ + m_partTag = tag; +} + +void EveSpaceObjectChild::SetOwner( IEveSpaceObject2* owner ) +{ + m_owner = owner; +} + +IEveSpaceObject2* EveSpaceObjectChild::GetOwner() const +{ + return m_owner; +} + +void EveSpaceObjectChild::SetParent( EveSpaceObjectChild* parent ) +{ + m_parent = parent; +} + +EveSpaceObjectChild* EveSpaceObjectChild::GetParent() const +{ + return m_parent; +} + +void EveSpaceObjectChild::RegisterChild( EveSpaceObjectChild* child ) +{ + if( child ) + { + child->SetParent( this ); + child->SetOwner( m_owner ); + if( m_partTag != EveSpaceObjectChild::NO_PART_TAG ) + { + child->SetPartTag( m_partTag ); + } + } +} + +void EveSpaceObjectChild::UnregisterChild( EveSpaceObjectChild* child ) +{ + if( child ) + { + CCP_ASSERT( child->GetParent() == this ); + child->SetParent( nullptr ); + child->SetOwner( nullptr ); + // No reason to reset the part tag as it is meaningless outside the hierarchy of the parent object + } +} diff --git a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h new file mode 100644 index 000000000..25651598c --- /dev/null +++ b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h @@ -0,0 +1,319 @@ +// Copyright © 2026 CCP ehf. + +#pragma once + +#include "IEveSpaceObjectChild.h" + +BLUE_CLASS_IMPL( EveSpaceObjectChild ); + +/** + * @brief Base class for all space object children. This class provides common functionality and properties for all child objects in the space object hierarchy. + */ +class EveSpaceObjectChild : public IEveSpaceObjectChild +{ +public: + EXPOSE_TO_BLUE(); + + /// @brief Enum representing the origin of the space object child, i.e. how it was created: using SOF or otherwise. + enum Origin + { + SPACE, + SOF, + }; + + /// @brief Type representing a part tag, which is used to identify parts of a modular space object. + using PartTag = uint32_t; + + /// @brief Constant representing a part tag for children that are not part of a modular space object. + static const PartTag NO_PART_TAG = 0; + + EveSpaceObjectChild( IRoot* lockobj = nullptr ); + + /** + * @brief Returns the name of the space object child. This name is used for identification and debugging purposes. + */ + const char* GetName() const; + + /** + * @brief Sets the name of the space object child. This name is used for identification and debugging purposes. + * @param name The new name to set for the space object child. + */ + virtual void SetName( const char* name ); + + /** + * @brief Updates the internal visibility state (frustum culling, LOD, etc.) of the object. This method is called during rendering before GetRenderables() to determine if the object should be rendered. + * Note, that this method is called from worker threads, so care should be taken when accessing shared data. + * The default implementation does nothing, derived classes should override this method to implement visibility logic if needed. + * @param updateContext Scene-wide update context containing timing and other relevant information for the update. + * @param parentTransform Parent transformation matrix to world coordinates. + * @param parentLod Owner space object's LOD level. + */ + virtual void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); + + /** + * @brief Pushes owned renderables to the provided vector. This method is called during rendering to collect all renderable objects for the current frame. + * The default implementation does nothing, derived classes implementing renderable features should override this method to provide their renderables. + * @param renderables Vector to which the renderables will be added. + */ + virtual void GetRenderables( std::vector& renderables ); + + /** + * @brief Retrieves the bounding sphere of the object. This method is used for frustum culling and LOD estimation. + * The default implementation does nothing, derived classes should override this method to provide their bounding sphere if available. + * @param sphere Vector4 to store the bounding sphere (x, y, z for center, w for radius). + * @param query Type of bounding sphere query. + * @return True if the bounding sphere is valid, false otherwise. + */ + virtual bool GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const; + + /** + * @brief Registers effects with the quad renderer. This method is called when the child is added to the scene to allow it to register any effects that need to be rendered as quads. + * The default implementation does nothing, derived classes implementing quad rendering should override this method to register their effects with the quad renderer. + * @param quadRenderer Quad renderer to register effects with. + */ + virtual void RegisterWithQuadRenderer( Tr2QuadRenderer& quadRenderer ); + + /** + * @brief Adds quads to the quad renderer for rendering. This method is called during rendering to allow the child to add any quads that need to be rendered. + * Note, that this method is called from worker threads, so care should be taken when accessing shared data. + * The default implementation does nothing, derived classes implementing quad rendering should override this method to add their quads to the quad renderer. + * @param frustum Frustum used for culling and visibility checks. + * @param quadRenderer Quad renderer to which quads will be added. + */ + virtual void AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) const; + + /** + * @brief Updates the state of the object. This method is called every frame from the main thread to allow the child to update its internal state, animations, etc. + * The default implementation does nothing, derived classes implementing quad rendering should override this method to add their quads to the quad renderer. + * @param updateContext Scene-wide update context containing timing and other relevant information for the update. + * @param params Space object and parent child information relevant for the update. + */ + virtual void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); + + /** + * @brief Updates the state of the object asynchronously. This method is called from worker threads to allow the child to update its internal state, animations, etc. + * The default implementation does nothing, derived classes implementing quad rendering should override this method to add their quads to the quad renderer. + * @param updateContext Scene-wide update context containing timing and other relevant information for the update. + * @param params Space object and parent child information relevant for the update. + */ + virtual void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); + + /** + * @brief Retrieves the local to world transformation matrix of the object. This method is poorly designed. Avoid using it if possible. Not every child has a local + * to world transformation, and this method has no way to return the failure state. The default implementation does nothing, derived classes should override this + * method to provide their local to world transformation if available. + * @param transform Matrix to store the local to world transformation. + */ + virtual void GetLocalToWorldTransform( Matrix& transform ) const; + + /** + * @brief Exotic method that is used to determine if the child needs to be always updated/rendered regardless of the owner's space object "activation strength". + * @return True if the child should always be updated/rendered, false otherwise. + */ + virtual bool IsAlwaysOn() const; + + /** + * @brief Sets up the child transform and LOD. This methods is called by the SOF when creating a child object. + * The default implementation does nothing. If the child has a transform, it should override this method to set up the transform and LOD. + * @param scale Optional scale factors (x, y, z) for the child transform. If nullptr, scaling is unaffected. + * @param rotation Optional rotation for the child transform. If nullptr, rotation is unaffected. + * @param translation Optional translation for the child transform. If nullptr, translation is unaffected. + * @param lowestLodVisible Lowest level of detail (LOD) of the owner space object that is visible for the child. + */ + virtual void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); + + /** + * @brief Notifies the child object that the level of detail (LOD) of the owner space object has changed. + * The default implementation does nothing. If the child has LOD-dependent behavior, it should override this method to respond to LOD changes. + * @param lod New level of detail (LOD) of the owner space object. + */ + virtual void ChangeLOD( Tr2Lod lod ); + + /** + * @brief Sets a controller variable for the child object. This method is called by the owner space object to update controller variables that affect the child's behavior. + * If the child owns controllers, it should override this method to propagate the variable to its controllers. Also, if the object owns other children, it should propagate the + * controller variable change to them as well. + * The default implementation does nothing. + * @param name Name of the controller variable. + * @param value Value to set for the controller variable. + */ + virtual void SetControllerVariable( const char* name, float value ); + + /** + * @brief Notifies child controllers that a controller event has occurred. This method is called by the owner space object to notify the child of controller events that may affect its behavior. + * If the child owns controllers, it should override this method to propagate the event to its controllers. Also, if the object owns other children, it should propagate the + * controller event to them as well. + * The default implementation does nothing. + * @param name Name of the controller event. + */ + virtual void HandleControllerEvent( const char* name ); + + /** + * @brief Starts controllers owned by the child object. If the child owns controllers, it should override this method to start them. Also, if the object owns other children, it should propagate the + * start command to them as well. + * The default implementation does nothing. + */ + virtual void StartControllers(); + + /** + * @brief Sets a "procedural container" variable. This method is very specific to EveChildProceduralContainer. Derived classes that own other children should override this method to propagate the call to them. + * The default implementation does nothing. + * @param name Name of the procedural container variable. + * @param value Value to set for the procedural container variable. + */ + virtual void SetProceduralContainerVariable( const char* name, float value ); + + /** + * @brief Sets a shader option for effects managed by the child object. Derived classes that manage effects (or meshes) should override this methods to set the shader option for their effects. Also, if the object + * owns other children, it should override this method to propagate the call to them. + * The default implementation does nothing. + * @param name Name of the shader option. + * @param value Value to set for the shader option. + */ + virtual void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ); + + /** + * @brief Sets the origin (creation method) of the child object. This method is called by the SOF to set the creation method of the object. + * The default implementation does nothing. + * @param origin Origin (creation method) of the child object. + */ + virtual void SetOrigin( Origin origin ); + + /** + * @brief Adds a transform modifier to the child object. If the child object supports transform modifiers, it can override this method to add the modifier to its list of modifiers. + * The default implementation does nothing. + * @param modifier New transform modifier. + */ + virtual void AddTransformModifier( IEveChildTransformModifier* modifier ); + + /** + * @brief Sets the muted state for audio emitters owned by the child object. If the child object owns audio emitters, it can override this method to set their muted state. + * Also, if the object owns other children, it should override this method to propagate the call to them. + * The default implementation does nothing. + * @param isMuted Should the audio emitters be muted (true) or unmuted (false). + */ + virtual void SetMute( bool isMuted ); + + /** + * @brief Returns the part tag of the child object for multi-part space objects. + * @return Part tag of the child object, or NO_PART_TAG if not applicable. + */ + PartTag GetPartTag() const; + + /** + * @brief Sets the part tag of the child object for multi-part space objects. Descendent classes that own other children should override this method to propagate the part tag to them. + * @param tag Part tag to set for the child object. + */ + virtual void SetPartTag( PartTag tag ); + + /** + * @brief Returns the owner space object of the child. It may return nullptr if the child is not currently attached to an owner space object. + * @return Owner space object of the child, or nullptr if not attached. + */ + IEveSpaceObject2* GetOwner() const; + + /** + * @brief Sets the owner space object of the child. Descendent classes that own other children should override this method to propagate the owner to them. + * @param owner Owner space object to set for the child. + */ + virtual void SetOwner( IEveSpaceObject2* owner ); + + /** + * @brief Returns the parent child object of this child. It may return nullptr if the child is not currently attached to a parent child object. + * @return Parent child object of this child, or nullptr if not attached. + */ + EveSpaceObjectChild* GetParent() const; + + /** + * @brief Sets the parent child object of this child. + * @param parent Parent child object to set for this child. + */ + void SetParent( EveSpaceObjectChild* parent ); + +protected: + /** + * @brief Helper function that registers a child object with this parent. Assigns the parent, owner and part tag to the child. + * @param child Child object to register. If the child is nullptr, the method does nothing. + */ + void RegisterChild( EveSpaceObjectChild* child ); + + /** + * @brief Helper function that unregisters a child object with this parent. Resets the parent and owner pointers of the child. + * @param child Child object to unregister. If the child is nullptr, the method does nothing. + */ + void UnregisterChild( EveSpaceObjectChild* child ); + + /** + * @brief Helper function that registers a sequence of child objects with this parent. Assigns the parent, owner and part tag to each child. + * @param children Sequence of child objects to register. + */ + template + void RegisterChildren( const ChildList& children ) + { + for( auto& child : children ) + { + this->RegisterChild( child ); + } + } + + /** + * @brief Helper function that unregisters a sequence of child objects with this parent. Resets the parent and owner pointers of each child. + * @param children Sequence of child objects to unregister. + */ + template + void UnregisterChildren( const ChildList& children ) + { + for( auto& child : children ) + { + this->UnregisterChild( child ); + } + } + + /** + * @brief Helper function that handles list modification notifications for a list of child objects to register and unregister children. + * @tparam ChildList Type of the list of child objects. + * @param event Event type indicating the modification. See BLUELISTEVENT for possible values. + * @param value Value associated with the event. + * @param children List of child objects for which the notification is being sent. + */ + template + void HandleChildrenListModified( + long event, // BLUELISTEVENT values + IRoot* value, + const ChildList& children ) + { + switch( event & BELIST_EVENTMASK ) + { + case BELIST_INSERTED: + if( EveSpaceObjectChildPtr child = BlueCastPtr( value ) ) + { + this->RegisterChild( child ); + } + break; + case BELIST_REMOVED: + if( EveSpaceObjectChildPtr child = BlueCastPtr( value ) ) + { + this->UnregisterChild( child ); + } + break; + case BELIST_UNLOADSTART: + for( auto& child : children ) + { + this->UnregisterChild( child ); + } + break; + default: + break; + } + } + + BlueSharedString m_name; +private: + IEveSpaceObject2* m_owner = nullptr; + EveSpaceObjectChild* m_parent = nullptr; + PartTag m_partTag = NO_PART_TAG; +}; + +BLUE_DECLARE_VECTOR( EveSpaceObjectChild ); + +TYPEDEF_BLUECLASS( EveSpaceObjectChild ); \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild_Blue.cpp new file mode 100644 index 000000000..f5a5a72d9 --- /dev/null +++ b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild_Blue.cpp @@ -0,0 +1,19 @@ +// Copyright © 2026 CCP ehf. + +#include "StdAfx.h" +#include "EveSpaceObjectChild.h" + +BLUE_DEFINE_ABSTRACT( EveSpaceObjectChild ); + +const Be::ClassInfo* EveSpaceObjectChild::ExposeToBlue() +{ + EXPOSURE_BEGIN( EveSpaceObjectChild, "" ) + MAP_INTERFACE( EveSpaceObjectChild ) + + MAP_ATTRIBUTE( "name", m_name, "Name of the space object child", Be::READWRITE | Be::PERSIST ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) + + EXPOSURE_END() +} From ce895840654d660257e6b4d494230ce9791f2e1f Mon Sep 17 00:00:00 2001 From: Filipp Pavlov Date: Mon, 20 Jul 2026 09:05:46 +0000 Subject: [PATCH 03/12] Format files --- trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp | 2 +- trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp index 26c34fa10..464de622b 100644 --- a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp +++ b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp @@ -38,7 +38,7 @@ void EveSpaceObjectChild::RegisterWithQuadRenderer( Tr2QuadRenderer& ) void EveSpaceObjectChild::AddQuadsToQuadRenderer( const TriFrustum&, Tr2QuadRenderer& ) const { } - + void EveSpaceObjectChild::UpdateSyncronous( const EveUpdateContext&, const EveChildUpdateParams& ) { } diff --git a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h index 25651598c..ef8721a7a 100644 --- a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h +++ b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h @@ -308,6 +308,7 @@ class EveSpaceObjectChild : public IEveSpaceObjectChild } BlueSharedString m_name; + private: IEveSpaceObject2* m_owner = nullptr; EveSpaceObjectChild* m_parent = nullptr; From 28e689026719d02e2be94778648598be420ce7ac Mon Sep 17 00:00:00 2001 From: Filipp Pavlov Date: Mon, 20 Jul 2026 09:07:30 +0000 Subject: [PATCH 04/12] Use property to access the part tag --- trinity/Eve/UI/EveEllipseSet_Blue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trinity/Eve/UI/EveEllipseSet_Blue.cpp b/trinity/Eve/UI/EveEllipseSet_Blue.cpp index 5de0c8c52..c25726485 100644 --- a/trinity/Eve/UI/EveEllipseSet_Blue.cpp +++ b/trinity/Eve/UI/EveEllipseSet_Blue.cpp @@ -34,7 +34,7 @@ const Be::ClassInfo* EveEllipseSet::ExposeToBlue() AddEllipse, "Adds a closed elliptical orbit in the given plane (center, semiMajor, semiMinor, planeNormal, rotationDegrees)" ); MAP_METHOD_AND_WRAP( "__init__", py__init__, "Initializes the EveEllipseSet" ); - MAP_ATTRIBUTE( "partTag", m_partTag, "Part tag for multi-part space objects", Be::READ ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() From 3173b93455cb9ed81398897efb81e67cbb659ab4 Mon Sep 17 00:00:00 2001 From: filipppavlov Date: Mon, 20 Jul 2026 11:21:01 +0000 Subject: [PATCH 05/12] Potential fix for pull request finding Use `UnregisterChild` helper method Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp index e20b56091..d87867607 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp @@ -354,8 +354,7 @@ void EveChildInstanceContainer::PopFront() front->UnRegister( GetComponentRegistry() ); } } - m_instances[0]->SetOwner( nullptr ); - m_instances[0]->SetParent( nullptr ); + UnregisterChild( m_instances[0] ); m_instances.Remove( 0 ); } } From 342fbe595b572070e09b583a03e215011f5924e9 Mon Sep 17 00:00:00 2001 From: filipppavlov Date: Tue, 21 Jul 2026 10:51:06 +0000 Subject: [PATCH 06/12] Rename .cmake files when installing to monolith. They need to match whatever was there before (#30) --- trinity/CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/trinity/CMakeLists.txt b/trinity/CMakeLists.txt index 9d8822d1e..dc0e9c6e0 100644 --- a/trinity/CMakeLists.txt +++ b/trinity/CMakeLists.txt @@ -1846,7 +1846,7 @@ else() endif() # utility function that sets properties shared between all trinity targets -function(set_shared_trinity_properties target package_name) +function(set_shared_trinity_properties target) target_link_libraries(${target} PUBLIC @@ -1935,11 +1935,11 @@ function(set_shared_trinity_properties target package_name) configure_ccp_vendor_config_file( TARGET ${target} - DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${package_name}Config.cmake" + DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${target}Config.cmake" DEPENDENCIES "" ) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${package_name}Config.cmake DESTINATION .) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${target}Config.cmake DESTINATION .) else () # VCPKG install mode # Install rule to ensure that our runtime and linker files are in the vcpkg structure @@ -1981,7 +1981,7 @@ if(WIN32) ) target_link_libraries(${TRINITY_STUB_TARGET_NAME} PRIVATE TrinityAL_stub) - set_shared_trinity_properties(${TRINITY_STUB_TARGET_NAME} carbon-trinity-stub) + set_shared_trinity_properties(${TRINITY_STUB_TARGET_NAME}) endif() if(WIN32) @@ -1997,7 +1997,7 @@ if(WIN32) ) #find_package(nvidia-aftermath CONFIG REQUIRED)#Required for dx11 target_link_libraries(${TRINITY_DX11_TARGET_NAME} PRIVATE TrinityAL_dx11) - set_shared_trinity_properties(${TRINITY_DX11_TARGET_NAME} carbon-trinity-dx11) + set_shared_trinity_properties(${TRINITY_DX11_TARGET_NAME}) endif() if (BUILD_DX12) @@ -2011,7 +2011,7 @@ if(WIN32) TRINITYNAME=_trinity_dx12 ) target_link_libraries(${TRINITY_DX12_TARGET_NAME} PRIVATE TrinityAL_dx12 ) - set_shared_trinity_properties(${TRINITY_DX12_TARGET_NAME} carbon-trinity-dx12) + set_shared_trinity_properties(${TRINITY_DX12_TARGET_NAME}) endif() elseif(APPLE) @@ -2026,7 +2026,7 @@ elseif(APPLE) TRINITY_PLATFORM=TRINITY_METAL TRINITYNAME=_trinity_metal ) - set_shared_trinity_properties(${TRINITY_METAL_TARGET_NAME} carbon-trinity-metal) + set_shared_trinity_properties(${TRINITY_METAL_TARGET_NAME}) target_link_libraries(${TRINITY_METAL_TARGET_NAME} PRIVATE TrinityAL_metal From 93843038ec47f302f2fe6344824b16354774b4c0 Mon Sep 17 00:00:00 2001 From: Filipp Pavlov Date: Fri, 17 Jul 2026 15:25:56 +0000 Subject: [PATCH 07/12] Refactor IEveSpaceObjectChild interface into a base class The new base class has support "owner", "parent" and "part tag" shared attributes. --- trinity/CMakeLists.txt | 3 + .../Actions/Tr2ActionChildEffect.cpp | 4 +- .../Actions/Tr2ActionChildEffect.h | 4 +- .../Actions/Tr2ActionPlayCurveSet.cpp | 1 - trinity/Eve/EveEffectRoot2.cpp | 29 ++++- trinity/Eve/EveEffectRoot2.h | 12 +- .../Eve/Renderable/Stretch/EveStretch3.cpp | 52 ++++---- trinity/Eve/Renderable/Stretch/EveStretch3.h | 32 ++--- .../SpaceObject/Children/EveChildAudio.cpp | 41 +------ .../Eve/SpaceObject/Children/EveChildAudio.h | 15 +-- .../Children/EveChildAudio_Blue.cpp | 4 + .../Children/EveChildBehaviorSystem.cpp | 20 +-- .../Children/EveChildBehaviorSystem.h | 10 +- .../Children/EveChildBehaviorSystem_Blue.cpp | 4 + .../Children/EveChildBulletStorm.cpp | 28 ----- .../Children/EveChildBulletStorm.h | 15 +-- .../Children/EveChildBulletStorm_Blue.cpp | 4 + .../SpaceObject/Children/EveChildCloud.cpp | 10 -- .../Eve/SpaceObject/Children/EveChildCloud.h | 13 +- .../SpaceObject/Children/EveChildCloud2.cpp | 18 --- .../Eve/SpaceObject/Children/EveChildCloud2.h | 17 +-- .../Children/EveChildCloud2_Blue.cpp | 4 + .../Children/EveChildCloud_Blue.cpp | 4 + .../Children/EveChildContainer.cpp | 48 +++++--- .../SpaceObject/Children/EveChildContainer.h | 20 ++- .../Children/EveChildContainer_Blue.cpp | 10 +- .../Children/EveChildEffectPropagator.cpp | 6 +- .../Children/EveChildEffectPropagator.h | 1 - .../EveChildEffectPropagator_Blue.cpp | 4 + .../Children/EveChildExplosion.cpp | 8 +- .../SpaceObject/Children/EveChildExplosion.h | 12 +- .../Children/EveChildExplosion_Blue.cpp | 4 + .../Children/EveChildFogVolume.cpp | 20 +-- .../SpaceObject/Children/EveChildFogVolume.h | 14 +-- .../Children/EveChildFogVolume_Blue.cpp | 5 +- .../Children/EveChildInstanceContainer.cpp | 116 +++++++++++------- .../Children/EveChildInstanceContainer.h | 31 +++-- .../EveChildInstanceContainer_Blue.cpp | 95 +++++++------- .../Children/EveChildInstanceMeshRenderer.h | 2 +- .../EveChildInstanceMeshRenderer_Blue.cpp | 4 + .../Children/EveChildInstancedMeshes.cpp | 14 --- .../Children/EveChildInstancedMeshes.h | 10 +- .../Children/EveChildInstancedMeshes_Blue.cpp | 4 + .../Children/EveChildLightingOverride.cpp | 14 --- .../Children/EveChildLightingOverride.h | 15 +-- .../EveChildLightingOverride_Blue.cpp | 4 + .../SpaceObject/Children/EveChildLineSet.cpp | 10 -- .../SpaceObject/Children/EveChildLineSet.h | 11 +- .../Children/EveChildLineSet_Blue.cpp | 4 + .../Eve/SpaceObject/Children/EveChildLink.h | 2 +- .../Eve/SpaceObject/Children/EveChildMesh.cpp | 10 -- .../Eve/SpaceObject/Children/EveChildMesh.h | 11 +- .../Children/EveChildMesh_Blue.cpp | 5 + .../Children/EveChildParticleSphere.cpp | 12 -- .../Children/EveChildParticleSphere.h | 11 +- .../Children/EveChildParticleSphere_Blue.cpp | 4 + .../Children/EveChildParticleSystem.cpp | 10 -- .../Children/EveChildParticleSystem.h | 10 +- .../Children/EveChildParticleSystem_Blue.cpp | 4 + .../Eve/SpaceObject/Children/EveChildPlug.cpp | 47 ++++--- .../Eve/SpaceObject/Children/EveChildPlug.h | 20 ++- .../Children/EveChildPlug_Blue.cpp | 4 + .../Children/EveChildPostProcessVolume.cpp | 19 +-- .../Children/EveChildPostProcessVolume.h | 14 +-- .../EveChildPostProcessVolume_Blue.cpp | 4 + .../Eve/SpaceObject/Children/EveChildQuad.cpp | 14 --- .../Eve/SpaceObject/Children/EveChildQuad.h | 11 +- .../Children/EveChildQuad_Blue.cpp | 4 + .../Eve/SpaceObject/Children/EveChildRef.cpp | 49 +++++--- .../Eve/SpaceObject/Children/EveChildRef.h | 21 ++-- .../SpaceObject/Children/EveChildRef_Blue.cpp | 4 + .../SpaceObject/Children/EveChildSocket.cpp | 44 ++++--- .../Eve/SpaceObject/Children/EveChildSocket.h | 19 ++- .../Children/EveChildSocket_Blue.cpp | 4 + .../SpaceObject/Children/EveChildSpherePin.h | 2 +- .../Children/IEveEffectChildrenOwner.h | 8 +- .../Children/IEveSpaceObjectChild.h | 57 ++------- .../EveChildProceduralContainer.cpp | 39 ++++-- .../EveChildProceduralContainer.h | 16 ++- .../EveChildProceduralContainer_Blue.cpp | 4 + .../SmartLightSets/EveChildSmartLightSet.cpp | 10 -- .../SmartLightSets/EveChildSmartLightSet.h | 14 +-- .../EveChildSmartLightSet_Blue.cpp | 4 + .../EveSmartLightBaseAttributeModifier.h | 2 +- trinity/Eve/SpaceObject/EveSpaceObject2.cpp | 29 ++++- trinity/Eve/SpaceObject/EveSpaceObject2.h | 10 +- .../fxAttributes/EveCameraFxAttributes.h | 2 +- trinity/Eve/SpaceObjectFactory/EveSOF.cpp | 22 ++-- trinity/Eve/Turret/EveTurretFiringFX.h | 4 +- trinity/Eve/Turret/EveTurretSet.cpp | 8 +- trinity/Eve/Turret/EveTurretSet.h | 8 +- trinity/Eve/UI/EveEllipseSet.cpp | 14 --- trinity/Eve/UI/EveEllipseSet.h | 10 +- trinity/Eve/UI/EveEllipseSet_Blue.cpp | 4 + trinity/trinity.cpp | 6 +- 95 files changed, 653 insertions(+), 807 deletions(-) diff --git a/trinity/CMakeLists.txt b/trinity/CMakeLists.txt index dc0e9c6e0..af3d96fab 100644 --- a/trinity/CMakeLists.txt +++ b/trinity/CMakeLists.txt @@ -572,6 +572,9 @@ set(_SOURCES Eve/SpaceObject/Children/EveCloudEditableVolume.cpp Eve/SpaceObject/Children/EveCloudEditableVolume.h Eve/SpaceObject/Children/EveCloudEditableVolume_Blue.cpp + Eve/SpaceObject/Children/EveSpaceObjectChild.cpp + Eve/SpaceObject/Children/EveSpaceObjectChild.h + Eve/SpaceObject/Children/EveSpaceObjectChild_Blue.cpp Eve/SpaceObject/Children/IEveEffectChildrenOwner.h Eve/SpaceObject/Children/IEveSpaceObjectChild.h Eve/SpaceObject/Utils/EveDistributionMethods/DistributionAttributeModifiers/EveDistributionModifierProcessLifetime.cpp diff --git a/trinity/Controllers/Actions/Tr2ActionChildEffect.cpp b/trinity/Controllers/Actions/Tr2ActionChildEffect.cpp index 637e4b83d..2ff61cfb4 100644 --- a/trinity/Controllers/Actions/Tr2ActionChildEffect.cpp +++ b/trinity/Controllers/Actions/Tr2ActionChildEffect.cpp @@ -4,7 +4,7 @@ #include "Tr2ActionChildEffect.h" #include "Controllers/Tr2Controller.h" #include "Eve/SpaceObject/Children/IEveEffectChildrenOwner.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Eve/EveMultiEffect.h" #include "Eve/EveMultiEffectParameter.h" #include "Eve/Renderable/Stretch/EveStretch3.h" @@ -115,7 +115,7 @@ void Tr2ActionChildEffect::Start( ITr2ActionController& controller ) } if( m_addOnStart && !m_child && !m_path.empty() ) { - m_child = BeResMan->LoadObject( m_path.c_str() ); + m_child = BeResMan->LoadObject( m_path.c_str() ); if( m_child ) { if( !m_childName.empty() ) diff --git a/trinity/Controllers/Actions/Tr2ActionChildEffect.h b/trinity/Controllers/Actions/Tr2ActionChildEffect.h index 10efcb47e..77f53a5b0 100644 --- a/trinity/Controllers/Actions/Tr2ActionChildEffect.h +++ b/trinity/Controllers/Actions/Tr2ActionChildEffect.h @@ -4,7 +4,7 @@ #include "ITr2ControllerAction.h" -BLUE_DECLARE_INTERFACE( IEveSpaceObjectChild ); +BLUE_DECLARE( EveSpaceObjectChild ); BLUE_CLASS( Tr2ActionChildEffect ) : @@ -21,7 +21,7 @@ BLUE_CLASS( Tr2ActionChildEffect ) : private: std::string m_path; std::string m_childName; - IEveSpaceObjectChildPtr m_child; + EveSpaceObjectChildPtr m_child; bool m_addOnStart; bool m_removeOnStop; BlueSharedString m_targetAnotherOwner; diff --git a/trinity/Controllers/Actions/Tr2ActionPlayCurveSet.cpp b/trinity/Controllers/Actions/Tr2ActionPlayCurveSet.cpp index eed76b4ac..ca8b094d5 100644 --- a/trinity/Controllers/Actions/Tr2ActionPlayCurveSet.cpp +++ b/trinity/Controllers/Actions/Tr2ActionPlayCurveSet.cpp @@ -7,7 +7,6 @@ #include "Curves/TriCurveSet.h" #include "Eve/SpaceObject/EveSpaceObject2.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" #include "Eve/EveEffectRoot2.h" diff --git a/trinity/Eve/EveEffectRoot2.cpp b/trinity/Eve/EveEffectRoot2.cpp index b37c60d85..70eb1bdf3 100644 --- a/trinity/Eve/EveEffectRoot2.cpp +++ b/trinity/Eve/EveEffectRoot2.cpp @@ -49,10 +49,18 @@ EveEffectRoot2::~EveEffectRoot2() { controller->Unlink( UnlinkReason::DELETING ); } + for( auto& child : m_effectChildren ) + { + child->SetOwner( nullptr ); + } } bool EveEffectRoot2::Initialize() { + for( auto& child : m_effectChildren ) + { + child->SetOwner( this ); + } for( auto& controller : m_controllers ) { if( !controller->IsLinked() ) @@ -113,8 +121,9 @@ void EveEffectRoot2::OnListModified( long event, ssize_t key, ssize_t key2, IRoo switch( event & BELIST_EVENTMASK ) { case BELIST_INSERTED: - if( IEveSpaceObjectChildPtr child = BlueCastPtr( value ) ) + if( EveSpaceObjectChildPtr child = BlueCastPtr( value ) ) { + child->SetOwner( this ); for( auto it = begin( m_controllerVariables ); it != end( m_controllerVariables ); ++it ) { child->SetControllerVariable( it->first.c_str(), it->second ); @@ -137,6 +146,10 @@ void EveEffectRoot2::OnListModified( long event, ssize_t key, ssize_t key2, IRoo entity->UnRegister( GetComponentRegistry() ); } } + if( EveSpaceObjectChildPtr child = BlueCastPtr( value ) ) + { + child->SetOwner( nullptr ); + } break; case BELIST_UNLOADSTART: if( IsInRegistry() ) @@ -149,6 +162,10 @@ void EveEffectRoot2::OnListModified( long event, ssize_t key, ssize_t key2, IRoo } } } + for( auto& child : m_effectChildren ) + { + child->SetOwner( nullptr ); + } default: break; } @@ -668,7 +685,7 @@ void EveEffectRoot2::GetMissPosition( const Vector3* hit, const Vector3* source, } // ----------------------------------------------------------------------------- -PIEveSpaceObjectChildVector& EveEffectRoot2::GetChildren() +PEveSpaceObjectChildVector& EveEffectRoot2::GetChildren() { return m_effectChildren; } @@ -884,7 +901,7 @@ void EveEffectRoot2::StartControllers() } // -------------------------------------------------------------------------------- -IEveSpaceObjectChildPtr EveEffectRoot2::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveEffectRoot2::GetEffectChildByName( const char* name ) const { for( auto it = begin( m_effectChildren ); it != end( m_effectChildren ); ++it ) { @@ -898,7 +915,7 @@ IEveSpaceObjectChildPtr EveEffectRoot2::GetEffectChildByName( const char* name ) } // -------------------------------------------------------------------------------- -void EveEffectRoot2::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveEffectRoot2::AddToEffectChildrenList( EveSpaceObjectChild* child ) { if( IsInRegistry() && m_display ) { @@ -911,7 +928,7 @@ void EveEffectRoot2::AddToEffectChildrenList( IEveSpaceObjectChild* child ) } // -------------------------------------------------------------------------------- -void EveEffectRoot2::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveEffectRoot2::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { auto index = m_effectChildren.FindKey( child ); if( index >= 0 ) @@ -931,7 +948,7 @@ void EveEffectRoot2::SetShaderOption( const BlueSharedString& name, const BlueSh { for( auto it = m_effectChildren.begin(); it != m_effectChildren.end(); ++it ) { - IEveSpaceObjectChild* child = *it; + EveSpaceObjectChild* child = *it; child->SetShaderOption( name, value ); } } diff --git a/trinity/Eve/EveEffectRoot2.h b/trinity/Eve/EveEffectRoot2.h index 2f49183c5..7114339a1 100644 --- a/trinity/Eve/EveEffectRoot2.h +++ b/trinity/Eve/EveEffectRoot2.h @@ -9,7 +9,7 @@ #include "EveTransform.h" #include "EveLODHelper.h" #include "IEveSpaceObject2.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Eve/SpaceObject/Children/IEveEffectChildrenOwner.h" #include "Tr2ShLightingManager.h" #include "Include/ITriTargetable.h" @@ -134,9 +134,9 @@ BLUE_CLASS( EveEffectRoot2 ) : ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) override; ///////////////////////////////////////////////////////////////////////////////////// @@ -160,7 +160,7 @@ BLUE_CLASS( EveEffectRoot2 ) : void Start(); void Stop(); - PIEveSpaceObjectChildVector& GetChildren(); + PEveSpaceObjectChildVector& GetChildren(); void SetTransform( const Matrix& transform ); @@ -204,7 +204,7 @@ BLUE_CLASS( EveEffectRoot2 ) : std::string m_name; bool m_display; bool m_mute; - PIEveSpaceObjectChildVector m_effectChildren; + PEveSpaceObjectChildVector m_effectChildren; Vector3 m_scaling; Quaternion m_rotation; diff --git a/trinity/Eve/Renderable/Stretch/EveStretch3.cpp b/trinity/Eve/Renderable/Stretch/EveStretch3.cpp index ef4a5711e..f518ca15e 100644 --- a/trinity/Eve/Renderable/Stretch/EveStretch3.cpp +++ b/trinity/Eve/Renderable/Stretch/EveStretch3.cpp @@ -13,7 +13,7 @@ #include "Lights/Tr2PointLight.h" #include "Controllers/ITr2Controller.h" #include "Eve/SpaceObject/Children/TransformModifiers/EveChildModifierStretch.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Audio/Tr2AudioStretchAuto.h" #include "Audio/Tr2AudioStretchBase.h" @@ -123,7 +123,7 @@ void EveStretch3::Rebind( bool onlyUpdateBindings ) } } -void EveStretch3::RunOnComponents( std::function func ) const +void EveStretch3::RunOnComponents( std::function func ) const { if( m_sourceObject ) { @@ -146,7 +146,7 @@ void EveStretch3::RunOnComponents( std::function } } -float EveStretch3::RunOnComponentsGetMax( std::function func ) const +float EveStretch3::RunOnComponentsGetMax( std::function func ) const { float ret = -1.f; if( m_sourceObject ) @@ -211,12 +211,12 @@ std::unordered_map EveStretch3::GetParameterMap() const return parameterMap; } -IEveSpaceObjectChild* EveStretch3::GetSourceObject() +EveSpaceObjectChild* EveStretch3::GetSourceObject() { return m_sourceObject; } -void EveStretch3::SetSourceObject( IEveSpaceObjectChild* sourceObject ) +void EveStretch3::SetSourceObject( EveSpaceObjectChild* sourceObject ) { auto registry = GetComponentRegistry(); if( EveEntityPtr entity = BlueCastPtr( m_sourceObject ) ) @@ -230,12 +230,12 @@ void EveStretch3::SetSourceObject( IEveSpaceObjectChild* sourceObject ) } } -IEveSpaceObjectChild* EveStretch3::GetDestObject() +EveSpaceObjectChild* EveStretch3::GetDestObject() { return m_destObject; } -void EveStretch3::SetDestObject( IEveSpaceObjectChild* destObject ) +void EveStretch3::SetDestObject( EveSpaceObjectChild* destObject ) { auto registry = GetComponentRegistry(); if( EveEntityPtr entity = BlueCastPtr( m_destObject ) ) @@ -249,12 +249,12 @@ void EveStretch3::SetDestObject( IEveSpaceObjectChild* destObject ) } } -IEveSpaceObjectChild* EveStretch3::GetStretchObject() +EveSpaceObjectChild* EveStretch3::GetStretchObject() { return m_stretchObject; } -void EveStretch3::SetStretchObject( IEveSpaceObjectChild* stretchObject ) +void EveStretch3::SetStretchObject( EveSpaceObjectChild* stretchObject ) { auto registry = GetComponentRegistry(); if( EveEntityPtr entity = BlueCastPtr( m_stretchObject ) ) @@ -280,12 +280,12 @@ void EveStretch3::SetStretchObject( IEveSpaceObjectChild* stretchObject ) } } -IEveSpaceObjectChild* EveStretch3::GetMoveObject() +EveSpaceObjectChild* EveStretch3::GetMoveObject() { return m_moveObject; } -void EveStretch3::SetMoveObject( IEveSpaceObjectChild* moveObject ) +void EveStretch3::SetMoveObject( EveSpaceObjectChild* moveObject ) { auto registry = GetComponentRegistry(); if( EveEntityPtr entity = BlueCastPtr( m_moveObject ) ) @@ -605,7 +605,7 @@ void EveStretch3::GetRenderables( std::vector& renderables, Tr2 return; } - RunOnComponents( [&renderables]( IEveSpaceObjectChild* c ) { c->GetRenderables( renderables ); } ); + RunOnComponents( [&renderables]( EveSpaceObjectChild* c ) { c->GetRenderables( renderables ); } ); } void EveStretch3::SetDisplay( bool display ) @@ -724,7 +724,7 @@ void EveStretch3::RegisterComponents() if( registry && m_display ) { RunOnComponents( - [this]( IEveSpaceObjectChild* c ) { + [this]( EveSpaceObjectChild* c ) { if( EveEntityPtr entity = BlueCastPtr( c ) ) { entity->Register( GetComponentRegistry() ); @@ -739,7 +739,7 @@ void EveStretch3::UnRegisterComponents() if( registry ) { RunOnComponents( - [this]( IEveSpaceObjectChild* c ) { + [this]( EveSpaceObjectChild* c ) { if( EveEntityPtr entity = BlueCastPtr( c ) ) { entity->UnRegister( GetComponentRegistry() ); @@ -763,7 +763,7 @@ void EveStretch3::GetBindingRoots( std::unordered_map& vari void EveStretch3::SetControllerVariable( const char* name, float value ) { - RunOnComponents( [name, value]( IEveSpaceObjectChild* c ) { c->SetControllerVariable( name, value ); } ); + RunOnComponents( [name, value]( EveSpaceObjectChild* c ) { c->SetControllerVariable( name, value ); } ); for( auto it = begin( m_controllers ); it != end( m_controllers ); ++it ) { @@ -774,7 +774,7 @@ void EveStretch3::SetControllerVariable( const char* name, float value ) void EveStretch3::HandleControllerEvent( const char* name ) { - RunOnComponents( [name]( IEveSpaceObjectChild* c ) { c->HandleControllerEvent( name ); } ); + RunOnComponents( [name]( EveSpaceObjectChild* c ) { c->HandleControllerEvent( name ); } ); for( auto it = begin( m_controllers ); it != end( m_controllers ); ++it ) { @@ -784,7 +784,7 @@ void EveStretch3::HandleControllerEvent( const char* name ) void EveStretch3::StartControllers() { - RunOnComponents( []( IEveSpaceObjectChild* c ) { c->StartControllers(); } ); + RunOnComponents( []( EveSpaceObjectChild* c ) { c->StartControllers(); } ); for( auto it = begin( m_controllers ); it != end( m_controllers ); ++it ) { @@ -799,7 +799,7 @@ void EveStretch3::RegisterWithQuadRenderer( Tr2QuadRenderer& quadRenderer ) { return; } - RunOnComponents( [&quadRenderer]( IEveSpaceObjectChild* c ) { c->RegisterWithQuadRenderer( quadRenderer ); } ); + RunOnComponents( [&quadRenderer]( EveSpaceObjectChild* c ) { c->RegisterWithQuadRenderer( quadRenderer ); } ); } void EveStretch3::AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) @@ -809,7 +809,7 @@ void EveStretch3::AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRend return; } - RunOnComponents( [&frustum, &quadRenderer]( IEveSpaceObjectChild* c ) { c->AddQuadsToQuadRenderer( frustum, quadRenderer ); } ); + RunOnComponents( [&frustum, &quadRenderer]( EveSpaceObjectChild* c ) { c->AddQuadsToQuadRenderer( frustum, quadRenderer ); } ); } void EveStretch3::UpdateModelCenterWorldPosition( Vector3& position, Be::Time t ) @@ -837,7 +837,7 @@ void EveStretch3::SetDestObjectScale( float scale ) void EveStretch3::GetDebugOptions( Tr2DebugRendererOptions& options ) { options.insert( "Lights" ); - RunOnComponents( [&options]( IEveSpaceObjectChild* c ) { + RunOnComponents( [&options]( EveSpaceObjectChild* c ) { auto debugRenderable = dynamic_cast( c ); if( debugRenderable ) { @@ -862,7 +862,7 @@ void EveStretch3::RenderDebugInfo( ITr2DebugRenderer2& renderer ) { return; } - RunOnComponents( [&renderer]( IEveSpaceObjectChild* c ) { + RunOnComponents( [&renderer]( EveSpaceObjectChild* c ) { auto debugRenderable = dynamic_cast( c ); if( debugRenderable ) { @@ -904,7 +904,7 @@ void EveStretch3::PlayCurveSet( const std::string& name, const std::string& rang } } - RunOnComponents( [name, rangeName]( IEveSpaceObjectChild* c ) { + RunOnComponents( [name, rangeName]( EveSpaceObjectChild* c ) { auto curveSetOwner = dynamic_cast( c ); if( curveSetOwner ) { @@ -928,7 +928,7 @@ void EveStretch3::StopCurveSet( const std::string& name ) } } - RunOnComponents( [name]( IEveSpaceObjectChild* c ) { + RunOnComponents( [name]( EveSpaceObjectChild* c ) { auto curveSetOwner = dynamic_cast( c ); if( curveSetOwner ) { @@ -947,7 +947,7 @@ void EveStretch3::UpdateCurveSet( const std::string& name, Be::Time time ) } } - RunOnComponents( [name, time]( IEveSpaceObjectChild* c ) { + RunOnComponents( [name, time]( EveSpaceObjectChild* c ) { auto curveSetOwner = dynamic_cast( c ); if( curveSetOwner ) { @@ -971,7 +971,7 @@ float EveStretch3::GetCurveSetDuration( const std::string& name ) const maxDuration = max( maxDuration, ( *it )->GetMaxCurveDuration() ); } } - float componentMax = RunOnComponentsGetMax( [name]( IEveSpaceObjectChild* c ) -> float { + float componentMax = RunOnComponentsGetMax( [name]( EveSpaceObjectChild* c ) -> float { auto curveSetOwner = dynamic_cast( c ); if( curveSetOwner ) { @@ -999,7 +999,7 @@ float EveStretch3::GetRangeDuration( const std::string& name, const std::string& } } - float componentMax = RunOnComponentsGetMax( [name, rangeName]( IEveSpaceObjectChild* c ) -> float { + float componentMax = RunOnComponentsGetMax( [name, rangeName]( EveSpaceObjectChild* c ) -> float { auto curveSetOwner = dynamic_cast( c ); if( curveSetOwner ) { diff --git a/trinity/Eve/Renderable/Stretch/EveStretch3.h b/trinity/Eve/Renderable/Stretch/EveStretch3.h index 1040a537d..75b47d7d9 100644 --- a/trinity/Eve/Renderable/Stretch/EveStretch3.h +++ b/trinity/Eve/Renderable/Stretch/EveStretch3.h @@ -12,13 +12,13 @@ #include "Controllers/ITr2ControllerOwner.h" #include "Lights/ITr2LightOwner.h" #include "Lights/Tr2Light.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" BLUE_DECLARE( EveStretch3 ); BLUE_DECLARE( TriFloat ); BLUE_DECLARE( EveChildModifierStretch ); -BLUE_DECLARE_INTERFACE( IEveSpaceObjectChild ); +BLUE_DECLARE( EveSpaceObjectChild ); BLUE_DECLARE_INTERFACE( ITr2Controller ); BLUE_DECLARE_INTERFACE( ITriVectorFunction ); @@ -126,14 +126,14 @@ BLUE_CLASS( EveStretch3 ) : // ITr2SoundEmitterOwner ITr2AudEmitterPtr FindSoundEmitter( const char* name ) override; - IEveSpaceObjectChild* GetSourceObject(); - void SetSourceObject( IEveSpaceObjectChild * sourceObject ); - IEveSpaceObjectChild* GetDestObject(); - void SetDestObject( IEveSpaceObjectChild * destObject ); - IEveSpaceObjectChild* GetStretchObject(); - void SetStretchObject( IEveSpaceObjectChild * stretchObject ); - IEveSpaceObjectChild* GetMoveObject(); - void SetMoveObject( IEveSpaceObjectChild * moveObject ); + EveSpaceObjectChild* GetSourceObject(); + void SetSourceObject( EveSpaceObjectChild * sourceObject ); + EveSpaceObjectChild* GetDestObject(); + void SetDestObject( EveSpaceObjectChild * destObject ); + EveSpaceObjectChild* GetStretchObject(); + void SetStretchObject( EveSpaceObjectChild * stretchObject ); + EveSpaceObjectChild* GetMoveObject(); + void SetMoveObject( EveSpaceObjectChild * moveObject ); private: enum StretchState @@ -144,8 +144,8 @@ BLUE_CLASS( EveStretch3 ) : STRETCH_STATE_STOPPING }; - void RunOnComponents( std::function func ) const; - float RunOnComponentsGetMax( std::function func ) const; + void RunOnComponents( std::function func ) const; + float RunOnComponentsGetMax( std::function func ) const; void SetSourceSpaceObject( IEveSpaceObject2 * spaceObject ); void SetDestSpaceObject( IEveSpaceObject2 * spaceObject ); @@ -169,10 +169,10 @@ BLUE_CLASS( EveStretch3 ) : BlueWeakRef m_sourceSpaceObject; BlueWeakRef m_destSpaceObject; - IEveSpaceObjectChildPtr m_sourceObject; - IEveSpaceObjectChildPtr m_destObject; - IEveSpaceObjectChildPtr m_stretchObject; - IEveSpaceObjectChildPtr m_moveObject; + EveSpaceObjectChildPtr m_sourceObject; + EveSpaceObjectChildPtr m_destObject; + EveSpaceObjectChildPtr m_stretchObject; + EveSpaceObjectChildPtr m_moveObject; PTriCurveSetVector m_curveSets; Be::Time m_startTime; diff --git a/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp b/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp index 0e8c8b2f9..0e7f9b9a0 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildAudio.cpp @@ -5,10 +5,10 @@ EveChildAudio::EveChildAudio( IRoot* lockobj ) : - m_name( "EveChildAudio" ), m_mute( false ), m_worldTransform( IdentityMatrix() ) { + m_name = BlueSharedString( "EveChildAudio" ); } bool EveChildAudio::Initialize() @@ -30,7 +30,7 @@ bool EveChildAudio::Initialize() } else { - emitterName = m_name; + emitterName = m_name.c_str(); } m_audioEmitter->Initialize( emitterName, L"", position ); @@ -68,40 +68,17 @@ bool EveChildAudio::OnModified( Be::Var* val ) } else { - SetEmitterName( m_name ); + SetEmitterName( m_name.c_str() ); } } return true; } -const char* EveChildAudio::GetName() const -{ - return m_name.c_str(); -} - -void EveChildAudio::SetName( const char* name ) -{ - m_name = name; -} - void EveChildAudio::GetLocalToWorldTransform( Matrix& transform ) const { transform = m_worldTransform; } -void EveChildAudio::Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) -{ -} - -void EveChildAudio::GetRenderables( std::vector& renderables ) -{ -} - -bool EveChildAudio::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const -{ - return false; -} - void EveChildAudio::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) { Matrix localToWorldTransform; @@ -130,10 +107,6 @@ void EveChildAudio::UpdateSyncronous( const EveUpdateContext& updateContext, con } } -void EveChildAudio::UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) -{ -} - void EveChildAudio::SetEmitterName( const std::string& name ) { if( m_audioEmitter ) @@ -142,14 +115,6 @@ void EveChildAudio::SetEmitterName( const std::string& name ) } } -void EveChildAudio::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) -{ -} - -void EveChildAudio::ChangeLOD( Tr2Lod lod ) -{ -} - void EveChildAudio::GetDebugOptions( Tr2DebugRendererOptions& options ) { if( ITr2DebugRenderablePtr tmp = BlueCastPtr( m_audioEmitter ) ) diff --git a/trinity/Eve/SpaceObject/Children/EveChildAudio.h b/trinity/Eve/SpaceObject/Children/EveChildAudio.h index cbabd87cb..3b626c383 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildAudio.h +++ b/trinity/Eve/SpaceObject/Children/EveChildAudio.h @@ -3,7 +3,7 @@ #ifndef EVE_CHILD_AUDIO_H #define EVE_CHILD_AUDIO_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #ifdef BLUE_USE_LOCAL_ITr2DebugRenderer2 @@ -27,7 +27,7 @@ BLUE_DECLARE( EveChildAudio ); * @brief Audio emitter that can be added as a child to EveChildContainer. */ BLUE_CLASS( EveChildAudio ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public IInitialize, public INotify, @@ -73,24 +73,15 @@ BLUE_CLASS( EveChildAudio ) : */ void SetEmitterName( const std::string& name ); - // Implementing the IEveSpaceObjectChild interface - const char* GetName() const; - void SetName( const char* name ); - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); - void GetRenderables( std::vector & renderables ); - bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; + // Implementing the EveSpaceObjectChild interface void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); - void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void GetLocalToWorldTransform( Matrix & transform ) const; - void ChangeLOD( Tr2Lod lod ); - void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); // ITr2DebugRenderable virtual void GetDebugOptions( Tr2DebugRendererOptions & options ) override; virtual void RenderDebugInfo( ITr2DebugRenderer2 & renderer ) override; private: - std::string m_name; ///< The name identifier for this audio child. Matrix m_worldTransform; ///< Cached world transformation matrix. bool m_mute; ///< Whether audio playback is muted. ITr2AudEmitterPtr m_audioEmitter; ///< The audio emitter instance. diff --git a/trinity/Eve/SpaceObject/Children/EveChildAudio_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildAudio_Blue.cpp index a156c15ed..1aeb552ad 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildAudio_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildAudio_Blue.cpp @@ -10,6 +10,7 @@ const Be::ClassInfo* EveChildAudio::ExposeToBlue() EXPOSURE_BEGIN( EveChildAudio, "Audio emitter space object child" ) MAP_INTERFACE( EveChildAudio ) MAP_INTERFACE( IEveSpaceObjectChild ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IInitialize ) MAP_INTERFACE( INotify ) @@ -20,5 +21,8 @@ const Be::ClassInfo* EveChildAudio::ExposeToBlue() MAP_METHOD_AND_WRAP( "SetEmitterName", SetEmitterName, "Sets emitter name" ) MAP_METHOD_AND_WRAP( "__init__", py__init__, "Initialize the audio emitter after contruction/deserialization" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.cpp b/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.cpp index 0a2c09176..2cb9b827f 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.cpp @@ -578,7 +578,7 @@ std::vector> EveChildBehaviorSystem::GetVertexElementAddedTh ///////////////////////////////////////////////////////////////////////////////////// -// IEveSpaceObjectChild +// EveSpaceObjectChild void EveChildBehaviorSystem::UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) { Matrix localToWorldTransform; @@ -615,11 +615,6 @@ void EveChildBehaviorSystem::UpdateAsyncronous( const EveUpdateContext& updateCo m_hasUpdated = true; } -const char* EveChildBehaviorSystem::GetName() const -{ - return m_name; -} - void EveChildBehaviorSystem::Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) { EveChildTransform::Setup( scale, rotation, translation, lowestLodVisible ); @@ -648,10 +643,6 @@ void EveChildBehaviorSystem::GetRenderables( std::vector& rende } } -void EveChildBehaviorSystem::SetName( const char* name ) -{ -} - void EveChildBehaviorSystem::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) { if( !m_display ) @@ -665,11 +656,6 @@ void EveChildBehaviorSystem::UpdateVisibility( const EveUpdateContext& updateCon } } -bool EveChildBehaviorSystem::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const -{ - return true; -} - bool EveChildBehaviorSystem::GetInstanceBufferBoundingBox( unsigned int bufferIndex, Vector3& minBounds, Vector3& maxBounds ) const { return false; @@ -679,10 +665,6 @@ void EveChildBehaviorSystem::GetLocalToWorldTransform( Matrix& transform ) const { } -void EveChildBehaviorSystem::ChangeLOD( Tr2Lod lod ) -{ -} - void EveChildBehaviorSystem::RegisterComponents() { if( !m_display ) diff --git a/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.h b/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.h index a5a4b4fe3..dcbbac7be 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.h +++ b/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem.h @@ -8,7 +8,7 @@ #include "Behaviors/BehaviorGroup.h" #include "Behaviors/SplineTunnelGroup.h" #include "Tr2DeviceResource.h" -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "TriRenderBatch.h" #include "ITr2Renderable.h" @@ -22,7 +22,7 @@ BLUE_DECLARE_VECTOR( BehaviorGroup ); BLUE_CLASS( EveChildBehaviorSystem ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public Tr2DeviceResource, public ITr2Renderable, public IInitialize, @@ -70,16 +70,11 @@ BLUE_CLASS( EveChildBehaviorSystem ) : { } - const char* GetName() const; - void SetName( const char* name ); - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); - bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void GetLocalToWorldTransform( Matrix & transform ) const; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); - void ChangeLOD( Tr2Lod lod ); ////////////////////////////////////////////////////////////////////////////////////// // EveEntity @@ -112,7 +107,6 @@ BLUE_CLASS( EveChildBehaviorSystem ) : bool OnPrepareResources(); void PassInVertexesToBehaviorGroups(); void PassInTunnelFunctionsToBehaviorGroups(); - char* m_name; bool m_behaviorGroupLoaded; bool m_behaviorGroupLoadedForTunnel; diff --git a/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem_Blue.cpp index 7737739c7..1f34f4581 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildBehaviorSystem_Blue.cpp @@ -8,6 +8,7 @@ const Be::ClassInfo* EveChildBehaviorSystem::ExposeToBlue() { EXPOSURE_BEGIN( EveChildBehaviorSystem, "" ) MAP_INTERFACE( EveChildBehaviorSystem ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( INotify ) @@ -30,5 +31,8 @@ const Be::ClassInfo* EveChildBehaviorSystem::ExposeToBlue() GetVertexElementAddedThroughCode, "for validation and objects requiring vertex elements added to the shader through code\n:jessica-hidden: True" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.cpp b/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.cpp index ddb989ae1..062f2e4d2 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.cpp @@ -77,18 +77,6 @@ bool EveChildBulletStorm::OnModified( Be::Var* val ) return true; } -// -------------------------------------------------------------------------------- -const char* EveChildBulletStorm::GetName() const -{ - return m_name.c_str(); -} - -// -------------------------------------------------------------------------------- -void EveChildBulletStorm::SetName( const char* name ) -{ - m_name = name; -} - // -------------------------------------------------------------------------------- // Description: // Trinity's way of rendering @@ -223,14 +211,6 @@ bool EveChildBulletStorm::GetBoundingSphere( Vector4& sphere, BoundingSphereQuer return true; } -// -------------------------------------------------------------------------------- -// Description: -// Syncronous updates happen here -// -------------------------------------------------------------------------------- -void EveChildBulletStorm::UpdateSyncronous( const EveUpdateContext&, const EveChildUpdateParams& ) -{ -} - void EveChildBulletStorm::StartEffect() { m_clipShereMul = 1.0f; @@ -317,14 +297,6 @@ void EveChildBulletStorm::GetLocalToWorldTransform( Matrix& transform ) const transform = m_worldTransform; } -// -------------------------------------------------------------------------------- -// Description: -// Used by state machine to animate state-related stuff -// -------------------------------------------------------------------------------- -void EveChildBulletStorm::Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) -{ -} - // -------------------------------------------------------------------------------- // Description: // Nothing transparent here, all additive! diff --git a/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.h b/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.h index f78c16289..52f1c3df3 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.h +++ b/trinity/Eve/SpaceObject/Children/EveChildBulletStorm.h @@ -4,7 +4,7 @@ #ifndef EveChildBulletStorm_H #define EveChildBulletStorm_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "ITr2Renderable.h" #include "Eve/SpaceObject/EveSpaceObject2.h" @@ -34,7 +34,7 @@ class EveChildBulletStormPerObjectData : public Tr2PerObjectData // A spaceobject child for rendering swarm like bullets // -------------------------------------------------------------------------------- BLUE_CLASS( EveChildBulletStorm ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public ITr2Renderable, public Tr2DeviceResource, public INotify, @@ -55,19 +55,11 @@ BLUE_CLASS( EveChildBulletStorm ) : bool OnModified( Be::Var * val ); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) - { - } + // EveSpaceObjectChild void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; - void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void GetLocalToWorldTransform( Matrix & transform ) const; - void ChangeLOD( Tr2Lod lod ) {}; - void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); ///////////////////////////////////////////////////////////////////////////////////// // ITr2Renderable @@ -93,7 +85,6 @@ BLUE_CLASS( EveChildBulletStorm ) : private: // general data - std::string m_name; bool m_display; // Has UpdateSyncronous/UpdateAsyncronous been called: until it has, the object cannot be rendered bool m_hasUpdated = false; diff --git a/trinity/Eve/SpaceObject/Children/EveChildBulletStorm_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildBulletStorm_Blue.cpp index 86ba7b4a1..8b51cae94 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildBulletStorm_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildBulletStorm_Blue.cpp @@ -9,6 +9,7 @@ const Be::ClassInfo* EveChildBulletStorm::ExposeToBlue() { EXPOSURE_BEGIN( EveChildBulletStorm, "" ) MAP_INTERFACE( EveChildBulletStorm ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( INotify ) @@ -35,5 +36,8 @@ const Be::ClassInfo* EveChildBulletStorm::ExposeToBlue() MAP_METHOD_AND_WRAP( "StopEffect", StopEffect, "Stop Effect" ) MAP_METHOD_AND_WRAP( "CanChangeState", CanChangeState, "Can start or stop the effect without visual errors?" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildCloud.cpp b/trinity/Eve/SpaceObject/Children/EveChildCloud.cpp index c80462793..83fb8f5ca 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildCloud.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildCloud.cpp @@ -208,16 +208,6 @@ bool EveChildCloud::OnModified( Be::Var* value ) return true; } -const char* EveChildCloud::GetName() const -{ - return m_name.c_str(); -} - -void EveChildCloud::SetName( const char* name ) -{ - m_name = name; -} - void EveChildCloud::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) { auto& frustum = updateContext.GetFrustum(); diff --git a/trinity/Eve/SpaceObject/Children/EveChildCloud.h b/trinity/Eve/SpaceObject/Children/EveChildCloud.h index f6c107e28..27bfa4671 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildCloud.h +++ b/trinity/Eve/SpaceObject/Children/EveChildCloud.h @@ -6,7 +6,7 @@ #include "ITr2Renderable.h" #include "Eve/IEveSpaceObject2.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Tr2ShLightingManager.h" #include "Tr2DebugRenderer.h" @@ -24,7 +24,7 @@ BLUE_CLASS( EveChildCloud ) : public Tr2DeviceResource, public IInitialize, public INotify, - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public ITr2DebugRenderable { public: @@ -42,19 +42,13 @@ BLUE_CLASS( EveChildCloud ) : virtual bool OnModified( Be::Var * value ); ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - virtual const char* GetName() const; - virtual void SetName( const char* name ); + // EveSpaceObjectChild virtual void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); virtual void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); virtual void GetLocalToWorldTransform( Matrix & transform ) const; virtual void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); virtual void GetRenderables( std::vector & renderables ); virtual bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; - virtual void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) - { - } - virtual void ChangeLOD( Tr2Lod lod ) {}; ///////////////////////////////////////////////////////////////////////////////////// // ITr2Renderable @@ -94,7 +88,6 @@ BLUE_CLASS( EveChildCloud ) : Tr2BufferAL m_vertexBuffer; TrackableStdVector m_indexBuffers; - std::string m_name; bool m_display; bool m_isVisible; // Has UpdateSyncronous/UpdateAsyncronous been called: until it has, the object cannot be rendered diff --git a/trinity/Eve/SpaceObject/Children/EveChildCloud2.cpp b/trinity/Eve/SpaceObject/Children/EveChildCloud2.cpp index 3e48803ae..ba6334b74 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildCloud2.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildCloud2.cpp @@ -205,24 +205,6 @@ bool EveChildCloud2::OnModified( Be::Var* value ) return true; } -const char* EveChildCloud2::GetName() const -{ - return m_name.c_str(); -} - -void EveChildCloud2::SetName( const char* name ) -{ - m_name = name; -} - -void EveChildCloud2::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) -{ -} - -void EveChildCloud2::GetRenderables( std::vector& ) -{ -} - bool EveChildCloud2::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery ) const { sphere = Vector4( m_boundingSphere.center, m_boundingSphere.radius ); diff --git a/trinity/Eve/SpaceObject/Children/EveChildCloud2.h b/trinity/Eve/SpaceObject/Children/EveChildCloud2.h index 9dce9cbbb..d641b48f4 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildCloud2.h +++ b/trinity/Eve/SpaceObject/Children/EveChildCloud2.h @@ -4,7 +4,7 @@ #include "ITr2Renderable.h" #include "Eve/IEveSpaceObject2.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Tr2DebugRenderer.h" #include "Tr2DepthStencil.h" #include "TriFrustumOrtho.h" @@ -27,12 +27,12 @@ BLUE_DECLARE( Tr2TextureAnimation ); // plane at the back of the object's bounding sphere using provided effect. // -------------------------------------------------------------------------------- BLUE_CLASS( EveChildCloud2 ) : + public EveSpaceObjectChild, public ITr2VolumetricRenderable, public Tr2DeviceResource, public IInitialize, public INotify, public IListNotify, - public IEveSpaceObjectChild, public ITr2DebugRenderable, public ITr2Renderable, public ITr2LightOwner, @@ -57,21 +57,11 @@ BLUE_CLASS( EveChildCloud2 ) : void OnListModified( long event, ssize_t key, ssize_t key2, IRoot* value, const struct IList* theList ) override; ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - virtual const char* GetName() const override; - virtual void SetName( const char* name ) override; + // EveSpaceObjectChild virtual void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; virtual void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; virtual void GetLocalToWorldTransform( Matrix & transform ) const override; - virtual void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override; - virtual void GetRenderables( std::vector & renderables ) override; virtual bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const override; - virtual void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) override - { - } - virtual void ChangeLOD( Tr2Lod lod ) override - { - } ////////////////////////////////////////////////////////////////////////////////////// // ITr2LightOwner @@ -189,7 +179,6 @@ BLUE_CLASS( EveChildCloud2 ) : Tr2DepthStencilPtr m_shadowMapDS; TriVariable* m_depthShadowMapHandle; - std::string m_name; bool m_display; bool m_castShadows; bool m_receiveShadows; diff --git a/trinity/Eve/SpaceObject/Children/EveChildCloud2_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildCloud2_Blue.cpp index c4245e970..b9b921289 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildCloud2_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildCloud2_Blue.cpp @@ -15,6 +15,7 @@ const Be::ClassInfo* EveChildCloud2::ExposeToBlue() MAP_INTERFACE( IInitialize ) MAP_INTERFACE( INotify ) MAP_INTERFACE( IListNotify ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( ITr2LightOwner ) @@ -65,5 +66,8 @@ const Be::ClassInfo* EveChildCloud2::ExposeToBlue() MAP_ATTRIBUTE( "mapOffset1", m_mapOffsets[1], "Texture offset 1. Used for debugging camera-attached clouds.\n:jessica-group: Tiling", Be::READ ) MAP_ATTRIBUTE( "mapOffset2", m_mapOffsets[2], "Texture offset 2. Used for debugging camera-attached clouds.\n:jessica-group: Tiling", Be::READ ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildCloud_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildCloud_Blue.cpp index be2b2c06b..7e02f2205 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildCloud_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildCloud_Blue.cpp @@ -13,6 +13,7 @@ const Be::ClassInfo* EveChildCloud::ExposeToBlue() MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( IInitialize ) MAP_INTERFACE( INotify ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_ATTRIBUTE( "name", m_name, "The name of the cloud", Be::READWRITE | Be::PERSIST ) @@ -36,5 +37,8 @@ const Be::ClassInfo* EveChildCloud::ExposeToBlue() MAP_ATTRIBUTE( "cellScreenSize", m_cellScreenSize, "Target size of a single cell in a grid on the screen (in pixels)", Be::READWRITE | Be::PERSIST ) MAP_ATTRIBUTE( "currentLod", m_currentIB, "Current cloud LOD", Be::READ ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp b/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp index a0641cb6b..5f29c6b90 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildContainer.cpp @@ -59,10 +59,12 @@ EveChildContainer::~EveChildContainer() { controller->Unlink( UnlinkReason::DELETING ); } + UnregisterChildren( m_objects ); } bool EveChildContainer::Initialize() { + RegisterChildren( m_objects ); for( auto& controller : m_controllers ) { if( !controller->IsLinked() ) @@ -142,6 +144,8 @@ void EveChildContainer::OnListModified( long event, ssize_t key, ssize_t key2, I } else if( list == &m_objects && ( event & BELIST_LOADING ) == 0 ) { + HandleChildrenListModified( event, value, m_objects ); + if( IsInRegistry() ) { switch( event & BELIST_EVENTMASK ) @@ -314,7 +318,7 @@ void EveChildContainer::SetShaderOption( const BlueSharedString& name, const Blu { for( auto it = m_objects.begin(); it != m_objects.end(); ++it ) { - IEveSpaceObjectChild* child = *it; + EveSpaceObjectChild* child = *it; child->SetShaderOption( name, value ); } @@ -366,16 +370,6 @@ bool EveChildContainer::IsUpdating() const return ( m_display || !m_updateOnDisplay ) && ( IsRendering() || m_displayFilter == ONLY_REFLECTIONS ); } -const char* EveChildContainer::GetName() const -{ - return m_name.c_str(); -} - -void EveChildContainer::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - void EveChildContainer::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) { if( !m_display ) @@ -442,7 +436,7 @@ bool EveChildContainer::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery Vector4 bSphere( 0.f, 0.f, 0.f, -1.f ); for( auto it = m_objects.begin(); it != m_objects.end(); it++ ) { - if( ( *it )->GetBoundingSphere( bSphere ) ) + if( ( *it )->GetBoundingSphere( bSphere, EVE_BOUNDS_NORMAL ) ) { BoundingSphereSetOrUpdate( bSphere, sphere, success ); success = true; @@ -966,7 +960,7 @@ void EveChildContainer::StartControllers() } } -IEveSpaceObjectChildPtr EveChildContainer::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveChildContainer::GetEffectChildByName( const char* name ) const { for( auto it = begin( m_objects ); it != end( m_objects ); ++it ) { @@ -979,7 +973,7 @@ IEveSpaceObjectChildPtr EveChildContainer::GetEffectChildByName( const char* nam return nullptr; } -void EveChildContainer::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildContainer::AddToEffectChildrenList( EveSpaceObjectChild* child ) { auto childRoot = child->GetRootObject(); m_objects.Append( childRoot ); @@ -993,7 +987,7 @@ void EveChildContainer::AddToEffectChildrenList( IEveSpaceObjectChild* child ) } } -void EveChildContainer::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildContainer::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { auto index = m_objects.FindKey( child ); if( index >= 0 ) @@ -1111,6 +1105,30 @@ void EveChildContainer::SetProceduralContainerVariable( const char* name, float } } +void EveChildContainer::SetOwner( IEveSpaceObject2* owner ) +{ + if( GetOwner() != owner ) + { + EveSpaceObjectChild::SetOwner( owner ); + for( auto& child : m_objects ) + { + child->SetOwner( owner ); + } + } +} + +void EveChildContainer::SetPartTag( PartTag tag ) +{ + if( GetPartTag() != tag ) + { + EveSpaceObjectChild::SetPartTag( tag ); + for( auto& child : m_objects ) + { + child->SetPartTag( tag ); + } + } +} + void EveChildContainer::SetAnimationOwner( ITr2GrannyAnimationOwner* animationOwner ) { m_animationOwner = animationOwner; diff --git a/trinity/Eve/SpaceObject/Children/EveChildContainer.h b/trinity/Eve/SpaceObject/Children/EveChildContainer.h index e8bdeac85..7fa1faa73 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildContainer.h +++ b/trinity/Eve/SpaceObject/Children/EveChildContainer.h @@ -4,7 +4,7 @@ #ifndef EveChildContainer_H #define EveChildContainer_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "IEveEffectChildrenOwner.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" @@ -31,7 +31,7 @@ BLUE_DECLARE_INTERFACE( IEveFxAttribute ); BLUE_DECLARE_IVECTOR( IEveFxAttribute ); BLUE_CLASS( EveChildContainer ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2Renderable, public ITr2CurveSetOwner, @@ -66,17 +66,19 @@ BLUE_CLASS( EveChildContainer ) : virtual bool OnModified( Be::Var * val ); ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild + // EveSpaceObjectChild void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) override; bool IsAlwaysOn() const override; void AddTransformModifier( IEveChildTransformModifier * modifier ) override; void SetProceduralContainerVariable( const char* name, float value ) override; + void SetOwner( IEveSpaceObject2 * owner ) override; + void SetPartTag( PartTag tag ) override; ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); ///////////////////////////////////////////////////////////////////////////////////// // ITr2ControllerOwner @@ -111,9 +113,6 @@ BLUE_CLASS( EveChildContainer ) : uint32_t GetPerObjectDataSize( Tr2RenderContextEnum::ShaderType shaderType ) const; void UpdatePerObjectBuffer( Tr2RenderContextEnum::ShaderType shaderType, uint32_t size, void* ); - const char* GetName() const; - void SetName( const char* name ); - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -171,7 +170,7 @@ BLUE_CLASS( EveChildContainer ) : bool Empty() const; - PIEveSpaceObjectChildVector m_objects; + PEveSpaceObjectChildVector m_objects; protected: void DoUpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); @@ -183,7 +182,6 @@ BLUE_CLASS( EveChildContainer ) : bool HasRenderables() const; - BlueSharedString m_name; PTriCurveSetVector m_curveSets; PTriObserverLocalVector m_observers; PTr2LightVector m_lights; diff --git a/trinity/Eve/SpaceObject/Children/EveChildContainer_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildContainer_Blue.cpp index 9e345bbf3..42ac5b7c3 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildContainer_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildContainer_Blue.cpp @@ -5,11 +5,11 @@ Be::VarChooser EveSpaceObjectChildOriginChooser[] = { - { "SPACE", BeCast( IEveSpaceObjectChild::SPACE ), "Origin in Space" }, - { "SOF", BeCast( IEveSpaceObjectChild::SOF ), "Origin in SOF" }, + { "SPACE", BeCast( EveSpaceObjectChild::SPACE ), "Origin in Space" }, + { "SOF", BeCast( EveSpaceObjectChild::SOF ), "Origin in SOF" }, { 0 } }; -BLUE_REGISTER_ENUM_EX( "EveSpaceObjectChildOrigin", IEveSpaceObjectChild::Origin, EveSpaceObjectChildOriginChooser, ENUM_REG_ENUM_OBJECT_ON_MODULE ); +BLUE_REGISTER_ENUM_EX( "EveSpaceObjectChildOrigin", EveSpaceObjectChild::Origin, EveSpaceObjectChildOriginChooser, ENUM_REG_ENUM_OBJECT_ON_MODULE ); Be::VarChooser EveChildContainerDataSetShaderChooser[] = { { "None_", BeCast( EveChildContainer::SHADER_ALL ), "Visible to users with all shader settings" }, @@ -33,6 +33,7 @@ const Be::ClassInfo* EveChildContainer::ExposeToBlue() MAP_INTERFACE( EveChildContainer ) MAP_INTERFACE( EveEntity ) MAP_INTERFACE( ITr2LightOwner ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2CurveSetOwner ) MAP_INTERFACE( IInitialize ) @@ -106,5 +107,8 @@ const Be::ClassInfo* EveChildContainer::ExposeToBlue() StartControllers, "Start all controllers" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.cpp b/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.cpp index dc5824371..a2091ca8c 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.cpp @@ -39,6 +39,7 @@ EveChildEffectPropagator::EveChildEffectPropagator( IRoot* lockobj ) : EveChildEffectPropagator::~EveChildEffectPropagator() { + UnregisterChild( m_effect ); } @@ -130,6 +131,7 @@ void EveChildEffectPropagator::Stop() bool EveChildEffectPropagator::Initialize() { + RegisterChild( m_effect ); if( m_effect != nullptr ) { m_effect->DisableEditMode( true ); @@ -168,7 +170,7 @@ void EveChildEffectPropagator::ManageTriggers() // -------------------------------------------- // Description: -// Implements IEveSpaceObjectChild interface. +// Implements EveSpaceObjectChild interface. // -------------------------------------------- void EveChildEffectPropagator::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) { @@ -646,10 +648,12 @@ void EveChildEffectPropagator::SetEffect( EveChildInstanceContainer* effect ) { // unregister the current effect UnRegisterComponents(); + UnregisterChild( m_effect ); m_effect = effect; // register again + RegisterChild( m_effect ); RegisterComponents(); } diff --git a/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.h b/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.h index 12deb0d46..f4287aafe 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.h +++ b/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator.h @@ -98,7 +98,6 @@ BLUE_CLASS( EveChildEffectPropagator ) : float m_playTime; EveChildInstanceContainerPtr m_effect; // Child containing trigger effect - IEveSpaceObjectChildPtr m_effectShared; // Child containing shared parts of the effect (particle systems etc.) Vector3 m_effectScaling; float m_randScaleMin; diff --git a/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator_Blue.cpp index 2391292dc..deca8722c 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildEffectPropagator_Blue.cpp @@ -27,6 +27,7 @@ const Be::ClassInfo* EveChildEffectPropagator::ExposeToBlue() EXPOSURE_BEGIN( EveChildEffectPropagator, "Specialized explosion propagator object child" ) MAP_INTERFACE( EveChildEffectPropagator ) MAP_INTERFACE( EveChildContainer ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( INotify ) MAP_INTERFACE( EveEntity ) @@ -72,5 +73,8 @@ const Be::ClassInfo* EveChildEffectPropagator::ExposeToBlue() MAP_METHOD_AND_WRAP( "RebuildLocalTransform", RebuildLocalTransform, "Rebuilds local transform." ) MAP_METHOD_AND_WRAP( "Stop", Stop, "Stops effect playback.\n:jessica-favorite:\n:jessica-icon: timeline/stop.png" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildExplosion.cpp b/trinity/Eve/SpaceObject/Children/EveChildExplosion.cpp index a252e4579..a08bd47bb 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildExplosion.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildExplosion.cpp @@ -174,7 +174,7 @@ void EveChildExplosion::SetGlobalExplosionOffset( const Vector3& offset ) // -------------------------------------------------------------------------------------- // Description: -// Implements IEveSpaceObjectChild interface. If the effect is playing this function +// Implements EveSpaceObjectChild interface. If the effect is playing this function // spawns explosions. // -------------------------------------------------------------------------------------- void EveChildExplosion::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) @@ -224,7 +224,7 @@ void EveChildExplosion::UpdateSyncronous( const EveUpdateContext& updateContext, { if( m_globalExplosionInstances.empty() ) { - IEveSpaceObjectChildPtr instance; + EveSpaceObjectChildPtr instance; if( BeClasses->CopyTo( m_globalExplosion, (IRoot**)&instance.p ) ) { Quaternion rotation = Quaternion( 0.0, 0.0, 0.0, 1.0 ); @@ -261,7 +261,7 @@ void EveChildExplosion::UpdateSyncronous( const EveUpdateContext& updateContext, for( auto it = m_globalExplosions.begin(); it != m_globalExplosions.end(); ++it ) { auto globalExplosion = ( *it ); - IEveSpaceObjectChildPtr instance; + EveSpaceObjectChildPtr instance; if( BeClasses->CopyTo( globalExplosion, (IRoot**)&instance.p ) ) { m_globalExplosionContainer->m_objects.Append( instance ); @@ -460,7 +460,7 @@ void EveChildExplosion::SpawnLocalExplosion( const Matrix& transform ) { return; } - IEveSpaceObjectChildPtr instance; + EveSpaceObjectChildPtr instance; Transform t; Vector3 scale; diff --git a/trinity/Eve/SpaceObject/Children/EveChildExplosion.h b/trinity/Eve/SpaceObject/Children/EveChildExplosion.h index 42953d774..4362c0319 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildExplosion.h +++ b/trinity/Eve/SpaceObject/Children/EveChildExplosion.h @@ -74,14 +74,14 @@ BLUE_CLASS( EveChildExplosion ) : // Child containing local explosion effect - IEveSpaceObjectChildPtr m_localExplosion; - PIEveSpaceObjectChildVector m_localExplosions; + EveSpaceObjectChildPtr m_localExplosion; + PEveSpaceObjectChildVector m_localExplosions; // Child containing shared parts of the local explosion effect (particle systems etc.) - IEveSpaceObjectChildPtr m_localExplosionShared; + EveSpaceObjectChildPtr m_localExplosionShared; // Child containing global explosion effect - IEveSpaceObjectChildPtr m_globalExplosion; - PIEveSpaceObjectChildVector m_globalExplosions; - PIEveSpaceObjectChildVector m_globalExplosionInstances; + EveSpaceObjectChildPtr m_globalExplosion; + PEveSpaceObjectChildVector m_globalExplosions; + PEveSpaceObjectChildVector m_globalExplosionInstances; EveChildContainerPtr m_globalExplosionContainer; // Transforms for local explosions diff --git a/trinity/Eve/SpaceObject/Children/EveChildExplosion_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildExplosion_Blue.cpp index 4a8777e78..e694d8237 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildExplosion_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildExplosion_Blue.cpp @@ -12,6 +12,7 @@ const Be::ClassInfo* EveChildExplosion::ExposeToBlue() MAP_INTERFACE( EveChildExplosion ) MAP_INTERFACE( EveChildContainer ) MAP_INTERFACE( EveEntity ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_ATTRIBUTE( "name", m_name, "", Be::READWRITE | Be::PERSIST ) @@ -141,5 +142,8 @@ const Be::ClassInfo* EveChildExplosion::ExposeToBlue() "Sets the global explosion offset.\n" ":param offset: Vector3 that to be used as the global explosion offset should be in local coordinates" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildFogVolume.cpp b/trinity/Eve/SpaceObject/Children/EveChildFogVolume.cpp index 15f13fbe3..92f9dafbd 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildFogVolume.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildFogVolume.cpp @@ -77,21 +77,7 @@ void EveChildFogVolume::UnRegisterComponents() } ///////////////////////////////////////////////////////////////////////////////////// -// IEveSpaceObjectChild -const char* EveChildFogVolume::GetName() const -{ - return m_name.c_str(); -} - -void EveChildFogVolume::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - -void EveChildFogVolume::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) -{ -} - +// EveSpaceObjectChild bool EveChildFogVolume::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const { sphere.GetXYZ() = m_boundingSphere.center; @@ -100,10 +86,6 @@ bool EveChildFogVolume::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery return true; } -void EveChildFogVolume::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) -{ -} - void EveChildFogVolume::UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) { UpdateTransformFromParent( params ); diff --git a/trinity/Eve/SpaceObject/Children/EveChildFogVolume.h b/trinity/Eve/SpaceObject/Children/EveChildFogVolume.h index 9e1d49362..86293a9f2 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildFogVolume.h +++ b/trinity/Eve/SpaceObject/Children/EveChildFogVolume.h @@ -2,7 +2,7 @@ #pragma once -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "ITr2Renderable.h" #include "Tr2DebugRenderer.h" @@ -14,7 +14,7 @@ BLUE_DECLARE_IVECTOR( IEveVolume ); BLUE_CLASS( EveChildFogVolume ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public IInitialize, public ITr2DebugRenderable, @@ -29,19 +29,12 @@ BLUE_CLASS( EveChildFogVolume ) : void RebuildBoundingSphere(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const override; - void SetName( const char* name ) override; - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override; - void GetRenderables( std::vector & renderables ) override{}; + // EveSpaceObjectChild bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query ) const override; - void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void GetLocalToWorldTransform( Matrix & transform ) const override; - void ChangeLOD( Tr2Lod lod ) override {}; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) override; bool IsAlwaysOn() const override; - void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) override {}; void RegisterComponents() override; void UnRegisterComponents() override; @@ -62,7 +55,6 @@ BLUE_CLASS( EveChildFogVolume ) : private: void UpdateTransformFromParent( const EveChildUpdateParams& params ); - BlueSharedString m_name; PIEveVolumeVector m_volumes; float m_intensity; diff --git a/trinity/Eve/SpaceObject/Children/EveChildFogVolume_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildFogVolume_Blue.cpp index 76f0c2582..cf5c6097c 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildFogVolume_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildFogVolume_Blue.cpp @@ -11,6 +11,7 @@ const Be::ClassInfo* EveChildFogVolume::ExposeToBlue() EXPOSURE_BEGIN( EveChildFogVolume, "" ) MAP_INTERFACE( ITr2FroxelFogSettings ) MAP_INTERFACE( EveEntity ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( IInitialize ) @@ -54,6 +55,8 @@ const Be::ClassInfo* EveChildFogVolume::ExposeToBlue() MAP_ATTRIBUTE( "boundingSphereCenter", m_boundingSphere.center, "", Be::READ ) MAP_ATTRIBUTE( "boundingSphereRadius", m_boundingSphere.radius, "", Be::READ ) MAP_ATTRIBUTE( "volumes", m_volumes, "", Be::READ | Be::PERSIST ) - + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp index 0d67cf3f0..e20b56091 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp @@ -54,16 +54,8 @@ EveChildInstanceContainer::EveChildInstanceContainer( IRoot* lockobj ) : EveChildInstanceContainer::~EveChildInstanceContainer() { -} - -const char* EveChildInstanceContainer::GetName() const -{ - return m_name.c_str(); -} - -void EveChildInstanceContainer::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); + UnregisterChildren( m_instances ); + UnregisterChild( m_source ); } bool EveChildInstanceContainer::OnModified( Be::Var* value ) @@ -121,25 +113,27 @@ void EveChildInstanceContainer::UnRegisterComponents() } } -void EveChildInstanceContainer::SetSourceEffect( IEveSpaceObjectChildPtr sourceEffect ) +void EveChildInstanceContainer::SetSourceEffect( EveSpaceObjectChildPtr sourceEffect ) { SetSource( sourceEffect ); m_reset = true; } -IEveSpaceObjectChildPtr EveChildInstanceContainer::GetSource() +EveSpaceObjectChildPtr EveChildInstanceContainer::GetSource() { return m_source; } -void EveChildInstanceContainer::SetSource( IEveSpaceObjectChild* source ) +void EveChildInstanceContainer::SetSource( EveSpaceObjectChild* source ) { auto registry = GetComponentRegistry(); if( EveEntityPtr entity = BlueCastPtr( m_source ) ) { entity->UnRegister( registry ); } + UnregisterChild( m_source ); m_source = source; + RegisterChild( m_source ); if( m_instances.empty() && !m_disableEditMode ) { if( EveEntityPtr entity = BlueCastPtr( m_source ) ) @@ -247,7 +241,7 @@ void EveChildInstanceContainer::CreateInstance( const Vector3& scale, const Quat EveChildContainerPtr translationParent; translationParent.CreateInstance(); - IEveSpaceObjectChildPtr instance; + EveSpaceObjectChildPtr instance; if( !BeClasses->CopyTo( m_source, (IRoot**)&instance ) ) { @@ -280,14 +274,20 @@ void EveChildInstanceContainer::CreateInstance( const Vector3& scale, const Quat boneParent->AddToEffectChildrenList( translationParent ); boneParent->RegisterWithQuadRenderer( *Tr2QuadRenderer::Instance() ); boneParent->Register( GetComponentRegistry() ); + boneParent->SetOwner( GetOwner() ); + boneParent->SetParent( this ); + boneParent->SetPartTag( GetPartTag() ); - m_instances.Append( (IEveSpaceObjectChildPtr)boneParent ); + m_instances.Append( boneParent->GetRawRoot() ); } else { translationParent->RegisterWithQuadRenderer( *Tr2QuadRenderer::Instance() ); translationParent->Register( GetComponentRegistry() ); - m_instances.Append( (IEveSpaceObjectChildPtr)translationParent ); + translationParent->SetOwner( GetOwner() ); + translationParent->SetParent( this ); + translationParent->SetPartTag( GetPartTag() ); + m_instances.Append( translationParent->GetRawRoot() ); } return; @@ -300,7 +300,7 @@ void EveChildInstanceContainer::CreateInstance( const Vector3& scale, const Quat // -------------------------------------------------------------------------------------- void EveChildInstanceContainer::UpdateInstance( const uint32_t index, const Vector3& scale, const Quaternion& rotation, const Vector3& translation ) { - auto instance = (IEveSpaceObjectChild*)m_instances.GetAt( index ); + auto instance = static_cast( m_instances.GetAt( index ) ); if( instance == nullptr ) { return; @@ -313,9 +313,9 @@ void EveChildInstanceContainer::UpdateInstance( const uint32_t index, const Vect // A helper method to run a function on the source (if the instances are not valid) or // on the instances // Arguments: -// func - The function to run, takes a single parameter which is an IEveSpaceObjectChild* +// func - The function to run, takes a single parameter which is an EveSpaceObjectChild* // -------------------------------------------------------------------------------------- -void EveChildInstanceContainer::RunOnInstances( std::function func ) const +void EveChildInstanceContainer::RunOnInstances( std::function func ) const { if( m_instances.empty() && m_source && !m_disableEditMode ) { @@ -339,6 +339,7 @@ void EveChildInstanceContainer::DisableEditMode( bool disable ) void EveChildInstanceContainer::ClearInstanceList() { UnRegisterComponents(); + UnregisterChildren( m_instances ); m_instances.Clear(); } @@ -353,7 +354,8 @@ void EveChildInstanceContainer::PopFront() front->UnRegister( GetComponentRegistry() ); } } - + m_instances[0]->SetOwner( nullptr ); + m_instances[0]->SetParent( nullptr ); m_instances.Remove( 0 ); } } @@ -370,7 +372,7 @@ void EveChildInstanceContainer::GetRenderables( std::vector& re return; } - RunOnInstances( [&renderables]( IEveSpaceObjectChild* c ) { c->GetRenderables( renderables ); } ); + RunOnInstances( [&renderables]( EveSpaceObjectChild* c ) { c->GetRenderables( renderables ); } ); } @@ -381,7 +383,7 @@ void EveChildInstanceContainer::UpdateVisibility( const EveUpdateContext& update return; } - RunOnInstances( [&updateContext, &parentTransform, parentLod]( IEveSpaceObjectChild* c ) { c->UpdateVisibility( updateContext, parentTransform, parentLod ); } ); + RunOnInstances( [&updateContext, &parentTransform, parentLod]( EveSpaceObjectChild* c ) { c->UpdateVisibility( updateContext, parentTransform, parentLod ); } ); } void EveChildInstanceContainer::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) @@ -405,7 +407,7 @@ void EveChildInstanceContainer::UpdateSyncronous( const EveUpdateContext& update newParams.childParent = this; newParams.localToWorldTransform = m_worldTransform; - RunOnInstances( [&updateContext, &newParams]( IEveSpaceObjectChild* c ) { c->UpdateSyncronous( updateContext, newParams ); } ); + RunOnInstances( [&updateContext, &newParams]( EveSpaceObjectChild* c ) { c->UpdateSyncronous( updateContext, newParams ); } ); } void EveChildInstanceContainer::AddTransformModifier( IEveChildTransformModifier* modifier ) @@ -430,7 +432,7 @@ void EveChildInstanceContainer::UpdateAsyncronous( const EveUpdateContext& updat newParams.childParent = this; newParams.localToWorldTransform = m_worldTransform; - RunOnInstances( [&updateContext, &newParams]( IEveSpaceObjectChild* c ) { c->UpdateAsyncronous( updateContext, newParams ); } ); + RunOnInstances( [&updateContext, &newParams]( EveSpaceObjectChild* c ) { c->UpdateAsyncronous( updateContext, newParams ); } ); if( params.spaceObjectParent && !params.childParent ) @@ -458,7 +460,7 @@ bool EveChildInstanceContainer::GetBoundingSphere( Vector4& sphere, BoundingSphe return true; } - RunOnInstances( [&sphere, &query]( IEveSpaceObjectChild* c ) { c->GetBoundingSphere( sphere, query ); } ); + RunOnInstances( [&sphere, &query]( EveSpaceObjectChild* c ) { c->GetBoundingSphere( sphere, query ); } ); return true; } @@ -473,12 +475,12 @@ void EveChildInstanceContainer::RegisterWithQuadRenderer( Tr2QuadRenderer& quadR void EveChildInstanceContainer::AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) const { - RunOnInstances( [&frustum, &quadRenderer]( IEveSpaceObjectChild* c ) { c->AddQuadsToQuadRenderer( frustum, quadRenderer ); } ); + RunOnInstances( [&frustum, &quadRenderer]( EveSpaceObjectChild* c ) { c->AddQuadsToQuadRenderer( frustum, quadRenderer ); } ); } void EveChildInstanceContainer::ChangeLOD( Tr2Lod lod ) { - RunOnInstances( [&lod]( IEveSpaceObjectChild* c ) { c->ChangeLOD( lod ); } ); + RunOnInstances( [&lod]( EveSpaceObjectChild* c ) { c->ChangeLOD( lod ); } ); } void EveChildInstanceContainer::SetOrigin( Origin origin ) @@ -488,7 +490,7 @@ void EveChildInstanceContainer::SetOrigin( Origin origin ) void EveChildInstanceContainer::SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) { - RunOnInstances( [&name, &value]( IEveSpaceObjectChild* c ) { c->SetShaderOption( name, value ); } ); + RunOnInstances( [&name, &value]( EveSpaceObjectChild* c ) { c->SetShaderOption( name, value ); } ); } bool EveChildInstanceContainer::IsAlwaysOn() const @@ -509,18 +511,18 @@ void EveChildInstanceContainer::GetWorldVelocity( Vector3& velocity ) const velocity = m_worldVelocity; } -IEveSpaceObjectChildPtr EveChildInstanceContainer::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveChildInstanceContainer::GetEffectChildByName( const char* name ) const { // don't really know what to do here... return nullptr; } -void EveChildInstanceContainer::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildInstanceContainer::AddToEffectChildrenList( EveSpaceObjectChild* child ) { // do nothing for now } -void EveChildInstanceContainer::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildInstanceContainer::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { // do nothing for now } @@ -540,17 +542,17 @@ void EveChildInstanceContainer::SetControllerVariable( const char* name, float v { found->second = value; } - RunOnInstances( [&name, &value]( IEveSpaceObjectChild* c ) { c->SetControllerVariable( name, value ); } ); + RunOnInstances( [&name, &value]( EveSpaceObjectChild* c ) { c->SetControllerVariable( name, value ); } ); } void EveChildInstanceContainer::HandleControllerEvent( const char* name ) { - RunOnInstances( [name]( IEveSpaceObjectChild* c ) { c->HandleControllerEvent( name ); } ); + RunOnInstances( [name]( EveSpaceObjectChild* c ) { c->HandleControllerEvent( name ); } ); } void EveChildInstanceContainer::StartControllers() { - RunOnInstances( []( IEveSpaceObjectChild* c ) { c->StartControllers(); } ); + RunOnInstances( []( EveSpaceObjectChild* c ) { c->StartControllers(); } ); } void EveChildInstanceContainer::SetControllerVariableForInstance( const uint32_t index, const char* name, float value ) @@ -577,7 +579,7 @@ void EveChildInstanceContainer::HandleControllerEventForInstance( const uint32_t void EveChildInstanceContainer::PlayCurveSet( const std::string& name, const std::string& rangeName ) { - RunOnInstances( [&name, &rangeName]( IEveSpaceObjectChild* c ) { + RunOnInstances( [&name, &rangeName]( EveSpaceObjectChild* c ) { ITr2CurveSetOwnerPtr cso = BlueCastPtr( c->GetRootObject() ); if( cso != nullptr ) { @@ -588,7 +590,7 @@ void EveChildInstanceContainer::PlayCurveSet( const std::string& name, const std void EveChildInstanceContainer::StopCurveSet( const std::string& name ) { - RunOnInstances( [&name]( IEveSpaceObjectChild* c ) { + RunOnInstances( [&name]( EveSpaceObjectChild* c ) { ITr2CurveSetOwnerPtr cso = BlueCastPtr( c->GetRootObject() ); if( cso != nullptr ) @@ -600,7 +602,7 @@ void EveChildInstanceContainer::StopCurveSet( const std::string& name ) void EveChildInstanceContainer::UpdateCurveSet( const std::string& name, Be::Time time ) { - RunOnInstances( [&name, time]( IEveSpaceObjectChild* c ) { + RunOnInstances( [&name, time]( EveSpaceObjectChild* c ) { ITr2CurveSetOwnerPtr cso = BlueCastPtr( c->GetRootObject() ); if( cso != nullptr ) { @@ -635,7 +637,7 @@ float EveChildInstanceContainer::GetRangeDuration( const std::string& name, cons void EveChildInstanceContainer::PlayAllCurveSets() { - RunOnInstances( []( IEveSpaceObjectChild* c ) { + RunOnInstances( []( EveSpaceObjectChild* c ) { EveChildContainerPtr cc = BlueCastPtr( c->GetRootObject() ); if( cc != nullptr ) { @@ -646,7 +648,7 @@ void EveChildInstanceContainer::PlayAllCurveSets() void EveChildInstanceContainer::StopAllCurveSets() { - RunOnInstances( []( IEveSpaceObjectChild* c ) { + RunOnInstances( []( EveSpaceObjectChild* c ) { EveChildContainerPtr cc = BlueCastPtr( c->GetRootObject() ); if( cc != nullptr ) { @@ -657,7 +659,7 @@ void EveChildInstanceContainer::StopAllCurveSets() void EveChildInstanceContainer::GetDebugOptions( Tr2DebugRendererOptions& options ) { - RunOnInstances( [&options]( IEveSpaceObjectChild* c ) { + RunOnInstances( [&options]( EveSpaceObjectChild* c ) { if( auto dr = dynamic_cast( c ) ) { dr->GetDebugOptions( options ); @@ -667,10 +669,42 @@ void EveChildInstanceContainer::GetDebugOptions( Tr2DebugRendererOptions& option void EveChildInstanceContainer::RenderDebugInfo( ITr2DebugRenderer2& renderer ) { - RunOnInstances( [&renderer]( IEveSpaceObjectChild* c ) { + RunOnInstances( [&renderer]( EveSpaceObjectChild* c ) { if( auto dr = dynamic_cast( c ) ) { dr->RenderDebugInfo( renderer ); } } ); } + +void EveChildInstanceContainer::SetOwner( IEveSpaceObject2* owner ) +{ + if( GetOwner() != owner ) + { + EveSpaceObjectChild::SetOwner( owner ); + for( auto& child : m_instances ) + { + child->SetOwner( owner ); + } + if( m_source ) + { + m_source->SetOwner( owner ); + } + } +} + +void EveChildInstanceContainer::SetPartTag( PartTag tag ) +{ + if( GetPartTag() != tag ) + { + EveSpaceObjectChild::SetPartTag( tag ); + for( auto& child : m_instances ) + { + child->SetPartTag( tag ); + } + if( m_source ) + { + m_source->SetPartTag( tag ); + } + } +} diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.h b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.h index 42fce1a86..9da27de71 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.h +++ b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.h @@ -2,7 +2,7 @@ #pragma once -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "IEveEffectChildrenOwner.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" @@ -28,11 +28,11 @@ BLUE_DECLARE( EveChildInheritProperties ); // -------------------------------------------------------------------------------------- // Description: -// A child container that copies a source IEveSpaceObjectChild across locatorsets +// A child container that copies a source EveSpaceObjectChild across locatorsets // and or transforms // -------------------------------------------------------------------------------------- BLUE_CLASS( EveChildInstanceContainer ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public ITr2CurveSetOwner, public INotify, public IEveEffectChildrenOwner, @@ -53,9 +53,7 @@ BLUE_CLASS( EveChildInstanceContainer ) : float GetOwnerMaxSpeed() const; ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -73,12 +71,14 @@ BLUE_CLASS( EveChildInstanceContainer ) : void GetWorldVelocity( Vector3 & velocity ) const; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); void AddTransformModifier( IEveChildTransformModifier * modifier ) override; + void SetOwner( IEveSpaceObject2 * owner ) override; + void SetPartTag( PartTag tag ) override; ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); ///////////////////////////////////////////////////////////////////////////////////// // ITr2ControllerOwner @@ -125,19 +125,18 @@ BLUE_CLASS( EveChildInstanceContainer ) : void PopFront(); void DisableEditMode( bool disable ); - void SetSourceEffect( IEveSpaceObjectChildPtr sourceEffect ); + void SetSourceEffect( EveSpaceObjectChildPtr sourceEffect ); void AddInstanceTransform( const Vector3& scale, const Quaternion& rotation, const Vector3& translation, int32_t boneIndex = -1 ); void UpdateInstance( const uint32_t index, const Vector3& scale, const Quaternion& rotation, const Vector3& translation ); - IEveSpaceObjectChildPtr GetSource(); - void SetSource( IEveSpaceObjectChild * source ); + EveSpaceObjectChildPtr GetSource(); + void SetSource( EveSpaceObjectChild * source ); protected: void CreateInstances( IEveSpaceObject2 * parent ); - void RunOnInstances( std::function func ) const; + void RunOnInstances( std::function func ) const; protected: - BlueSharedString m_name; Vector3 m_worldVelocity; float m_ownerMaxSpeed; bool m_display; @@ -152,8 +151,8 @@ BLUE_CLASS( EveChildInstanceContainer ) : Origin m_origin; std::vector> m_controllerVariables; - IEveSpaceObjectChildPtr m_source; - PIEveSpaceObjectChildVector m_instances; + EveSpaceObjectChildPtr m_source; + PEveSpaceObjectChildVector m_instances; bool m_reset; BlueSharedString m_locatorSetName; diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer_Blue.cpp index 1dd3207d2..4dc4f8e1e 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer_Blue.cpp @@ -6,61 +6,66 @@ BLUE_DEFINE( EveChildInstanceContainer ); BLUE_DECLARE_INTERFACE( ITr2DebugRenderable ); -const Be::ClassInfo* EveChildInstanceContainer::ExposeToBlue() { +const Be::ClassInfo* EveChildInstanceContainer::ExposeToBlue() +{ EXPOSURE_BEGIN( EveChildInstanceContainer, "" ) MAP_INTERFACE( EveChildInstanceContainer ) - MAP_INTERFACE( IEveSpaceObjectChild ) - MAP_INTERFACE( ITr2CurveSetOwner ) - MAP_INTERFACE( INotify ) - MAP_INTERFACE( IEveEffectChildrenOwner ) - MAP_INTERFACE( IShaderConfigurer ) - MAP_INTERFACE( ITr2ControllerOwner ) - MAP_INTERFACE( IListNotify ) - MAP_INTERFACE( EveEntity ) + MAP_INTERFACE( EveSpaceObjectChild ) + MAP_INTERFACE( IEveSpaceObjectChild ) + MAP_INTERFACE( ITr2CurveSetOwner ) + MAP_INTERFACE( INotify ) + MAP_INTERFACE( IEveEffectChildrenOwner ) + MAP_INTERFACE( IShaderConfigurer ) + MAP_INTERFACE( ITr2ControllerOwner ) + MAP_INTERFACE( IListNotify ) + MAP_INTERFACE( EveEntity ) - MAP_ATTRIBUTE( "name", m_name, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "display", m_display, "", Be::READWRITE | Be::PERSIST | Be::NOTIFY ) - MAP_ATTRIBUTE( "alwaysOn", m_isAlwaysOn, "If false this will be hidden if a spaceobjects activation strength < 0.5. If True then it is always on.", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "name", m_name, "", Be::READWRITE | Be::PERSIST ); + MAP_ATTRIBUTE( "display", m_display, "", Be::READWRITE | Be::PERSIST | Be::NOTIFY ) + MAP_ATTRIBUTE( "alwaysOn", m_isAlwaysOn, "If false this will be hidden if a spaceobjects activation strength < 0.5. If True then it is always on.", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "inheritProperties", m_inheritProperties, "Properties inherited from the parent ship when loaded through SOF", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "origin", m_origin, "Where did this effect originate from", Be::READ ) + MAP_ATTRIBUTE( "inheritProperties", m_inheritProperties, "Properties inherited from the parent ship when loaded through SOF", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "origin", m_origin, "Where did this effect originate from", Be::READ ) - MAP_ATTRIBUTE( "translation", m_translation, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "scaling", m_scaling, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "rotation", m_rotation, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "localTransform", m_localTransform, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "worldTransform", m_worldTransform, "", Be::READ ) + MAP_ATTRIBUTE( "translation", m_translation, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "scaling", m_scaling, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "rotation", m_rotation, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "localTransform", m_localTransform, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "worldTransform", m_worldTransform, "", Be::READ ) - MAP_ATTRIBUTE( "staticTransform", m_staticTransform, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "useSRT", m_useSRT, "", Be::READWRITE | Be::PERSIST ) - MAP_ATTRIBUTE( "useStaticRotation", m_useStaticRotation, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "staticTransform", m_staticTransform, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "useSRT", m_useSRT, "", Be::READWRITE | Be::PERSIST ) + MAP_ATTRIBUTE( "useStaticRotation", m_useStaticRotation, "", Be::READWRITE | Be::PERSIST ) - MAP_METHOD_AND_WRAP( - "SetControllerVariable", - SetControllerVariable, - "Set variable for all applicable controllers\n" - ":param name: variable name\n" - ":param value: new variable value\n" ) + MAP_METHOD_AND_WRAP( + "SetControllerVariable", + SetControllerVariable, + "Set variable for all applicable controllers\n" + ":param name: variable name\n" + ":param value: new variable value\n" ) - MAP_METHOD_AND_WRAP( - "HandleControllerEvent", - HandleControllerEvent, - "Pass an event to controllers\n" - ":param name: event name" ) + MAP_METHOD_AND_WRAP( + "HandleControllerEvent", + HandleControllerEvent, + "Pass an event to controllers\n" + ":param name: event name" ) - MAP_METHOD_AND_WRAP( - "StartControllers", - StartControllers, - "Start all controllers" ) + MAP_METHOD_AND_WRAP( + "StartControllers", + StartControllers, + "Start all controllers" ) - MAP_ATTRIBUTE( "source", m_source, "The sourceObject to instance", Be::PERSISTONLY ) - MAP_PROPERTY( "source", GetSource, SetSource, "The sourceObject to instance" ) + MAP_ATTRIBUTE( "source", m_source, "The sourceObject to instance", Be::PERSISTONLY ) + MAP_PROPERTY( "source", GetSource, SetSource, "The sourceObject to instance" ) - MAP_ATTRIBUTE( "locatorSet", m_locatorSetName, "The name of the locatorset to distribute across", Be::READWRITE | Be::PERSIST | Be::NOTIFY ) - MAP_ATTRIBUTE( "reset", m_reset, "Redistributes the source", Be::READWRITE ) - MAP_ATTRIBUTE( "instances", m_instances, "The generated instances\n:jessica-skip-validation:", Be::READ ) - MAP_ATTRIBUTE( "transforms", m_transforms, "", Be::READ | Be::PERSIST ) - MAP_ATTRIBUTE( "transformModifiers", m_transformModifiers, "", Be::READ | Be::PERSIST | Be::NOTIFY ) + MAP_ATTRIBUTE( "locatorSet", m_locatorSetName, "The name of the locatorset to distribute across", Be::READWRITE | Be::PERSIST | Be::NOTIFY ) + MAP_ATTRIBUTE( "reset", m_reset, "Redistributes the source", Be::READWRITE ) + MAP_ATTRIBUTE( "instances", m_instances, "The generated instances\n:jessica-skip-validation:", Be::READ ) + MAP_ATTRIBUTE( "transforms", m_transforms, "", Be::READ | Be::PERSIST ) + MAP_ATTRIBUTE( "transformModifiers", m_transformModifiers, "", Be::READ | Be::PERSIST | Be::NOTIFY ) - EXPOSURE_END() + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) + EXPOSURE_END() }; diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer.h b/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer.h index 0a9c2929d..b08878313 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer.h +++ b/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer.h @@ -2,7 +2,7 @@ #pragma once -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" #include "TriRenderBatch.h" diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer_Blue.cpp index cb209e33b..4a97f370d 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildInstanceMeshRenderer_Blue.cpp @@ -21,6 +21,7 @@ const Be::ClassInfo* EveChildInstanceMeshRenderer::ExposeToBlue() MAP_INTERFACE( EveChildInstanceMeshRenderer ) MAP_INTERFACE( EveEntity ) MAP_INTERFACE( EveChildMesh ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( IInitialize ) @@ -42,5 +43,8 @@ const Be::ClassInfo* EveChildInstanceMeshRenderer::ExposeToBlue() MAP_METHOD_AND_WRAP( "RefreshStaticGeometry", RefreshStaticGeometry, "if static geo parameters were changed during authoring: refresh here\n:jessica-placement: TOOLBAR" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.cpp b/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.cpp index 4bc9ddbef..cc6915557 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.cpp @@ -170,16 +170,6 @@ void EveChildInstancedMeshes::PushRtGeometry( Tr2RaytracingManager& rtManager ) } -const char* EveChildInstancedMeshes::GetName() const -{ - return m_name.c_str(); -} - -void EveChildInstancedMeshes::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - void EveChildInstancedMeshes::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) { m_lastCameraFrustum = updateContext.GetFrustum(); @@ -336,10 +326,6 @@ void EveChildInstancedMeshes::Setup( const Vector3* scale, const Quaternion* rot { } -void EveChildInstancedMeshes::ChangeLOD( Tr2Lod lod ) -{ -} - void EveChildInstancedMeshes::SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) { for( auto& mesh : m_meshes ) diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.h b/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.h index 5a25e441d..6248b4aa8 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.h +++ b/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes.h @@ -2,7 +2,7 @@ #pragma once -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "../../EveInstancedMeshManager.h" BLUE_DECLARE( TriGeometryRes ); @@ -10,7 +10,7 @@ BLUE_DECLARE( Tr2Effect ); BLUE_CLASS( EveChildInstancedMeshes ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveEntity, public IBlueAsyncResNotifyTarget, public IEveShadowCaster, @@ -25,9 +25,7 @@ BLUE_CLASS( EveChildInstancedMeshes ) : ~EveChildInstancedMeshes(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const override; - void SetName( const char* name ) override; + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override; void GetRenderables( std::vector & renderables ) override; bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const override; @@ -35,7 +33,6 @@ BLUE_CLASS( EveChildInstancedMeshes ) : void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void GetLocalToWorldTransform( Matrix & transform ) const override; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) override; - void ChangeLOD( Tr2Lod lod ) override; void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) override; @@ -137,7 +134,6 @@ BLUE_CLASS( EveChildInstancedMeshes ) : void ReleaseResources( TriStorage s ) override; bool OnPrepareResources() override; - BlueSharedString m_name; Matrix m_worldTransform = IdentityMatrix(); EveSpacePerObjectData m_perObjectData; EveInstancedMeshManager::PerObjectDataHandle m_perObjectDataHandle; diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes_Blue.cpp index 59c4d83b7..0cd88e865 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildInstancedMeshes_Blue.cpp @@ -11,6 +11,7 @@ const Be::ClassInfo* EveChildInstancedMeshes::ExposeToBlue() { EXPOSURE_BEGIN( EveChildInstancedMeshes, "" ) MAP_INTERFACE( EveChildInstancedMeshes ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( EveEntity ) MAP_INTERFACE( IEveShadowCaster ) @@ -59,5 +60,8 @@ const Be::ClassInfo* EveChildInstancedMeshes::ExposeToBlue() ":param display: True to render the mesh, False to hide it\n" ":rtype: None" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.cpp b/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.cpp index 23bfe5459..3283e2fc4 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.cpp @@ -90,16 +90,6 @@ void EveChildLightingOverride::RebuildBoundingSphere() } } -const char* EveChildLightingOverride::GetName() const -{ - return m_name.c_str(); -} - -void EveChildLightingOverride::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - bool EveChildLightingOverride::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const { sphere.GetXYZ() = m_boundingSphere.center; @@ -108,10 +98,6 @@ bool EveChildLightingOverride::GetBoundingSphere( Vector4& sphere, BoundingSpher return true; } -void EveChildLightingOverride::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) -{ -} - void EveChildLightingOverride::UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) { Matrix localToWorldTransform = params.localToWorldTransform; diff --git a/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.h b/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.h index c786b7f34..a6a4980ac 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.h +++ b/trinity/Eve/SpaceObject/Children/EveChildLightingOverride.h @@ -2,7 +2,7 @@ #pragma once -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "Eve/EveEntity.h" #include "PostProcess/Tr2PostProcessEnums.h" @@ -37,7 +37,7 @@ REGISTER_COMPONENT_TYPE( "EveLightingOverride", IEveLightingOverride ); BLUE_CLASS( EveChildLightingOverride ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public IEveLightingOverride, public IInitialize, public ITr2DebugRenderable, @@ -52,19 +52,12 @@ BLUE_CLASS( EveChildLightingOverride ) : OverrideInfo GetOverrides() const override; ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const override; - void SetName( const char* name ) override; - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override {}; - void GetRenderables( std::vector & renderables ) override{}; + // EveSpaceObjectChild bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query ) const override; - void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void GetLocalToWorldTransform( Matrix & transform ) const override; - void ChangeLOD( Tr2Lod lod ) override {}; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) override; bool IsAlwaysOn() const override; - void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) override {}; void RegisterComponents() override; void UnRegisterComponents() override; @@ -82,8 +75,6 @@ BLUE_CLASS( EveChildLightingOverride ) : private: void RebuildBoundingSphere(); - BlueSharedString m_name; - OverrideInfo m_overrides; PIEveVolumeVector m_volumes; float m_intensity; diff --git a/trinity/Eve/SpaceObject/Children/EveChildLightingOverride_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildLightingOverride_Blue.cpp index 737d043e7..6c6dbe5f8 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLightingOverride_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildLightingOverride_Blue.cpp @@ -13,6 +13,7 @@ const Be::ClassInfo* EveChildLightingOverride::ExposeToBlue() { EXPOSURE_BEGIN( EveChildLightingOverride, "" ) MAP_INTERFACE( EveEntity ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( IEveLightingOverride ) MAP_INTERFACE( IInitialize ) @@ -56,5 +57,8 @@ const Be::ClassInfo* EveChildLightingOverride::ExposeToBlue() m_volumes, "The volumes that affect the light overrides", Be::READ | Be::PERSIST ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildLineSet.cpp b/trinity/Eve/SpaceObject/Children/EveChildLineSet.cpp index 843db76dd..7ccd6c3ed 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLineSet.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildLineSet.cpp @@ -186,16 +186,6 @@ void EveChildLineSet::UpdateBoundingSphere( bool reCalculateChildren ) m_boundingSphere = sphere; } -const char* EveChildLineSet::GetName() const -{ - return m_name.c_str(); -} - -void EveChildLineSet::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - void EveChildLineSet::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) { if( !m_display ) diff --git a/trinity/Eve/SpaceObject/Children/EveChildLineSet.h b/trinity/Eve/SpaceObject/Children/EveChildLineSet.h index 56146263b..61e1d2afe 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLineSet.h +++ b/trinity/Eve/SpaceObject/Children/EveChildLineSet.h @@ -2,7 +2,7 @@ #pragma once -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" #include "TriRenderBatch.h" @@ -17,8 +17,8 @@ class ChildLineSetInstancingBatch; BLUE_CLASS( EveChildLineSet ) : + public EveSpaceObjectChild, public IInitialize, - public IEveSpaceObjectChild, public Tr2DeviceResource, public ITr2Renderable, public EveChildTransform, @@ -40,9 +40,7 @@ BLUE_CLASS( EveChildLineSet ) : bool OnModified( Be::Var * value ) override; ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const override; - void SetName( const char* name ) override; + // EveSpaceObjectChild void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) override; bool IsAlwaysOn() const override; @@ -51,9 +49,7 @@ BLUE_CLASS( EveChildLineSet ) : bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const override; void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override; - void AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) const override {}; void GetRenderables( std::vector & renderables ) override; - void RegisterWithQuadRenderer( Tr2QuadRenderer & quadRenderer ) override{}; ///////////////////////////////////////////////////////////////////////////////////// // Tr2DeviceResource @@ -105,7 +101,6 @@ BLUE_CLASS( EveChildLineSet ) : void GenerateManagedPoints(); void UpdateBoundingSphere( bool reCalculateChildren = true ); - BlueSharedString m_name; Vector3 m_worldVelocity; float m_ownerMaxSpeed; diff --git a/trinity/Eve/SpaceObject/Children/EveChildLineSet_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildLineSet_Blue.cpp index 63fd188f8..b6eb83374 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLineSet_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildLineSet_Blue.cpp @@ -18,6 +18,7 @@ const Be::ClassInfo* EveChildLineSet::ExposeToBlue() { EXPOSURE_BEGIN( EveChildLineSet, "" ) MAP_INTERFACE( EveChildLineSet ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( IInitialize ) MAP_INTERFACE( INotify ) @@ -48,5 +49,8 @@ const Be::ClassInfo* EveChildLineSet::ExposeToBlue() MAP_ATTRIBUTE( "lineSet", m_lineSet, ":jessica-hidden: True", Be::READWRITE | Be::PERSIST ) MAP_ATTRIBUTE( "mesh", m_mesh, "the rendered mesh", Be::READWRITE | Be::PERSIST | Be::NOTIFY ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildLink.h b/trinity/Eve/SpaceObject/Children/EveChildLink.h index bcfeb78a3..00509a37c 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildLink.h +++ b/trinity/Eve/SpaceObject/Children/EveChildLink.h @@ -22,7 +22,7 @@ BLUE_CLASS( EveChildLink ) : ~EveChildLink(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild + // EveSpaceObjectChild void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); diff --git a/trinity/Eve/SpaceObject/Children/EveChildMesh.cpp b/trinity/Eve/SpaceObject/Children/EveChildMesh.cpp index c76586eb9..82b5a8704 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildMesh.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildMesh.cpp @@ -204,16 +204,6 @@ bool EveChildMesh::OnModified( Be::Var* val ) return true; } -const char* EveChildMesh::GetName() const -{ - return m_name.c_str(); -} - -void EveChildMesh::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - void EveChildMesh::InitializeAnimation() { if( m_animationUpdater && m_animationUpdater->GetResPath().empty() ) diff --git a/trinity/Eve/SpaceObject/Children/EveChildMesh.h b/trinity/Eve/SpaceObject/Children/EveChildMesh.h index 54d5e1b52..23fa6116a 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildMesh.h +++ b/trinity/Eve/SpaceObject/Children/EveChildMesh.h @@ -4,7 +4,7 @@ #ifndef EveChildMesh_H #define EveChildMesh_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "Eve/SpaceObject/EveSpaceObject2.h" #include "Eve/SpaceObject/Attachments/EveSpaceObjectDecal.h" @@ -54,7 +54,7 @@ enum class MorphTargetAnimationFilter : uint8_t }; BLUE_CLASS( EveChildMesh ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2Renderable, public IInitialize, @@ -78,9 +78,7 @@ BLUE_CLASS( EveChildMesh ) : ~EveChildMesh(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -205,9 +203,6 @@ BLUE_CLASS( EveChildMesh ) : std::pair GetMorphTargets( MorphTargetAnimationFilter filter ); void UpdateMorphAnimationBuffer(); - // general data - BlueSharedString m_name; - // the mesh Tr2MeshBasePtr m_mesh; Tr2InstancedMeshPtr m_instancedMesh; // Cached downcast of m_mesh diff --git a/trinity/Eve/SpaceObject/Children/EveChildMesh_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildMesh_Blue.cpp index de99e6f6a..69816dd72 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildMesh_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildMesh_Blue.cpp @@ -3,6 +3,7 @@ #include "StdAfx.h" #include "EveChildMesh.h" +BLUE_DEFINE_INTERFACE( IMultiPartObjectElement ); BLUE_DEFINE( EveChildMesh ); const Be::ClassInfo* EveChildMesh::ExposeToBlue() @@ -11,6 +12,7 @@ const Be::ClassInfo* EveChildMesh::ExposeToBlue() MAP_INTERFACE( EveChildMesh ) MAP_INTERFACE( EveEntity ) MAP_INTERFACE( IEveSpaceObjectDecalOwner ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( IInitialize ) @@ -88,5 +90,8 @@ const Be::ClassInfo* EveChildMesh::ExposeToBlue() "GetMorphTargetWeight( name )\n\n" "Returns the weight of the morph target. Returns 0 if no morph target with that name was found.\n" ":param name: morph target name\n" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.cpp b/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.cpp index 6d01b4d4e..828333e46 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.cpp @@ -68,18 +68,6 @@ EveChildParticleSphere::EveChildParticleSphere( IRoot* lockobj ) : { } -// -------------------------------------------------------------------------------- -const char* EveChildParticleSphere::GetName() const -{ - return m_name.c_str(); -} - -// -------------------------------------------------------------------------------- -void EveChildParticleSphere::SetName( const char* name ) -{ - m_name = name; -} - // ----------------------------------------------------------------------------- void EveChildParticleSphere::GetRenderables( std::vector& renderables ) { diff --git a/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.h b/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.h index 975b379a2..a771f2b60 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.h +++ b/trinity/Eve/SpaceObject/Children/EveChildParticleSphere.h @@ -2,7 +2,7 @@ #pragma once -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "ITr2Renderable.h" #include "Particle/Tr2ParticleElementDeclaration.h" @@ -13,7 +13,7 @@ BLUE_DECLARE( Tr2ParticleSystem ); class EveUpdateContext; BLUE_CLASS( EveChildParticleSphere ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public ITr2Renderable { public: @@ -23,9 +23,7 @@ BLUE_CLASS( EveChildParticleSphere ) : ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); + // EveSpaceObjectChild void GetRenderables( std::vector & renderables ); void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -33,7 +31,6 @@ BLUE_CLASS( EveChildParticleSphere ) : void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void GetLocalToWorldTransform( Matrix & transform ) const; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); - void ChangeLOD( Tr2Lod lod ) {}; ///////////////////////////////////////////////////////////////////////////////////// // ITr2Renderable @@ -66,8 +63,6 @@ BLUE_CLASS( EveChildParticleSphere ) : Matrix m_worldTransform; Vector4 m_boundingSphere; - std::string m_name; - enum { BIND_PENDING, diff --git a/trinity/Eve/SpaceObject/Children/EveChildParticleSphere_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildParticleSphere_Blue.cpp index eb533845c..d28a976bc 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildParticleSphere_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildParticleSphere_Blue.cpp @@ -9,6 +9,7 @@ const Be::ClassInfo* EveChildParticleSphere::ExposeToBlue() { EXPOSURE_BEGIN( EveChildParticleSphere, "" ) MAP_INTERFACE( EveChildParticleSphere ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) @@ -35,5 +36,8 @@ const Be::ClassInfo* EveChildParticleSphere::ExposeToBlue() MAP_ATTRIBUTE( "useSpaceObjectData", m_useSpaceObjectData, "", Be::READWRITE | Be::PERSIST ) MAP_METHOD_AND_WRAP( "Refresh", Refresh, "Re-binds particle system and re-adds particles" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.cpp b/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.cpp index 8134510ae..037c04d20 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.cpp @@ -77,16 +77,6 @@ bool EveChildParticleSystem::OnModified( Be::Var* value ) return true; } -const char* EveChildParticleSystem::GetName() const -{ - return m_name.c_str(); -} - -void EveChildParticleSystem::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - // -------------------------------------------------------------------------------- // Description: // Setup function to set data from outside, in this case just pass it to diff --git a/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.h b/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.h index d3197edac..79012e5ff 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.h +++ b/trinity/Eve/SpaceObject/Children/EveChildParticleSystem.h @@ -4,7 +4,7 @@ #ifndef EveChildParticleSystem_H #define EveChildParticleSystem_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "ITr2Renderable.h" @@ -25,7 +25,7 @@ BLUE_DECLARE_INTERFACE( ITr2GenericEmitter ); BLUE_DECLARE_IVECTOR( ITr2GenericEmitter ); BLUE_CLASS( EveChildParticleSystem ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2Renderable, public IInitialize, @@ -40,9 +40,7 @@ BLUE_CLASS( EveChildParticleSystem ) : ~EveChildParticleSystem(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -85,8 +83,6 @@ BLUE_CLASS( EveChildParticleSystem ) : PITr2GenericEmitterVector m_particleEmitters; private: - BlueSharedString m_name; - Vector4 m_boundingSphere; Vector4 m_lodSphere; diff --git a/trinity/Eve/SpaceObject/Children/EveChildParticleSystem_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildParticleSystem_Blue.cpp index 66bdaa945..dadda5153 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildParticleSystem_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildParticleSystem_Blue.cpp @@ -10,6 +10,7 @@ const Be::ClassInfo* EveChildParticleSystem::ExposeToBlue() EXPOSURE_BEGIN( EveChildParticleSystem, "" ) MAP_INTERFACE( EveChildParticleSystem ) MAP_INTERFACE( EveEntity ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( IInitialize ) @@ -70,5 +71,8 @@ const Be::ClassInfo* EveChildParticleSystem::ExposeToBlue() MAP_ATTRIBUTE( "currentScreenSize", m_currentScreenSize, "Screen size for last frame\n:jessica-group: LOD", Be::READ ) MAP_METHOD_AND_WRAP( "RebuildLocalTransform", RebuildLocalTransform, "Rebuilds local transform if useSRT is set." ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildPlug.cpp b/trinity/Eve/SpaceObject/Children/EveChildPlug.cpp index 90ab0a190..b0db45722 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildPlug.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildPlug.cpp @@ -25,10 +25,12 @@ EveChildPlug::~EveChildPlug() { controller->Unlink( UnlinkReason::DELETING ); } + UnregisterChildren( m_objects ); } bool EveChildPlug::Initialize() { + RegisterChildren( m_objects ); for( auto& controller : m_controllers ) { if( !controller->IsLinked() ) @@ -73,6 +75,7 @@ void EveChildPlug::OnListModified( long event, ssize_t key, ssize_t key2, IRoot* } else if( list == &m_objects && ( event & BELIST_LOADING ) == 0 ) { + HandleChildrenListModified( event, value, m_objects ); if( IsInRegistry() ) { switch( event & BELIST_EVENTMASK ) @@ -153,16 +156,6 @@ void EveChildPlug::UnRegisterComponents() } } -const char* EveChildPlug::GetName() const -{ - return m_name.c_str(); -} - -void EveChildPlug::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - void EveChildPlug::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) { if( !m_display ) @@ -195,7 +188,7 @@ bool EveChildPlug::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query Vector4 bSphere( 0.f, 0.f, 0.f, -1.f ); for( auto it = m_objects.begin(); it != m_objects.end(); it++ ) { - if( ( *it )->GetBoundingSphere( bSphere ) ) + if( ( *it )->GetBoundingSphere( bSphere, EVE_BOUNDS_NORMAL ) ) { BoundingSphereSetOrUpdate( bSphere, sphere, success ); success = true; @@ -271,7 +264,7 @@ void EveChildPlug::SetShaderOption( const BlueSharedString& name, const BlueShar { for( auto it = m_objects.begin(); it != m_objects.end(); ++it ) { - IEveSpaceObjectChild* child = *it; + EveSpaceObjectChild* child = *it; child->SetShaderOption( name, value ); } } @@ -426,7 +419,7 @@ void EveChildPlug::StartControllers() } } -IEveSpaceObjectChildPtr EveChildPlug::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveChildPlug::GetEffectChildByName( const char* name ) const { for( auto it = begin( m_objects ); it != end( m_objects ); ++it ) { @@ -439,7 +432,7 @@ IEveSpaceObjectChildPtr EveChildPlug::GetEffectChildByName( const char* name ) c return nullptr; } -void EveChildPlug::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildPlug::AddToEffectChildrenList( EveSpaceObjectChild* child ) { if( IsInRegistry() ) { @@ -451,7 +444,7 @@ void EveChildPlug::AddToEffectChildrenList( IEveSpaceObjectChild* child ) m_objects.Append( child->GetRootObject() ); } -void EveChildPlug::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildPlug::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { auto index = m_objects.FindKey( child ); if( index >= 0 ) @@ -505,3 +498,27 @@ ITr2AudEmitterPtr EveChildPlug::FindSoundEmitter( const char* name ) } return nullptr; } + +void EveChildPlug::SetOwner( IEveSpaceObject2* owner ) +{ + if( GetOwner() != owner ) + { + EveSpaceObjectChild::SetOwner( owner ); + for( auto& child : m_objects ) + { + child->SetOwner( owner ); + } + } +} + +void EveChildPlug::SetPartTag( PartTag tag ) +{ + if( GetPartTag() != tag ) + { + EveSpaceObjectChild::SetPartTag( tag ); + for( auto& child : m_objects ) + { + child->SetPartTag( tag ); + } + } +} diff --git a/trinity/Eve/SpaceObject/Children/EveChildPlug.h b/trinity/Eve/SpaceObject/Children/EveChildPlug.h index efdabcfb8..37b228850 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildPlug.h +++ b/trinity/Eve/SpaceObject/Children/EveChildPlug.h @@ -5,7 +5,7 @@ #define EveChildPlug_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "IEveEffectChildrenOwner.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" @@ -19,7 +19,7 @@ BLUE_DECLARE_VECTOR( Tr2ExternalParameter ); BLUE_CLASS( EveChildPlug ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2CurveSetOwner, public IInitialize, @@ -51,18 +51,15 @@ BLUE_CLASS( EveChildPlug ) : ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); ////////////////////////////////////////////////////////////////////////////////////// // EveEntity void RegisterComponents() override; void UnRegisterComponents() override; - const char* GetName() const; - void SetName( const char* name ); - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -77,6 +74,9 @@ BLUE_CLASS( EveChildPlug ) : void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); + void SetOwner( IEveSpaceObject2 * owner ) override; + void SetPartTag( PartTag tag ) override; + void PlayAllCurveSets(); void StopAllCurveSets(); void PlayCurveSet( const std::string& name, const std::string& rangeName ); @@ -102,9 +102,7 @@ BLUE_CLASS( EveChildPlug ) : ITr2AudEmitterPtr FindSoundEmitter( const char* name ) override; protected: - PIEveSpaceObjectChildVector m_objects; - - BlueSharedString m_name; + PEveSpaceObjectChildVector m_objects; PITr2ControllerVector m_controllers; std::vector> m_controllerVariables; diff --git a/trinity/Eve/SpaceObject/Children/EveChildPlug_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildPlug_Blue.cpp index 97d8b9cd5..1ce9a4105 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildPlug_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildPlug_Blue.cpp @@ -10,6 +10,7 @@ const Be::ClassInfo* EveChildPlug::ExposeToBlue() { EXPOSURE_BEGIN( EveChildPlug, "\n:jessica-icon: plug\n:jessica-icon-color: (123, 28, 212)\n:jessica-help-url: https://wiki.ccpgames.com/pages/viewpage.action?spaceKey=TTL&title=Plugs+and+Sockets \n" ) MAP_INTERFACE( EveChildPlug ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2CurveSetOwner ) MAP_INTERFACE( IInitialize ) @@ -44,5 +45,8 @@ const Be::ClassInfo* EveChildPlug::ExposeToBlue() StartControllers, "Start all controllers" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.cpp b/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.cpp index d82375bf8..af7e266ce 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.cpp @@ -70,20 +70,7 @@ void EveChildPostProcessVolume::UnRegisterComponents() } ///////////////////////////////////////////////////////////////////////////////////// -// IEveSpaceObjectChild -const char* EveChildPostProcessVolume::GetName() const -{ - return m_name.c_str(); -} - -void EveChildPostProcessVolume::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - -void EveChildPostProcessVolume::UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) -{ -} +// EveSpaceObjectChild bool EveChildPostProcessVolume::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const { @@ -93,10 +80,6 @@ bool EveChildPostProcessVolume::GetBoundingSphere( Vector4& sphere, BoundingSphe return true; } -void EveChildPostProcessVolume::UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) -{ -} - void EveChildPostProcessVolume::UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) { CCP_STATS_ZONE( __FUNCTION__ ); diff --git a/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.h b/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.h index 10d33b44a..8e45a3058 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.h +++ b/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume.h @@ -3,7 +3,7 @@ #pragma once #include "StdAfx.h" -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "ITr2Renderable.h" #include "Tr2DebugRenderer.h" @@ -17,7 +17,7 @@ BLUE_DECLARE_IVECTOR( IEveVolume ); BLUE_CLASS( EveChildPostProcessVolume ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public IInitialize, public ITr2DebugRenderable, @@ -33,19 +33,12 @@ BLUE_CLASS( EveChildPostProcessVolume ) : void RebuildBoundingSphere(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); - void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); - void GetRenderables( std::vector & renderables ){}; + // EveSpaceObjectChild bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; - void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void GetLocalToWorldTransform( Matrix & transform ) const; - void ChangeLOD( Tr2Lod lod ) {}; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) override; bool IsAlwaysOn() const; - void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) {}; virtual void RegisterComponents(); virtual void UnRegisterComponents(); @@ -66,7 +59,6 @@ BLUE_CLASS( EveChildPostProcessVolume ) : private: void UpdateTransformFromParent( const EveChildUpdateParams& params ); - BlueSharedString m_name; PIEveVolumeVector m_volumes; PIEveVolumeVector m_exclusionVolumes; diff --git a/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume_Blue.cpp index 32907e00a..d0ffb1142 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildPostProcessVolume_Blue.cpp @@ -14,6 +14,7 @@ const Be::ClassInfo* EveChildPostProcessVolume::ExposeToBlue() EXPOSURE_BEGIN( EveChildPostProcessVolume, "" ) MAP_INTERFACE( ITr2PostProcessOwner ) MAP_INTERFACE( EveEntity ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( IInitialize ) @@ -24,5 +25,8 @@ const Be::ClassInfo* EveChildPostProcessVolume::ExposeToBlue() MAP_ATTRIBUTE( "exclusionVolumes", m_exclusionVolumes, "", Be::READ | Be::PERSIST ) MAP_ATTRIBUTE( "postProcessAttributes", m_postProcessAttributes, "", Be::READWRITE | Be::PERSIST ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildQuad.cpp b/trinity/Eve/SpaceObject/Children/EveChildQuad.cpp index a4a8eea7e..d7f8ea48d 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildQuad.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildQuad.cpp @@ -64,16 +64,6 @@ bool EveChildQuad::Initialize() return true; } -const char* EveChildQuad::GetName() const -{ - return m_name.c_str(); -} - -void EveChildQuad::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - // -------------------------------------------------------------------------------- // Description: // Setup function to set data from outside, in this case just pass it to @@ -100,10 +90,6 @@ void EveChildQuad::AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRen } } -void EveChildQuad::GetRenderables( std::vector& renderables ) -{ -} - bool EveChildQuad::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const { sphere = Vector4( 0.f, 0.f, 0.f, std::sqrt( 2.f ) ); diff --git a/trinity/Eve/SpaceObject/Children/EveChildQuad.h b/trinity/Eve/SpaceObject/Children/EveChildQuad.h index 926bf64e1..2c072a079 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildQuad.h +++ b/trinity/Eve/SpaceObject/Children/EveChildQuad.h @@ -4,7 +4,7 @@ #ifndef EveChildQuad_H #define EveChildQuad_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "EveChildTransform.h" #include "ITr2Renderable.h" @@ -12,7 +12,7 @@ BLUE_DECLARE( Tr2Effect ); BLUE_CLASS( EveChildQuad ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2Renderable, public IInitialize @@ -26,18 +26,14 @@ BLUE_CLASS( EveChildQuad ) : static Tr2VertexDefinition& GetQuadDefinition(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); - void GetRenderables( std::vector & renderables ); bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; void RegisterWithQuadRenderer( Tr2QuadRenderer & quadRenderer ); void AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) const; void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); void GetLocalToWorldTransform( Matrix & transform ) const; - void ChangeLOD( Tr2Lod lod ) {}; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); ///////////////////////////////////////////////////////////////////////////////////// @@ -66,7 +62,6 @@ BLUE_CLASS( EveChildQuad ) : Float_16 m_brightness[2]; }; - BlueSharedString m_name; Tr2EffectPtr m_effect; unsigned m_effectKey; Quad m_quad; diff --git a/trinity/Eve/SpaceObject/Children/EveChildQuad_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildQuad_Blue.cpp index 1e9f446a0..6bfc4db89 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildQuad_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildQuad_Blue.cpp @@ -9,6 +9,7 @@ const Be::ClassInfo* EveChildQuad::ExposeToBlue() { EXPOSURE_BEGIN( EveChildQuad, "" ) MAP_INTERFACE( EveChildQuad ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( IInitialize ) @@ -34,5 +35,8 @@ const Be::ClassInfo* EveChildQuad::ExposeToBlue() Be::READWRITE | Be::PERSIST ) MAP_ATTRIBUTE( "currentScreenSize", m_currentScreenSize, "Screen size for last frame\n:jessica-group: LOD", Be::READ ) MAP_METHOD_AND_WRAP( "RebuildLocalTransform", RebuildLocalTransform, "Rebuilds local transform if useSRT is set." ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildRef.cpp b/trinity/Eve/SpaceObject/Children/EveChildRef.cpp index 23a00cdd8..299fdb622 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildRef.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildRef.cpp @@ -16,6 +16,7 @@ EveChildRef::EveChildRef( IRoot* lockobj ) : EveChildRef::~EveChildRef() { + UnregisterChild( m_child ); } const char* EveChildRef::GetResPath() const @@ -74,16 +75,6 @@ bool EveChildRef::OnModified( Be::Var* value ) return true; } -const char* EveChildRef::GetName() const -{ - return m_name.c_str(); -} - -void EveChildRef::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - void EveChildRef::RegisterComponents() { if( IsInRegistry() && m_child != nullptr && m_display ) @@ -106,7 +97,7 @@ void EveChildRef::UnRegisterComponents() } } -IEveSpaceObjectChildPtr EveChildRef::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveChildRef::GetEffectChildByName( const char* name ) const { if( auto ref = dynamic_cast( m_child.p ) ) { @@ -115,7 +106,7 @@ IEveSpaceObjectChildPtr EveChildRef::GetEffectChildByName( const char* name ) co return nullptr; } -void EveChildRef::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildRef::AddToEffectChildrenList( EveSpaceObjectChild* child ) { if( auto ref = dynamic_cast( m_child.p ) ) { @@ -123,7 +114,7 @@ void EveChildRef::AddToEffectChildrenList( IEveSpaceObjectChild* child ) } } -void EveChildRef::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildRef::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { if( auto ref = dynamic_cast( m_child.p ) ) { @@ -163,7 +154,7 @@ bool EveChildRef::GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query { bool success = false; Vector4 bSphere( 0.f, 0.f, 0.f, -1.f ); - if( m_child && m_child->GetBoundingSphere( bSphere ) ) + if( m_child && m_child->GetBoundingSphere( bSphere, EVE_BOUNDS_NORMAL ) ) { BoundingSphereSetOrUpdate( bSphere, sphere, success ); success = true; @@ -352,14 +343,16 @@ bool EveChildRef::LoadChild() { // unregister the old child UnRegisterComponents(); + UnregisterChild( m_child ); CCP_LOG( "Loading child red file %s", m_resPath.c_str() ); - m_child = BeResMan->LoadObject( m_resPath.c_str() ); + m_child = BeResMan->LoadObject( m_resPath.c_str() ); if( !m_child ) { CCP_LOGERR( "Red file %s is invalid or not an Eve Child type.", m_resPath.c_str() ); return false; } + RegisterChild( m_child ); RegisterComponents(); @@ -373,4 +366,28 @@ ITr2AudEmitterPtr EveChildRef::FindSoundEmitter( const char* name ) return owner->FindSoundEmitter( name ); } return nullptr; -} \ No newline at end of file +} + +void EveChildRef::SetOwner( IEveSpaceObject2* owner ) +{ + if( GetOwner() != owner ) + { + EveSpaceObjectChild::SetOwner( owner ); + if( m_child ) + { + m_child->SetOwner( owner ); + } + } +} + +void EveChildRef::SetPartTag( PartTag tag ) +{ + if( GetPartTag() != tag ) + { + EveSpaceObjectChild::SetPartTag( tag ); + if( m_child ) + { + m_child->SetPartTag( tag ); + } + } +} diff --git a/trinity/Eve/SpaceObject/Children/EveChildRef.h b/trinity/Eve/SpaceObject/Children/EveChildRef.h index 1ef6ca39d..20b241190 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildRef.h +++ b/trinity/Eve/SpaceObject/Children/EveChildRef.h @@ -5,7 +5,7 @@ #define EveChildRef_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "IEveEffectChildrenOwner.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" @@ -16,7 +16,7 @@ BLUE_CLASS( EveChildRef ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2CurveSetOwner, public IInitialize, @@ -52,16 +52,11 @@ BLUE_CLASS( EveChildRef ) : void RegisterComponents() override; void UnRegisterComponents() override; - ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); - ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); void SetProceduralContainerVariable( const char* name, float value ) override; void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); @@ -79,6 +74,9 @@ BLUE_CLASS( EveChildRef ) : void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); + void SetOwner( IEveSpaceObject2 * owner ) override; + void SetPartTag( PartTag tag ) override; + void PlayCurveSet( const std::string& name, const std::string& rangeName ); void StopCurveSet( const std::string& name ); void UpdateCurveSet( const std::string& name, Be::Time time ); @@ -104,8 +102,7 @@ BLUE_CLASS( EveChildRef ) : protected: bool LoadChild(); - IEveSpaceObjectChildPtr m_child; - BlueSharedString m_name; + EveSpaceObjectChildPtr m_child; std::string m_resPath; bool m_loadChildAutomatically; diff --git a/trinity/Eve/SpaceObject/Children/EveChildRef_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildRef_Blue.cpp index ed5256332..9a6999058 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildRef_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildRef_Blue.cpp @@ -10,6 +10,7 @@ const Be::ClassInfo* EveChildRef::ExposeToBlue() { EXPOSURE_BEGIN( EveChildRef, "\n:jessica-icon: alicorn\n:jessica-icon-color: (123, 28, 212)\n:jessica-help-url: https://wiki.ccpgames.com/pages/viewpage.action?spaceKey=TTL&title=Plugs+and+Sockets \n" ) MAP_INTERFACE( EveChildRef ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2CurveSetOwner ) MAP_INTERFACE( IInitialize ) @@ -62,5 +63,8 @@ const Be::ClassInfo* EveChildRef::ExposeToBlue() Reload, 1, "Reload the effect child.\n" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildSocket.cpp b/trinity/Eve/SpaceObject/Children/EveChildSocket.cpp index 8c89fb919..e35db336c 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildSocket.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildSocket.cpp @@ -15,7 +15,6 @@ EveChildSocket::EveChildSocket( IRoot* lockobj ) : PARENTLOCK( m_parameters ), m_plug(), - m_name(), m_plugResPath(), m_display( true ) { @@ -23,6 +22,7 @@ EveChildSocket::EveChildSocket( IRoot* lockobj ) : EveChildSocket::~EveChildSocket() { + UnregisterChild( m_plug ); } const char* EveChildSocket::GetPlugResPath() const @@ -236,17 +236,7 @@ void EveChildSocket::UnRegisterComponents() } -const char* EveChildSocket::GetName() const -{ - return m_name.c_str(); -} - -void EveChildSocket::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - -IEveSpaceObjectChildPtr EveChildSocket::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveChildSocket::GetEffectChildByName( const char* name ) const { if( m_plug ) { @@ -255,11 +245,11 @@ IEveSpaceObjectChildPtr EveChildSocket::GetEffectChildByName( const char* name ) return nullptr; } -void EveChildSocket::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildSocket::AddToEffectChildrenList( EveSpaceObjectChild* child ) { } -void EveChildSocket::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveChildSocket::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { } @@ -490,6 +480,7 @@ bool EveChildSocket::LoadChild() { // unregister the current child UnRegisterComponents(); + UnregisterChild( m_plug ); CCP_LOG( "Loading child red file %s", m_plugResPath.c_str() ); m_plug = BeResMan->LoadObject( m_plugResPath.c_str() ); @@ -498,6 +489,7 @@ bool EveChildSocket::LoadChild() CCP_LOGERR( "Red file %s is invalid or not an Eve Child type.", m_plugResPath.c_str() ); return false; } + RegisterChild( m_plug ); RegisterComponents(); @@ -512,3 +504,27 @@ ITr2AudEmitterPtr EveChildSocket::FindSoundEmitter( const char* name ) } return nullptr; } + +void EveChildSocket::SetOwner( IEveSpaceObject2* owner ) +{ + if( GetOwner() != owner ) + { + EveSpaceObjectChild::SetOwner( owner ); + if( m_plug ) + { + m_plug->SetOwner( owner ); + } + } +} + +void EveChildSocket::SetPartTag( PartTag tag ) +{ + if( GetPartTag() != tag ) + { + EveSpaceObjectChild::SetPartTag( tag ); + if( m_plug ) + { + m_plug->SetPartTag( tag ); + } + } +} diff --git a/trinity/Eve/SpaceObject/Children/EveChildSocket.h b/trinity/Eve/SpaceObject/Children/EveChildSocket.h index 0827ae425..225de887f 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildSocket.h +++ b/trinity/Eve/SpaceObject/Children/EveChildSocket.h @@ -4,7 +4,7 @@ #ifndef EveChildSocket_H #define EveChildSocket_H -#include "IEveSpaceObjectChild.h" +#include "EveSpaceObjectChild.h" #include "IEveEffectChildrenOwner.h" #include "EveChildTransform.h" #include "Tr2DebugRenderer.h" @@ -19,7 +19,7 @@ BLUE_DECLARE_IVECTOR( IEveSocketParameter ); BLUE_CLASS( EveChildSocket ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2CurveSetOwner, public IInitialize, @@ -52,16 +52,11 @@ BLUE_CLASS( EveChildSocket ) : // INotify virtual bool OnModified( Be::Var * value ); - ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); - ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); ////////////////////////////////////////////////////////////////////////////////////// // EveEntity @@ -82,6 +77,9 @@ BLUE_CLASS( EveChildSocket ) : void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); + void SetOwner( IEveSpaceObject2 * owner ) override; + void SetPartTag( PartTag tag ) override; + void PlayAllCurveSets(); void StopAllCurveSets(); void PlayCurveSet( const std::string& name, const std::string& rangeName ); @@ -109,7 +107,6 @@ BLUE_CLASS( EveChildSocket ) : EveChildPlugPtr m_plug; - BlueSharedString m_name; std::string m_plugResPath; bool m_display; diff --git a/trinity/Eve/SpaceObject/Children/EveChildSocket_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveChildSocket_Blue.cpp index 109731c0e..2aaf872c1 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildSocket_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildSocket_Blue.cpp @@ -10,6 +10,7 @@ const Be::ClassInfo* EveChildSocket::ExposeToBlue() { EXPOSURE_BEGIN( EveChildSocket, "\n:jessica-icon:blender-phone\n:jessica-icon-color: (123, 28, 212)\n:jessica-help-url: https://wiki.ccpgames.com/pages/viewpage.action?spaceKey=TTL&title=Plugs+and+Sockets \n" ) MAP_INTERFACE( EveChildSocket ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2CurveSetOwner ) MAP_INTERFACE( IInitialize ) @@ -69,5 +70,8 @@ const Be::ClassInfo* EveChildSocket::ExposeToBlue() ":jessica-placement:\n" ":jessica-icon: far-sync\n" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveChildSpherePin.h b/trinity/Eve/SpaceObject/Children/EveChildSpherePin.h index 3b9f501a3..0317a23b5 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildSpherePin.h +++ b/trinity/Eve/SpaceObject/Children/EveChildSpherePin.h @@ -37,7 +37,7 @@ BLUE_CLASS( EveChildSpherePin ) : ~EveChildSpherePin(); ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild + // EveSpaceObjectChild void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; Tr2PerObjectData* GetPerObjectData( ITriRenderBatchAccumulator * accumulator ); diff --git a/trinity/Eve/SpaceObject/Children/IEveEffectChildrenOwner.h b/trinity/Eve/SpaceObject/Children/IEveEffectChildrenOwner.h index b7a510709..d5aa1b5f9 100644 --- a/trinity/Eve/SpaceObject/Children/IEveEffectChildrenOwner.h +++ b/trinity/Eve/SpaceObject/Children/IEveEffectChildrenOwner.h @@ -3,13 +3,13 @@ #pragma once -BLUE_DECLARE_INTERFACE( IEveSpaceObjectChild ); +BLUE_DECLARE( EveSpaceObjectChild ); BLUE_INTERFACE( IEveEffectChildrenOwner ) : public IRoot { - virtual IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const = 0; - virtual void AddToEffectChildrenList( IEveSpaceObjectChild * child ) = 0; - virtual void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ) = 0; + virtual EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const = 0; + virtual void AddToEffectChildrenList( EveSpaceObjectChild * child ) = 0; + virtual void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ) = 0; }; \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h b/trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h index 8a8cd6c73..9f635f921 100644 --- a/trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h +++ b/trinity/Eve/SpaceObject/Children/IEveSpaceObjectChild.h @@ -12,6 +12,7 @@ class EveUpdateContext; class Tr2LightManager; BLUE_DECLARE_INTERFACE( IEveSpaceObjectChild ); +BLUE_DECLARE( EveSpaceObjectChild ); BLUE_DECLARE_INTERFACE( IEveChildTransformModifier ); struct EveChildUpdateParams @@ -31,7 +32,7 @@ struct EveChildUpdateParams } IEveSpaceObject2* spaceObjectParent; - IEveSpaceObjectChild* childParent; + EveSpaceObjectChild* childParent; size_t boneCount; const Float4x3* bones; float ownerMaxSpeed; @@ -42,56 +43,12 @@ struct EveChildUpdateParams Vector3 worldVelocity; }; +/** + * @brief Deprecated interface for EveSpaceObjectChild. Classes deriving from EveSpaceObjectChild should still declare + * this interface in MAP_INTERFACE macro for backward compatibility with Python code, but otherwise this interface should not be used directly. + */ BLUE_INTERFACE( IEveSpaceObjectChild ) : - public IRoot -{ - enum Origin - { - SPACE, - SOF, - }; - - virtual const char* GetName() const = 0; - virtual void SetName( const char* name ) = 0; - - virtual void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) = 0; - virtual void GetRenderables( std::vector & renderables ) = 0; - virtual bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const = 0; - virtual void RegisterWithQuadRenderer( Tr2QuadRenderer & quadRenderer ) - { - } - virtual void AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) const - { - } - - virtual void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) = 0; - virtual void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) = 0; - - virtual void GetLocalToWorldTransform( Matrix & transform ) const = 0; - - virtual bool IsAlwaysOn() const - { - return false; - }; - - virtual void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) = 0; - - virtual void ChangeLOD( Tr2Lod lod ) = 0; - - virtual void SetControllerVariable( const char* name, float value ) {}; - virtual void HandleControllerEvent( const char* name ) {}; - virtual void StartControllers() {}; - - virtual void SetProceduralContainerVariable( const char* name, float value ) {}; - - virtual void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ) {}; - - virtual void SetOrigin( Origin origin ) {}; - - virtual void AddTransformModifier( IEveChildTransformModifier * modifier ){}; - - virtual void SetMute( bool isMuted ) {}; -}; + public IRoot{}; BLUE_DECLARE_IVECTOR( IEveSpaceObjectChild ); diff --git a/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.cpp b/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.cpp index d47fb4bb0..fdcc10596 100644 --- a/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.cpp +++ b/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.cpp @@ -14,16 +14,7 @@ EveChildProceduralContainer::EveChildProceduralContainer( IRoot* lockobj ) : EveChildProceduralContainer::~EveChildProceduralContainer() { -} - -const char* EveChildProceduralContainer::GetName() const -{ - return m_name.c_str(); -} - -void EveChildProceduralContainer::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); + UnregisterChild( m_selectedObject ); } bool EveChildProceduralContainer::Initialize() @@ -60,7 +51,7 @@ bool EveChildProceduralContainer::GetBoundingSphere( Vector4& sphere, BoundingSp { bool success = false; Vector4 bSphere( 0.f, 0.f, 0.f, -1.f ); - if( m_selectedObject && m_selectedObject->GetBoundingSphere( bSphere ) ) + if( m_selectedObject && m_selectedObject->GetBoundingSphere( bSphere, EVE_BOUNDS_NORMAL ) ) { BoundingSphereSetOrUpdate( bSphere, sphere, success ); success = true; @@ -148,7 +139,9 @@ void EveChildProceduralContainer::ConfigureSelectedObject() { entity->UnRegister( registry ); } + UnregisterChild( m_selectedObject ); m_selectedObject = child; + RegisterChild( m_selectedObject ); if( EveEntityPtr entity = BlueCastPtr( m_selectedObject ) ) { entity->Register( registry ); @@ -388,4 +381,28 @@ void EveChildProceduralContainer::RenderDebugInfo( ITr2DebugRenderer2& renderer } } } +} + +void EveChildProceduralContainer::SetOwner( IEveSpaceObject2* owner ) +{ + if( GetOwner() != owner ) + { + EveSpaceObjectChild::SetOwner( owner ); + if( m_selectedObject ) + { + m_selectedObject->SetOwner( owner ); + } + } +} + +void EveChildProceduralContainer::SetPartTag( PartTag tag ) +{ + if( GetPartTag() != tag ) + { + EveSpaceObjectChild::SetPartTag( tag ); + if( m_selectedObject ) + { + m_selectedObject->SetPartTag( tag ); + } + } } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.h b/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.h index 122ee0afc..8a370b44c 100644 --- a/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.h +++ b/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer.h @@ -2,7 +2,7 @@ #pragma once -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Eve/SpaceObject/Children/IEveEffectChildrenOwner.h" #include "Eve/SpaceObject/Children/EveChildTransform.h" #include "Eve/SpaceObject/Children/TransformModifiers/IEveChildTransformModifier.h" @@ -13,7 +13,7 @@ BLUE_CLASS( EveChildProceduralContainer ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public ITr2CurveSetOwner, public IEveInheritPropertiesOwner, public EveChildTransform, @@ -31,9 +31,6 @@ BLUE_CLASS( EveChildProceduralContainer ) : EveChildProceduralContainer( IRoot* lockobj = NULL ); ~EveChildProceduralContainer(); - const char* GetName() const override; - void SetName( const char* name ) override; - void ConfigureSelectedObject(); const char* GetMethodVariableName(); @@ -50,7 +47,7 @@ BLUE_CLASS( EveChildProceduralContainer ) : void OnListModified( long event, ssize_t key, ssize_t key2, IRoot* value, const IList* list ) override; ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChildOwner + // EveSpaceObjectChildOwner void AddTransformModifier( IEveChildTransformModifier * modifier ) override; void SetProceduralContainerVariable( const char* name, float value ); @@ -71,7 +68,7 @@ BLUE_CLASS( EveChildProceduralContainer ) : void StopAllCurveSets() override; ///////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override; void GetRenderables( std::vector & renderables ) override; bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const; @@ -84,6 +81,8 @@ BLUE_CLASS( EveChildProceduralContainer ) : void ChangeLOD( Tr2Lod lod ) override; ITr2AudEmitterPtr FindSoundEmitter( const char* name ) override; void SetInheritProperties( const Color* colorSet ) override; + void SetOwner( IEveSpaceObject2 * owner ) override; + void SetPartTag( PartTag tag ) override; ////////////////////////////////////////////////////////////////////////////////////// // EveEntity @@ -100,10 +99,9 @@ BLUE_CLASS( EveChildProceduralContainer ) : void RenderDebugInfo( ITr2DebugRenderer2 & renderer ) override; protected: - IEveSpaceObjectChildPtr m_selectedObject; + EveSpaceObjectChildPtr m_selectedObject; IEveProceduralSelectionMethodPtr m_selectionMethod; - BlueSharedString m_name; PIEveChildTransformModifierVector m_transformModifiers; TrackableStdUnorderedMap m_proceduralContainerVariables; bool m_display; diff --git a/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer_Blue.cpp b/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer_Blue.cpp index e86efdcb0..3bbe124cf 100644 --- a/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/ProceduralContainer/EveChildProceduralContainer_Blue.cpp @@ -8,6 +8,7 @@ const Be::ClassInfo* EveChildProceduralContainer::ExposeToBlue() { EXPOSURE_BEGIN( EveChildProceduralContainer, "" ) MAP_INTERFACE( EveChildProceduralContainer ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2CurveSetOwner ) MAP_INTERFACE( IInitialize ) @@ -42,5 +43,8 @@ const Be::ClassInfo* EveChildProceduralContainer::ExposeToBlue() MAP_METHOD_AND_WRAP( "StartControllers", StartControllers, "Start all controllers" ) MAP_METHOD_AND_WRAP( "GetMethodVariableName", GetMethodVariableName, "Get the name of the seed variable being utilized" ) MAP_METHOD_AND_WRAP( "SetProceduralContainerVariable", SetProceduralContainerVariable, "Set variable for all applicable ProceduralContainers\n:param name: variable name\n:param value: new variable value\n" ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.cpp b/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.cpp index 2cba8fc94..6060c1338 100644 --- a/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.cpp +++ b/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.cpp @@ -13,16 +13,6 @@ EveChildSmartLightSet::EveChildSmartLightSet( IRoot* lockobj ) : m_lightGroups.SetNotify( this ); } -const char* EveChildSmartLightSet::GetName() const -{ - return m_name.c_str(); -} - -void EveChildSmartLightSet::SetName( const char* name ) -{ - m_name = name; -} - void EveChildSmartLightSet::OnListModified( long event, ssize_t key, ssize_t key2, IRoot* value, const IList* list ) { if( list == &m_lightGroups && ( event & BELIST_EVENTMASK ) == BELIST_INSERTED ) diff --git a/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.h b/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.h index a5b1b1ea2..6e87d569a 100644 --- a/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.h +++ b/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet.h @@ -3,6 +3,7 @@ #pragma once #include "../EveChildTransform.h" +#include "../EveSpaceObjectChild.h" #include "../EveChildInheritProperties.h" #include "../IEveInheritPropertiesOwner.h" #include "attributeModifiers/IEveSmartLightGroupAttributeModifier.h" @@ -14,7 +15,7 @@ BLUE_DECLARE_INTERFACE( IEveSmartLightGroup ); BLUE_DECLARE_IVECTOR( IEveSmartLightGroup ); BLUE_CLASS( EveChildSmartLightSet ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2DebugRenderable, public IEveInheritPropertiesOwner, @@ -31,22 +32,14 @@ BLUE_CLASS( EveChildSmartLightSet ) : void RenderDebugInfo( ITr2DebugRenderer2 & renderer ) override; void GetDebugOptions( Tr2DebugRendererOptions & options ) override; - // IEveSpaceObjectChild - const char* GetName() const; - void SetName( const char* name ); + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); void GetRenderables( std::vector & renderables ); - bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const - { - return false; - }; void RegisterWithQuadRenderer( Tr2QuadRenderer & quadRenderer ); void AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) const; void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void GetLocalToWorldTransform( Matrix & transform ) const; - void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) {}; - void ChangeLOD( Tr2Lod lod ) {}; void SetControllerVariable( const char* name, float value ) override; ////////////////////////////////////////////////////////////////////////////////////// @@ -65,7 +58,6 @@ BLUE_CLASS( EveChildSmartLightSet ) : private: bool m_display; - std::string m_name; IEveDistributionMethodPtr m_distribution; PIEveSmartLightGroupVector m_lightGroups; diff --git a/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet_Blue.cpp b/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet_Blue.cpp index cddf27441..24220044c 100644 --- a/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet_Blue.cpp +++ b/trinity/Eve/SpaceObject/Children/SmartLightSets/EveChildSmartLightSet_Blue.cpp @@ -9,6 +9,7 @@ const Be::ClassInfo* EveChildSmartLightSet::ExposeToBlue() { EXPOSURE_BEGIN( EveChildSmartLightSet, "\n:jessica-icon: lightbulb-gear\n:jessica-icon-color: (255, 207, 50)\n:jessica-help-url: https://ccpgames.atlassian.net/wiki/spaces/TTL/pages/1308393505/SmartLightSets\n" ) MAP_INTERFACE( EveChildSmartLightSet ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2DebugRenderable ) MAP_INTERFACE( INotify ) @@ -22,5 +23,8 @@ const Be::ClassInfo* EveChildSmartLightSet::ExposeToBlue() MAP_ATTRIBUTE( "distribution", m_distribution, "distributionMethod for entities\n:jessica-icon: map-location-dot\n:jessica-help-url: https://ccpgames.atlassian.net/wiki/spaces/TTL/pages/1311441160/Distributions\n", Be::READWRITE | Be::PERSIST ) MAP_ATTRIBUTE( "lightGroups", m_lightGroups, "list of lights and light-renderables", Be::READ | Be::PERSIST ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/Eve/SpaceObject/Children/SmartLightSets/attributeModifiers/EveSmartLightBaseAttributeModifier.h b/trinity/Eve/SpaceObject/Children/SmartLightSets/attributeModifiers/EveSmartLightBaseAttributeModifier.h index 34f63f71e..d7abc3278 100644 --- a/trinity/Eve/SpaceObject/Children/SmartLightSets/attributeModifiers/EveSmartLightBaseAttributeModifier.h +++ b/trinity/Eve/SpaceObject/Children/SmartLightSets/attributeModifiers/EveSmartLightBaseAttributeModifier.h @@ -5,7 +5,7 @@ #include "IEveSmartLightGroupAttributeModifier.h" #include "Lights/Tr2PointLight.h" #include -#include +#include #include "Curves/Tr2CurveScalar.h" BLUE_DECLARE( Tr2CurveScalar ); diff --git a/trinity/Eve/SpaceObject/EveSpaceObject2.cpp b/trinity/Eve/SpaceObject/EveSpaceObject2.cpp index c580579b1..a5c179100 100644 --- a/trinity/Eve/SpaceObject/EveSpaceObject2.cpp +++ b/trinity/Eve/SpaceObject/EveSpaceObject2.cpp @@ -239,6 +239,11 @@ EveSpaceObject2::~EveSpaceObject2() } UnregisterAudioGeometry(); + + for( auto& child : m_effectChildren ) + { + child->SetOwner( nullptr ); + } } bool EveSpaceObject2::Initialize() @@ -249,6 +254,11 @@ bool EveSpaceObject2::Initialize() PrepareForAnimation(); } + for( auto& child : m_effectChildren ) + { + child->SetOwner( this ); + } + for( auto& controller : m_controllers ) { if( !controller->IsLinked() ) @@ -307,8 +317,9 @@ void EveSpaceObject2::OnListModified( long event, ssize_t key, ssize_t key2, IRo switch( event & BELIST_EVENTMASK ) { case BELIST_INSERTED: - if( IEveSpaceObjectChildPtr child = BlueCastPtr( value ) ) + if( EveSpaceObjectChildPtr child = BlueCastPtr( value ) ) { + child->SetOwner( this ); for( auto it = begin( m_controllerVariables ); it != end( m_controllerVariables ); ++it ) { child->SetControllerVariable( it->first.c_str(), it->second ); @@ -327,6 +338,10 @@ void EveSpaceObject2::OnListModified( long event, ssize_t key, ssize_t key2, IRo { entity->UnRegister( this->GetComponentRegistry() ); } + if( EveSpaceObjectChildPtr child = BlueCastPtr( value ) ) + { + child->SetOwner( nullptr ); + } break; case BELIST_UNLOADSTART: if( IsInRegistry() ) @@ -339,6 +354,10 @@ void EveSpaceObject2::OnListModified( long event, ssize_t key, ssize_t key2, IRo } } } + for( auto& child : m_effectChildren ) + { + child->SetOwner( nullptr ); + } break; default: break; @@ -3005,7 +3024,7 @@ void EveSpaceObject2::AddObserver( TriObserverLocalPtr observer ) } // -------------------------------------------------------------------------------- -IEveSpaceObjectChildPtr EveSpaceObject2::GetEffectChildByName( const char* name ) const +EveSpaceObjectChildPtr EveSpaceObject2::GetEffectChildByName( const char* name ) const { for( auto it = begin( m_effectChildren ); it != end( m_effectChildren ); ++it ) { @@ -3022,7 +3041,7 @@ IEveSpaceObjectChildPtr EveSpaceObject2::GetEffectChildByName( const char* name // Description: // Add a child to the effectChildren list // -------------------------------------------------------------------------------- -void EveSpaceObject2::AddToEffectChildrenList( IEveSpaceObjectChild* child ) +void EveSpaceObject2::AddToEffectChildrenList( EveSpaceObjectChild* child ) { if( m_inheritProperties ) { @@ -3036,7 +3055,7 @@ void EveSpaceObject2::AddToEffectChildrenList( IEveSpaceObjectChild* child ) } // -------------------------------------------------------------------------------- -void EveSpaceObject2::RemoveFromEffectChildrenList( IEveSpaceObjectChild* child ) +void EveSpaceObject2::RemoveFromEffectChildrenList( EveSpaceObjectChild* child ) { auto index = m_effectChildren.FindKey( child ); if( index >= 0 ) @@ -3858,7 +3877,7 @@ void EveSpaceObject2::SetShaderOption( const BlueSharedString& name, const BlueS for( auto it = m_effectChildren.begin(); it != m_effectChildren.end(); ++it ) { - IEveSpaceObjectChild* child = *it; + EveSpaceObjectChild* child = *it; child->SetShaderOption( name, value ); } } diff --git a/trinity/Eve/SpaceObject/EveSpaceObject2.h b/trinity/Eve/SpaceObject/EveSpaceObject2.h index 19ded272d..d06f06f95 100644 --- a/trinity/Eve/SpaceObject/EveSpaceObject2.h +++ b/trinity/Eve/SpaceObject/EveSpaceObject2.h @@ -21,7 +21,7 @@ #include "Eve/SpaceObject/Attachments/EveMeshOverlayEffect.h" #include "Eve/SpaceObject/Attachments/EveSpaceObjectDecal.h" #include "Eve/SpaceObject/Attachments/EveImpactOverlay.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "Eve/SpaceObject/Children/IEveEffectChildrenOwner.h" #include "Eve/SpaceObject/Children/IEveInheritPropertiesOwner.h" #include "Eve/SpaceObject/Attachments/IEveSpaceObjectDecalOwner.h" @@ -385,9 +385,9 @@ BLUE_CLASS( EveSpaceObject2 ) : ///////////////////////////////////////////////////////////////////////////////////// // IEveEffectChildrenOwner - IEveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; - void AddToEffectChildrenList( IEveSpaceObjectChild * child ); - void RemoveFromEffectChildrenList( IEveSpaceObjectChild * child ); + EveSpaceObjectChildPtr GetEffectChildByName( const char* name ) const; + void AddToEffectChildrenList( EveSpaceObjectChild * child ); + void RemoveFromEffectChildrenList( EveSpaceObjectChild * child ); ///////////////////////////////////////////////////////////////////////////////////// // ITr2ControllerOwner @@ -704,7 +704,7 @@ BLUE_CLASS( EveSpaceObject2 ) : ///////////////////////////////////////////////////////////////////////////////////// // Effect children - PIEveSpaceObjectChildVector m_effectChildren; + PEveSpaceObjectChildVector m_effectChildren; EveChildInheritPropertiesPtr m_inheritProperties; ///////////////////////////////////////////////////////////////////////////////////// diff --git a/trinity/Eve/SpaceObject/Utils/fxAttributes/EveCameraFxAttributes.h b/trinity/Eve/SpaceObject/Utils/fxAttributes/EveCameraFxAttributes.h index db557831e..576624e18 100644 --- a/trinity/Eve/SpaceObject/Utils/fxAttributes/EveCameraFxAttributes.h +++ b/trinity/Eve/SpaceObject/Utils/fxAttributes/EveCameraFxAttributes.h @@ -3,7 +3,7 @@ #pragma once #include "Eve/EveUpdateContext.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #include "IEveFxAttribute.h" diff --git a/trinity/Eve/SpaceObjectFactory/EveSOF.cpp b/trinity/Eve/SpaceObjectFactory/EveSOF.cpp index b809f11a4..788a34064 100644 --- a/trinity/Eve/SpaceObjectFactory/EveSOF.cpp +++ b/trinity/Eve/SpaceObjectFactory/EveSOF.cpp @@ -273,7 +273,7 @@ IRootPtr EveSOF::BuildFromDNA( const char* dnaString ) EveChildContainerPtr layoutContainer; layoutContainer.CreateInstance(); layoutContainer->SetName( "layouts" ); - layoutContainer->SetOrigin( IEveSpaceObjectChild::SOF ); + layoutContainer->SetOrigin( EveSpaceObjectChild::SOF ); layoutContainer->SetIsPlacementRoot( true ); layoutContainer->SetAlwaysOn( true ); SetupLayout( newObj, layoutContainer, sharedMeshes, dna, centerOffset ); @@ -1719,7 +1719,7 @@ void RecursiveBindParticleEmitters( EveTransform* transform, TriCurveSet* curveS } } -void RecursiveBindParticleEmitters( IEveSpaceObjectChild* child, TriCurveSet* curveSet, Tr2CurveScalar* curve ) +void RecursiveBindParticleEmitters( EveSpaceObjectChild* child, TriCurveSet* curveSet, Tr2CurveScalar* curve ) { if( EveChildContainerPtr container = BlueCastPtr( child ) ) { @@ -1757,7 +1757,7 @@ void EveSOF::SetupChildrenAndAnimations( EveSpaceObject2Ptr obj, IEveEffectChild auto postCopy = m_editorMode ? &PostCopyMetadata : nullptr; std::map> childrenToBindTo; - std::map> soChildrenToBindTo; + std::map> soChildrenToBindTo; const std::vector& hullChildren = dna->GetHullChildren(); for( auto childIt = hullChildren.begin(); childIt != hullChildren.end(); ++childIt ) @@ -1805,12 +1805,12 @@ void EveSOF::SetupChildrenAndAnimations( EveSpaceObject2Ptr obj, IEveEffectChild obj->AddToChildrenList( transformedChild ); } } - else if( IEveSpaceObjectChildPtr effectChild = BlueCastPtr( p ) ) + else if( EveSpaceObjectChildPtr effectChild = BlueCastPtr( p ) ) { size_t index = 0; for( auto& offset : offsets ) { - IEveSpaceObjectChildPtr transformedChild; + EveSpaceObjectChildPtr transformedChild; if( ++index < offsets.size() ) { CCP_STATS_ZONE( "Child Copy" ); @@ -1829,7 +1829,7 @@ void EveSOF::SetupChildrenAndAnimations( EveSpaceObject2Ptr obj, IEveEffectChild transformedChild->Setup( &childIt->scaling, &rot, &pos, childIt->lowestLodVisible ); - transformedChild->SetOrigin( IEveSpaceObjectChild::SOF ); + transformedChild->SetOrigin( EveSpaceObjectChild::SOF ); childOwner->AddToEffectChildrenList( transformedChild ); if( childIt->id != -1 ) { @@ -1866,7 +1866,7 @@ void EveSOF::SetupChildrenAndAnimations( EveSpaceObject2Ptr obj, IEveEffectChild { RecursiveBindParticleEmitters( ( *transformIt ), curveSet, scalarCurve ); } - std::vector childVector = soChildrenToBindTo[animIt->id]; + std::vector childVector = soChildrenToBindTo[animIt->id]; for( auto childIt = childVector.begin(); childIt != childVector.end(); ++childIt ) { RecursiveBindParticleEmitters( ( *childIt ), curveSet, scalarCurve ); @@ -1971,11 +1971,11 @@ void EveSOF::SetupEffectChildren( EveSpaceObject2Ptr newObj, IEveEffectChildrenO newObj->AddToChildrenList( transformedChild ); } } - else if( IEveSpaceObjectChildPtr effectChild = BlueCastPtr( p ) ) + else if( EveSpaceObjectChildPtr effectChild = BlueCastPtr( p ) ) { for( auto& offset : offsets ) { - IEveSpaceObjectChildPtr transformedChild; + EveSpaceObjectChildPtr transformedChild; if( &offset != &offsets.back() ) { BeClasses->CopyTo( effectChild->GetRootObject(), (IRoot**)&transformedChild ); @@ -1993,7 +1993,7 @@ void EveSOF::SetupEffectChildren( EveSpaceObject2Ptr newObj, IEveEffectChildrenO transformedChild->Setup( &childSetItem.scaling, &rot, &pos, childSetItem.lowestLodVisible ); - transformedChild->SetOrigin( IEveSpaceObjectChild::SOF ); + transformedChild->SetOrigin( EveSpaceObjectChild::SOF ); childOwner->AddToEffectChildrenList( transformedChild ); } } @@ -3624,7 +3624,7 @@ void EveSOF::CreatePlacement( { sharedMeshes.CreateInstance(); sharedMeshes->SetName( "SharedInstancedMeshes" ); - sharedMeshes->SetOrigin( IEveSpaceObjectChild::SOF ); + sharedMeshes->SetOrigin( EveSpaceObjectChild::SOF ); parent->AddToEffectChildrenList( sharedMeshes ); } diff --git a/trinity/Eve/Turret/EveTurretFiringFX.h b/trinity/Eve/Turret/EveTurretFiringFX.h index 016359445..667b06389 100644 --- a/trinity/Eve/Turret/EveTurretFiringFX.h +++ b/trinity/Eve/Turret/EveTurretFiringFX.h @@ -15,8 +15,8 @@ BLUE_DECLARE_INTERFACE( IEveFiringEffectElement ); BLUE_DECLARE_IVECTOR( IEveFiringEffectElement ); BLUE_DECLARE_INTERFACE( IEveEffectChildrenOwner ); -BLUE_DECLARE_INTERFACE( IEveSpaceObjectChild ); -BLUE_DECLARE_IVECTOR( IEveSpaceObjectChild ); +BLUE_DECLARE( EveSpaceObjectChild ); +BLUE_DECLARE_VECTOR( EveSpaceObjectChild ); BLUE_DECLARE( TriCurveSet ); BLUE_DECLARE( TriObserverLocal ); BLUE_DECLARE( Tr2QuadRenderer ); diff --git a/trinity/Eve/Turret/EveTurretSet.cpp b/trinity/Eve/Turret/EveTurretSet.cpp index 87efc0812..d6107a0d8 100644 --- a/trinity/Eve/Turret/EveTurretSet.cpp +++ b/trinity/Eve/Turret/EveTurretSet.cpp @@ -18,7 +18,7 @@ #include "EveTurretFiringFX.h" #include "include/TriMath.h" #include "Tr2QuadRenderer.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" CCP_STATS_DECLARED_ELSEWHERE( primitiveCount ); @@ -461,7 +461,7 @@ bool EveTurretSet::IsAmbientVisible() const } -IEveSpaceObjectChild* EveTurretSet::GetAmbientEffectOrGeneratedEffect() const +EveSpaceObjectChild* EveTurretSet::GetAmbientEffectOrGeneratedEffect() const { if( m_ambientEffectEditingMode ) { @@ -3654,12 +3654,12 @@ void EveTurretSet::SetFiringEffect( EveTurretFiringFX* firingEffect ) InitializeFiringEffect(); } -IEveSpaceObjectChild* EveTurretSet::GetAmbientEffect() +EveSpaceObjectChild* EveTurretSet::GetAmbientEffect() { return m_ambientEffect; } -void EveTurretSet::SetAmbientEffect( IEveSpaceObjectChild* ambientEffect ) +void EveTurretSet::SetAmbientEffect( EveSpaceObjectChild* ambientEffect ) { auto registry = GetComponentRegistry(); if( EveEntityPtr entity = BlueCastPtr( m_ambientEffect ) ) diff --git a/trinity/Eve/Turret/EveTurretSet.h b/trinity/Eve/Turret/EveTurretSet.h index baa640760..169157903 100644 --- a/trinity/Eve/Turret/EveTurretSet.h +++ b/trinity/Eve/Turret/EveTurretSet.h @@ -283,7 +283,7 @@ BLUE_CLASS( EveTurretSet ) : void InitializeFiringEffect(); // setup the attached ambient effect void InitializeAmbientEffect(); - IEveSpaceObjectChild* GetAmbientEffectOrGeneratedEffect() const; + EveSpaceObjectChild* GetAmbientEffectOrGeneratedEffect() const; void SetAmbientEffectControllerVariableOnInstance( int index, const char* name, float value ); bool IsAmbientVisible() const; @@ -323,8 +323,8 @@ BLUE_CLASS( EveTurretSet ) : EveTurretFiringFX* GetFiringEffect(); void SetFiringEffect( EveTurretFiringFX * firingEffect ); - IEveSpaceObjectChild* GetAmbientEffect(); - void SetAmbientEffect( IEveSpaceObjectChild * ambientEffect ); + EveSpaceObjectChild* GetAmbientEffect(); + void SetAmbientEffect( EveSpaceObjectChild * ambientEffect ); // name std::string m_name; @@ -491,7 +491,7 @@ BLUE_CLASS( EveTurretSet ) : bool m_randomizeExplosionRotation; // ambient effects - IEveSpaceObjectChildPtr m_ambientEffect; + EveSpaceObjectChildPtr m_ambientEffect; EveChildInstanceContainerPtr m_generatedDistributedAmbientEffect; Matrix m_ambientOffsetMatrix; // used while editing bool m_ambientEffectEditingMode; // used for editing diff --git a/trinity/Eve/UI/EveEllipseSet.cpp b/trinity/Eve/UI/EveEllipseSet.cpp index 4e04b6070..3fde5324b 100644 --- a/trinity/Eve/UI/EveEllipseSet.cpp +++ b/trinity/Eve/UI/EveEllipseSet.cpp @@ -127,16 +127,6 @@ bool EveEllipseSet::AddEllipse( const Vector3& center, float semiMajor, float se return true; } -const char* EveEllipseSet::GetName() const -{ - return m_name.c_str(); -} - -void EveEllipseSet::SetName( const char* name ) -{ - m_name = BlueSharedString( name ); -} - EveEllipseSet::~EveEllipseSet() { // Specs may outlive via Python references @@ -400,10 +390,6 @@ void EveEllipseSet::Setup( const Vector3* scale, const Quaternion* rotation, con m_lowestLodVisible = lowestLodVisible; } -void EveEllipseSet::ChangeLOD( Tr2Lod lod ) -{ -} - IRoot* EveEllipseSet::GetID( uint16_t ) { return GetRawRoot(); diff --git a/trinity/Eve/UI/EveEllipseSet.h b/trinity/Eve/UI/EveEllipseSet.h index 2c1639d16..7a8b516e2 100644 --- a/trinity/Eve/UI/EveEllipseSet.h +++ b/trinity/Eve/UI/EveEllipseSet.h @@ -11,12 +11,12 @@ #include "Shader/Tr2EffectStateManager.h" #include "Tr2BufferAL.h" #include "EveEllipseDefinition.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" BLUE_DECLARE( EveEllipseSet ); BLUE_CLASS( EveEllipseSet ) : - public IEveSpaceObjectChild, + public EveSpaceObjectChild, public EveChildTransform, public ITr2Renderable, public IListNotify, @@ -36,9 +36,7 @@ BLUE_CLASS( EveEllipseSet ) : bool AddEllipse( const Vector3& center, float semiMajor, float semiMinor, const Vector3& planeNormal, float rotationDegrees ); ////////////////////////////////////////////////////////////////////////////////////// - // IEveSpaceObjectChild - const char* GetName() const override; - void SetName( const char* name ) override; + // EveSpaceObjectChild void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ) override; void GetRenderables( std::vector & renderables ) override; bool GetBoundingSphere( Vector4 & sphere, BoundingSphereQuery query = EVE_BOUNDS_NORMAL ) const override; @@ -46,7 +44,6 @@ BLUE_CLASS( EveEllipseSet ) : void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ) override; void GetLocalToWorldTransform( Matrix & transform ) const override; void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ) override; - void ChangeLOD( Tr2Lod lod ) override; ////////////////////////////////////////////////////////////////////////////////////// // ITr2Pickable @@ -72,7 +69,6 @@ BLUE_CLASS( EveEllipseSet ) : // INotify bool OnModified( Be::Var * val ) override; - BlueSharedString m_name; bool m_display = true; bool m_enablePicking = true; float m_depthOffset = 0.f; diff --git a/trinity/Eve/UI/EveEllipseSet_Blue.cpp b/trinity/Eve/UI/EveEllipseSet_Blue.cpp index ade0c2f04..5de0c8c52 100644 --- a/trinity/Eve/UI/EveEllipseSet_Blue.cpp +++ b/trinity/Eve/UI/EveEllipseSet_Blue.cpp @@ -9,6 +9,7 @@ const Be::ClassInfo* EveEllipseSet::ExposeToBlue() { EXPOSURE_BEGIN( EveEllipseSet, "" ) MAP_INTERFACE( EveEllipseSet ) + MAP_INTERFACE( EveSpaceObjectChild ) MAP_INTERFACE( IEveSpaceObjectChild ) MAP_INTERFACE( ITr2Renderable ) MAP_INTERFACE( ITr2Pickable ) @@ -33,5 +34,8 @@ const Be::ClassInfo* EveEllipseSet::ExposeToBlue() AddEllipse, "Adds a closed elliptical orbit in the given plane (center, semiMajor, semiMinor, planeNormal, rotationDegrees)" ); MAP_METHOD_AND_WRAP( "__init__", py__init__, "Initializes the EveEllipseSet" ); + MAP_ATTRIBUTE( "partTag", m_partTag, "Part tag for multi-part space objects", Be::READ ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() } diff --git a/trinity/trinity.cpp b/trinity/trinity.cpp index 11142507b..8e0380eb6 100644 --- a/trinity/trinity.cpp +++ b/trinity/trinity.cpp @@ -34,7 +34,7 @@ BLUE_DEFINE_INTERFACE( IBlueObjectProxy ); #include "TriSettingsRegistrar.h" #include "Eve/IEveSpaceObject2.h" -#include "Eve/SpaceObject/Children/IEveSpaceObjectChild.h" +#include "Eve/SpaceObject/Children/EveSpaceObjectChild.h" #ifndef TRINITYNAME #error Please add TRINITYNAME= to compiler preprocessor definitions (/D) @@ -400,7 +400,7 @@ MAP_FUNCTION_AND_WRAP( "GetGrannyProductVersion", GetGrannyProductVersion, "Retu static BlueStdResult GetObjectWorldTransform( IRoot* object, Matrix& result ) { - if( IEveSpaceObjectChildPtr child = BlueCastPtr( object ) ) + if( EveSpaceObjectChildPtr child = BlueCastPtr( object ) ) { child->GetLocalToWorldTransform( result ); return BlueStdResult( BLUE_STD_RESULT_OK ); @@ -418,7 +418,7 @@ MAP_FUNCTION_AND_WRAP( "GetObjectWorldTransform", GetObjectWorldTransform, "Returns world transform for some supported object interfaces. Currently only\n" - "IEveSpaceObject2 and IEveSpaceObjectChild interfaces are supported.\n" + "IEveSpaceObject2 and EveSpaceObjectChild interfaces are supported.\n" ":param obj: blue object to get world transform from\n" ":raies TypeError: if the function does not support the object type" ); From 98f1653684cac5ba2bbe75fb465bbc649eb2b25c Mon Sep 17 00:00:00 2001 From: Filipp Pavlov Date: Mon, 20 Jul 2026 09:02:11 +0000 Subject: [PATCH 08/12] Add the important files --- .../Children/EveSpaceObjectChild.cpp | 151 +++++++++ .../Children/EveSpaceObjectChild.h | 319 ++++++++++++++++++ .../Children/EveSpaceObjectChild_Blue.cpp | 19 ++ 3 files changed, 489 insertions(+) create mode 100644 trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp create mode 100644 trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h create mode 100644 trinity/Eve/SpaceObject/Children/EveSpaceObjectChild_Blue.cpp diff --git a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp new file mode 100644 index 000000000..26c34fa10 --- /dev/null +++ b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp @@ -0,0 +1,151 @@ +// Copyright © 2026 CCP ehf. + +#include "StdAfx.h" +#include "EveSpaceObjectChild.h" + + +EveSpaceObjectChild::EveSpaceObjectChild( IRoot* ) +{ +} + +const char* EveSpaceObjectChild::GetName() const +{ + return m_name.c_str(); +} + +void EveSpaceObjectChild::SetName( const char* name ) +{ + m_name = BlueSharedString( name ); +} + +void EveSpaceObjectChild::UpdateVisibility( const EveUpdateContext&, const Matrix&, Tr2Lod ) +{ +} + +void EveSpaceObjectChild::GetRenderables( std::vector& ) +{ +} + +bool EveSpaceObjectChild::GetBoundingSphere( Vector4&, BoundingSphereQuery ) const +{ + return false; +} + +void EveSpaceObjectChild::RegisterWithQuadRenderer( Tr2QuadRenderer& ) +{ +} + +void EveSpaceObjectChild::AddQuadsToQuadRenderer( const TriFrustum&, Tr2QuadRenderer& ) const +{ +} + +void EveSpaceObjectChild::UpdateSyncronous( const EveUpdateContext&, const EveChildUpdateParams& ) +{ +} + +void EveSpaceObjectChild::UpdateAsyncronous( const EveUpdateContext&, const EveChildUpdateParams& ) +{ +} + +void EveSpaceObjectChild::GetLocalToWorldTransform( Matrix& ) const +{ +} + +bool EveSpaceObjectChild::IsAlwaysOn() const +{ + return false; +}; + +void EveSpaceObjectChild::Setup( const Vector3*, const Quaternion*, const Vector3*, Tr2Lod ) +{ +} + +void EveSpaceObjectChild::ChangeLOD( Tr2Lod ) +{ +} + +void EveSpaceObjectChild::SetControllerVariable( const char*, float ) +{ +} + +void EveSpaceObjectChild::HandleControllerEvent( const char* ) +{ +} + +void EveSpaceObjectChild::StartControllers() +{ +} + +void EveSpaceObjectChild::SetProceduralContainerVariable( const char*, float ) +{ +} + +void EveSpaceObjectChild::SetShaderOption( const BlueSharedString&, const BlueSharedString& ) +{ +} + +void EveSpaceObjectChild::SetOrigin( Origin ) +{ +} + +void EveSpaceObjectChild::AddTransformModifier( IEveChildTransformModifier* ) +{ +} + +void EveSpaceObjectChild::SetMute( bool isMuted ) +{ +} + +EveSpaceObjectChild::PartTag EveSpaceObjectChild::GetPartTag() const +{ + return m_partTag; +} + +void EveSpaceObjectChild::SetPartTag( PartTag tag ) +{ + m_partTag = tag; +} + +void EveSpaceObjectChild::SetOwner( IEveSpaceObject2* owner ) +{ + m_owner = owner; +} + +IEveSpaceObject2* EveSpaceObjectChild::GetOwner() const +{ + return m_owner; +} + +void EveSpaceObjectChild::SetParent( EveSpaceObjectChild* parent ) +{ + m_parent = parent; +} + +EveSpaceObjectChild* EveSpaceObjectChild::GetParent() const +{ + return m_parent; +} + +void EveSpaceObjectChild::RegisterChild( EveSpaceObjectChild* child ) +{ + if( child ) + { + child->SetParent( this ); + child->SetOwner( m_owner ); + if( m_partTag != EveSpaceObjectChild::NO_PART_TAG ) + { + child->SetPartTag( m_partTag ); + } + } +} + +void EveSpaceObjectChild::UnregisterChild( EveSpaceObjectChild* child ) +{ + if( child ) + { + CCP_ASSERT( child->GetParent() == this ); + child->SetParent( nullptr ); + child->SetOwner( nullptr ); + // No reason to reset the part tag as it is meaningless outside the hierarchy of the parent object + } +} diff --git a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h new file mode 100644 index 000000000..25651598c --- /dev/null +++ b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h @@ -0,0 +1,319 @@ +// Copyright © 2026 CCP ehf. + +#pragma once + +#include "IEveSpaceObjectChild.h" + +BLUE_CLASS_IMPL( EveSpaceObjectChild ); + +/** + * @brief Base class for all space object children. This class provides common functionality and properties for all child objects in the space object hierarchy. + */ +class EveSpaceObjectChild : public IEveSpaceObjectChild +{ +public: + EXPOSE_TO_BLUE(); + + /// @brief Enum representing the origin of the space object child, i.e. how it was created: using SOF or otherwise. + enum Origin + { + SPACE, + SOF, + }; + + /// @brief Type representing a part tag, which is used to identify parts of a modular space object. + using PartTag = uint32_t; + + /// @brief Constant representing a part tag for children that are not part of a modular space object. + static const PartTag NO_PART_TAG = 0; + + EveSpaceObjectChild( IRoot* lockobj = nullptr ); + + /** + * @brief Returns the name of the space object child. This name is used for identification and debugging purposes. + */ + const char* GetName() const; + + /** + * @brief Sets the name of the space object child. This name is used for identification and debugging purposes. + * @param name The new name to set for the space object child. + */ + virtual void SetName( const char* name ); + + /** + * @brief Updates the internal visibility state (frustum culling, LOD, etc.) of the object. This method is called during rendering before GetRenderables() to determine if the object should be rendered. + * Note, that this method is called from worker threads, so care should be taken when accessing shared data. + * The default implementation does nothing, derived classes should override this method to implement visibility logic if needed. + * @param updateContext Scene-wide update context containing timing and other relevant information for the update. + * @param parentTransform Parent transformation matrix to world coordinates. + * @param parentLod Owner space object's LOD level. + */ + virtual void UpdateVisibility( const EveUpdateContext& updateContext, const Matrix& parentTransform, Tr2Lod parentLod ); + + /** + * @brief Pushes owned renderables to the provided vector. This method is called during rendering to collect all renderable objects for the current frame. + * The default implementation does nothing, derived classes implementing renderable features should override this method to provide their renderables. + * @param renderables Vector to which the renderables will be added. + */ + virtual void GetRenderables( std::vector& renderables ); + + /** + * @brief Retrieves the bounding sphere of the object. This method is used for frustum culling and LOD estimation. + * The default implementation does nothing, derived classes should override this method to provide their bounding sphere if available. + * @param sphere Vector4 to store the bounding sphere (x, y, z for center, w for radius). + * @param query Type of bounding sphere query. + * @return True if the bounding sphere is valid, false otherwise. + */ + virtual bool GetBoundingSphere( Vector4& sphere, BoundingSphereQuery query ) const; + + /** + * @brief Registers effects with the quad renderer. This method is called when the child is added to the scene to allow it to register any effects that need to be rendered as quads. + * The default implementation does nothing, derived classes implementing quad rendering should override this method to register their effects with the quad renderer. + * @param quadRenderer Quad renderer to register effects with. + */ + virtual void RegisterWithQuadRenderer( Tr2QuadRenderer& quadRenderer ); + + /** + * @brief Adds quads to the quad renderer for rendering. This method is called during rendering to allow the child to add any quads that need to be rendered. + * Note, that this method is called from worker threads, so care should be taken when accessing shared data. + * The default implementation does nothing, derived classes implementing quad rendering should override this method to add their quads to the quad renderer. + * @param frustum Frustum used for culling and visibility checks. + * @param quadRenderer Quad renderer to which quads will be added. + */ + virtual void AddQuadsToQuadRenderer( const TriFrustum& frustum, Tr2QuadRenderer& quadRenderer ) const; + + /** + * @brief Updates the state of the object. This method is called every frame from the main thread to allow the child to update its internal state, animations, etc. + * The default implementation does nothing, derived classes implementing quad rendering should override this method to add their quads to the quad renderer. + * @param updateContext Scene-wide update context containing timing and other relevant information for the update. + * @param params Space object and parent child information relevant for the update. + */ + virtual void UpdateSyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); + + /** + * @brief Updates the state of the object asynchronously. This method is called from worker threads to allow the child to update its internal state, animations, etc. + * The default implementation does nothing, derived classes implementing quad rendering should override this method to add their quads to the quad renderer. + * @param updateContext Scene-wide update context containing timing and other relevant information for the update. + * @param params Space object and parent child information relevant for the update. + */ + virtual void UpdateAsyncronous( const EveUpdateContext& updateContext, const EveChildUpdateParams& params ); + + /** + * @brief Retrieves the local to world transformation matrix of the object. This method is poorly designed. Avoid using it if possible. Not every child has a local + * to world transformation, and this method has no way to return the failure state. The default implementation does nothing, derived classes should override this + * method to provide their local to world transformation if available. + * @param transform Matrix to store the local to world transformation. + */ + virtual void GetLocalToWorldTransform( Matrix& transform ) const; + + /** + * @brief Exotic method that is used to determine if the child needs to be always updated/rendered regardless of the owner's space object "activation strength". + * @return True if the child should always be updated/rendered, false otherwise. + */ + virtual bool IsAlwaysOn() const; + + /** + * @brief Sets up the child transform and LOD. This methods is called by the SOF when creating a child object. + * The default implementation does nothing. If the child has a transform, it should override this method to set up the transform and LOD. + * @param scale Optional scale factors (x, y, z) for the child transform. If nullptr, scaling is unaffected. + * @param rotation Optional rotation for the child transform. If nullptr, rotation is unaffected. + * @param translation Optional translation for the child transform. If nullptr, translation is unaffected. + * @param lowestLodVisible Lowest level of detail (LOD) of the owner space object that is visible for the child. + */ + virtual void Setup( const Vector3* scale, const Quaternion* rotation, const Vector3* translation, Tr2Lod lowestLodVisible ); + + /** + * @brief Notifies the child object that the level of detail (LOD) of the owner space object has changed. + * The default implementation does nothing. If the child has LOD-dependent behavior, it should override this method to respond to LOD changes. + * @param lod New level of detail (LOD) of the owner space object. + */ + virtual void ChangeLOD( Tr2Lod lod ); + + /** + * @brief Sets a controller variable for the child object. This method is called by the owner space object to update controller variables that affect the child's behavior. + * If the child owns controllers, it should override this method to propagate the variable to its controllers. Also, if the object owns other children, it should propagate the + * controller variable change to them as well. + * The default implementation does nothing. + * @param name Name of the controller variable. + * @param value Value to set for the controller variable. + */ + virtual void SetControllerVariable( const char* name, float value ); + + /** + * @brief Notifies child controllers that a controller event has occurred. This method is called by the owner space object to notify the child of controller events that may affect its behavior. + * If the child owns controllers, it should override this method to propagate the event to its controllers. Also, if the object owns other children, it should propagate the + * controller event to them as well. + * The default implementation does nothing. + * @param name Name of the controller event. + */ + virtual void HandleControllerEvent( const char* name ); + + /** + * @brief Starts controllers owned by the child object. If the child owns controllers, it should override this method to start them. Also, if the object owns other children, it should propagate the + * start command to them as well. + * The default implementation does nothing. + */ + virtual void StartControllers(); + + /** + * @brief Sets a "procedural container" variable. This method is very specific to EveChildProceduralContainer. Derived classes that own other children should override this method to propagate the call to them. + * The default implementation does nothing. + * @param name Name of the procedural container variable. + * @param value Value to set for the procedural container variable. + */ + virtual void SetProceduralContainerVariable( const char* name, float value ); + + /** + * @brief Sets a shader option for effects managed by the child object. Derived classes that manage effects (or meshes) should override this methods to set the shader option for their effects. Also, if the object + * owns other children, it should override this method to propagate the call to them. + * The default implementation does nothing. + * @param name Name of the shader option. + * @param value Value to set for the shader option. + */ + virtual void SetShaderOption( const BlueSharedString& name, const BlueSharedString& value ); + + /** + * @brief Sets the origin (creation method) of the child object. This method is called by the SOF to set the creation method of the object. + * The default implementation does nothing. + * @param origin Origin (creation method) of the child object. + */ + virtual void SetOrigin( Origin origin ); + + /** + * @brief Adds a transform modifier to the child object. If the child object supports transform modifiers, it can override this method to add the modifier to its list of modifiers. + * The default implementation does nothing. + * @param modifier New transform modifier. + */ + virtual void AddTransformModifier( IEveChildTransformModifier* modifier ); + + /** + * @brief Sets the muted state for audio emitters owned by the child object. If the child object owns audio emitters, it can override this method to set their muted state. + * Also, if the object owns other children, it should override this method to propagate the call to them. + * The default implementation does nothing. + * @param isMuted Should the audio emitters be muted (true) or unmuted (false). + */ + virtual void SetMute( bool isMuted ); + + /** + * @brief Returns the part tag of the child object for multi-part space objects. + * @return Part tag of the child object, or NO_PART_TAG if not applicable. + */ + PartTag GetPartTag() const; + + /** + * @brief Sets the part tag of the child object for multi-part space objects. Descendent classes that own other children should override this method to propagate the part tag to them. + * @param tag Part tag to set for the child object. + */ + virtual void SetPartTag( PartTag tag ); + + /** + * @brief Returns the owner space object of the child. It may return nullptr if the child is not currently attached to an owner space object. + * @return Owner space object of the child, or nullptr if not attached. + */ + IEveSpaceObject2* GetOwner() const; + + /** + * @brief Sets the owner space object of the child. Descendent classes that own other children should override this method to propagate the owner to them. + * @param owner Owner space object to set for the child. + */ + virtual void SetOwner( IEveSpaceObject2* owner ); + + /** + * @brief Returns the parent child object of this child. It may return nullptr if the child is not currently attached to a parent child object. + * @return Parent child object of this child, or nullptr if not attached. + */ + EveSpaceObjectChild* GetParent() const; + + /** + * @brief Sets the parent child object of this child. + * @param parent Parent child object to set for this child. + */ + void SetParent( EveSpaceObjectChild* parent ); + +protected: + /** + * @brief Helper function that registers a child object with this parent. Assigns the parent, owner and part tag to the child. + * @param child Child object to register. If the child is nullptr, the method does nothing. + */ + void RegisterChild( EveSpaceObjectChild* child ); + + /** + * @brief Helper function that unregisters a child object with this parent. Resets the parent and owner pointers of the child. + * @param child Child object to unregister. If the child is nullptr, the method does nothing. + */ + void UnregisterChild( EveSpaceObjectChild* child ); + + /** + * @brief Helper function that registers a sequence of child objects with this parent. Assigns the parent, owner and part tag to each child. + * @param children Sequence of child objects to register. + */ + template + void RegisterChildren( const ChildList& children ) + { + for( auto& child : children ) + { + this->RegisterChild( child ); + } + } + + /** + * @brief Helper function that unregisters a sequence of child objects with this parent. Resets the parent and owner pointers of each child. + * @param children Sequence of child objects to unregister. + */ + template + void UnregisterChildren( const ChildList& children ) + { + for( auto& child : children ) + { + this->UnregisterChild( child ); + } + } + + /** + * @brief Helper function that handles list modification notifications for a list of child objects to register and unregister children. + * @tparam ChildList Type of the list of child objects. + * @param event Event type indicating the modification. See BLUELISTEVENT for possible values. + * @param value Value associated with the event. + * @param children List of child objects for which the notification is being sent. + */ + template + void HandleChildrenListModified( + long event, // BLUELISTEVENT values + IRoot* value, + const ChildList& children ) + { + switch( event & BELIST_EVENTMASK ) + { + case BELIST_INSERTED: + if( EveSpaceObjectChildPtr child = BlueCastPtr( value ) ) + { + this->RegisterChild( child ); + } + break; + case BELIST_REMOVED: + if( EveSpaceObjectChildPtr child = BlueCastPtr( value ) ) + { + this->UnregisterChild( child ); + } + break; + case BELIST_UNLOADSTART: + for( auto& child : children ) + { + this->UnregisterChild( child ); + } + break; + default: + break; + } + } + + BlueSharedString m_name; +private: + IEveSpaceObject2* m_owner = nullptr; + EveSpaceObjectChild* m_parent = nullptr; + PartTag m_partTag = NO_PART_TAG; +}; + +BLUE_DECLARE_VECTOR( EveSpaceObjectChild ); + +TYPEDEF_BLUECLASS( EveSpaceObjectChild ); \ No newline at end of file diff --git a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild_Blue.cpp b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild_Blue.cpp new file mode 100644 index 000000000..f5a5a72d9 --- /dev/null +++ b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild_Blue.cpp @@ -0,0 +1,19 @@ +// Copyright © 2026 CCP ehf. + +#include "StdAfx.h" +#include "EveSpaceObjectChild.h" + +BLUE_DEFINE_ABSTRACT( EveSpaceObjectChild ); + +const Be::ClassInfo* EveSpaceObjectChild::ExposeToBlue() +{ + EXPOSURE_BEGIN( EveSpaceObjectChild, "" ) + MAP_INTERFACE( EveSpaceObjectChild ) + + MAP_ATTRIBUTE( "name", m_name, "Name of the space object child", Be::READWRITE | Be::PERSIST ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) + MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) + MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) + + EXPOSURE_END() +} From d125679bab49bdfda8c8c155ee8fdc382be49d45 Mon Sep 17 00:00:00 2001 From: Filipp Pavlov Date: Mon, 20 Jul 2026 09:05:46 +0000 Subject: [PATCH 09/12] Format files --- trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp | 2 +- trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp index 26c34fa10..464de622b 100644 --- a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp +++ b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.cpp @@ -38,7 +38,7 @@ void EveSpaceObjectChild::RegisterWithQuadRenderer( Tr2QuadRenderer& ) void EveSpaceObjectChild::AddQuadsToQuadRenderer( const TriFrustum&, Tr2QuadRenderer& ) const { } - + void EveSpaceObjectChild::UpdateSyncronous( const EveUpdateContext&, const EveChildUpdateParams& ) { } diff --git a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h index 25651598c..ef8721a7a 100644 --- a/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h +++ b/trinity/Eve/SpaceObject/Children/EveSpaceObjectChild.h @@ -308,6 +308,7 @@ class EveSpaceObjectChild : public IEveSpaceObjectChild } BlueSharedString m_name; + private: IEveSpaceObject2* m_owner = nullptr; EveSpaceObjectChild* m_parent = nullptr; From 6fc4d0e28e81a419645047741dc06be0efc117d6 Mon Sep 17 00:00:00 2001 From: Filipp Pavlov Date: Mon, 20 Jul 2026 09:07:30 +0000 Subject: [PATCH 10/12] Use property to access the part tag --- trinity/Eve/UI/EveEllipseSet_Blue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trinity/Eve/UI/EveEllipseSet_Blue.cpp b/trinity/Eve/UI/EveEllipseSet_Blue.cpp index 5de0c8c52..c25726485 100644 --- a/trinity/Eve/UI/EveEllipseSet_Blue.cpp +++ b/trinity/Eve/UI/EveEllipseSet_Blue.cpp @@ -34,7 +34,7 @@ const Be::ClassInfo* EveEllipseSet::ExposeToBlue() AddEllipse, "Adds a closed elliptical orbit in the given plane (center, semiMajor, semiMinor, planeNormal, rotationDegrees)" ); MAP_METHOD_AND_WRAP( "__init__", py__init__, "Initializes the EveEllipseSet" ); - MAP_ATTRIBUTE( "partTag", m_partTag, "Part tag for multi-part space objects", Be::READ ) + MAP_PROPERTY_READONLY( "partTag", GetPartTag, "Part tag for multi-part space objects" ) MAP_METHOD_AND_WRAP( "GetParent", GetParent, "Returns the parent space object child in the hierarchy" ) MAP_METHOD_AND_WRAP( "GetOwner", GetOwner, "Returns the owner space object" ) EXPOSURE_END() From 5d1cfe0956aa0f43b71d6724e0e8d4bdf9178721 Mon Sep 17 00:00:00 2001 From: filipppavlov Date: Mon, 20 Jul 2026 11:21:01 +0000 Subject: [PATCH 11/12] Potential fix for pull request finding Use `UnregisterChild` helper method Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp index e20b56091..d87867607 100644 --- a/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp +++ b/trinity/Eve/SpaceObject/Children/EveChildInstanceContainer.cpp @@ -354,8 +354,7 @@ void EveChildInstanceContainer::PopFront() front->UnRegister( GetComponentRegistry() ); } } - m_instances[0]->SetOwner( nullptr ); - m_instances[0]->SetParent( nullptr ); + UnregisterChild( m_instances[0] ); m_instances.Remove( 0 ); } } From 8d7e70e3bebb970377e1c3264cfe31bd23a4b303 Mon Sep 17 00:00:00 2001 From: Filipp Pavlov Date: Wed, 22 Jul 2026 09:30:52 +0000 Subject: [PATCH 12/12] Rebase to main --- vendor/github.com/carbonengine/vcpkg-registry | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/github.com/carbonengine/vcpkg-registry b/vendor/github.com/carbonengine/vcpkg-registry index f503eea8c..8bd572152 160000 --- a/vendor/github.com/carbonengine/vcpkg-registry +++ b/vendor/github.com/carbonengine/vcpkg-registry @@ -1 +1 @@ -Subproject commit f503eea8c313ba8f61d97a5bb0f37e7ba69f749c +Subproject commit 8bd572152d56d5d4b26be0e129615c1c43df438e