Added snap to grid + local/world space UI
This commit is contained in:
@@ -138,10 +138,42 @@ editor_ui :: () {
|
||||
viewport_layer := ui_box(.NONE);
|
||||
ui_push_parent(viewport_layer, alignment=.LEFT, axis=.VERTICAL);
|
||||
{
|
||||
|
||||
ui_set_next_size_x(.PCT, 1.0);
|
||||
ui_tab_title_bar("SCENE");
|
||||
|
||||
ui_set_next_size_x(.PCT, 1.0);
|
||||
ui_set_next_size_y(.PCT, 0.75);
|
||||
ui_set_next_size_y(.PCT, 0.1);
|
||||
ui_toolbar();
|
||||
ui_push_parent(ui_state.last_box, alignment=.LEFT, axis=.HORIZONTAL);
|
||||
{
|
||||
if engine.editor.transform_gizmo.snap_to_grid {
|
||||
if ui_toolbar_button("Snap to grid enabled", .{0.0, 0.4, 0.0, 1.0}) {
|
||||
engine.editor.transform_gizmo.snap_to_grid = false;
|
||||
}
|
||||
} else {
|
||||
if ui_toolbar_button("Snap to grid disabled", .{0.4, 0.0, 0.0, 1.0}) {
|
||||
engine.editor.transform_gizmo.snap_to_grid = true;
|
||||
}
|
||||
}
|
||||
|
||||
if engine.editor.transform_gizmo.space == .LOCAL {
|
||||
if ui_toolbar_button("LOCAL", .{0.0, 0.3, 0.0, 1.0}) {
|
||||
engine.editor.transform_gizmo.space = .WORLD;
|
||||
}
|
||||
} else {
|
||||
if ui_toolbar_button("WORLD", .{0.0, 0.0, 0.3, 1.0}) {
|
||||
engine.editor.transform_gizmo.space = .LOCAL;
|
||||
}
|
||||
}
|
||||
//ui_space(15, 10)
|
||||
|
||||
ui_space(20, 0);
|
||||
}
|
||||
ui_pop_parent();
|
||||
|
||||
ui_set_next_size_x(.PCT, 1.0);
|
||||
ui_set_next_size_y(.PCT, 0.65);
|
||||
|
||||
state := ui_interactable_texture(get_texture_from_pass("UI Blend Pass"));
|
||||
engine.input.viewport_mouse_position = state.local_mouse_coordinates;
|
||||
|
||||
Reference in New Issue
Block a user