Skip to content

Commit

Permalink
Fixing hierarchy listing of deleted objects
Browse files Browse the repository at this point in the history
  • Loading branch information
BrentFarris committed Jun 12, 2024
1 parent f184425 commit f328f1e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/editor/ui/hierarchy/hierarchy_window.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,15 @@ func (h *Hierarchy) orderEntitiesVisually() []entityEntry {
entries := make([]entityEntry, 0, len(allEntities))
roots := make([]*engine.Entity, 0, len(allEntities))
for _, entity := range allEntities {
if entity.IsRoot() {
if entity.IsRoot() && !entity.EditorBindings.IsDeleted {
roots = append(roots, entity)
}
}
var addChildren func(*engine.Entity)
addChildren = func(entity *engine.Entity) {
if entity.EditorBindings.IsDeleted {
return
}
entries = append(entries, entityEntry{entity, false})
for _, c := range entity.Children {
addChildren(c)
Expand Down
2 changes: 2 additions & 0 deletions src/editor/viewport/tools/deleter/delete_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type deleteHistory struct {
func (h *deleteHistory) Redo() {
for _, e := range h.entities {
draws := e.EditorBindings.Drawings()
e.EditorBindings.IsDeleted = true
for _, d := range draws {
d.ShaderData.Deactivate()
}
Expand All @@ -67,6 +68,7 @@ func (h *deleteHistory) Redo() {
func (h *deleteHistory) Undo() {
for _, e := range h.entities {
draws := e.EditorBindings.Drawings()
e.EditorBindings.IsDeleted = false
for _, d := range draws {
d.ShaderData.Activate()
}
Expand Down
3 changes: 2 additions & 1 deletion src/engine/entity.ed.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ const (
)

type entityEditorBindings struct {
data map[string]any
data map[string]any
IsDeleted bool
}

func (e *entityEditorBindings) init() {
Expand Down

0 comments on commit f328f1e

Please sign in to comment.