@@ -194,7 +194,7 @@ namespace FlaxEditor.SceneGraph
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var scene = _actor.Scene;
|
var scene = _actor ? _actor.Scene : null;
|
||||||
return scene != null ? SceneGraphFactory.FindNode(scene.ID) as SceneNode : null;
|
return scene != null ? SceneGraphFactory.FindNode(scene.ID) as SceneNode : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,6 @@ namespace FlaxEditor.SceneGraph
|
|||||||
{
|
{
|
||||||
if (!(value is ActorNode))
|
if (!(value is ActorNode))
|
||||||
throw new InvalidOperationException("ActorNode can have only ActorNode as a parent node.");
|
throw new InvalidOperationException("ActorNode can have only ActorNode as a parent node.");
|
||||||
|
|
||||||
base.ParentNode = value;
|
base.ParentNode = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -299,6 +298,7 @@ namespace FlaxEditor.SceneGraph
|
|||||||
// (eg. we build new node for spawned actor and link it to the game)
|
// (eg. we build new node for spawned actor and link it to the game)
|
||||||
if (_treeNode.Parent != null && !_treeNode.Parent.IsLayoutLocked)
|
if (_treeNode.Parent != null && !_treeNode.Parent.IsLayoutLocked)
|
||||||
{
|
{
|
||||||
|
_treeNode.IndexInParent = _actor.OrderInParent;
|
||||||
_treeNode.Parent.SortChildren();
|
_treeNode.Parent.SortChildren();
|
||||||
|
|
||||||
// Update UI
|
// Update UI
|
||||||
|
|||||||
@@ -86,6 +86,10 @@ namespace FlaxEditor.SceneGraph.GUI
|
|||||||
}
|
}
|
||||||
parent.SortChildren();
|
parent.SortChildren();
|
||||||
}
|
}
|
||||||
|
else if (Actor)
|
||||||
|
{
|
||||||
|
_orderInParent = Actor.OrderInParent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnNameChanged()
|
internal void OnNameChanged()
|
||||||
|
|||||||
@@ -112,18 +112,9 @@ namespace FlaxEditor.SceneGraph
|
|||||||
{
|
{
|
||||||
if (parentNode != value)
|
if (parentNode != value)
|
||||||
{
|
{
|
||||||
if (parentNode != null)
|
parentNode?.ChildNodes.Remove(this);
|
||||||
{
|
|
||||||
parentNode.ChildNodes.Remove(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
parentNode = value;
|
parentNode = value;
|
||||||
|
parentNode?.ChildNodes.Add(this);
|
||||||
if (parentNode != null)
|
|
||||||
{
|
|
||||||
parentNode.ChildNodes.Add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
OnParentChanged();
|
OnParentChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1597,7 +1597,7 @@ bool Actor::FromBytes(const Span<byte>& data, Array<Actor*>& output, ISerializeM
|
|||||||
// Order in parent
|
// Order in parent
|
||||||
int32 orderInParent;
|
int32 orderInParent;
|
||||||
stream.ReadInt32(&orderInParent);
|
stream.ReadInt32(&orderInParent);
|
||||||
order.At(i) = orderInParent;
|
order[i] = orderInParent;
|
||||||
|
|
||||||
// Load JSON
|
// Load JSON
|
||||||
rapidjson_flax::Document document;
|
rapidjson_flax::Document document;
|
||||||
@@ -1637,7 +1637,6 @@ bool Actor::FromBytes(const Span<byte>& data, Array<Actor*>& output, ISerializeM
|
|||||||
// Order in parent
|
// Order in parent
|
||||||
int32 orderInParent;
|
int32 orderInParent;
|
||||||
stream.ReadInt32(&orderInParent);
|
stream.ReadInt32(&orderInParent);
|
||||||
order.Add(orderInParent);
|
|
||||||
|
|
||||||
// Load JSON
|
// Load JSON
|
||||||
rapidjson_flax::Document document;
|
rapidjson_flax::Document document;
|
||||||
|
|||||||
@@ -249,6 +249,8 @@ namespace FlaxEngine.GUI
|
|||||||
internal void ChangeChildIndex(Control child, int newIndex)
|
internal void ChangeChildIndex(Control child, int newIndex)
|
||||||
{
|
{
|
||||||
int oldIndex = _children.IndexOf(child);
|
int oldIndex = _children.IndexOf(child);
|
||||||
|
if (oldIndex == newIndex)
|
||||||
|
return;
|
||||||
_children.RemoveAt(oldIndex);
|
_children.RemoveAt(oldIndex);
|
||||||
|
|
||||||
// Check if index is invalid
|
// Check if index is invalid
|
||||||
|
|||||||
Reference in New Issue
Block a user