Mesh: Replace auto smooth with node group #108014

Merged
Hans Goudey merged 149 commits from HooglyBoogly/blender:refactor-mesh-corner-normals-lazy into main 2023-10-20 16:54:20 +02:00
1 changed files with 16 additions and 10 deletions
Showing only changes of commit 4b925788b6 - Show all commits

View File

@ -2108,18 +2108,24 @@ static bNodeTree *add_auto_smooth_node_tree(Main &bmain)
shade_smooth->locy = 40.0f;
bNode *store_node = nodeAddNode(nullptr, node_tree, "GeometryNodeStoreNamedAttribute");
store_node->locx = 40.0f;
store_node->locy = 40.0f;
static_cast<NodeGeometryStoreNamedAttribute *>(store_node->storage)->data_type = CD_PROP_BOOL;
static_cast<NodeGeometryStoreNamedAttribute *>(store_node->storage)->domain = ATTR_DOMAIN_EDGE;
bNodeSocket *name = nodeFindSocket(store_node, SOCK_IN, DATA_("Name"));
STRNCPY(name->default_value_typed<bNodeSocketValueString>()->value, "sharp_edge");
{
store_node->locx = 40.0f;
store_node->locy = 40.0f;
HooglyBoogly marked this conversation as resolved Outdated

Don't use more casts than necessary.

Don't use more casts than necessary.
auto *storage = static_cast<NodeGeometryStoreNamedAttribute *>(store_node->storage);
storage->data_type = CD_PROP_BOOL;
storage->domain = ATTR_DOMAIN_EDGE;
bNodeSocket *name = nodeFindSocket(store_node, SOCK_IN, DATA_("Name"));
STRNCPY(name->default_value_typed<bNodeSocketValueString>()->value, "sharp_edge");
}
bNode *greater_node = nodeAddNode(nullptr, node_tree, "FunctionNodeCompare");
greater_node->locx = -160.0f;
greater_node->locy = -100.0f;
static_cast<NodeFunctionCompare *>(greater_node->storage)->operation = NODE_COMPARE_GREATER_THAN;
static_cast<NodeFunctionCompare *>(greater_node->storage)->data_type = SOCK_FLOAT;
{
greater_node->locx = -160.0f;
greater_node->locy = -100.0f;
auto *storage = static_cast<NodeFunctionCompare *>(store_node->storage);
storage->operation = NODE_COMPARE_GREATER_THAN;
storage->data_type = SOCK_FLOAT;
}
bNode *edge_angle_node = nodeAddNode(nullptr, node_tree, "GeometryNodeInputMeshEdgeAngle");
edge_angle_node->locx = -380.0f;