Skip to content

Commit b949720

Browse files
authored
Avoid (Missing Reference) on embedded material asset fields (#758)
1 parent f4307f2 commit b949720

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

Sources/OvEditor/src/OvEditor/Core/Editor.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,22 @@ void OvEditor::Core::Editor::SetupUI()
147147
OvCore::Helpers::GUIHelpers::SetAssetExistsChecker(
148148
[this](const std::string& p_path)
149149
{
150-
return std::filesystem::exists(m_editorActions.GetRealPath(p_path));
150+
const std::string path = OvTools::Utils::PathParser::MakeNonWindowsStyle(p_path);
151+
152+
if (const auto embeddedAssetPath = ParseEmbeddedAssetPath(path); embeddedAssetPath)
153+
{
154+
const bool isEmbeddedMaterial = ParseEmbeddedMaterialIndex(embeddedAssetPath->assetName).has_value();
155+
const bool isEmbeddedTexture = ParseEmbeddedTextureIndex(embeddedAssetPath->assetName).has_value();
156+
157+
if (isEmbeddedMaterial || isEmbeddedTexture)
158+
{
159+
return std::filesystem::exists(m_editorActions.GetRealPath(embeddedAssetPath->modelPath));
160+
}
161+
162+
return false;
163+
}
164+
165+
return std::filesystem::exists(m_editorActions.GetRealPath(path));
151166
}
152167
);
153168

0 commit comments

Comments
 (0)