techkaczynski.dev / code

summaryrefslogtreecommitdiff
path: root/editor.c
diff options
context:
space:
mode:
Diffstat (limited to 'editor.c')
-rw-r--r--editor.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/editor.c b/editor.c
index cf74bae..0e7fd58 100644
--- a/editor.c
+++ b/editor.c
@@ -1267,7 +1267,7 @@ panel_bool(Rect row, cstr label, bool *value, bool mixed) {
row.x + 40,
row.y + (row.height - 20) * 0.5f,
20, 20,
- }, NULL, value);
+ }, "", value);
}
static bool
@@ -1528,6 +1528,29 @@ panel_properties(EditorPanelContainer container, bool input) {
20,
};
+ GuiSetStyle(DEFAULT, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
+ if (GuiButton((Rect){
+ group.x, group.y + group.height + pad,
+ 120, 20
+ }, "Remove Model")) {
+ edit.focus = 0;
+
+ EditorAction action = action_begin(ED_ACTION_MODEL, false);
+
+ for (u32 i = 0; i < action.item_cnt; ++i) {
+ Entity *target = entity_get(
+ entity_id_from_pid(action.item[i].pid)
+ );
+
+ free(target->mdl.key);
+ target->mdl = (ModelCmp){0};
+ }
+
+ action_commit(&action);
+ goto reset;
+ }
+ GuiSetStyle(DEFAULT, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
+
GuiLabel((Rect){row.x, row.y, 32, row.height}, "Key");
if (GuiButton(
@@ -1555,7 +1578,7 @@ panel_properties(EditorPanelContainer container, bool input) {
action_commit(&action);
}
- row.y = group.y + group.height - 20;
+ row.y = group.y + group.height + 20;
comp_add:
GuiUnlock();