/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/EditorPlugins/Assets/EditorPluginAssets/RenderPipelineAsset/RenderPipelineAsset.cpp
150 строк
6 KB
C-Core
Array usage cleanup (#1864)
11 мар 2026, 23:44
Не верифицирован
11 мар 2026, 23:44
f7cb730
Код
Авторство
О чём код?
#include <EditorPluginAssets/EditorPluginAssetsPCH.h> #include <EditorPluginAssets/RenderPipelineAsset/RenderPipelineAsset.h> #include <Foundation/Serialization/BinarySerializer.h> #include <GuiFoundation/VisualGraph/Scene.moc.h> #include <RendererCore/Pipeline/Extractor.h> #include <RendererCore/Pipeline/RenderPipelinePass.h> #include <ToolsFoundation/Serialization/DocumentObjectConverter.h> #include <ToolsFoundation/Serialization/ToolsSerializationUtils.h> EZ_BEGIN_DYNAMIC_REFLECTED_TYPE(ezRenderPipelineAssetDocument, 5, ezRTTINoAllocator) EZ_END_DYNAMIC_REFLECTED_TYPE; bool ezRenderPipelineNodeManager::InternalIsNode(const ezDocumentObject* pObject) const { auto pType = pObject->GetTypeAccessor().GetType(); return pType->IsDerivedFrom<ezRenderPipelinePass>() || pType->IsDerivedFrom<ezExtractor>(); } void ezRenderPipelineNodeManager::InternalCreatePins(const ezDocumentObject* pObject, NodeInternal& ref_node) { auto pType = pObject->GetTypeAccessor().GetType(); if (!pType->IsDerivedFrom<ezRenderPipelinePass>()) return; ezTempHybridArray<const ezAbstractProperty*, 32> properties; pType->GetAllProperties(properties); for (auto pProp : properties) { if (pProp->GetCategory() != ezPropertyCategory::Member) continue; if (!pProp->GetSpecificType()->IsDerivedFrom<ezRenderPipelineNodePin>()) continue; ezColor pinColor; if (const ezColorAttribute* pAttr = pProp->GetAttributeByType<ezColorAttribute>()) { pinColor = pAttr->GetColor(); } else { ezColorScheme::Enum color = ezColorScheme::Gray; if (ezStringUtils::IsEqual(pProp->GetPropertyName(), "DepthStencil")) color = ezColorScheme::Pink; pinColor = ezColorScheme::DarkUI(color); } if (pProp->GetSpecificType()->IsDerivedFrom<ezRenderPipelineNodeInputPin>()) { auto pPin = EZ_DEFAULT_NEW(ezVisualGraphPin, ezVisualGraphPin::Type::Input, pProp->GetPropertyName(), pinColor, pObject); ref_node.m_Inputs.PushBack(pPin); } else if (pProp->GetSpecificType()->IsDerivedFrom<ezRenderPipelineNodeOutputPin>()) { auto pPin = EZ_DEFAULT_NEW(ezVisualGraphPin, ezVisualGraphPin::Type::Output, pProp->GetPropertyName(), pinColor, pObject); ref_node.m_Outputs.PushBack(pPin); } else if (pProp->GetSpecificType()->IsDerivedFrom<ezRenderPipelineNodePassThroughPin>()) { auto pPinIn = EZ_DEFAULT_NEW(ezVisualGraphPin, ezVisualGraphPin::Type::Input, pProp->GetPropertyName(), pinColor, pObject); ref_node.m_Inputs.PushBack(pPinIn); auto pPinOut = EZ_DEFAULT_NEW(ezVisualGraphPin, ezVisualGraphPin::Type::Output, pProp->GetPropertyName(), pinColor, pObject); ref_node.m_Outputs.PushBack(pPinOut); } } } void ezRenderPipelineNodeManager::GetCreateableTypes(ezDynamicArray<const ezRTTI*>& out_types) const { ezRTTI::ForEachDerivedType<ezRenderPipelinePass>( [&](const ezRTTI* pRtti) { out_types.PushBack(pRtti); }, ezRTTI::ForEachOptions::ExcludeAbstract); ezRTTI::ForEachDerivedType<ezExtractor>( [&](const ezRTTI* pRtti) { out_types.PushBack(pRtti); }, ezRTTI::ForEachOptions::ExcludeAbstract); } ezStatus ezRenderPipelineNodeManager::InternalCanConnect(const ezVisualGraphPin& source, const ezVisualGraphPin& target, CanConnectResult& out_result) const { out_result = CanConnectResult::ConnectNto1; return ezStatus(EZ_SUCCESS); } ////////////////////////////////////////////////////////////////////////// ezRenderPipelineAssetDocument::ezRenderPipelineAssetDocument(ezStringView sDocumentPath) : ezAssetDocument(sDocumentPath, EZ_DEFAULT_NEW(ezRenderPipelineNodeManager), ezAssetDocEngineConnection::FullObjectMirroring) { } ezRenderPipelineAssetDocument::~ezRenderPipelineAssetDocument() = default; ezTransformStatus ezRenderPipelineAssetDocument::InternalTransformAsset(const char* szTargetFile, ezStringView sOutputTag, const ezPlatformProfile* pAssetProfile, const ezAssetFileHeader& AssetHeader, ezBitflags<ezTransformFlags> transformFlags) { return ezAssetDocument::RemoteExport(AssetHeader, szTargetFile); } ezTransformStatus ezRenderPipelineAssetDocument::InternalTransformAsset(ezStreamWriter& stream, ezStringView sOutputTag, const ezPlatformProfile* pAssetProfile, const ezAssetFileHeader& AssetHeader, ezBitflags<ezTransformFlags> transformFlags) { EZ_REPORT_FAILURE("Should not be called"); return ezTransformStatus(); } void ezRenderPipelineAssetDocument::InternalGetMetaDataHash(const ezDocumentObject* pObject, ezUInt64& inout_uiHash) const { const ezVisualGraphObjectManager* pManager = static_cast<const ezVisualGraphObjectManager*>(GetObjectManager()); pManager->GetMetaDataHash(pObject, inout_uiHash); } void ezRenderPipelineAssetDocument::AttachMetaDataBeforeSaving(ezAbstractObjectGraph& graph) const { SUPER::AttachMetaDataBeforeSaving(graph); const ezVisualGraphObjectManager* pManager = static_cast<const ezVisualGraphObjectManager*>(GetObjectManager()); pManager->AttachMetaDataBeforeSaving(graph); } void ezRenderPipelineAssetDocument::RestoreMetaDataAfterLoading(const ezAbstractObjectGraph& graph, bool bUndoable) { SUPER::RestoreMetaDataAfterLoading(graph, bUndoable); ezVisualGraphObjectManager* pManager = static_cast<ezVisualGraphObjectManager*>(GetObjectManager()); pManager->RestoreMetaDataAfterLoading(graph, bUndoable); } void ezRenderPipelineAssetDocument::GetSupportedMimeTypesForPasting(ezDynamicArray<ezString>& out_mimeTypes) const { out_mimeTypes.PushBack("application/ezEditor.RenderPipelineGraph"); } bool ezRenderPipelineAssetDocument::CopySelectedObjects(ezAbstractObjectGraph& out_objectGraph, ezStringBuilder& out_MimeType) const { out_MimeType = "application/ezEditor.RenderPipelineGraph"; const ezVisualGraphObjectManager* pManager = static_cast<const ezVisualGraphObjectManager*>(GetObjectManager()); return pManager->CopySelectedObjects(out_objectGraph); } bool ezRenderPipelineAssetDocument::Paste(const ezArrayPtr<PasteInfo>& info, const ezAbstractObjectGraph& objectGraph, bool bAllowPickedPosition, ezStringView sMimeType) { ezVisualGraphObjectManager* pManager = static_cast<ezVisualGraphObjectManager*>(GetObjectManager()); return pManager->PasteObjects(info, objectGraph, ezQtVisualGraphScene::GetLastMouseInteractionPos(), bAllowPickedPosition); }