diff --git a/SHADE_Managed/src/Components/Transform.cxx b/SHADE_Managed/src/Components/Transform.cxx
index 98f0da4f..927ce87f 100644
--- a/SHADE_Managed/src/Components/Transform.cxx
+++ b/SHADE_Managed/src/Components/Transform.cxx
@@ -87,15 +87,6 @@ namespace SHADE
{
GetNativeComponent()->SetWorldScale(Convert::ToNative(val));
}
- Transform^ Transform::Parent::get()
- {
- auto node = SHSceneManager::GetCurrentSceneGraph().GetNode(owner.GetEntity());
- if (!node)
- throw gcnew System::InvalidOperationException("[Transform] Unable to retrieve SceneGraphNode for an Entity.");
-
- const auto PARENT = node->GetParent();
- return PARENT ? gcnew Transform(PARENT->GetEntityID()) : nullptr;
- }
/*---------------------------------------------------------------------------------*/
/* Constructors */
@@ -103,21 +94,4 @@ namespace SHADE
Transform::Transform(Entity entity)
: Component(entity)
{}
-
- /*---------------------------------------------------------------------------------*/
- /* Usage Functions */
- /*---------------------------------------------------------------------------------*/
-
- void Transform::SetParent(Transform^ parent, bool worldPositionStays)
- {
- auto& sceneGraph = SHSceneManager::GetCurrentSceneGraph();
- auto node = sceneGraph.GetNode(owner.GetEntity());
- if (!node)
- throw gcnew System::InvalidOperationException("[Transform] Unable to retrieve SceneGraphNode for an Entity.");
-
- if (parent)
- node->SetParent(sceneGraph.GetNode(parent->owner.GetEntity()));
- else
- sceneGraph.SetParent(parent->owner.GetEntity(), nullptr);
- }
}
diff --git a/SHADE_Managed/src/Components/Transform.hxx b/SHADE_Managed/src/Components/Transform.hxx
index bbe9fd19..942c6224 100644
--- a/SHADE_Managed/src/Components/Transform.hxx
+++ b/SHADE_Managed/src/Components/Transform.hxx
@@ -107,30 +107,6 @@ namespace SHADE
Vector3 get();
void set(Vector3 val);
}
- ///
- /// Parent Transform that affects this Transform.
- ///
- property Transform^ Parent
- {
- Transform^ get();
- }
-
- /*-----------------------------------------------------------------------------*/
- /* Usage Functions */
- /*-----------------------------------------------------------------------------*/
- ///
- /// Sets the parent of this Transform component.
- ///
- ///
- /// Entity that contains the Transform component that this Transform will be
- /// parented to. If null, unparenting will occur.
- ///
- ///
- /// If true, the transform values of this Transform component will retain their
- /// pre-parent-change global transforms. The local transform values will be
- /// modified to ensure that the global transforms do not change.
- ///
- void SetParent(Transform^ parent, bool worldPositionStays);
};
}
diff --git a/SHADE_Managed/src/Engine/GameObject.cxx b/SHADE_Managed/src/Engine/GameObject.cxx
index 965e0ef2..7ceabfed 100644
--- a/SHADE_Managed/src/Engine/GameObject.cxx
+++ b/SHADE_Managed/src/Engine/GameObject.cxx
@@ -79,11 +79,24 @@ namespace SHADE
}
GameObject^ GameObject::Parent::get()
{
- return nullptr;
+ const auto& SCENE_GRAPH = SHSceneManager::GetCurrentSceneGraph();
+ const auto* ROOT = SCENE_GRAPH.GetRoot();
+
+ const auto* NODE = SCENE_GRAPH.GetNode(entity);
+ if (NODE == nullptr)
+ throw gcnew System::InvalidOperationException("Unable to retrieve SceneGraphNode for Entity " + entity.ToString());
+
+ const auto* PARENT = NODE->GetParent();
+ return PARENT != ROOT ? gcnew GameObject(PARENT->GetEntityID()) : nullptr;
}
void GameObject::Parent::set(GameObject^ newParent)
{
-
+ const auto& SCENE_GRAPH = SHSceneManager::GetCurrentSceneGraph();
+
+ if (newParent == nullptr)
+ SCENE_GRAPH.SetParent(entity, nullptr);
+ else
+ SCENE_GRAPH.SetParent(entity, newParent->EntityId);
}
/*---------------------------------------------------------------------------------*/
@@ -97,10 +110,6 @@ namespace SHADE
{
GetNativeEntity().SetActive(active);
}
- System::Collections::ArrayList^ GameObject::GetChildren()
- {
- return children;
- }
/*---------------------------------------------------------------------------------*/
/* Component Functions */
diff --git a/SHADE_Managed/src/Engine/GameObject.hxx b/SHADE_Managed/src/Engine/GameObject.hxx
index a0b5086a..99296a91 100644
--- a/SHADE_Managed/src/Engine/GameObject.hxx
+++ b/SHADE_Managed/src/Engine/GameObject.hxx
@@ -93,6 +93,9 @@ namespace SHADE
{
Entity get();
}
+ ///
+ /// The parent entity for this GameObject.
+ ///
property GameObject^ Parent
{
GameObject^ get();
@@ -117,15 +120,6 @@ namespace SHADE
/// Whether to activate or deactivate this GameObject.
///
void SetActive(bool active);
-
- ///
- /// Gets the list of GameObjects that are the children of this GameObject.
- ///
- ///
- /// The list of GameObjects that are the children of this GameObject. List is empty is
- /// there is none.
- ///
- System::Collections::ArrayList^ GetChildren();
/*-----------------------------------------------------------------------------*/