Remove unlogical PrefabManager::IsNotCreatingPrefab (use IsCreatingPrefab flag)
This commit is contained in:
@@ -419,7 +419,7 @@ void StaticModel::Serialize(SerializeStream& stream, const void* otherObj)
|
||||
|
||||
if (HasLightmap()
|
||||
#if USE_EDITOR
|
||||
&& PrefabManager::IsNotCreatingPrefab
|
||||
&& !PrefabManager::IsCreatingPrefab
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#if USE_EDITOR
|
||||
bool PrefabManager::IsCreatingPrefab = false;
|
||||
bool PrefabManager::IsNotCreatingPrefab = true;
|
||||
Dictionary<Guid, Array<Actor*>> PrefabManager::PrefabsReferences;
|
||||
CriticalSection PrefabManager::PrefabsReferencesLocker;
|
||||
#endif
|
||||
@@ -316,8 +315,8 @@ bool PrefabManager::CreatePrefab(Actor* targetActor, const StringView& outputPat
|
||||
LOG(Info, "Creating prefab from actor {0} (total objects count: {2}) to {1}...", targetActor->ToString(), outputPath, sceneObjects->Count());
|
||||
|
||||
// Serialize to json data
|
||||
ASSERT(!IsCreatingPrefab);
|
||||
IsCreatingPrefab = true;
|
||||
IsNotCreatingPrefab = false;
|
||||
rapidjson_flax::StringBuffer actorsDataBuffer;
|
||||
{
|
||||
CompactJsonWriter writerObj(actorsDataBuffer);
|
||||
@@ -331,7 +330,6 @@ bool PrefabManager::CreatePrefab(Actor* targetActor, const StringView& outputPat
|
||||
writer.EndArray();
|
||||
}
|
||||
IsCreatingPrefab = false;
|
||||
IsNotCreatingPrefab = true;
|
||||
|
||||
// Randomize the objects ids (prevent overlapping of the prefab instance objects ids and the prefab objects ids)
|
||||
Dictionary<Guid, Guid> objectInstanceIdToPrefabObjectId;
|
||||
|
||||
@@ -20,7 +20,7 @@ struct Transform;
|
||||
/// </summary>
|
||||
API_CLASS(Static) class FLAXENGINE_API PrefabManager
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(PrefabManager);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(PrefabManager);
|
||||
|
||||
/// <summary>
|
||||
/// Spawns the instance of the prefab objects. Prefab will be spawned to the first loaded scene.
|
||||
@@ -92,11 +92,6 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(PrefabManager);
|
||||
/// </summary>
|
||||
static bool IsCreatingPrefab;
|
||||
|
||||
/// <summary>
|
||||
/// Helper global state flag set to false during prefab asset creation. Can be used to skip local objects data serialization to prefab data.
|
||||
/// </summary>
|
||||
static bool IsNotCreatingPrefab;
|
||||
|
||||
/// <summary>
|
||||
/// Creates the prefab asset from the given root actor. Saves it to the output file path.
|
||||
/// </summary>
|
||||
|
||||
@@ -287,7 +287,7 @@ void TerrainChunk::Serialize(SerializeStream& stream, const void* otherObj)
|
||||
|
||||
if (HasLightmap()
|
||||
#if USE_EDITOR
|
||||
&& PrefabManager::IsNotCreatingPrefab
|
||||
&& !PrefabManager::IsCreatingPrefab
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user