/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Tools/Libs/ToolsFoundation/Object/DocumentObjectMirror.h
74 строки
3 KB
C-Core
Array usage cleanup (#1864)
11 мар 2026, 23:44
Не верифицирован
11 мар 2026, 23:44
f7cb730
Код
Авторство
О чём код?
#pragma once #include <Foundation/Containers/HybridArray.h> #include <Foundation/Reflection/PropertyPath.h> #include <Foundation/Serialization/RttiConverter.h> #include <ToolsFoundation/Object/DocumentObjectManager.h> #include <ToolsFoundation/ToolsFoundationDLL.h> /// \brief An object change starts at the heap object m_Root (because we can only safely store pointers to those). /// From this object we follow m_Steps (member arrays, structs) to execute m_Change at the end target. /// /// In case of an NodeAdded operation, m_GraphData contains the entire subgraph of this node. class EZ_TOOLSFOUNDATION_DLL ezObjectChange { public: ezObjectChange() = default; ezObjectChange(const ezObjectChange&); ezObjectChange(ezObjectChange&& rhs); void operator=(ezObjectChange&& rhs); void operator=(ezObjectChange& rhs); void GetGraph(ezAbstractObjectGraph& ref_graph) const; void SetGraph(ezAbstractObjectGraph& ref_graph); ezUuid m_Root; //< The object that is the parent of the op, namely the parent heap object we can store a pointer to. ezHybridArray<ezPropertyPathStep, 2> m_Steps; //< Path from root to target of change. ezDiffOperation m_Change; //< Change at the target. ezDataBuffer m_GraphData; //< In case of ObjectAdded, this holds the binary serialized object graph. }; EZ_DECLARE_REFLECTABLE_TYPE(EZ_TOOLSFOUNDATION_DLL, ezObjectChange); class EZ_TOOLSFOUNDATION_DLL ezDocumentObjectMirror { public: ezDocumentObjectMirror(); virtual ~ezDocumentObjectMirror(); void InitSender(const ezDocumentObjectManager* pManager); void InitReceiver(ezRttiConverterContext* pContext); void DeInit(); using FilterFunction = ezDelegate<bool(const ezDocumentObject*, ezStringView)>; /// \brief /// /// \param filter /// Filter that defines whether an object property should be mirrored or not. void SetFilterFunction(FilterFunction filter); void SendDocument(); void Clear(); void TreeStructureEventHandler(const ezDocumentObjectStructureEvent& e); void TreePropertyEventHandler(const ezDocumentObjectPropertyEvent& e); void* GetNativeObjectPointer(const ezDocumentObject* pObject); const void* GetNativeObjectPointer(const ezDocumentObject* pObject) const; protected: bool IsRootObject(const ezDocumentObject* pParent); bool IsHeapAllocated(const ezDocumentObject* pParent, ezStringView sParentProperty); bool IsDiscardedByFilter(const ezDocumentObject* pObject, ezStringView sProperty) const; static void CreatePath(ezObjectChange& out_change, const ezDocumentObject* pRoot, ezStringView sProperty); static ezUuid FindRootOpObject(const ezDocumentObject* pObject, ezDynamicArray<const ezDocumentObject*>& out_path); static void FlattenSteps(const ezArrayPtr<const ezDocumentObject* const> path, ezDynamicArray<ezPropertyPathStep>& out_steps); virtual void ApplyOp(ezObjectChange& change); void ApplyOp(ezRttiConverterObject object, const ezObjectChange& change); protected: ezRttiConverterContext* m_pContext; const ezDocumentObjectManager* m_pManager; FilterFunction m_Filter; };