mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Merge pull request #56044 from timothyqiu/position-nodes
[3.x] Improve axis awareness and visibility for Position2D and Position3D
This commit is contained in:
commit
7249e170f7
2 changed files with 69 additions and 11 deletions
|
@ -1567,19 +1567,46 @@ Position3DSpatialGizmoPlugin::Position3DSpatialGizmoPlugin() {
|
|||
cursor_points = Vector<Vector3>();
|
||||
|
||||
PoolVector<Color> cursor_colors;
|
||||
float cs = 0.25;
|
||||
const float cs = 0.25;
|
||||
// Add more points to create a "hard stop" in the color gradient.
|
||||
cursor_points.push_back(Vector3(+cs, 0, 0));
|
||||
cursor_points.push_back(Vector3());
|
||||
cursor_points.push_back(Vector3());
|
||||
cursor_points.push_back(Vector3(-cs, 0, 0));
|
||||
|
||||
cursor_points.push_back(Vector3(0, +cs, 0));
|
||||
cursor_points.push_back(Vector3());
|
||||
cursor_points.push_back(Vector3());
|
||||
cursor_points.push_back(Vector3(0, -cs, 0));
|
||||
|
||||
cursor_points.push_back(Vector3(0, 0, +cs));
|
||||
cursor_points.push_back(Vector3());
|
||||
cursor_points.push_back(Vector3());
|
||||
cursor_points.push_back(Vector3(0, 0, -cs));
|
||||
cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_x_color", "Editor"));
|
||||
cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_x_color", "Editor"));
|
||||
cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_y_color", "Editor"));
|
||||
cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_y_color", "Editor"));
|
||||
cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_z_color", "Editor"));
|
||||
cursor_colors.push_back(EditorNode::get_singleton()->get_gui_base()->get_color("axis_z_color", "Editor"));
|
||||
|
||||
// Use the axis color which is brighter for the positive axis.
|
||||
// Use a darkened axis color for the negative axis.
|
||||
// This makes it possible to see in which direction the Position3D node is rotated
|
||||
// (which can be important depending on how it's used).
|
||||
const Color color_x = EditorNode::get_singleton()->get_gui_base()->get_color("axis_x_color", "Editor");
|
||||
cursor_colors.push_back(color_x);
|
||||
cursor_colors.push_back(color_x);
|
||||
// FIXME: Use less strong darkening factor once GH-48573 is fixed.
|
||||
// The current darkening factor compensates for lines being too bright in the 3D editor.
|
||||
cursor_colors.push_back(color_x.linear_interpolate(Color(0, 0, 0), 0.75));
|
||||
cursor_colors.push_back(color_x.linear_interpolate(Color(0, 0, 0), 0.75));
|
||||
|
||||
const Color color_y = EditorNode::get_singleton()->get_gui_base()->get_color("axis_y_color", "Editor");
|
||||
cursor_colors.push_back(color_y);
|
||||
cursor_colors.push_back(color_y);
|
||||
cursor_colors.push_back(color_y.linear_interpolate(Color(0, 0, 0), 0.75));
|
||||
cursor_colors.push_back(color_y.linear_interpolate(Color(0, 0, 0), 0.75));
|
||||
|
||||
const Color color_z = EditorNode::get_singleton()->get_gui_base()->get_color("axis_z_color", "Editor");
|
||||
cursor_colors.push_back(color_z);
|
||||
cursor_colors.push_back(color_z);
|
||||
cursor_colors.push_back(color_z.linear_interpolate(Color(0, 0, 0), 0.75));
|
||||
cursor_colors.push_back(color_z.linear_interpolate(Color(0, 0, 0), 0.75));
|
||||
|
||||
Ref<SpatialMaterial> mat = memnew(SpatialMaterial);
|
||||
mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue