engine: sync editor rendering and ui changes
This commit is contained in:
@@ -139,7 +139,7 @@ void MeshFilterComponent::Serialize(std::ostream& os) const {
|
||||
}
|
||||
|
||||
os << "meshRef=" << EncodeAssetRef(meshRef) << ";";
|
||||
if (!meshRef.IsValid() && !m_meshPath.empty()) {
|
||||
if (!meshRef.IsValid() && !m_meshPath.empty() && HasVirtualPathScheme(m_meshPath)) {
|
||||
os << "meshPath=" << m_meshPath << ";";
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ void MeshFilterComponent::Deserialize(std::istream& is) {
|
||||
const std::string key = token.substr(0, eqPos);
|
||||
const std::string value = token.substr(eqPos + 1);
|
||||
|
||||
if (key == "mesh" || key == "meshPath") {
|
||||
if (key == "meshPath") {
|
||||
pendingMeshPath = value;
|
||||
} else if (key == "meshRef") {
|
||||
TryDecodeAssetRef(value, pendingMeshRef);
|
||||
@@ -203,12 +203,9 @@ void MeshFilterComponent::Deserialize(std::istream& is) {
|
||||
} else {
|
||||
m_meshPath = pendingMeshPath;
|
||||
}
|
||||
} else if (!pendingMeshPath.empty()) {
|
||||
} else if (!pendingMeshPath.empty() && HasVirtualPathScheme(pendingMeshPath)) {
|
||||
if (Resources::ResourceManager::Get().IsDeferredSceneLoadEnabled()) {
|
||||
m_meshPath = pendingMeshPath;
|
||||
if (!Resources::ResourceManager::Get().TryGetAssetRef(m_meshPath.c_str(), Resources::ResourceType::Mesh, m_meshRef)) {
|
||||
m_meshRef.Reset();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +240,6 @@ void MeshRendererComponent::Serialize(std::ostream& os) const {
|
||||
serializedRefs.resize(slotCount);
|
||||
std::vector<std::string> serializedPaths = m_materialPaths;
|
||||
serializedPaths.resize(slotCount);
|
||||
std::vector<std::string> fallbackPaths(slotCount);
|
||||
for (size_t i = 0; i < slotCount; ++i) {
|
||||
if (!serializedRefs[i].IsValid() &&
|
||||
!serializedPaths[i].empty() &&
|
||||
@@ -251,8 +250,8 @@ void MeshRendererComponent::Serialize(std::ostream& os) const {
|
||||
serializedRefs[i])) {
|
||||
}
|
||||
|
||||
if (!serializedRefs[i].IsValid()) {
|
||||
fallbackPaths[i] = serializedPaths[i];
|
||||
if (serializedRefs[i].IsValid() || !HasVirtualPathScheme(serializedPaths[i])) {
|
||||
serializedPaths[i].clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +260,7 @@ void MeshRendererComponent::Serialize(std::ostream& os) const {
|
||||
if (i > 0) {
|
||||
os << "|";
|
||||
}
|
||||
os << fallbackPaths[i];
|
||||
os << serializedPaths[i];
|
||||
}
|
||||
os << ";";
|
||||
os << "materialRefs=";
|
||||
@@ -298,7 +297,7 @@ void MeshRendererComponent::Deserialize(std::istream& is) {
|
||||
const std::string key = token.substr(0, eqPos);
|
||||
const std::string value = token.substr(eqPos + 1);
|
||||
|
||||
if (key == "materials" || key == "materialPaths") {
|
||||
if (key == "materialPaths") {
|
||||
m_materialPaths = SplitMaterialPaths(value);
|
||||
m_materials.resize(m_materialPaths.size());
|
||||
m_materialRefs.resize(m_materialPaths.size());
|
||||
@@ -362,15 +361,12 @@ void MeshRendererComponent::Deserialize(std::istream& is) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!HasVirtualPathScheme(m_materialPaths[i])) {
|
||||
m_materialPaths[i].clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Resources::ResourceManager::Get().IsDeferredSceneLoadEnabled()) {
|
||||
if (!m_materialPaths[i].empty()) {
|
||||
if (!m_materialRefs[i].IsValid() &&
|
||||
!Resources::ResourceManager::Get().TryGetAssetRef(m_materialPaths[i].c_str(),
|
||||
Resources::ResourceType::Material,
|
||||
m_materialRefs[i])) {
|
||||
m_materialRefs[i].Reset();
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user