Geometry Nodes: Rotation socket tooltip

Formatted inspection strings for field/single value of new rotation
type of socket. Called `Rotation`, displayed as XYZ Euler degrees.

See: #92967

Pull Request: https://projects.blender.org/blender/blender/pulls/109851
This commit is contained in:
Iliya Katueshenock
2023-07-13 13:21:46 +02:00
committed by Hans Goudey
parent 99b962811b
commit c48f8cd12b

View File

@@ -849,6 +849,14 @@ static void create_inspection_string_for_generic_value(const bNodeSocket &socket
const blender::ColorGeometry4f &color = *static_cast<blender::ColorGeometry4f *>(socket_value);
ss << fmt::format(TIP_("({}, {}, {}, {}) (Color)"), color.r, color.g, color.b, color.a);
}
else if (socket_type.is<math::Quaternion>()) {
const math::Quaternion &rotation = *static_cast<math::Quaternion *>(socket_value);
const math::EulerXYZ euler = math::to_euler(rotation);
ss << fmt::format(TIP_("({}°, {}°, {}°) (Rotation)"),
euler.x().degree(),
euler.y().degree(),
euler.z().degree());
}
else if (socket_type.is<bool>()) {
ss << fmt::format(TIP_("{} (Boolean)"),
((*static_cast<bool *>(socket_value)) ? TIP_("True") : TIP_("False")));
@@ -886,6 +894,9 @@ static void create_inspection_string_for_field_info(const bNodeSocket &socket,
else if (socket_type.is<blender::ColorGeometry4f>()) {
ss << TIP_("Color field based on:");
}
else if (socket_type.is<math::Quaternion>()) {
ss << TIP_("Rotation field based on:");
}
ss << "\n";
for (const int i : input_tooltips.index_range()) {