Use the same axis colors consistently in the 2D and 3D editors
This commit is contained in:
parent
24e1039eb6
commit
c2bcc3f700
@ -367,6 +367,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
|||||||
theme->set_color("box_selection_fill_color", "Editor", accent_color * Color(1, 1, 1, 0.3));
|
theme->set_color("box_selection_fill_color", "Editor", accent_color * Color(1, 1, 1, 0.3));
|
||||||
theme->set_color("box_selection_stroke_color", "Editor", accent_color * Color(1, 1, 1, 0.8));
|
theme->set_color("box_selection_stroke_color", "Editor", accent_color * Color(1, 1, 1, 0.8));
|
||||||
|
|
||||||
|
theme->set_color("axis_x_color", "Editor", Color(0.96, 0.20, 0.32));
|
||||||
|
theme->set_color("axis_y_color", "Editor", Color(0.53, 0.84, 0.01));
|
||||||
|
theme->set_color("axis_z_color", "Editor", Color(0.16, 0.55, 0.96));
|
||||||
|
|
||||||
theme->set_color("font_color", "Editor", font_color);
|
theme->set_color("font_color", "Editor", font_color);
|
||||||
theme->set_color("highlighted_font_color", "Editor", font_color_hl);
|
theme->set_color("highlighted_font_color", "Editor", font_color_hl);
|
||||||
theme->set_color("disabled_font_color", "Editor", font_color_disabled);
|
theme->set_color("disabled_font_color", "Editor", font_color_disabled);
|
||||||
|
@ -3084,14 +3084,12 @@ void CanvasItemEditor::_draw_selection() {
|
|||||||
|
|
||||||
viewport->draw_set_transform_matrix(simple_xform);
|
viewport->draw_set_transform_matrix(simple_xform);
|
||||||
Rect2 x_handle_rect = Rect2(scale_factor.x * EDSCALE, -5 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE);
|
Rect2 x_handle_rect = Rect2(scale_factor.x * EDSCALE, -5 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE);
|
||||||
Color x_axis_color(1.0, 0.4, 0.4, 0.6);
|
viewport->draw_rect(x_handle_rect, get_color("axis_x_color", "Editor"));
|
||||||
viewport->draw_rect(x_handle_rect, x_axis_color);
|
viewport->draw_line(Point2(), Point2(scale_factor.x * EDSCALE, 0), get_color("axis_x_color", "Editor"), Math::round(EDSCALE), true);
|
||||||
viewport->draw_line(Point2(), Point2(scale_factor.x * EDSCALE, 0), x_axis_color, Math::round(EDSCALE), true);
|
|
||||||
|
|
||||||
Rect2 y_handle_rect = Rect2(-5 * EDSCALE, -(scale_factor.y + 10) * EDSCALE, 10 * EDSCALE, 10 * EDSCALE);
|
Rect2 y_handle_rect = Rect2(-5 * EDSCALE, -(scale_factor.y + 10) * EDSCALE, 10 * EDSCALE, 10 * EDSCALE);
|
||||||
Color y_axis_color(0.4, 1.0, 0.4, 0.6);
|
viewport->draw_rect(y_handle_rect, get_color("axis_y_color", "Editor"));
|
||||||
viewport->draw_rect(y_handle_rect, y_axis_color);
|
viewport->draw_line(Point2(), Point2(0, -scale_factor.y * EDSCALE), get_color("axis_y_color", "Editor"), Math::round(EDSCALE), true);
|
||||||
viewport->draw_line(Point2(), Point2(0, -scale_factor.y * EDSCALE), y_axis_color, Math::round(EDSCALE), true);
|
|
||||||
|
|
||||||
viewport->draw_set_transform_matrix(viewport->get_transform());
|
viewport->draw_set_transform_matrix(viewport->get_transform());
|
||||||
}
|
}
|
||||||
@ -3171,11 +3169,8 @@ void CanvasItemEditor::_draw_axis() {
|
|||||||
|
|
||||||
if (show_origin) {
|
if (show_origin) {
|
||||||
|
|
||||||
Color x_axis_color(1.0, 0.4, 0.4, 0.6);
|
_draw_straight_line(Point2(), Point2(1, 0), get_color("axis_x_color", "Editor") * Color(1, 1, 1, 0.75));
|
||||||
Color y_axis_color(0.4, 1.0, 0.4, 0.6);
|
_draw_straight_line(Point2(), Point2(0, 1), get_color("axis_y_color", "Editor") * Color(1, 1, 1, 0.75));
|
||||||
|
|
||||||
_draw_straight_line(Point2(), Point2(1, 0), x_axis_color);
|
|
||||||
_draw_straight_line(Point2(), Point2(0, 1), y_axis_color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (show_viewport) {
|
if (show_viewport) {
|
||||||
|
@ -4080,23 +4080,6 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) {
|
|||||||
return si;
|
return si;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color SpatialEditor::_get_axis_color(int axis) {
|
|
||||||
|
|
||||||
switch (axis) {
|
|
||||||
case 0:
|
|
||||||
// X axis
|
|
||||||
return Color(0.96, 0.20, 0.32);
|
|
||||||
case 1:
|
|
||||||
// Y axis
|
|
||||||
return Color(0.53, 0.84, 0.01);
|
|
||||||
case 2:
|
|
||||||
// Z axis
|
|
||||||
return Color(0.16, 0.55, 0.96);
|
|
||||||
default:
|
|
||||||
return Color(0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpatialEditor::_generate_selection_box() {
|
void SpatialEditor::_generate_selection_box() {
|
||||||
|
|
||||||
AABB aabb(Vector3(), Vector3(1, 1, 1));
|
AABB aabb(Vector3(), Vector3(1, 1, 1));
|
||||||
@ -4648,7 +4631,21 @@ void SpatialEditor::_init_indicators() {
|
|||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
Vector3 axis;
|
Vector3 axis;
|
||||||
axis[i] = 1;
|
axis[i] = 1;
|
||||||
Color origin_color = _get_axis_color(i);
|
Color origin_color;
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
origin_color = get_color("axis_x_color", "Editor");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
origin_color = get_color("axis_y_color", "Editor");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
origin_color = get_color("axis_z_color", "Editor");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
origin_color = Color();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
grid_enable[i] = false;
|
grid_enable[i] = false;
|
||||||
grid_visible[i] = false;
|
grid_visible[i] = false;
|
||||||
@ -4685,7 +4682,22 @@ void SpatialEditor::_init_indicators() {
|
|||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
|
|
||||||
Color col = _get_axis_color(i);
|
Color col;
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
col = get_color("axis_x_color", "Editor");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
col = get_color("axis_y_color", "Editor");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
col = get_color("axis_z_color", "Editor");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
col = Color();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
col.a = EditorSettings::get_singleton()->get("editors/3d/manipulator_gizmo_opacity");
|
col.a = EditorSettings::get_singleton()->get("editors/3d/manipulator_gizmo_opacity");
|
||||||
|
|
||||||
move_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
|
move_gizmo[i] = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||||
|
@ -633,7 +633,6 @@ private:
|
|||||||
Node *custom_camera;
|
Node *custom_camera;
|
||||||
|
|
||||||
Object *_get_editor_data(Object *p_what);
|
Object *_get_editor_data(Object *p_what);
|
||||||
Color _get_axis_color(int axis);
|
|
||||||
|
|
||||||
Ref<Environment> viewport_environment;
|
Ref<Environment> viewport_environment;
|
||||||
|
|
||||||
|
@ -1543,12 +1543,12 @@ Position3DSpatialGizmoPlugin::Position3DSpatialGizmoPlugin() {
|
|||||||
cursor_points.push_back(Vector3(0, -cs, 0));
|
cursor_points.push_back(Vector3(0, -cs, 0));
|
||||||
cursor_points.push_back(Vector3(0, 0, +cs));
|
cursor_points.push_back(Vector3(0, 0, +cs));
|
||||||
cursor_points.push_back(Vector3(0, 0, -cs));
|
cursor_points.push_back(Vector3(0, 0, -cs));
|
||||||
cursor_colors.push_back(Color(1, 0.5, 0.5, 0.7));
|
cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_x_color", "Editor"));
|
||||||
cursor_colors.push_back(Color(1, 0.5, 0.5, 0.7));
|
cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_x_color", "Editor"));
|
||||||
cursor_colors.push_back(Color(0.5, 1, 0.5, 0.7));
|
cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_y_color", "Editor"));
|
||||||
cursor_colors.push_back(Color(0.5, 1, 0.5, 0.7));
|
cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_y_color", "Editor"));
|
||||||
cursor_colors.push_back(Color(0.5, 0.5, 1, 0.7));
|
cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_z_color", "Editor"));
|
||||||
cursor_colors.push_back(Color(0.5, 0.5, 1, 0.7));
|
cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_z_color", "Editor"));
|
||||||
|
|
||||||
Ref<SpatialMaterial> mat = memnew(SpatialMaterial);
|
Ref<SpatialMaterial> mat = memnew(SpatialMaterial);
|
||||||
mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||||
|
@ -38,8 +38,9 @@ const float DEFAULT_GIZMO_EXTENTS = 10.0;
|
|||||||
void Position2D::_draw_cross() {
|
void Position2D::_draw_cross() {
|
||||||
|
|
||||||
float extents = get_gizmo_extents();
|
float extents = get_gizmo_extents();
|
||||||
draw_line(Point2(-extents, 0), Point2(+extents, 0), Color(1, 0.5, 0.5));
|
// Colors taken from `axis_x_color` and `axis_y_color` (defined in `editor/editor_themes.cpp`)
|
||||||
draw_line(Point2(0, -extents), Point2(0, +extents), Color(0.5, 1, 0.5));
|
draw_line(Point2(-extents, 0), Point2(+extents, 0), Color(0.96, 0.20, 0.32));
|
||||||
|
draw_line(Point2(0, -extents), Point2(0, +extents), Color(0.53, 0.84, 0.01));
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect2 Position2D::_edit_get_rect() const {
|
Rect2 Position2D::_edit_get_rect() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user