Merge branch 'ensure-prefab-staticflags' of https://github.com/Tryibion/FlaxEngine into Tryibion-ensure-prefab-staticflags
This commit is contained in:
@@ -625,7 +625,16 @@ namespace FlaxEditor.SceneGraph.GUI
|
|||||||
{
|
{
|
||||||
var item = _dragAssets.Objects[i];
|
var item = _dragAssets.Objects[i];
|
||||||
var actor = item.OnEditorDrop(this);
|
var actor = item.OnEditorDrop(this);
|
||||||
actor.StaticFlags = spawnParent.StaticFlags;
|
if (spawnParent.GetType() != typeof(Scene))
|
||||||
|
{
|
||||||
|
// Set all Actors static flags to match parents
|
||||||
|
List<Actor> childActors = new List<Actor>();
|
||||||
|
GetActorsTree(childActors, actor);
|
||||||
|
foreach (var child in childActors)
|
||||||
|
{
|
||||||
|
child.StaticFlags = spawnParent.StaticFlags;
|
||||||
|
}
|
||||||
|
}
|
||||||
actor.Name = item.ShortName;
|
actor.Name = item.ShortName;
|
||||||
actor.Transform = spawnParent.Transform;
|
actor.Transform = spawnParent.Transform;
|
||||||
Editor.Instance.SceneEditing.Spawn(actor, spawnParent, false);
|
Editor.Instance.SceneEditing.Spawn(actor, spawnParent, false);
|
||||||
@@ -671,6 +680,16 @@ namespace FlaxEditor.SceneGraph.GUI
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void GetActorsTree(List<Actor> list, Actor a)
|
||||||
|
{
|
||||||
|
list.Add(a);
|
||||||
|
int cnt = a.ChildrenCount;
|
||||||
|
for (int i = 0; i < cnt; i++)
|
||||||
|
{
|
||||||
|
GetActorsTree(list, a.GetChild(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool ValidateDragActor(ActorNode actorNode)
|
private bool ValidateDragActor(ActorNode actorNode)
|
||||||
{
|
{
|
||||||
// Reject dragging actors not linked to scene (eg. from prefab) or in the opposite way
|
// Reject dragging actors not linked to scene (eg. from prefab) or in the opposite way
|
||||||
|
|||||||
Reference in New Issue
Block a user