Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_geometry_set.hh19
-rw-r--r--source/blender/blenkernel/intern/attribute_access.cc4
-rw-r--r--source/blender/editors/space_node/node_draw.cc12
-rw-r--r--source/blender/functions/FN_field.hh16
-rw-r--r--source/blender/functions/intern/field.cc1
-rw-r--r--source/blender/nodes/NOD_geometry_exec.hh2
-rw-r--r--source/blender/nodes/NOD_node_tree_ref.hh16
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc5
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc3
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_parameter.cc3
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc9
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc10
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_normal.cc3
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc3
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc3
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_material_selection.cc3
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc3
-rw-r--r--source/blender/nodes/intern/geometry_nodes_eval_log.cc18
-rw-r--r--source/blender/nodes/intern/node_geometry_exec.cc5
20 files changed, 111 insertions, 33 deletions
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index f57765e373b..78ccefaed5c 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -736,6 +736,7 @@ class AttributeFieldInput : public fn::FieldInput {
AttributeFieldInput(std::string name, const CPPType &type)
: fn::FieldInput(type, name), name_(std::move(name))
{
+ category_ = Category::NamedAttribute;
}
template<typename T> static fn::Field<T> Create(std::string name)
@@ -764,6 +765,7 @@ class IDAttributeFieldInput : public fn::FieldInput {
public:
IDAttributeFieldInput() : fn::FieldInput(CPPType::get<int>())
{
+ category_ = Category::Generated;
}
static fn::Field<int> Create();
@@ -785,18 +787,25 @@ class AnonymousAttributeFieldInput : public fn::FieldInput {
* automatically.
*/
StrongAnonymousAttributeID anonymous_id_;
+ std::string producer_name_;
public:
- AnonymousAttributeFieldInput(StrongAnonymousAttributeID anonymous_id, const CPPType &type)
- : fn::FieldInput(type, anonymous_id.debug_name()), anonymous_id_(std::move(anonymous_id))
+ AnonymousAttributeFieldInput(StrongAnonymousAttributeID anonymous_id,
+ const CPPType &type,
+ std::string producer_name)
+ : fn::FieldInput(type, anonymous_id.debug_name()),
+ anonymous_id_(std::move(anonymous_id)),
+ producer_name_(producer_name)
{
+ category_ = Category::AnonymousAttribute;
}
- template<typename T> static fn::Field<T> Create(StrongAnonymousAttributeID anonymous_id)
+ template<typename T>
+ static fn::Field<T> Create(StrongAnonymousAttributeID anonymous_id, std::string producer_name)
{
const CPPType &type = CPPType::get<T>();
- auto field_input = std::make_shared<AnonymousAttributeFieldInput>(std::move(anonymous_id),
- type);
+ auto field_input = std::make_shared<AnonymousAttributeFieldInput>(
+ std::move(anonymous_id), type, std::move(producer_name));
return fn::Field<T>{field_input};
}
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index 3386d346364..1ea7f522bef 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -1385,7 +1385,7 @@ const GVArray *AttributeFieldInput::get_varray_for_context(const fn::FieldContex
std::string AttributeFieldInput::socket_inspection_name() const
{
std::stringstream ss;
- ss << TIP_("Attribute: ") << name_;
+ ss << '"' << name_ << '"' << TIP_(" attribute from geometry");
return ss.str();
}
@@ -1468,7 +1468,7 @@ const GVArray *AnonymousAttributeFieldInput::get_varray_for_context(
std::string AnonymousAttributeFieldInput::socket_inspection_name() const
{
std::stringstream ss;
- ss << TIP_("Anonymous Attribute: ") << debug_name_;
+ ss << '"' << debug_name_ << '"' << TIP_(" from ") << producer_name_;
return ss.str();
}
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index 3a307777d0a..9e91d394fef 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -907,22 +907,22 @@ static void create_inspection_string_for_gfield(const geo_log::GFieldValueLog &v
}
else {
if (type.is<int>()) {
- ss << TIP_("Integer Field");
+ ss << TIP_("Integer field");
}
else if (type.is<float>()) {
- ss << TIP_("Float Field");
+ ss << TIP_("Float field");
}
else if (type.is<blender::float3>()) {
- ss << TIP_("Vector Field");
+ ss << TIP_("Vector field");
}
else if (type.is<bool>()) {
- ss << TIP_("Boolean Field");
+ ss << TIP_("Boolean field");
}
else if (type.is<std::string>()) {
- ss << TIP_("String Field");
+ ss << TIP_("String field");
}
else if (type.is<blender::ColorGeometry4f>()) {
- ss << TIP_("Color Field");
+ ss << TIP_("Color field");
}
ss << TIP_(" based on:\n");
diff --git a/source/blender/functions/FN_field.hh b/source/blender/functions/FN_field.hh
index ed5064fdf25..5e0302130af 100644
--- a/source/blender/functions/FN_field.hh
+++ b/source/blender/functions/FN_field.hh
@@ -227,9 +227,19 @@ class FieldContext;
* A #FieldNode that represents an input to the entire field-tree.
*/
class FieldInput : public FieldNode {
+ public:
+ /* The order is also used for sorting in socket inspection. */
+ enum class Category {
+ NamedAttribute = 0,
+ Generated = 1,
+ AnonymousAttribute = 2,
+ Unknown,
+ };
+
protected:
const CPPType *type_;
std::string debug_name_;
+ Category category_ = Category::Unknown;
public:
FieldInput(const CPPType &type, std::string debug_name = "");
@@ -245,6 +255,7 @@ class FieldInput : public FieldNode {
virtual std::string socket_inspection_name() const;
blender::StringRef debug_name() const;
const CPPType &cpp_type() const;
+ Category category() const;
const CPPType &output_cpp_type(int output_index) const override;
void foreach_field_input(FunctionRef<void(const FieldInput &)> foreach_fn) const override;
@@ -527,6 +538,11 @@ inline const CPPType &FieldInput::cpp_type() const
return *type_;
}
+inline FieldInput::Category FieldInput::category() const
+{
+ return category_;
+}
+
inline const CPPType &FieldInput::output_cpp_type(int output_index) const
{
BLI_assert(output_index == 0);
diff --git a/source/blender/functions/intern/field.cc b/source/blender/functions/intern/field.cc
index 5c13db9ec17..4de5e71c910 100644
--- a/source/blender/functions/intern/field.cc
+++ b/source/blender/functions/intern/field.cc
@@ -523,6 +523,7 @@ const GVArray *FieldContext::get_varray_for_input(const FieldInput &field_input,
IndexFieldInput::IndexFieldInput() : FieldInput(CPPType::get<int>(), "Index")
{
+ category_ = Category::Generated;
}
GVArray *IndexFieldInput::get_index_varray(IndexMask mask, ResourceScope &scope)
diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh
index 962e1c3c48f..f5775b8a6e0 100644
--- a/source/blender/nodes/NOD_geometry_exec.hh
+++ b/source/blender/nodes/NOD_geometry_exec.hh
@@ -335,6 +335,8 @@ class GeoNodeExecParams {
const GeometryComponent &component,
const AttributeDomain default_domain) const;
+ std::string attribute_producer_name() const;
+
private:
/* Utilities for detecting common errors at when using this class. */
void check_input_access(StringRef identifier, const CPPType *requested_type = nullptr) const;
diff --git a/source/blender/nodes/NOD_node_tree_ref.hh b/source/blender/nodes/NOD_node_tree_ref.hh
index b6e372470c8..9f9dcc69376 100644
--- a/source/blender/nodes/NOD_node_tree_ref.hh
+++ b/source/blender/nodes/NOD_node_tree_ref.hh
@@ -200,6 +200,8 @@ class NodeRef : NonCopyable, NonMovable {
PointerRNA *rna() const;
StringRefNull idname() const;
StringRefNull name() const;
+ StringRefNull label() const;
+ StringRefNull label_or_name() const;
bNodeType *typeinfo() const;
const NodeDeclaration *declaration() const;
@@ -575,6 +577,20 @@ inline StringRefNull NodeRef::name() const
return bnode_->name;
}
+inline StringRefNull NodeRef::label() const
+{
+ return bnode_->label;
+}
+
+inline StringRefNull NodeRef::label_or_name() const
+{
+ const StringRefNull label = this->label();
+ if (!label.is_empty()) {
+ return label;
+ }
+ return this->name();
+}
+
inline bNodeType *NodeRef::typeinfo() const
{
return bnode_->typeinfo;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
index b7352160f89..8ad70cd6d3f 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_capture.cc
@@ -144,7 +144,7 @@ static void geo_node_attribute_capture_exec(GeoNodeExecParams params)
break;
}
- WeakAnonymousAttributeID anonymous_id{"Attribute Capture"};
+ WeakAnonymousAttributeID anonymous_id{"Attribute"};
const CPPType &type = field.cpp_type();
static const Array<GeometryComponentType> types = {
@@ -158,8 +158,8 @@ static void geo_node_attribute_capture_exec(GeoNodeExecParams params)
}
});
- GField output_field{
- std::make_shared<bke::AnonymousAttributeFieldInput>(std::move(anonymous_id), type)};
+ GField output_field{std::make_shared<bke::AnonymousAttributeFieldInput>(
+ std::move(anonymous_id), type, params.attribute_producer_name())};
switch (data_type) {
case CD_PROP_FLOAT: {
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc
index ee6cf055ecb..fbe5af3bb18 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc
@@ -56,8 +56,11 @@ class EndpointFieldInput final : public fn::FieldInput {
public:
EndpointFieldInput(Field<int> start_size, Field<int> end_size)
- : FieldInput(CPPType::get<bool>(), "Selection"), start_size_(start_size), end_size_(end_size)
+ : FieldInput(CPPType::get<bool>(), "Endpoint Selection node"),
+ start_size_(start_size),
+ end_size_(end_size)
{
+ category_ = Category::Generated;
}
const GVArray *get_varray_for_context(const fn::FieldContext &context,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
index b565b1e4602..3ae330fd5cd 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_handle_type_selection.cc
@@ -91,8 +91,9 @@ class HandleTypeFieldInput final : public fn::FieldInput {
public:
HandleTypeFieldInput(BezierSpline::HandleType type, GeometryNodeCurveHandleMode mode)
- : FieldInput(CPPType::get<bool>(), "Selection"), type_(type), mode_(mode)
+ : FieldInput(CPPType::get<bool>(), "Handle Type Selection node"), type_(type), mode_(mode)
{
+ category_ = Category::Generated;
}
const GVArray *get_varray_for_context(const fn::FieldContext &context,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_parameter.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_parameter.cc
index 90853387ec7..938f5f22a03 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_parameter.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_parameter.cc
@@ -150,8 +150,9 @@ static const GVArray *construct_curve_parameter_gvarray(const CurveEval &curve,
class CurveParameterFieldInput final : public fn::FieldInput {
public:
- CurveParameterFieldInput() : fn::FieldInput(CPPType::get<float>(), "Curve Parameter")
+ CurveParameterFieldInput() : fn::FieldInput(CPPType::get<float>(), "Curve Parameter node")
{
+ category_ = Category::Generated;
}
const GVArray *get_varray_for_context(const fn::FieldContext &context,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
index 4f4fde6c7df..e43e1fa6c75 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
@@ -357,17 +357,20 @@ static void geo_node_curve_to_points_exec(GeoNodeExecParams params)
if (attribute_outputs.tangent_id) {
params.set_output(
"Tangent",
- AnonymousAttributeFieldInput::Create<float3>(std::move(attribute_outputs.tangent_id)));
+ AnonymousAttributeFieldInput::Create<float3>(std::move(attribute_outputs.tangent_id),
+ params.attribute_producer_name()));
}
if (attribute_outputs.normal_id) {
params.set_output(
"Normal",
- AnonymousAttributeFieldInput::Create<float3>(std::move(attribute_outputs.normal_id)));
+ AnonymousAttributeFieldInput::Create<float3>(std::move(attribute_outputs.normal_id),
+ params.attribute_producer_name()));
}
if (attribute_outputs.rotation_id) {
params.set_output(
"Rotation",
- AnonymousAttributeFieldInput::Create<float3>(std::move(attribute_outputs.rotation_id)));
+ AnonymousAttributeFieldInput::Create<float3>(std::move(attribute_outputs.rotation_id),
+ params.attribute_producer_name()));
}
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
index 0d481011f00..c267815226a 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
@@ -543,10 +543,10 @@ static void geo_node_point_distribute_points_on_faces_exec(GeoNodeExecParams par
AttributeOutputs attribute_outputs;
if (params.output_is_required("Normal")) {
- attribute_outputs.normal_id = StrongAnonymousAttributeID("normal");
+ attribute_outputs.normal_id = StrongAnonymousAttributeID("Normal");
}
if (params.output_is_required("Rotation")) {
- attribute_outputs.rotation_id = StrongAnonymousAttributeID("rotation");
+ attribute_outputs.rotation_id = StrongAnonymousAttributeID("Rotation");
}
geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) {
@@ -562,12 +562,14 @@ static void geo_node_point_distribute_points_on_faces_exec(GeoNodeExecParams par
if (attribute_outputs.normal_id) {
params.set_output(
"Normal",
- AnonymousAttributeFieldInput::Create<float3>(std::move(attribute_outputs.normal_id)));
+ AnonymousAttributeFieldInput::Create<float3>(std::move(attribute_outputs.normal_id),
+ params.attribute_producer_name()));
}
if (attribute_outputs.rotation_id) {
params.set_output(
"Rotation",
- AnonymousAttributeFieldInput::Create<float3>(std::move(attribute_outputs.rotation_id)));
+ AnonymousAttributeFieldInput::Create<float3>(std::move(attribute_outputs.rotation_id),
+ params.attribute_producer_name()));
}
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc b/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc
index 5a2495afb9e..3387f8d6c6e 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc
@@ -241,8 +241,9 @@ static const GVArray *construct_curve_normal_gvarray(const CurveComponent &compo
class NormalFieldInput final : public fn::FieldInput {
public:
- NormalFieldInput() : fn::FieldInput(CPPType::get<float3>(), "Normal")
+ NormalFieldInput() : fn::FieldInput(CPPType::get<float3>(), "Normal node")
{
+ category_ = Category::Generated;
}
const GVArray *get_varray_for_context(const fn::FieldContext &context,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc b/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc
index b5f3e1b0c28..ec502f7f1bc 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc
@@ -57,8 +57,9 @@ static const GVArray *construct_spline_length_gvarray(const CurveComponent &comp
class SplineLengthFieldInput final : public fn::FieldInput {
public:
- SplineLengthFieldInput() : fn::FieldInput(CPPType::get<float>(), "Spline Length")
+ SplineLengthFieldInput() : fn::FieldInput(CPPType::get<float>(), "Spline Length node")
{
+ category_ = Category::Generated;
}
const GVArray *get_varray_for_context(const fn::FieldContext &context,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc b/source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc
index d690642373a..f746edbbca2 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc
@@ -121,8 +121,9 @@ static const GVArray *construct_curve_tangent_gvarray(const CurveComponent &comp
class TangentFieldInput final : public fn::FieldInput {
public:
- TangentFieldInput() : fn::FieldInput(CPPType::get<float3>(), "Tangent")
+ TangentFieldInput() : fn::FieldInput(CPPType::get<float3>(), "Tangent node")
{
+ category_ = Category::Generated;
}
const GVArray *get_varray_for_context(const fn::FieldContext &context,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc
index 9d4533b9bda..7dffc7793e5 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc
@@ -59,8 +59,9 @@ class MaterialSelectionFieldInput final : public fn::FieldInput {
public:
MaterialSelectionFieldInput(Material *material)
- : fn::FieldInput(CPPType::get<bool>(), "Material Selection"), material_(material)
+ : fn::FieldInput(CPPType::get<bool>(), "Material Selection node"), material_(material)
{
+ category_ = Category::Generated;
}
const GVArray *get_varray_for_context(const fn::FieldContext &context,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc
index 1c287a0f1bf..5350b14b53b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc
@@ -628,13 +628,14 @@ class IndexTransferFieldInput : public FieldInput {
GField src_field,
Field<int> index_field,
const AttributeDomain domain)
- : FieldInput(src_field.cpp_type(), "Attribute Transfer Index"),
+ : FieldInput(src_field.cpp_type(), "Attribute Transfer node"),
src_geometry_(std::move(geometry)),
src_field_(std::move(src_field)),
index_field_(std::move(index_field)),
domain_(domain)
{
src_geometry_.ensure_owns_direct_data();
+ category_ = Category::Generated;
}
const GVArray *get_varray_for_context(const FieldContext &context,
diff --git a/source/blender/nodes/intern/geometry_nodes_eval_log.cc b/source/blender/nodes/intern/geometry_nodes_eval_log.cc
index 13dc73c7206..ddd3c991518 100644
--- a/source/blender/nodes/intern/geometry_nodes_eval_log.cc
+++ b/source/blender/nodes/intern/geometry_nodes_eval_log.cc
@@ -177,9 +177,23 @@ const SocketLog *NodeLog::lookup_socket_log(const bNode &node, const bNodeSocket
GFieldValueLog::GFieldValueLog(fn::GField field, bool log_full_field) : type_(field.cpp_type())
{
- VectorSet<std::reference_wrapper<const FieldInput>> field_inputs;
+ Set<std::reference_wrapper<const FieldInput>> field_inputs_set;
field.node().foreach_field_input(
- [&](const FieldInput &field_input) { field_inputs.add(field_input); });
+ [&](const FieldInput &field_input) { field_inputs_set.add(field_input); });
+
+ Vector<std::reference_wrapper<const FieldInput>> field_inputs;
+ field_inputs.extend(field_inputs_set.begin(), field_inputs_set.end());
+
+ std::sort(
+ field_inputs.begin(), field_inputs.end(), [](const FieldInput &a, const FieldInput &b) {
+ const int index_a = (int)a.category();
+ const int index_b = (int)b.category();
+ if (index_a == index_b) {
+ return a.socket_inspection_name().size() < b.socket_inspection_name().size();
+ }
+ return index_a < index_b;
+ });
+
for (const FieldInput &field_input : field_inputs) {
input_tooltips_.append(field_input.socket_inspection_name());
}
diff --git a/source/blender/nodes/intern/node_geometry_exec.cc b/source/blender/nodes/intern/node_geometry_exec.cc
index a3bbca90731..8ea085d42f9 100644
--- a/source/blender/nodes/intern/node_geometry_exec.cc
+++ b/source/blender/nodes/intern/node_geometry_exec.cc
@@ -183,6 +183,11 @@ AttributeDomain GeoNodeExecParams::get_highest_priority_input_domain(
return default_domain;
}
+std::string GeoNodeExecParams::attribute_producer_name() const
+{
+ return provider_->dnode->label_or_name() + TIP_(" node");
+}
+
void GeoNodeExecParams::check_input_access(StringRef identifier,
const CPPType *requested_type) const
{