mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-15 16:16:14 +00:00
Various property cleanup, fixing more broken stuff, trialing new features
This commit is contained in:
@@ -18,12 +18,12 @@ void CAreaAttributes::SetObject(CScriptObject *pObj)
|
||||
|
||||
mpObject = pObj;
|
||||
mGame = pTemplate->MasterTemplate()->Game();
|
||||
mNeedSky = CBoolRef(pObj, pProperties->ChildByIndex(1));
|
||||
mNeedSky = CBoolRef(pObj->PropertyData(), pProperties->ChildByIndex(1));
|
||||
|
||||
if (mGame == ePrime)
|
||||
mOverrideSky = CAssetRef(pObj, pProperties->ChildByIndex(7));
|
||||
mOverrideSky = CAssetRef(pObj->PropertyData(), pProperties->ChildByIndex(7));
|
||||
else if (mGame > ePrime)
|
||||
mOverrideSky = CAssetRef(pObj, pProperties->ChildByID(0xD208C9FA));
|
||||
mOverrideSky = CAssetRef(pObj->PropertyData(), pProperties->ChildByID(0xD208C9FA));
|
||||
}
|
||||
|
||||
bool CAreaAttributes::IsLayerEnabled() const
|
||||
|
||||
@@ -24,13 +24,13 @@ public:
|
||||
{
|
||||
if (Game <= ePrime)
|
||||
{
|
||||
mWorldLightingOptions = TEnumRef<EWorldLightingOptions>(InStruct.Object(), InStruct.Property()->ChildByIndex(0x7));
|
||||
mLightLayer = CIntRef(InStruct.Object(), InStruct.Property()->ChildByIndex(0xD));
|
||||
mWorldLightingOptions = TEnumRef<EWorldLightingOptions>(InStruct.DataPointer(), InStruct.Property()->ChildByIndex(0x7));
|
||||
mLightLayer = CIntRef(InStruct.DataPointer(), InStruct.Property()->ChildByIndex(0xD));
|
||||
}
|
||||
else
|
||||
{
|
||||
mWorldLightingOptions = TEnumRef<EWorldLightingOptions>(InStruct.Object(), InStruct.Property()->ChildByID(0x6B5E7509));
|
||||
mLightLayer = CIntRef(InStruct.Object(), InStruct.Property()->ChildByID(0x1F715FD3));
|
||||
mWorldLightingOptions = TEnumRef<EWorldLightingOptions>(InStruct.DataPointer(), InStruct.Property()->ChildByID(0x6B5E7509));
|
||||
mLightLayer = CIntRef(InStruct.DataPointer(), InStruct.Property()->ChildByID(0x1F715FD3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "CLight.h"
|
||||
#include "Core/Render/CGraphics.h"
|
||||
#include <Common/Common.h>
|
||||
#include <cmath>
|
||||
#include <float.h>
|
||||
|
||||
@@ -127,6 +128,52 @@ void CLight::SetAngleAtten(float AngleCoefA, float AngleCoefB, float AngleCoefC)
|
||||
mAngleAttenCoefficients.Z = AngleCoefC;
|
||||
}
|
||||
|
||||
CStructPropertyNew* CLight::GetProperties() const
|
||||
{
|
||||
//@todo MP1 properties only
|
||||
//@todo we cannot display full properties because a lot of them are discarded on load
|
||||
static CStructPropertyNew* pProperties = nullptr;
|
||||
|
||||
if (!pProperties)
|
||||
{
|
||||
pProperties = (CStructPropertyNew*) IPropertyNew::CreateIntrinsic(EPropertyTypeNew::Struct,
|
||||
nullptr,
|
||||
0,
|
||||
"Light");
|
||||
|
||||
CChoiceProperty* pLightType = (CChoiceProperty*) IPropertyNew::CreateIntrinsic(EPropertyTypeNew::Choice,
|
||||
pProperties,
|
||||
MEMBER_OFFSET(CLight, mType),
|
||||
"LightType");
|
||||
pLightType->AddValue("LocalAmbient", eLocalAmbient);
|
||||
pLightType->AddValue("Directional", eDirectional);
|
||||
pLightType->AddValue("Spot", eSpot);
|
||||
pLightType->AddValue("Custom", eCustom);
|
||||
|
||||
IPropertyNew::CreateIntrinsic(EPropertyTypeNew::Color,
|
||||
pProperties,
|
||||
MEMBER_OFFSET(CLight, mColor),
|
||||
"Color");
|
||||
|
||||
IPropertyNew::CreateIntrinsic(EPropertyTypeNew::Vector,
|
||||
pProperties,
|
||||
MEMBER_OFFSET(CLight, mPosition),
|
||||
"Position");
|
||||
|
||||
IPropertyNew::CreateIntrinsic(EPropertyTypeNew::Vector,
|
||||
pProperties,
|
||||
MEMBER_OFFSET(CLight, mDirection),
|
||||
"Direction");
|
||||
|
||||
IPropertyNew::CreateIntrinsic(EPropertyTypeNew::Float,
|
||||
pProperties,
|
||||
MEMBER_OFFSET(CLight, mSpotCutoff),
|
||||
"SpotCutoff");
|
||||
}
|
||||
|
||||
return pProperties;
|
||||
}
|
||||
|
||||
// ************ OTHER ************
|
||||
void CLight::Load() const
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef CLIGHT_H
|
||||
#define CLIGHT_H
|
||||
|
||||
#include "Core/Resource/Script/Property/Properties.h"
|
||||
#include <Common/CColor.h>
|
||||
#include <Common/FileIO/IInputStream.h>
|
||||
#include <Math/CVector3f.h>
|
||||
@@ -62,6 +63,8 @@ public:
|
||||
void SetDistAtten(float DistCoefA, float DistCoefB, float DistCoefC);
|
||||
void SetAngleAtten(float AngleCoefA, float AngleCoefB, float AngleCoefC);
|
||||
|
||||
CStructPropertyNew* GetProperties() const;
|
||||
|
||||
// Other
|
||||
void Load() const;
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate*
|
||||
// no archetype, so do normal create
|
||||
if (!pProp)
|
||||
{
|
||||
pProp = IPropertyNew::Create(Type, pParent, mpMaster, pScript, false);
|
||||
pProp = IPropertyNew::Create(Type, pParent, mGame, pScript, false);
|
||||
}
|
||||
|
||||
// we need to have a valid property by this point
|
||||
@@ -340,7 +340,7 @@ IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate*
|
||||
}
|
||||
else
|
||||
{
|
||||
pArray->mpItemArchetype = IPropertyNew::Create(EPropertyTypeNew::Struct, pArray, mpMaster, pScript, false);
|
||||
pArray->mpItemArchetype = IPropertyNew::Create(EPropertyTypeNew::Struct, pArray, mGame, pScript, false);
|
||||
pStruct = TPropCast<CStructPropertyNew>(pArray->mpItemArchetype);
|
||||
pStruct->mFlags = EPropertyFlag::IsAtomic | EPropertyFlag::IsArrayArchetype;
|
||||
}
|
||||
@@ -389,8 +389,9 @@ CStructPropertyNew* CTemplateLoader::LoadStructArchetype(const TString& rkTempla
|
||||
pArchetype = TPropCast<CStructPropertyNew>(
|
||||
IPropertyNew::Create(EPropertyTypeNew::Struct,
|
||||
nullptr,
|
||||
mpMaster,
|
||||
nullptr, false)
|
||||
mGame,
|
||||
nullptr,
|
||||
false)
|
||||
);
|
||||
ASSERT(pArchetype != nullptr);
|
||||
|
||||
@@ -458,7 +459,7 @@ CEnumProperty* CTemplateLoader::LoadEnumArchetype(const TString& rkTemplateFileN
|
||||
pArchetype = static_cast<CEnumProperty*>(
|
||||
IPropertyNew::Create(bIsChoice ? EPropertyTypeNew::Choice : EPropertyTypeNew::Enum,
|
||||
nullptr,
|
||||
mpMaster,
|
||||
mGame,
|
||||
nullptr,
|
||||
false)
|
||||
);
|
||||
@@ -500,8 +501,9 @@ CFlagsProperty* CTemplateLoader::LoadFlagsArchetype(const TString& rkTemplateFil
|
||||
pArchetype = TPropCast<CFlagsProperty>(
|
||||
IPropertyNew::Create(EPropertyTypeNew::Flags,
|
||||
nullptr,
|
||||
mpMaster,
|
||||
nullptr, false)
|
||||
mGame,
|
||||
nullptr,
|
||||
false)
|
||||
);
|
||||
ASSERT(pArchetype != nullptr);
|
||||
|
||||
@@ -600,11 +602,6 @@ void CTemplateLoader::LoadBitFlags(XMLElement *pFlagsElem, CFlagsProperty* pFlag
|
||||
}
|
||||
}
|
||||
|
||||
enum class ETest
|
||||
{
|
||||
ValueA = (true ? 0 : (u32) reinterpret_cast<u64>("ValueA"))
|
||||
};
|
||||
|
||||
// ************ SCRIPT OBJECT ************
|
||||
CScriptTemplate* CTemplateLoader::LoadScriptTemplate(XMLDocument *pDoc, const TString& rkTemplateName, u32 ObjectID)
|
||||
{
|
||||
@@ -612,7 +609,7 @@ CScriptTemplate* CTemplateLoader::LoadScriptTemplate(XMLDocument *pDoc, const TS
|
||||
pScript->mObjectID = ObjectID;
|
||||
pScript->mSourceFile = rkTemplateName;
|
||||
|
||||
IPropertyNew* pBaseStruct = IPropertyNew::Create(EPropertyTypeNew::Struct, nullptr, mpMaster, pScript);
|
||||
IPropertyNew* pBaseStruct = IPropertyNew::Create(EPropertyTypeNew::Struct, nullptr, mGame, pScript);
|
||||
pScript->mpProperties = std::make_unique<CStructPropertyNew>( *TPropCast<CStructPropertyNew>(pBaseStruct) );
|
||||
|
||||
XMLElement *pRoot = pDoc->FirstChildElement("ScriptTemplate");
|
||||
|
||||
@@ -17,15 +17,17 @@ CScriptObject::CScriptObject(u32 InstanceID, CGameArea *pArea, CScriptLayer *pLa
|
||||
// Init properties
|
||||
CStructPropertyNew* pProperties = pTemplate->Properties();
|
||||
u32 PropertiesSize = pProperties->DataSize();
|
||||
mPropertyData.resize( PropertiesSize );
|
||||
pProperties->Construct( mPropertyData.data() );
|
||||
|
||||
mInstanceName = CStringRef(this, pTemplate->NameProperty());
|
||||
mPosition = CVectorRef(this, pTemplate->PositionProperty());
|
||||
mRotation = CVectorRef(this, pTemplate->RotationProperty());
|
||||
mScale = CVectorRef(this, pTemplate->ScaleProperty());
|
||||
mActive = CBoolRef(this, pTemplate->ActiveProperty());
|
||||
mLightParameters = CStructRef(this, pTemplate->LightParametersProperty());
|
||||
mPropertyData.resize( PropertiesSize );
|
||||
void* pData = mPropertyData.data();
|
||||
pProperties->Construct( pData );
|
||||
|
||||
mInstanceName = CStringRef(pData, pTemplate->NameProperty());
|
||||
mPosition = CVectorRef(pData, pTemplate->PositionProperty());
|
||||
mRotation = CVectorRef(pData, pTemplate->RotationProperty());
|
||||
mScale = CVectorRef(pData, pTemplate->ScaleProperty());
|
||||
mActive = CBoolRef(pData, pTemplate->ActiveProperty());
|
||||
mLightParameters = CStructRef(pData, pTemplate->LightParametersProperty());
|
||||
}
|
||||
|
||||
CScriptObject::~CScriptObject()
|
||||
|
||||
@@ -255,12 +255,12 @@ bool IPropertyNew::HasAccurateName()
|
||||
/** IPropertyNew Accessors */
|
||||
EGame IPropertyNew::Game() const
|
||||
{
|
||||
return mpMasterTemplate->Game();
|
||||
return mGame;
|
||||
}
|
||||
|
||||
IPropertyNew* IPropertyNew::Create(EPropertyTypeNew Type,
|
||||
IPropertyNew* pParent,
|
||||
CMasterTemplate* pMaster,
|
||||
EGame Game,
|
||||
CScriptTemplate* pScript,
|
||||
bool CallPostInit /*= true*/)
|
||||
{
|
||||
@@ -316,7 +316,7 @@ IPropertyNew* IPropertyNew::Create(EPropertyTypeNew Type,
|
||||
}
|
||||
|
||||
// Set other metadata
|
||||
pOut->mpMasterTemplate = pMaster;
|
||||
pOut->mGame = Game;
|
||||
pOut->mpScriptTemplate = pScript;
|
||||
pOut->_CalcOffset();
|
||||
|
||||
@@ -344,8 +344,20 @@ IPropertyNew* IPropertyNew::CreateCopy(IPropertyNew* pArchetype,
|
||||
// always be valid.
|
||||
ASSERT(pParent != nullptr);
|
||||
|
||||
IPropertyNew* pOut = Create(pArchetype->Type(), pParent, pParent->mpMasterTemplate, pParent->mpScriptTemplate, false);
|
||||
IPropertyNew* pOut = Create(pArchetype->Type(), pParent, pParent->mGame, pParent->mpScriptTemplate, false);
|
||||
pOut->InitFromArchetype(pArchetype);
|
||||
pArchetype->mSubInstances.push_back(pOut);
|
||||
return pOut;
|
||||
}
|
||||
|
||||
IPropertyNew* IPropertyNew::CreateIntrinsic(EPropertyTypeNew Type,
|
||||
IPropertyNew* pParent,
|
||||
u32 Offset,
|
||||
const TString& rkName)
|
||||
{
|
||||
IPropertyNew* pOut = Create(Type, pParent, pParent ? pParent->mGame : eUnknownGame, nullptr, false);
|
||||
pOut->mOffset = Offset;
|
||||
pOut->SetName(rkName);
|
||||
pOut->PostInitialize();
|
||||
return pOut;
|
||||
}
|
||||
|
||||
@@ -137,9 +137,8 @@ protected:
|
||||
/** Child properties; these appear underneath this property on the UI */
|
||||
std::vector<IPropertyNew*> mChildren;
|
||||
|
||||
/** Master template for the game this property belongs to.
|
||||
* Cannot be derived from mpScriptTemplate because mpScriptTemplate is null sometimes */
|
||||
CMasterTemplate* mpMasterTemplate;
|
||||
/** Game this property belongs to */
|
||||
EGame mGame;
|
||||
|
||||
/** Script template that this property belongs to. Null for struct/enum/flag archetypes. */
|
||||
CScriptTemplate* mpScriptTemplate;
|
||||
@@ -231,12 +230,17 @@ public:
|
||||
/** Create */
|
||||
static IPropertyNew* Create(EPropertyTypeNew Type,
|
||||
IPropertyNew* pParent,
|
||||
CMasterTemplate* pMaster,
|
||||
EGame Game,
|
||||
CScriptTemplate* pScript,
|
||||
bool CallPostInit = true);
|
||||
|
||||
static IPropertyNew* CreateCopy(IPropertyNew* pArchetype,
|
||||
IPropertyNew* pParent);
|
||||
|
||||
static IPropertyNew* CreateIntrinsic(EPropertyTypeNew Type,
|
||||
IPropertyNew* pParent,
|
||||
u32 Offset,
|
||||
const TString& rkName);
|
||||
};
|
||||
|
||||
inline ECookPreferenceNew IPropertyNew::CookPreference() const
|
||||
@@ -284,11 +288,6 @@ inline CScriptTemplate* IPropertyNew::ScriptTemplate() const
|
||||
return mpScriptTemplate;
|
||||
}
|
||||
|
||||
inline CMasterTemplate* IPropertyNew::MasterTemplate() const
|
||||
{
|
||||
return mpMasterTemplate;
|
||||
}
|
||||
|
||||
inline TString IPropertyNew::Name() const
|
||||
{
|
||||
return mName;
|
||||
|
||||
@@ -15,10 +15,10 @@ protected:
|
||||
public:
|
||||
virtual void PostInitialize()
|
||||
{
|
||||
IPropertyNew* pR = Create(EPropertyTypeNew::Float, this, mpMasterTemplate, mpScriptTemplate);
|
||||
IPropertyNew* pG = Create(EPropertyTypeNew::Float, this, mpMasterTemplate, mpScriptTemplate);
|
||||
IPropertyNew* pB = Create(EPropertyTypeNew::Float, this, mpMasterTemplate, mpScriptTemplate);
|
||||
IPropertyNew* pA = Create(EPropertyTypeNew::Float, this, mpMasterTemplate, mpScriptTemplate);
|
||||
IPropertyNew* pR = Create(EPropertyTypeNew::Float, this, mGame, mpScriptTemplate);
|
||||
IPropertyNew* pG = Create(EPropertyTypeNew::Float, this, mGame, mpScriptTemplate);
|
||||
IPropertyNew* pB = Create(EPropertyTypeNew::Float, this, mGame, mpScriptTemplate);
|
||||
IPropertyNew* pA = Create(EPropertyTypeNew::Float, this, mGame, mpScriptTemplate);
|
||||
pR->SetName("R");
|
||||
pG->SetName("G");
|
||||
pB->SetName("B");
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
|
||||
/** There are two types of enum properties: in the game data enum and choice.
|
||||
/** There are two types of enum properties in the game data: enum and choice.
|
||||
*
|
||||
* In the game, the difference is that choice properties are index-based, while
|
||||
* enum properties are stored as a hash of the name of the enum.
|
||||
* enum properties are stored as a hash of the name of the enum value.
|
||||
*
|
||||
* In PWE, however, they are both implemented the same way under the hood.
|
||||
*/
|
||||
@@ -59,6 +59,11 @@ public:
|
||||
return IsArchetype() ? mSourceFile : mpArchetype->GetTemplateFileName();
|
||||
}
|
||||
|
||||
void AddValue(TString ValueName, u32 ValueID)
|
||||
{
|
||||
mValues.push_back( SEnumValue(ValueName, ValueID) );
|
||||
}
|
||||
|
||||
inline u32 NumPossibleValues() const { return mValues.size(); }
|
||||
|
||||
u32 ValueIndex(u32 ID) const
|
||||
|
||||
@@ -15,9 +15,9 @@ protected:
|
||||
public:
|
||||
virtual void PostInitialize()
|
||||
{
|
||||
IPropertyNew* pX = Create(EPropertyTypeNew::Float, this, mpMasterTemplate, mpScriptTemplate);
|
||||
IPropertyNew* pY = Create(EPropertyTypeNew::Float, this, mpMasterTemplate, mpScriptTemplate);
|
||||
IPropertyNew* pZ = Create(EPropertyTypeNew::Float, this, mpMasterTemplate, mpScriptTemplate);
|
||||
IPropertyNew* pX = Create(EPropertyTypeNew::Float, this, mGame, mpScriptTemplate);
|
||||
IPropertyNew* pY = Create(EPropertyTypeNew::Float, this, mGame, mpScriptTemplate);
|
||||
IPropertyNew* pZ = Create(EPropertyTypeNew::Float, this, mGame, mpScriptTemplate);
|
||||
pX->SetName("X");
|
||||
pY->SetName("Y");
|
||||
pZ->SetName("Z");
|
||||
|
||||
@@ -22,37 +22,37 @@
|
||||
#include "CStructProperty.h"
|
||||
#include "CVectorProperty.h"
|
||||
|
||||
/** TPropertyRef: Embeds a reference to a property on a specific script object */
|
||||
/** TPropertyRef: Embeds a reference to a property on a specific object */
|
||||
template<class PropertyClass, typename ValueType = PropertyClass::ValueType>
|
||||
class TPropertyRef
|
||||
{
|
||||
/** Script object containing the property data being referenced */
|
||||
CScriptObject* mpObject;
|
||||
/** Property data being referenced */
|
||||
void* mpPropertyData;
|
||||
|
||||
/** Property being referenced */
|
||||
PropertyClass* mpProperty;
|
||||
PropertyClass* mpProperty;
|
||||
|
||||
public:
|
||||
TPropertyRef()
|
||||
: mpObject(nullptr), mpProperty(nullptr)
|
||||
: mpPropertyData(nullptr), mpProperty(nullptr)
|
||||
{}
|
||||
|
||||
TPropertyRef(CScriptObject* pInObject, IPropertyNew* pInProperty)
|
||||
: mpObject(pInObject), mpProperty( TPropCast<PropertyClass>(pInProperty) )
|
||||
explicit TPropertyRef(void* pInData, IPropertyNew* pInProperty)
|
||||
: mpPropertyData(pInData), mpProperty( TPropCast<PropertyClass>(pInProperty) )
|
||||
{
|
||||
}
|
||||
|
||||
TPropertyRef(CScriptObject* pInObject, PropertyClass* pInProperty)
|
||||
: mpObject(pInObject), mpProperty(pInProperty)
|
||||
explicit TPropertyRef(void* pInData, PropertyClass* pInProperty)
|
||||
: mpPropertyData(pInData), mpProperty(pInProperty)
|
||||
{
|
||||
}
|
||||
|
||||
/** Accessors */
|
||||
inline CScriptObject* Object() const { return mpObject; }
|
||||
inline void* DataPointer() const { return mpPropertyData; }
|
||||
inline PropertyClass* Property() const { return mpProperty; }
|
||||
inline ValueType Get() const { return IsValid() ? *((ValueType*) mpProperty->RawValuePtr( mpObject->PropertyData() )) : ValueType(); }
|
||||
inline void Set(const ValueType& kIn) const { if (IsValid()) *((ValueType*) mpProperty->RawValuePtr( mpObject->PropertyData() )) = kIn; }
|
||||
inline bool IsValid() const { return mpObject != nullptr && mpProperty != nullptr; }
|
||||
inline ValueType Get() const { return IsValid() ? *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) : ValueType(); }
|
||||
inline void Set(const ValueType& kIn) const { if (IsValid()) *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) = kIn; }
|
||||
inline bool IsValid() const { return mpPropertyData != nullptr && mpProperty != nullptr; }
|
||||
|
||||
/** Inline operators */
|
||||
inline operator ValueType() const
|
||||
@@ -101,12 +101,12 @@ public:
|
||||
: TPropertyRef()
|
||||
{}
|
||||
|
||||
TEnumRef(CScriptObject* pInObject, IPropertyNew* pInProperty)
|
||||
: TPropertyRef(pInObject, pInProperty)
|
||||
TEnumRef(void* pInData, IPropertyNew* pInProperty)
|
||||
: TPropertyRef(pInData, pInProperty)
|
||||
{}
|
||||
|
||||
TEnumRef(CScriptObject* pInObject, CEnumProperty* pInProperty)
|
||||
: TPropertyRef(pInObject, pInProperty)
|
||||
TEnumRef(void* pInData, CEnumProperty* pInProperty)
|
||||
: TPropertyRef(pInData, pInProperty)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
@@ -125,6 +125,19 @@ SRayIntersection CLightNode::RayNodeIntersectTest(const CRay& rkRay, u32 AssetID
|
||||
return Out;
|
||||
}
|
||||
|
||||
CStructRef CLightNode::GetProperties() const
|
||||
{
|
||||
return CStructRef(mpLight, mpLight->GetProperties());
|
||||
}
|
||||
|
||||
void CLightNode::PropertyModified(IPropertyNew* pProperty)
|
||||
{
|
||||
CSceneNode::PropertyModified(pProperty);
|
||||
|
||||
if (pProperty->Name() == "Position")
|
||||
SetPosition( mpLight->Position() );
|
||||
}
|
||||
|
||||
CLight* CLightNode::Light()
|
||||
{
|
||||
return mpLight;
|
||||
|
||||
@@ -15,6 +15,8 @@ public:
|
||||
void DrawSelection();
|
||||
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo);
|
||||
SRayIntersection RayNodeIntersectTest(const CRay &Ray, u32 AssetID, const SViewInfo& ViewInfo);
|
||||
CStructRef GetProperties() const;
|
||||
void PropertyModified(IPropertyNew* pProperty);
|
||||
bool AllowsRotate() const { return false; }
|
||||
CLight* Light();
|
||||
CVector2f BillboardScale();
|
||||
|
||||
@@ -69,6 +69,8 @@ public:
|
||||
virtual bool IsVisible() const;
|
||||
virtual CColor TintColor(const SViewInfo& rkViewInfo) const;
|
||||
virtual CColor WireframeColor() const;
|
||||
virtual CStructRef GetProperties() const { return CStructRef(); }
|
||||
virtual void PropertyModified(IPropertyNew* pProperty) {}
|
||||
|
||||
void OnLoadFinished();
|
||||
void Unparent();
|
||||
|
||||
@@ -13,8 +13,8 @@ CScriptAttachNode::CScriptAttachNode(CScene *pScene, const SAttachment& rkAttach
|
||||
CStructPropertyNew* pBaseStruct = pParent->Template()->Properties();
|
||||
|
||||
mpAttachAssetProp = pBaseStruct->ChildByIDString(rkAttachment.AttachProperty);
|
||||
mAttachAssetRef = CAssetRef(pParent->Instance(), mpAttachAssetProp);
|
||||
mAttachAnimSetRef = CAnimationSetRef(pParent->Instance(), mpAttachAssetProp);
|
||||
mAttachAssetRef = CAssetRef(pParent->Instance()->PropertyData(), mpAttachAssetProp);
|
||||
mAttachAnimSetRef = CAnimationSetRef(pParent->Instance()->PropertyData(), mpAttachAssetProp);
|
||||
if (mpAttachAssetProp) AttachPropertyModified();
|
||||
|
||||
ParentDisplayAssetChanged(mpScriptNode->DisplayAsset());
|
||||
|
||||
@@ -454,6 +454,11 @@ void CScriptNode::LinksModified()
|
||||
if (mpExtra) mpExtra->LinksModified();
|
||||
}
|
||||
|
||||
CStructRef CScriptNode::GetProperties() const
|
||||
{
|
||||
return CStructRef(mpInstance->PropertyData(), mpInstance->Template()->Properties());
|
||||
}
|
||||
|
||||
void CScriptNode::PropertyModified(IPropertyNew* pProp)
|
||||
{
|
||||
// Update volume
|
||||
|
||||
@@ -47,9 +47,10 @@ public:
|
||||
bool IsVisible() const;
|
||||
CColor TintColor(const SViewInfo& rkViewInfo) const;
|
||||
CColor WireframeColor() const;
|
||||
CStructRef GetProperties() const;
|
||||
void PropertyModified(IPropertyNew* pProp);
|
||||
|
||||
void LinksModified();
|
||||
void PropertyModified(IPropertyNew* pProp);
|
||||
void UpdatePreviewVolume();
|
||||
void GeneratePosition();
|
||||
void TestGameModeVisibility();
|
||||
|
||||
@@ -17,17 +17,17 @@ CDamageableTriggerExtra::CDamageableTriggerExtra(CScriptObject *pInstance, CScen
|
||||
CStructPropertyNew* pProperties = pInstance->Template()->Properties();
|
||||
|
||||
// Fetch render side
|
||||
mRenderSide = TEnumRef<ERenderSide>(pInstance, pProperties->ChildByIndex(5));
|
||||
mRenderSide = TEnumRef<ERenderSide>(pInstance->PropertyData(), pProperties->ChildByIndex(5));
|
||||
if (mRenderSide.IsValid()) PropertyModified(mRenderSide.Property());
|
||||
|
||||
// Fetch scale
|
||||
mPlaneSize = CVectorRef(pInstance, pProperties->ChildByIndex(2));
|
||||
mPlaneSize = CVectorRef(pInstance->PropertyData(), pProperties->ChildByIndex(2));
|
||||
if (mPlaneSize.IsValid()) PropertyModified(mPlaneSize.Property());
|
||||
|
||||
// Fetch textures
|
||||
for (u32 TextureIdx = 0; TextureIdx < 3; TextureIdx++)
|
||||
{
|
||||
mTextureAssets[TextureIdx] = CAssetRef(pInstance, pProperties->ChildByIndex(6 + TextureIdx));
|
||||
mTextureAssets[TextureIdx] = CAssetRef(pInstance->PropertyData(), pProperties->ChildByIndex(6 + TextureIdx));
|
||||
if (mTextureAssets[TextureIdx].IsValid()) PropertyModified(mTextureAssets[TextureIdx].Property());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,18 +6,18 @@ CDoorExtra::CDoorExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pP
|
||||
{
|
||||
CStructPropertyNew* pProperties = pInstance->Template()->Properties();
|
||||
|
||||
mShieldModelProp = CAssetRef(pInstance, pProperties->ChildByID(0xB20CC271));
|
||||
mShieldModelProp = CAssetRef(pInstance->PropertyData(), pProperties->ChildByID(0xB20CC271));
|
||||
if (mShieldModelProp.IsValid()) PropertyModified(mShieldModelProp.Property());
|
||||
|
||||
if (mGame >= eEchoes)
|
||||
{
|
||||
mShieldColorProp = CColorRef(pInstance, pProperties->ChildByID(0x47B4E863));
|
||||
mShieldColorProp = CColorRef(pInstance->PropertyData(), pProperties->ChildByID(0x47B4E863));
|
||||
if (mShieldColorProp.IsValid()) PropertyModified(mShieldColorProp.Property());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
mDisabledProp = CBoolRef(pInstance, pProperties->ChildByID(0xDEE730F5));
|
||||
mDisabledProp = CBoolRef(pInstance->PropertyData(), pProperties->ChildByID(0xDEE730F5));
|
||||
if (mDisabledProp.IsValid()) PropertyModified(mDisabledProp.Property());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ CPointOfInterestExtra::CPointOfInterestExtra(CScriptObject *pInstance, CScene *p
|
||||
// Fetch scan data property
|
||||
CStructPropertyNew* pProperties = pInstance->Template()->Properties();
|
||||
|
||||
if (mGame <= ePrime) mScanProperty = CAssetRef(pInstance, pProperties->ChildByIDString("0x04:0x00"));
|
||||
else mScanProperty = CAssetRef(pInstance, pProperties->ChildByIDString("0xBDBEC295:0xB94E9BE7"));
|
||||
if (mGame <= ePrime) mScanProperty = CAssetRef(pInstance->PropertyData(), pProperties->ChildByIDString("0x04:0x00"));
|
||||
else mScanProperty = CAssetRef(pInstance->PropertyData(), pProperties->ChildByIDString("0xBDBEC295:0xB94E9BE7"));
|
||||
|
||||
PropertyModified(mScanProperty.Property());
|
||||
}
|
||||
|
||||
@@ -11,16 +11,16 @@ CRadiusSphereExtra::CRadiusSphereExtra(CScriptObject* pInstance, CScene* pScene,
|
||||
switch (mObjectType)
|
||||
{
|
||||
case 0x63: // Repulsor (MP1)
|
||||
mRadius = CFloatRef(pInstance, pProperties->ChildByID(3));
|
||||
mRadius = CFloatRef(pInstance->PropertyData(), pProperties->ChildByID(3));
|
||||
break;
|
||||
|
||||
case 0x68: // RadialDamage (MP1)
|
||||
mRadius = CFloatRef(pInstance, pProperties->ChildByID(0x4));
|
||||
mRadius = CFloatRef(pInstance->PropertyData(), pProperties->ChildByID(0x4));
|
||||
break;
|
||||
|
||||
case FOURCC('REPL'): // Repulsor (MP2/MP3)
|
||||
case FOURCC('RADD'): // RadialDamage (MP2/MP3/DKCR)
|
||||
mRadius = CFloatRef(pInstance, pProperties->ChildByID(0x78C507EB));
|
||||
mRadius = CFloatRef(pInstance->PropertyData(), pProperties->ChildByID(0x78C507EB));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ CSandwormExtra::CSandwormExtra(CScriptObject* pInstance, CScene* pScene, CScript
|
||||
}
|
||||
|
||||
// Get pincers scale
|
||||
mPincersScale = CFloatRef(pInstance, pInstance->Template()->Properties()->ChildByID(0x3DB583AE));
|
||||
mPincersScale = CFloatRef(pInstance->PropertyData(), pInstance->Template()->Properties()->ChildByID(0x3DB583AE));
|
||||
if (mPincersScale.IsValid()) PropertyModified(mPincersScale.Property());
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
CSplinePathExtra::CSplinePathExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent)
|
||||
: CScriptExtra(pInstance, pScene, pParent)
|
||||
{
|
||||
mPathColor = CColorRef(pInstance, pInstance->Template()->Properties()->ChildByID(0x00DD86E2));
|
||||
mPathColor = CColorRef(pInstance->PropertyData(), pInstance->Template()->Properties()->ChildByID(0x00DD86E2));
|
||||
}
|
||||
|
||||
void CSplinePathExtra::PropertyModified(IPropertyNew* pProperty)
|
||||
|
||||
Reference in New Issue
Block a user