27 , m_LightSettings(bEnableDefaultLighting)
29 if (bEnableDefaultLighting)
32 pPreferences->ApplyDefaultValues(m_LightSettings);
37 : BaseClass(sDocumentPath, pObjectManager, engineConnectionType)
38 , m_LightSettings(bEnableDefaultLighting)
40 if (bEnableDefaultLighting)
43 pPreferences->ApplyDefaultValues(m_LightSettings);
49 m_ObjectMirror.Clear();
50 m_ObjectMirror.DeInit();
53 const PropertyType* GetProperties()
const
55 return static_cast<const PropertyType*
>(m_ObjectMirror.GetNativeObjectPointer(this->GetObjectManager()->GetRootObject()->GetChildren()[0]));
58 PropertyType* GetProperties()
60 return static_cast<PropertyType*
>(m_ObjectMirror.GetNativeObjectPointer(this->GetObjectManager()->GetRootObject()->GetChildren()[0]));
63 plDocumentObject* GetPropertyObject() {
return this->GetObjectManager()->GetRootObject()->GetChildren()[0]; }
66 virtual void InitializeAfterLoading(
bool bFirstTimeCreation)
override
68 EnsureSettingsObjectExist();
70 m_ObjectMirror.InitSender(this->GetObjectManager());
71 m_ObjectMirror.InitReceiver(&m_Context);
72 m_ObjectMirror.SendDocument();
74 BaseClass::InitializeAfterLoading(bFirstTimeCreation);
79 virtual plStatus InternalLoadDocument()
override
81 this->GetObjectManager()->DestroyAllObjects();
83 plStatus ret = BaseClass::InternalLoadDocument();
91 void ApplyNativePropertyChangesToObjectManager(
bool bForceIndexBasedRemapping =
false)
93 PL_PROFILE_SCOPE(
"ApplyNativePropertyChangesToObjectManager");
99 pOrigRootNode = writer.AddObjectToGraph(GetPropertyObject());
110 nativeChangesContext.RegisterObject(pOrigRootNode->GetGuid(), plGetStaticRTTI<PropertyType>(), GetProperties());
111 pRootNode = rttiConverter.AddObjectToGraph(GetProperties(),
"Object");
118 if (bForceIndexBasedRemapping)
125 graph.CreateDiffWithBaseGraph(origGraph, diffResult);
131 if (!diffResult.
IsEmpty() || bForceIndexBasedRemapping)
134 m_ObjectMirror.Clear();
137 this->GetObjectAccessor()->StartTransaction(
"Apply Native Property Changes to Object");
139 plDocumentObjectConverterReader::ApplyDiffToObject(this->GetObjectAccessor(), GetPropertyObject(), diffResult);
142 m_ObjectMirror.SendDocument();
144 this->GetObjectAccessor()->FinishTransaction();
149 void EnsureSettingsObjectExist()
151 auto pRoot = this->GetObjectManager()->GetRootObject();
152 if (pRoot->GetChildren().IsEmpty())
154 plDocumentObject* pObject = this->GetObjectManager()->CreateObject(plGetStaticRTTI<PropertyType>());
155 this->GetObjectManager()->AddObject(pObject, pRoot,
"Children", 0);
void ReMapNodeGuidsToMatchGraph(plAbstractObjectNode *pRoot, const plAbstractObjectGraph &rhsGraph, const plAbstractObjectNode *pRhsRoot)
Tries to remap the guids of this graph to those in rhsGraph by walking in both down the hierarchy,...
Definition AbstractObjectGraph.cpp:327
The plApplyNativePropertyChangesContext takes care of generating guids for native pointers that match...
Definition ApplyNativePropertyChangesContext.h:8
static TYPE * QueryPreferences(const plDocument *pDocument=nullptr)
Static function to query a preferences object of the given type. If the instance does not exist yet,...
Definition Preferences.h:31
Definition RttiConverter.h:33