Fixed crash when creating new projects
This commit is contained in:
parent
1baa48de34
commit
b49f19c386
|
@ -16,7 +16,7 @@ EXTERNALS_DIR = $$PWD/../externals
|
||||||
PWE_MAIN_INCLUDE = $$PWD
|
PWE_MAIN_INCLUDE = $$PWD
|
||||||
|
|
||||||
DEFINES += 'APP_NAME=\"\\\"Prime World Editor\\\"\"' \
|
DEFINES += 'APP_NAME=\"\\\"Prime World Editor\\\"\"' \
|
||||||
'APP_VERSION=\"\\\"1.2.1\\\"\"'
|
'APP_VERSION=\"\\\"1.2.2\\\"\"'
|
||||||
|
|
||||||
PUBLIC_RELEASE {
|
PUBLIC_RELEASE {
|
||||||
DEFINES += 'PUBLIC_RELEASE=1' \
|
DEFINES += 'PUBLIC_RELEASE=1' \
|
||||||
|
|
|
@ -626,7 +626,9 @@ void CGameExporter::ExportResource(SResourceInstance& rRes)
|
||||||
Name = rRes.ResourceID.ToString();
|
Name = rRes.ResourceID.ToString();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CResourceEntry *pEntry = mpStore->CreateNewResource(rRes.ResourceID, CResTypeInfo::TypeForCookedExtension(mGame, rRes.ResourceType)->Type(), Directory, Name);
|
CResourceEntry *pEntry = mpStore->CreateNewResource(rRes.ResourceID,
|
||||||
|
CResTypeInfo::TypeForCookedExtension(mGame, rRes.ResourceType)->Type(),
|
||||||
|
Directory, Name, true);
|
||||||
|
|
||||||
// Set flags
|
// Set flags
|
||||||
pEntry->SetFlag(EResEntryFlag::IsBaseGameResource);
|
pEntry->SetFlag(EResEntryFlag::IsBaseGameResource);
|
||||||
|
|
|
@ -24,7 +24,7 @@ CResourceEntry::CResourceEntry(CResourceStore *pStore)
|
||||||
// Static constructors
|
// Static constructors
|
||||||
CResourceEntry* CResourceEntry::CreateNewResource(CResourceStore *pStore, const CAssetID& rkID,
|
CResourceEntry* CResourceEntry::CreateNewResource(CResourceStore *pStore, const CAssetID& rkID,
|
||||||
const TString& rkDir, const TString& rkName,
|
const TString& rkDir, const TString& rkName,
|
||||||
EResourceType Type)
|
EResourceType Type, bool ExistingResource /*= false*/)
|
||||||
{
|
{
|
||||||
// Initialize all entry info with the input data.
|
// Initialize all entry info with the input data.
|
||||||
CResourceEntry *pEntry = new CResourceEntry(pStore);
|
CResourceEntry *pEntry = new CResourceEntry(pStore);
|
||||||
|
@ -41,13 +41,17 @@ CResourceEntry* CResourceEntry::CreateNewResource(CResourceStore *pStore, const
|
||||||
|
|
||||||
pEntry->mMetadataDirty = true;
|
pEntry->mMetadataDirty = true;
|
||||||
|
|
||||||
// Check if the data exists or not. If so, then we are creating an entry for an existing resource (game exporter).
|
// If this is a new resource (i.e. not a base game resource that we are currently exporting),
|
||||||
// If not, we want to initiate the new resource data and save it as soon as possible.
|
// then instantiate the new resource data so it can be saved as soon as possible.
|
||||||
if (!pEntry->HasCookedVersion())
|
if (!ExistingResource)
|
||||||
|
{
|
||||||
|
pEntry->mpResource = CResourceFactory::CreateResource(pEntry);
|
||||||
|
|
||||||
|
if (pEntry->mpResource)
|
||||||
{
|
{
|
||||||
pEntry->mpResource = CResourceFactory::SpawnResource(pEntry);
|
|
||||||
pEntry->mpResource->InitializeNewResource();
|
pEntry->mpResource->InitializeNewResource();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return pEntry;
|
return pEntry;
|
||||||
}
|
}
|
||||||
|
@ -394,7 +398,7 @@ CResource* CResourceEntry::Load()
|
||||||
// support serialization yet) then load the cooked version as a backup.
|
// support serialization yet) then load the cooked version as a backup.
|
||||||
if (HasRawVersion())
|
if (HasRawVersion())
|
||||||
{
|
{
|
||||||
mpResource = CResourceFactory::SpawnResource(this);
|
mpResource = CResourceFactory::CreateResource(this);
|
||||||
|
|
||||||
if (mpResource)
|
if (mpResource)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,7 @@ class CResourceEntry
|
||||||
public:
|
public:
|
||||||
static CResourceEntry* CreateNewResource(CResourceStore *pStore, const CAssetID& rkID,
|
static CResourceEntry* CreateNewResource(CResourceStore *pStore, const CAssetID& rkID,
|
||||||
const TString& rkDir, const TString& rkName,
|
const TString& rkDir, const TString& rkName,
|
||||||
EResourceType Type);
|
EResourceType Type, bool ExistingResource = false);
|
||||||
static CResourceEntry* BuildFromArchive(CResourceStore *pStore, IArchive& rArc);
|
static CResourceEntry* BuildFromArchive(CResourceStore *pStore, IArchive& rArc);
|
||||||
static CResourceEntry* BuildFromDirectory(CResourceStore *pStore, CResTypeInfo *pTypeInfo,
|
static CResourceEntry* BuildFromDirectory(CResourceStore *pStore, CResTypeInfo *pTypeInfo,
|
||||||
const TString& rkDirPath, const TString& rkName);
|
const TString& rkDirPath, const TString& rkName);
|
||||||
|
|
|
@ -445,7 +445,7 @@ bool CResourceStore::IsResourceRegistered(const CAssetID& rkID) const
|
||||||
return FindEntry(rkID) != nullptr;
|
return FindEntry(rkID) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CResourceEntry* CResourceStore::CreateNewResource(const CAssetID& rkID, EResourceType Type, const TString& rkDir, const TString& rkName)
|
CResourceEntry* CResourceStore::CreateNewResource(const CAssetID& rkID, EResourceType Type, const TString& rkDir, const TString& rkName, bool ExistingResource /*= false*/)
|
||||||
{
|
{
|
||||||
CResourceEntry *pEntry = FindEntry(rkID);
|
CResourceEntry *pEntry = FindEntry(rkID);
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ CResourceEntry* CResourceStore::CreateNewResource(const CAssetID& rkID, EResourc
|
||||||
// Validate directory
|
// Validate directory
|
||||||
if (IsValidResourcePath(rkDir, rkName))
|
if (IsValidResourcePath(rkDir, rkName))
|
||||||
{
|
{
|
||||||
pEntry = CResourceEntry::CreateNewResource(this, rkID, rkDir, rkName, Type);
|
pEntry = CResourceEntry::CreateNewResource(this, rkID, rkDir, rkName, Type, ExistingResource);
|
||||||
mResourceEntries[rkID] = pEntry;
|
mResourceEntries[rkID] = pEntry;
|
||||||
mDatabaseCacheDirty = true;
|
mDatabaseCacheDirty = true;
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
TString DeletedResourcePath() const;
|
TString DeletedResourcePath() const;
|
||||||
|
|
||||||
bool IsResourceRegistered(const CAssetID& rkID) const;
|
bool IsResourceRegistered(const CAssetID& rkID) const;
|
||||||
CResourceEntry* CreateNewResource(const CAssetID& rkID, EResourceType Type, const TString& rkDir, const TString& rkName);
|
CResourceEntry* CreateNewResource(const CAssetID& rkID, EResourceType Type, const TString& rkDir, const TString& rkName, bool ExistingResource = false);
|
||||||
CResourceEntry* FindEntry(const CAssetID& rkID) const;
|
CResourceEntry* FindEntry(const CAssetID& rkID) const;
|
||||||
CResourceEntry* FindEntry(const TString& rkPath) const;
|
CResourceEntry* FindEntry(const TString& rkPath) const;
|
||||||
bool AreAllEntriesValid() const;
|
bool AreAllEntriesValid() const;
|
||||||
|
|
|
@ -32,7 +32,7 @@ class CResourceFactory
|
||||||
CResourceFactory() {}
|
CResourceFactory() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CResource* SpawnResource(CResourceEntry *pEntry)
|
static CResource* CreateResource(CResourceEntry *pEntry)
|
||||||
{
|
{
|
||||||
switch (pEntry->ResourceType())
|
switch (pEntry->ResourceType())
|
||||||
{
|
{
|
||||||
|
|
|
@ -839,6 +839,18 @@
|
||||||
<Key>EditorProperties</Key>
|
<Key>EditorProperties</Key>
|
||||||
<Value Path="Structs/EditorProperties.xml"/>
|
<Value Path="Structs/EditorProperties.xml"/>
|
||||||
</Element>
|
</Element>
|
||||||
|
<Element>
|
||||||
|
<Key>EmperorIngStage1Data</Key>
|
||||||
|
<Value Path="Structs/EmperorIngStage1Data.xml"/>
|
||||||
|
</Element>
|
||||||
|
<Element>
|
||||||
|
<Key>EmperorIngStage1TentacleData</Key>
|
||||||
|
<Value Path="Structs/EmperorIngStage1TentacleData.xml"/>
|
||||||
|
</Element>
|
||||||
|
<Element>
|
||||||
|
<Key>EmperorIngStage2TentacleData</Key>
|
||||||
|
<Value Path="Structs/EmperorIngStage2TentacleData.xml"/>
|
||||||
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<Key>EmperorIngStage3Data</Key>
|
<Key>EmperorIngStage3Data</Key>
|
||||||
<Value Path="Structs/EmperorIngStage3Data.xml"/>
|
<Value Path="Structs/EmperorIngStage3Data.xml"/>
|
||||||
|
@ -1307,14 +1319,6 @@
|
||||||
<Key>UnknownStruct17</Key>
|
<Key>UnknownStruct17</Key>
|
||||||
<Value Path="Structs/UnknownStruct17.xml"/>
|
<Value Path="Structs/UnknownStruct17.xml"/>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
|
||||||
<Key>UnknownStruct18</Key>
|
|
||||||
<Value Path="Structs/UnknownStruct18.xml"/>
|
|
||||||
</Element>
|
|
||||||
<Element>
|
|
||||||
<Key>UnknownStruct19</Key>
|
|
||||||
<Value Path="Structs/UnknownStruct19.xml"/>
|
|
||||||
</Element>
|
|
||||||
<Element>
|
<Element>
|
||||||
<Key>UnknownStruct2</Key>
|
<Key>UnknownStruct2</Key>
|
||||||
<Value Path="Structs/UnknownStruct2.xml"/>
|
<Value Path="Structs/UnknownStruct2.xml"/>
|
||||||
|
@ -1339,10 +1343,6 @@
|
||||||
<Key>UnknownStruct24</Key>
|
<Key>UnknownStruct24</Key>
|
||||||
<Value Path="Structs/UnknownStruct24.xml"/>
|
<Value Path="Structs/UnknownStruct24.xml"/>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
|
||||||
<Key>UnknownStruct25</Key>
|
|
||||||
<Value Path="Structs/UnknownStruct25.xml"/>
|
|
||||||
</Element>
|
|
||||||
<Element>
|
<Element>
|
||||||
<Key>UnknownStruct26</Key>
|
<Key>UnknownStruct26</Key>
|
||||||
<Value Path="Structs/UnknownStruct26.xml"/>
|
<Value Path="Structs/UnknownStruct26.xml"/>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</SubProperties>
|
</SubProperties>
|
||||||
</Element>
|
</Element>
|
||||||
<Element Type="Struct" ID="0x7E397FED" Archetype="ActorParameters"/>
|
<Element Type="Struct" ID="0x7E397FED" Archetype="ActorParameters"/>
|
||||||
<Element Type="Struct" ID="0x4A1E493B" Archetype="UnknownStruct25"/>
|
<Element Type="Struct" ID="0x4A1E493B" Archetype="EmperorIngStage1Data"/>
|
||||||
</SubProperties>
|
</SubProperties>
|
||||||
</Properties>
|
</Properties>
|
||||||
<EditorProperties>
|
<EditorProperties>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</SubProperties>
|
</SubProperties>
|
||||||
</Element>
|
</Element>
|
||||||
<Element Type="Struct" ID="0x7E397FED" Archetype="ActorParameters"/>
|
<Element Type="Struct" ID="0x7E397FED" Archetype="ActorParameters"/>
|
||||||
<Element Type="Struct" ID="0x5105FA2D" Archetype="UnknownStruct18"/>
|
<Element Type="Struct" ID="0x5105FA2D" Archetype="EmperorIngStage2TentacleData"/>
|
||||||
</SubProperties>
|
</SubProperties>
|
||||||
</Properties>
|
</Properties>
|
||||||
<EditorProperties>
|
<EditorProperties>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<PropertyTemplate ArchiveVer="4" Game="Echoes">
|
<PropertyTemplate ArchiveVer="4" Game="Echoes">
|
||||||
<PropertyArchetype Type="Struct">
|
<PropertyArchetype Type="Struct">
|
||||||
<Name>UnknownStruct25</Name>
|
<Name>EmperorIngStage1Data</Name>
|
||||||
<SubProperties>
|
<SubProperties>
|
||||||
<Element Type="Struct" ID="0xB3C6398F" Archetype="UnknownStruct19"/>
|
<Element Type="Struct" ID="0xB3C6398F" Archetype="EmperorIngStage1TentacleData"/>
|
||||||
<Element Type="Struct" ID="0xF59F9A60" Archetype="UnknownStruct20"/>
|
<Element Type="Struct" ID="0xF59F9A60" Archetype="UnknownStruct20"/>
|
||||||
<Element Type="Struct" ID="0xA1CDA0B6" Archetype="UnknownStruct21"/>
|
<Element Type="Struct" ID="0xA1CDA0B6" Archetype="UnknownStruct21"/>
|
||||||
<Element Type="Struct" ID="0x85F36473" Archetype="UnknownStruct22"/>
|
<Element Type="Struct" ID="0x85F36473" Archetype="UnknownStruct22"/>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
<Element Type="Float" ID="0xE5A7C358">
|
<Element Type="Float" ID="0xE5A7C358">
|
||||||
<DefaultValue>0.0</DefaultValue>
|
<DefaultValue>0.0</DefaultValue>
|
||||||
</Element>
|
</Element>
|
||||||
<Element Type="Int" ID="0x93357240">
|
<Element Type="Sound" ID="0x93357240">
|
||||||
<DefaultValue>-1</DefaultValue>
|
<DefaultValue>-1</DefaultValue>
|
||||||
</Element>
|
</Element>
|
||||||
<Element Type="Float" ID="0x293A0C19">
|
<Element Type="Float" ID="0x293A0C19">
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<PropertyTemplate ArchiveVer="4" Game="Echoes">
|
<PropertyTemplate ArchiveVer="4" Game="Echoes">
|
||||||
<PropertyArchetype Type="Struct">
|
<PropertyArchetype Type="Struct">
|
||||||
<Name>UnknownStruct19</Name>
|
<Name>EmperorIngStage1TentacleData</Name>
|
||||||
<SubProperties>
|
<SubProperties>
|
||||||
<Element Type="Struct" ID="0xCF90D15E" Archetype="HealthInfo"/>
|
<Element Type="Struct" ID="0xCF90D15E" Archetype="HealthInfo"/>
|
||||||
<Element Type="Struct" ID="0x29DF61E1" Archetype="DamageVulnerability"/>
|
<Element Type="Struct" ID="0x29DF61E1" Archetype="DamageVulnerability"/>
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<PropertyTemplate ArchiveVer="4" Game="Echoes">
|
<PropertyTemplate ArchiveVer="4" Game="Echoes">
|
||||||
<PropertyArchetype Type="Struct">
|
<PropertyArchetype Type="Struct">
|
||||||
<Name>UnknownStruct18</Name>
|
<Name>EmperorIngStage2TentacleData</Name>
|
||||||
<SubProperties>
|
<SubProperties>
|
||||||
<Element Type="Float" ID="0xBAA9254A">
|
<Element Type="Float" ID="0xBAA9254A">
|
||||||
<DefaultValue>0.0</DefaultValue>
|
<DefaultValue>0.0</DefaultValue>
|
|
@ -1213,10 +1213,6 @@
|
||||||
<Key ID="0x6DCF118" Type="float"/>
|
<Key ID="0x6DCF118" Type="float"/>
|
||||||
<Value Name="CloseDelay"/>
|
<Value Name="CloseDelay"/>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
|
||||||
<Key ID="0x6DEE4C5" Type="choice"/>
|
|
||||||
<Value Name="Unknown"/>
|
|
||||||
</Element>
|
|
||||||
<Element>
|
<Element>
|
||||||
<Key ID="0x6DEE4C5" Type="int"/>
|
<Key ID="0x6DEE4C5" Type="int"/>
|
||||||
<Value Name="Unknown"/>
|
<Value Name="Unknown"/>
|
||||||
|
@ -13561,9 +13557,13 @@
|
||||||
<Key ID="0x4A1E493B" Type="UnknownStruct16"/>
|
<Key ID="0x4A1E493B" Type="UnknownStruct16"/>
|
||||||
<Value Name="UnknownStruct25"/>
|
<Value Name="UnknownStruct25"/>
|
||||||
</Element>
|
</Element>
|
||||||
|
<Element>
|
||||||
|
<Key ID="0x4A1E493B" Type="EmperorIngStage1Data"/>
|
||||||
|
<Value Name="Data"/>
|
||||||
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<Key ID="0x4A1E493B" Type="UnknownStruct25"/>
|
<Key ID="0x4A1E493B" Type="UnknownStruct25"/>
|
||||||
<Value Name="UnknownStruct25"/>
|
<Value Name="Data"/>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<Key ID="0x4A1E8961" Type="float"/>
|
<Key ID="0x4A1E8961" Type="float"/>
|
||||||
|
@ -14909,9 +14909,13 @@
|
||||||
<Key ID="0x50FC4ACB" Type="float"/>
|
<Key ID="0x50FC4ACB" Type="float"/>
|
||||||
<Value Name="BallCameraChaseAnglePerSecond"/>
|
<Value Name="BallCameraChaseAnglePerSecond"/>
|
||||||
</Element>
|
</Element>
|
||||||
|
<Element>
|
||||||
|
<Key ID="0x5105FA2D" Type="EmperorIngStage2TentacleData"/>
|
||||||
|
<Value Name="Data"/>
|
||||||
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<Key ID="0x5105FA2D" Type="UnknownStruct18"/>
|
<Key ID="0x5105FA2D" Type="UnknownStruct18"/>
|
||||||
<Value Name="UnknownStruct18"/>
|
<Value Name="Data"/>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<Key ID="0x5106FEB9" Type="bool"/>
|
<Key ID="0x5106FEB9" Type="bool"/>
|
||||||
|
@ -26838,7 +26842,7 @@
|
||||||
<Value Name="Jump"/>
|
<Value Name="Jump"/>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<Key ID="0x93357240" Type="int"/>
|
<Key ID="0x93357240" Type="sound"/>
|
||||||
<Value Name="VulnerabilityChangeSound"/>
|
<Value Name="VulnerabilityChangeSound"/>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
|
@ -29043,7 +29047,7 @@
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<Key ID="0x9FB2FAA6" Type="float"/>
|
<Key ID="0x9FB2FAA6" Type="float"/>
|
||||||
<Value Name="Unknown"/>
|
<Value Name="FieldofView2Player"/>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<Key ID="0x9FB991FE" Type="float"/>
|
<Key ID="0x9FB991FE" Type="float"/>
|
||||||
|
@ -32857,9 +32861,13 @@
|
||||||
<Key ID="0xB3C6398F" Type="UnknownStruct13"/>
|
<Key ID="0xB3C6398F" Type="UnknownStruct13"/>
|
||||||
<Value Name="UnknownStruct19"/>
|
<Value Name="UnknownStruct19"/>
|
||||||
</Element>
|
</Element>
|
||||||
|
<Element>
|
||||||
|
<Key ID="0xB3C6398F" Type="EmperorIngStage1TentacleData"/>
|
||||||
|
<Value Name="Tentacle"/>
|
||||||
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<Key ID="0xB3C6398F" Type="UnknownStruct19"/>
|
<Key ID="0xB3C6398F" Type="UnknownStruct19"/>
|
||||||
<Value Name="UnknownStruct19"/>
|
<Value Name="Tentacle"/>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<Key ID="0xB3DABF84" Type="DamageInfo"/>
|
<Key ID="0xB3DABF84" Type="DamageInfo"/>
|
||||||
|
|
Loading…
Reference in New Issue