Fixed newly created level having the right source field set (#986)
* Fixed an issue with the source field a newly created level not being set correctly
This commit is contained in:
+1
-1
@@ -57,6 +57,6 @@ namespace AzToolsFramework
|
||||
virtual void StartPlayInEditor() = 0;
|
||||
virtual void StopPlayInEditor() = 0;
|
||||
|
||||
virtual void CreateNewLevelPrefab(AZStd::string_view filename) = 0;
|
||||
virtual void CreateNewLevelPrefab(AZStd::string_view filename, const AZStd::string& templateFilename) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
+3
-3
@@ -265,7 +265,7 @@ namespace AzToolsFramework
|
||||
return false;
|
||||
}
|
||||
|
||||
void PrefabEditorEntityOwnershipService::CreateNewLevelPrefab(AZStd::string_view filename)
|
||||
void PrefabEditorEntityOwnershipService::CreateNewLevelPrefab(AZStd::string_view filename, const AZStd::string& templateFilename)
|
||||
{
|
||||
AZ::IO::Path relativePath = m_loaderInterface->GetRelativePathToProject(filename);
|
||||
AzToolsFramework::Prefab::TemplateId templateId = m_prefabSystemComponent->GetTemplateIdFromFilePath(relativePath);
|
||||
@@ -276,7 +276,7 @@ namespace AzToolsFramework
|
||||
AZ::Data::AssetInfo assetInfo;
|
||||
bool sourceInfoFound = false;
|
||||
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(
|
||||
sourceInfoFound, &AzToolsFramework::AssetSystemRequestBus::Events::GetSourceInfoBySourcePath, DefaultLevelTemplateName,
|
||||
sourceInfoFound, &AzToolsFramework::AssetSystemRequestBus::Events::GetSourceInfoBySourcePath, templateFilename.c_str(),
|
||||
assetInfo, watchFolder);
|
||||
|
||||
if (sourceInfoFound)
|
||||
@@ -292,7 +292,7 @@ namespace AzToolsFramework
|
||||
levelDefaultDom.CopyFrom(dom, levelDefaultDom.GetAllocator());
|
||||
|
||||
Prefab::PrefabDomPath sourcePath("/Source");
|
||||
sourcePath.Set(levelDefaultDom, assetInfo.m_relativePath.c_str());
|
||||
sourcePath.Set(levelDefaultDom, relativePath.c_str());
|
||||
|
||||
templateId = m_prefabSystemComponent->AddTemplate(relativePath, AZStd::move(levelDefaultDom));
|
||||
}
|
||||
|
||||
+1
-3
@@ -170,7 +170,7 @@ namespace AzToolsFramework
|
||||
void StartPlayInEditor() override;
|
||||
void StopPlayInEditor() override;
|
||||
|
||||
void CreateNewLevelPrefab(AZStd::string_view filename) override;
|
||||
void CreateNewLevelPrefab(AZStd::string_view filename, const AZStd::string& templateFilename) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -218,7 +218,5 @@ namespace AzToolsFramework
|
||||
Prefab::PrefabLoaderInterface* m_loaderInterface;
|
||||
AzFramework::EntityContextId m_entityContextId;
|
||||
AZ::SerializeContext m_serializeContext;
|
||||
|
||||
static inline constexpr const char* DefaultLevelTemplateName = "Prefabs/Default_Level.prefab";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3111,7 +3111,7 @@ CCryEditApp::ECreateLevelResult CCryEditApp::CreateLevel(const QString& levelNam
|
||||
auto* service = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
|
||||
if (service)
|
||||
{
|
||||
service->CreateNewLevelPrefab((const char*)fullyQualifiedLevelName.toUtf8());
|
||||
service->CreateNewLevelPrefab(fullyQualifiedLevelName.toUtf8().constData(), DefaultLevelTemplateName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -358,6 +358,8 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
private:
|
||||
static inline constexpr const char* DefaultLevelTemplateName = "Prefabs/Default_Level.prefab";
|
||||
|
||||
struct PythonOutputHandler;
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZStd::shared_ptr<PythonOutputHandler> m_pythonOutputHandler;
|
||||
|
||||
Reference in New Issue
Block a user