Merge branch 'FlaxEngine:master' into master
This commit is contained in:
@@ -72,6 +72,7 @@ namespace FlaxEngine.Windows.Search
|
||||
/// <summary>
|
||||
/// The content searching window. Allows to search inside Visual Scripts, Materials, Particles and other assets.
|
||||
/// </summary>
|
||||
[HideInEditor]
|
||||
internal class ContentSearchWindow : EditorWindow
|
||||
{
|
||||
/// <summary>
|
||||
@@ -115,6 +116,7 @@ namespace FlaxEngine.Windows.Search
|
||||
}
|
||||
}
|
||||
|
||||
[HideInEditor]
|
||||
private sealed class SearchResultTreeNode : TreeNode
|
||||
{
|
||||
public Action<SearchResultTreeNode> Navigate;
|
||||
|
||||
@@ -49,6 +49,8 @@ void MissingScript::SetReferenceScript(const ScriptingObjectReference<Script>& v
|
||||
SceneObjectsFactory::Context::Context(ISerializeModifier* modifier)
|
||||
: Modifier(modifier)
|
||||
{
|
||||
// Override the main thread value to not create it again in GetModifier() if called from the same thread
|
||||
Modifiers.Set(modifier);
|
||||
}
|
||||
|
||||
SceneObjectsFactory::Context::~Context()
|
||||
@@ -58,7 +60,11 @@ SceneObjectsFactory::Context::~Context()
|
||||
Array<ISerializeModifier*, FixedAllocation<PLATFORM_THREADS_LIMIT>> modifiers;
|
||||
Modifiers.GetValues(modifiers);
|
||||
for (ISerializeModifier* e : modifiers)
|
||||
{
|
||||
if (e == Modifier)
|
||||
continue;
|
||||
Cache::ISerializeModifier.Put(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,15 +90,15 @@ ISerializeModifier* SceneObjectsFactory::Context::GetModifier()
|
||||
return modifier;
|
||||
}
|
||||
|
||||
void SceneObjectsFactory::Context::SetupIdsMapping(const SceneObject* obj, ISerializeModifier* modifier)
|
||||
void SceneObjectsFactory::Context::SetupIdsMapping(const SceneObject* obj, ISerializeModifier* modifier) const
|
||||
{
|
||||
int32 instanceIndex;
|
||||
if (ObjectToInstance.TryGet(obj->GetID(), instanceIndex) && instanceIndex != modifier->CurrentInstance)
|
||||
{
|
||||
// Apply the current prefab instance objects ids table to resolve references inside a prefab properly
|
||||
modifier->CurrentInstance = instanceIndex;
|
||||
auto& instance = Instances[instanceIndex];
|
||||
for (auto& e : instance.IdsMapping)
|
||||
const auto& instance = Instances[instanceIndex];
|
||||
for (const auto& e : instance.IdsMapping)
|
||||
modifier->IdsMapping[e.Key] = e.Value;
|
||||
}
|
||||
}
|
||||
@@ -486,9 +492,6 @@ void SceneObjectsFactory::SynchronizeNewPrefabInstances(Context& context, Prefab
|
||||
continue;
|
||||
const Guid actorParentId = JsonTools::GetGuid(stream, "ParentID");
|
||||
|
||||
// Map prefab object id to this actor so the new objects gets added to it
|
||||
data.Modifier->IdsMapping[actorPrefabObjectId] = actor->GetID();
|
||||
|
||||
// Load prefab
|
||||
auto prefab = Content::LoadAsync<Prefab>(prefabId);
|
||||
if (prefab == nullptr)
|
||||
@@ -554,8 +557,12 @@ void SceneObjectsFactory::SynchronizeNewPrefabInstances(Context& context, Prefab
|
||||
if (spawned)
|
||||
continue;
|
||||
|
||||
// Create instance (including all children)
|
||||
// Map prefab object id to this actor's prefab instance so the new objects gets added to it
|
||||
context.SetupIdsMapping(actor, data.Modifier);
|
||||
data.Modifier->IdsMapping[actorPrefabObjectId] = actor->GetID();
|
||||
Scripting::ObjectsLookupIdMapping.Set(&data.Modifier->IdsMapping);
|
||||
|
||||
// Create instance (including all children)
|
||||
SynchronizeNewPrefabInstance(context, data, prefab, actor, prefabObjectId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
~Context();
|
||||
|
||||
ISerializeModifier* GetModifier();
|
||||
void SetupIdsMapping(const SceneObject* obj, ISerializeModifier* modifier);
|
||||
void SetupIdsMapping(const SceneObject* obj, ISerializeModifier* modifier) const;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user