Drag/drop to change entity parent/child relationship working

master
Joey Pollack 3 years ago
parent b87f95dd94
commit 148dd8e1bc

@ -1,7 +1,8 @@
Editor: Editor:
☐ Remove Entity
☐ Remove Component ✔ Remove Entity @done(22-10-14 18:28)
✔ Remove Component @done(22-10-14 18:28)
✔ Add Entity children @done(22-09-14 15:07) ✔ Add Entity children @done(22-09-14 15:07)
✔ Entity Parent/Child hierarchy system @done(22-09-14 15:07) ✔ Entity Parent/Child hierarchy system @done(22-09-14 15:07)
✔ Give Entities a name property separate from the tag component @done(22-09-14 15:06) ✔ Give Entities a name property separate from the tag component @done(22-09-14 15:06)
@ -56,10 +57,14 @@ Editor:
☐ Toolbar with play/pause/stop buttons ☐ Toolbar with play/pause/stop buttons
World Hierarchy (Tree View): World Hierarchy (Tree View):
☐ Handle showing Enities with children @high ☐ If control is held while dropping and entities, reorder the dropped entity instead of parenting
☐ Handle adding child entities @high - This will allow for reorganizing the hierarchy
☐ Add "move up" and "move down" options to the entity context menu
- Another way to reorganize the hierarchy
✔ Handle showing Enities with children @high @done(22-10-14 18:29)
✔ Handle adding child entities @high @done(22-10-14 18:29)
If an entity was right clicked on the new entity should be a child of the clicked entity If an entity was right clicked on the new entity should be a child of the clicked entity
☐ Handle drag and dropping entities to change the child/parent relationships @high Handle drag and dropping entities to change the child/parent relationships @high @done(22-10-14 18:46)
Asset Viewer: Asset Viewer:
✔ Get references to the EditorAsset objects instead of the raw file locations @done(22-06-01 18:48) ✔ Get references to the EditorAsset objects instead of the raw file locations @done(22-06-01 18:48)

@ -165,7 +165,8 @@ namespace lunarium { namespace editor
// If the dropped ent is the parent of pEnt then we need to swap the relationship // If the dropped ent is the parent of pEnt then we need to swap the relationship
if (pEnt->HasParent() && pEnt->GetParent() == pDroppedEnt->GetUUID()) if (pEnt->HasParent() && pEnt->GetParent() == pDroppedEnt->GetUUID())
{ {
// TODO: Finish Entity Drop Logic pDroppedEnt->RemoveChild(pEnt->GetUUID());
pEnt->AddChild(pDroppedEnt->GetUUID());
} }
// If the dropped ent is already a child of pEnt then we do nothing // If the dropped ent is already a child of pEnt then we do nothing
@ -192,9 +193,14 @@ namespace lunarium { namespace editor
if (pEnt->HasChildren()) if (pEnt->HasChildren())
{ {
const std::vector<LUUID>& children = pEnt->GetChildren(); const std::vector<LUUID>& children = pEnt->GetChildren();
for (auto iter = children.begin(); iter != children.end(); iter++) // for (auto iter = children.begin(); iter != children.end(); iter++)
// {
// Entity* pe = mpWorld->GetEntity((*iter));
// ShowEntity(pe);
// }
for (int i = 0; i < children.size(); i++)
{ {
Entity* pe = mpWorld->GetEntity((*iter)); Entity* pe = mpWorld->GetEntity(children[i]);
ShowEntity(pe); ShowEntity(pe);
} }
} }

Loading…
Cancel
Save