Merge branch 'skip-setting-prefab-root-name' of https://github.com/Tryibion/FlaxEngine into Tryibion-skip-setting-prefab-root-name
This commit is contained in:
@@ -317,7 +317,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
|||||||
var childEditor = editor.ChildrenEditors[i];
|
var childEditor = editor.ChildrenEditors[i];
|
||||||
|
|
||||||
// Special case for root actor transformation (can be applied only in Prefab editor, not in Level)
|
// Special case for root actor transformation (can be applied only in Prefab editor, not in Level)
|
||||||
if (isActorEditorInLevel && childEditor.Values.Info.Name is "LocalPosition" or "LocalOrientation" or "LocalScale")
|
if (isActorEditorInLevel && childEditor.Values.Info.Name is "LocalPosition" or "LocalOrientation" or "LocalScale" or "Name")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var child = ProcessDiff(childEditor, !isScriptEditorWithRefValue);
|
var child = ProcessDiff(childEditor, !isScriptEditorWithRefValue);
|
||||||
|
|||||||
@@ -255,12 +255,17 @@ namespace FlaxEditor.Modules
|
|||||||
|
|
||||||
// When applying changes to prefab from actor in level ignore it's root transformation (see ActorEditor.ProcessDiff)
|
// When applying changes to prefab from actor in level ignore it's root transformation (see ActorEditor.ProcessDiff)
|
||||||
var originalTransform = instance.LocalTransform;
|
var originalTransform = instance.LocalTransform;
|
||||||
|
var originalName = instance.Name;
|
||||||
if (instance.IsPrefabRoot && instance.HasScene)
|
if (instance.IsPrefabRoot && instance.HasScene)
|
||||||
|
{
|
||||||
instance.LocalTransform = prefab.GetDefaultInstance().Transform;
|
instance.LocalTransform = prefab.GetDefaultInstance().Transform;
|
||||||
|
instance.Name = prefab.GetDefaultInstance().Name;
|
||||||
|
}
|
||||||
|
|
||||||
// Call backend
|
// Call backend
|
||||||
var failed = PrefabManager.Internal_ApplyAll(FlaxEngine.Object.GetUnmanagedPtr(instance));
|
var failed = PrefabManager.Internal_ApplyAll(FlaxEngine.Object.GetUnmanagedPtr(instance));
|
||||||
instance.LocalTransform = originalTransform;
|
instance.LocalTransform = originalTransform;
|
||||||
|
instance.Name = originalName;
|
||||||
if (failed)
|
if (failed)
|
||||||
throw new Exception("Failed to apply the prefab. See log to learn more.");
|
throw new Exception("Failed to apply the prefab. See log to learn more.");
|
||||||
|
|
||||||
|
|||||||
@@ -1090,7 +1090,7 @@ bool Prefab::ApplyAllInternal(Actor* targetActor, bool linkTargetActorObjectToPr
|
|||||||
root = dynamic_cast<Actor*>(sceneObjects.Value->At(targetActorIdx));
|
root = dynamic_cast<Actor*>(sceneObjects.Value->At(targetActorIdx));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try using the first actor without a parent as a new ro0t
|
// Try using the first actor without a parent as a new root
|
||||||
for (int32 i = 1; i < sceneObjects->Count(); i++)
|
for (int32 i = 1; i < sceneObjects->Count(); i++)
|
||||||
{
|
{
|
||||||
SceneObject* obj = sceneObjects.Value->At(i);
|
SceneObject* obj = sceneObjects.Value->At(i);
|
||||||
|
|||||||
Reference in New Issue
Block a user