Geometry Nodes: Use boolean type for "use attribute" inputs
When the "use_attribute" properties were added, boolean IDProperties
didn't exist. Then we didn't change it for a while because of forward
compatibility concerns. But currently we always convert boolean
properties to integer properties when saving anyway (since
2ea47e0def, so there is no issue with compatibility.
Using booleans makes working with the properties in the Python API
a bit friendlier.
Pull Request: https://projects.blender.org/blender/blender/pulls/119129
This commit is contained in:
@@ -431,7 +431,7 @@ static int run_node_group_invoke(bContext *C, wmOperator *op, const wmEvent * /*
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
nodes::update_input_properties_from_node_tree(*node_tree, op->properties, true, *op->properties);
|
||||
nodes::update_input_properties_from_node_tree(*node_tree, op->properties, *op->properties);
|
||||
nodes::update_output_properties_from_node_tree(*node_tree, op->properties, *op->properties);
|
||||
|
||||
return run_node_group_exec(C, op);
|
||||
|
||||
@@ -336,8 +336,7 @@ static void update_id_properties_from_node_group(NodesModifierData *nmd)
|
||||
}
|
||||
IDProperty *new_properties = nmd->settings.properties;
|
||||
|
||||
nodes::update_input_properties_from_node_tree(
|
||||
*nmd->node_group, old_properties, false, *new_properties);
|
||||
nodes::update_input_properties_from_node_tree(*nmd->node_group, old_properties, *new_properties);
|
||||
nodes::update_output_properties_from_node_tree(
|
||||
*nmd->node_group, old_properties, *new_properties);
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ bke::GeometrySet execute_geometry_nodes_on_geometry(const bNodeTree &btree,
|
||||
|
||||
void update_input_properties_from_node_tree(const bNodeTree &tree,
|
||||
const IDProperty *old_properties,
|
||||
bool use_bool_for_use_attribute,
|
||||
IDProperty &properties);
|
||||
|
||||
void update_output_properties_from_node_tree(const bNodeTree &tree,
|
||||
|
||||
@@ -857,7 +857,6 @@ bke::GeometrySet execute_geometry_nodes_on_geometry(const bNodeTree &btree,
|
||||
|
||||
void update_input_properties_from_node_tree(const bNodeTree &tree,
|
||||
const IDProperty *old_properties,
|
||||
const bool use_bool_for_use_attribute,
|
||||
IDProperty &properties)
|
||||
{
|
||||
tree.ensure_interface_cache();
|
||||
@@ -911,8 +910,7 @@ void update_input_properties_from_node_tree(const bNodeTree &tree,
|
||||
const std::string attribute_name_id = socket_identifier + input_attribute_name_suffix();
|
||||
|
||||
IDPropertyTemplate idprop = {0};
|
||||
IDProperty *use_attribute_prop = IDP_New(
|
||||
use_bool_for_use_attribute ? IDP_BOOLEAN : IDP_INT, &idprop, use_attribute_id.c_str());
|
||||
IDProperty *use_attribute_prop = IDP_New(IDP_BOOLEAN, &idprop, use_attribute_id.c_str());
|
||||
IDP_AddToGroup(&properties, use_attribute_prop);
|
||||
|
||||
IDProperty *attribute_prop = IDP_New(IDP_STRING, &idprop, attribute_name_id.c_str());
|
||||
|
||||
Reference in New Issue
Block a user