Cleanup: Register node property layout callbacks in files

This commit moves the property layout callbacks for node types to their
implementation files from `drawnode.c`. This was proposed a while ago in
T75724.

**Benefits**
 - Fewer files need to be changed when adding a new node.
 - Makes it possible to reuse functions from the node's implementation
   in the layout code.
 - Except for RNA, all of the node "inputs" are in the same place.
 - Code gets shorter overall, avoids the large switch statements.

**Downsides**
 - Requires including two UI headers.
 - Requires adding an editors dependency to the nodes folder.

This commit only changes function nodes and geometry nodes, more can be
moved later.

Differential Revision: https://developer.blender.org/D10352
This commit is contained in:
Hans Goudey 2021-02-08 15:09:49 -06:00
parent 13299a7367
commit cfa48c84d0
Notes: blender-bot 2023-02-14 04:10:15 +01:00
Referenced by commit 3b1c7a6d6f, Cleanup: move eIconSizes, ID_Type enums into own file
Referenced by issue #85484, Refactor High level UI code into its own module
Referenced by issue #75724, Extensible Architecture Refactoring
29 changed files with 354 additions and 429 deletions

View File

@ -23,6 +23,9 @@
#pragma once
/* Required for enum iconSizes which can't be forward declared if this file is included in C++. */
#include "DNA_ID.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -34,8 +37,6 @@ struct PreviewImage;
struct Scene;
struct bContext;
enum eIconSizes;
typedef struct IconFile {
struct IconFile *next, *prev;
char filename[256]; /* FILE_MAXFILE size */

View File

@ -3126,393 +3126,6 @@ static void node_texture_set_butfunc(bNodeType *ntype)
}
}
/* ****************** BUTTON CALLBACKS FOR GEOMETRY NODES ***************** */
static void node_geometry_buts_boolean_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE);
}
static void node_geometry_buts_attribute_compare(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE);
uiItemR(layout, ptr, "input_type_a", DEFAULT_FLAGS, IFACE_("Type A"), ICON_NONE);
uiItemR(layout, ptr, "input_type_b", DEFAULT_FLAGS, IFACE_("Type B"), ICON_NONE);
}
static void node_geometry_buts_subdivision_surface(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *UNUSED(ptr))
{
#ifndef WITH_OPENSUBDIV
uiItemL(layout, IFACE_("Disabled, built without OpenSubdiv"), ICON_ERROR);
#else
UNUSED_VARS(layout);
#endif
}
static void node_geometry_buts_triangulate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "quad_method", DEFAULT_FLAGS, "", ICON_NONE);
uiItemR(layout, ptr, "ngon_method", DEFAULT_FLAGS, "", ICON_NONE);
}
static void node_geometry_buts_random_attribute(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "data_type", DEFAULT_FLAGS, "", ICON_NONE);
}
static bool node_attribute_math_operation_use_input_b(const NodeMathOperation operation)
{
switch (operation) {
case NODE_MATH_ADD:
case NODE_MATH_SUBTRACT:
case NODE_MATH_MULTIPLY:
case NODE_MATH_DIVIDE:
case NODE_MATH_POWER:
case NODE_MATH_LOGARITHM:
case NODE_MATH_MINIMUM:
case NODE_MATH_MAXIMUM:
case NODE_MATH_LESS_THAN:
case NODE_MATH_GREATER_THAN:
case NODE_MATH_MODULO:
case NODE_MATH_ARCTAN2:
case NODE_MATH_SNAP:
case NODE_MATH_WRAP:
case NODE_MATH_COMPARE:
case NODE_MATH_MULTIPLY_ADD:
case NODE_MATH_PINGPONG:
case NODE_MATH_SMOOTH_MIN:
case NODE_MATH_SMOOTH_MAX:
return true;
case NODE_MATH_SINE:
case NODE_MATH_COSINE:
case NODE_MATH_TANGENT:
case NODE_MATH_ARCSINE:
case NODE_MATH_ARCCOSINE:
case NODE_MATH_ARCTANGENT:
case NODE_MATH_ROUND:
case NODE_MATH_ABSOLUTE:
case NODE_MATH_FLOOR:
case NODE_MATH_CEIL:
case NODE_MATH_FRACTION:
case NODE_MATH_SQRT:
case NODE_MATH_INV_SQRT:
case NODE_MATH_SIGN:
case NODE_MATH_EXPONENT:
case NODE_MATH_RADIANS:
case NODE_MATH_DEGREES:
case NODE_MATH_SINH:
case NODE_MATH_COSH:
case NODE_MATH_TANH:
case NODE_MATH_TRUNC:
return false;
}
BLI_assert(false);
return false;
}
static void node_geometry_buts_attribute_math(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
bNode *node = (bNode *)ptr->data;
NodeAttributeMath *node_storage = (NodeAttributeMath *)node->storage;
NodeMathOperation operation = (NodeMathOperation)node_storage->operation;
uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE);
uiItemR(layout, ptr, "input_type_a", DEFAULT_FLAGS, IFACE_("Type A"), ICON_NONE);
/* These "use input b / c" checks are copied from the node's code.
* They could be de-duplicated if the drawing code was moved to the node's file. */
if (node_attribute_math_operation_use_input_b(operation)) {
uiItemR(layout, ptr, "input_type_b", DEFAULT_FLAGS, IFACE_("Type B"), ICON_NONE);
}
if (ELEM(operation,
NODE_MATH_MULTIPLY_ADD,
NODE_MATH_SMOOTH_MIN,
NODE_MATH_SMOOTH_MAX,
NODE_MATH_WRAP,
NODE_MATH_COMPARE)) {
uiItemR(layout, ptr, "input_type_c", DEFAULT_FLAGS, IFACE_("Type C"), ICON_NONE);
}
}
static void node_geometry_buts_attribute_vector_math(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
bNode *node = (bNode *)ptr->data;
NodeAttributeVectorMath *node_storage = (NodeAttributeVectorMath *)node->storage;
uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE);
uiItemR(layout, ptr, "input_type_a", DEFAULT_FLAGS, IFACE_("Type A"), ICON_NONE);
/* These "use input b / c" checks are copied from the node's code.
* They could be de-duplicated if the drawing code was moved to the node's file. */
if (!ELEM(node_storage->operation,
NODE_VECTOR_MATH_NORMALIZE,
NODE_VECTOR_MATH_FLOOR,
NODE_VECTOR_MATH_CEIL,
NODE_VECTOR_MATH_FRACTION,
NODE_VECTOR_MATH_ABSOLUTE,
NODE_VECTOR_MATH_SINE,
NODE_VECTOR_MATH_COSINE,
NODE_VECTOR_MATH_TANGENT,
NODE_VECTOR_MATH_LENGTH)) {
uiItemR(layout, ptr, "input_type_b", DEFAULT_FLAGS, IFACE_("Type B"), ICON_NONE);
}
if (ELEM(node_storage->operation, NODE_VECTOR_MATH_WRAP)) {
uiItemR(layout, ptr, "input_type_c", DEFAULT_FLAGS, IFACE_("Type C"), ICON_NONE);
}
}
static void node_geometry_buts_point_instance(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "instance_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "instance_type") == GEO_NODE_POINT_INSTANCE_TYPE_COLLECTION) {
uiItemR(layout, ptr, "use_whole_collection", DEFAULT_FLAGS, NULL, ICON_NONE);
}
}
static void node_geometry_buts_attribute_fill(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "data_type", DEFAULT_FLAGS, "", ICON_NONE);
// uiItemR(layout, ptr, "domain", DEFAULT_FLAGS, "", ICON_NONE);
}
static void node_geometry_buts_attribute_mix(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "blend_type", DEFAULT_FLAGS, "", ICON_NONE);
uiLayout *col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "input_type_factor", DEFAULT_FLAGS, IFACE_("Factor"), ICON_NONE);
uiItemR(col, ptr, "input_type_a", DEFAULT_FLAGS, IFACE_("A"), ICON_NONE);
uiItemR(col, ptr, "input_type_b", DEFAULT_FLAGS, IFACE_("B"), ICON_NONE);
}
static void node_geometry_buts_attribute_point_distribute(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "distribute_method", DEFAULT_FLAGS, "", ICON_NONE);
}
static void node_geometry_buts_attribute_color_ramp(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiTemplateColorRamp(layout, ptr, "color_ramp", 0);
}
static void node_geometry_buts_point_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
NodeGeometryRotatePoints *storage = (NodeGeometryRotatePoints *)((bNode *)ptr->data)->storage;
uiItemR(layout, ptr, "type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(layout, ptr, "space", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiLayout *col = uiLayoutColumn(layout, false);
if (storage->type == GEO_NODE_POINT_ROTATE_TYPE_AXIS_ANGLE) {
uiItemR(col, ptr, "input_type_axis", DEFAULT_FLAGS, IFACE_("Axis"), ICON_NONE);
uiItemR(col, ptr, "input_type_angle", DEFAULT_FLAGS, IFACE_("Angle"), ICON_NONE);
}
else {
uiItemR(col, ptr, "input_type_rotation", DEFAULT_FLAGS, IFACE_("Rotation"), ICON_NONE);
}
}
static void node_geometry_buts_align_rotation_to_vector(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(layout, ptr, "pivot_axis", DEFAULT_FLAGS, IFACE_("Pivot"), ICON_NONE);
uiLayout *col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "input_type_factor", DEFAULT_FLAGS, IFACE_("Factor"), ICON_NONE);
uiItemR(col, ptr, "input_type_vector", DEFAULT_FLAGS, IFACE_("Vector"), ICON_NONE);
}
static void node_geometry_buts_point_translate(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "input_type", DEFAULT_FLAGS, IFACE_("Type"), ICON_NONE);
}
static void node_geometry_buts_point_scale(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "input_type", DEFAULT_FLAGS, IFACE_("Type"), ICON_NONE);
}
static void node_geometry_buts_object_info(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "transform_space", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
static void node_geometry_buts_attribute_sample_texture(uiLayout *layout,
bContext *C,
PointerRNA *ptr)
{
uiTemplateID(layout, C, ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL);
}
static void node_geometry_buts_points_to_volume(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, ptr, "resolution_mode", DEFAULT_FLAGS, IFACE_("Resolution"), ICON_NONE);
uiItemR(layout, ptr, "input_type_radius", DEFAULT_FLAGS, IFACE_("Radius"), ICON_NONE);
}
static void node_geometry_buts_collection_info(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "transform_space", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
static void node_geometry_buts_attribute_proximity(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "target_geometry_element", DEFAULT_FLAGS, "", ICON_NONE);
}
static void node_geometry_buts_volume_to_mesh(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, ptr, "resolution_mode", DEFAULT_FLAGS, IFACE_("Resolution"), ICON_NONE);
}
static void node_geometry_set_butfunc(bNodeType *ntype)
{
switch (ntype->type) {
case GEO_NODE_BOOLEAN:
ntype->draw_buttons = node_geometry_buts_boolean_math;
break;
case GEO_NODE_SUBDIVISION_SURFACE:
ntype->draw_buttons = node_geometry_buts_subdivision_surface;
break;
case GEO_NODE_TRIANGULATE:
ntype->draw_buttons = node_geometry_buts_triangulate;
break;
case GEO_NODE_ATTRIBUTE_RANDOMIZE:
ntype->draw_buttons = node_geometry_buts_random_attribute;
break;
case GEO_NODE_ATTRIBUTE_MATH:
ntype->draw_buttons = node_geometry_buts_attribute_math;
break;
case GEO_NODE_ATTRIBUTE_COMPARE:
ntype->draw_buttons = node_geometry_buts_attribute_compare;
break;
case GEO_NODE_POINT_INSTANCE:
ntype->draw_buttons = node_geometry_buts_point_instance;
break;
case GEO_NODE_ATTRIBUTE_FILL:
ntype->draw_buttons = node_geometry_buts_attribute_fill;
break;
case GEO_NODE_ATTRIBUTE_MIX:
ntype->draw_buttons = node_geometry_buts_attribute_mix;
break;
case GEO_NODE_ATTRIBUTE_VECTOR_MATH:
ntype->draw_buttons = node_geometry_buts_attribute_vector_math;
break;
case GEO_NODE_POINT_DISTRIBUTE:
ntype->draw_buttons = node_geometry_buts_attribute_point_distribute;
break;
case GEO_NODE_ATTRIBUTE_COLOR_RAMP:
ntype->draw_buttons = node_geometry_buts_attribute_color_ramp;
break;
case GEO_NODE_POINT_ROTATE:
ntype->draw_buttons = node_geometry_buts_point_rotate;
break;
case GEO_NODE_ALIGN_ROTATION_TO_VECTOR:
ntype->draw_buttons = node_geometry_buts_align_rotation_to_vector;
break;
case GEO_NODE_POINT_TRANSLATE:
ntype->draw_buttons = node_geometry_buts_point_translate;
break;
case GEO_NODE_POINT_SCALE:
ntype->draw_buttons = node_geometry_buts_point_scale;
break;
case GEO_NODE_OBJECT_INFO:
ntype->draw_buttons = node_geometry_buts_object_info;
break;
case GEO_NODE_ATTRIBUTE_SAMPLE_TEXTURE:
ntype->draw_buttons = node_geometry_buts_attribute_sample_texture;
break;
case GEO_NODE_POINTS_TO_VOLUME:
ntype->draw_buttons = node_geometry_buts_points_to_volume;
break;
case GEO_NODE_COLLECTION_INFO:
ntype->draw_buttons = node_geometry_buts_collection_info;
break;
case GEO_NODE_ATTRIBUTE_PROXIMITY:
ntype->draw_buttons = node_geometry_buts_attribute_proximity;
break;
case GEO_NODE_VOLUME_TO_MESH:
ntype->draw_buttons = node_geometry_buts_volume_to_mesh;
break;
}
}
/* ****************** BUTTON CALLBACKS FOR FUNCTION NODES ***************** */
static void node_function_buts_boolean_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE);
}
static void node_function_buts_float_compare(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE);
}
static void node_function_buts_switch(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "data_type", DEFAULT_FLAGS, "", ICON_NONE);
}
static void node_function_buts_input_vector(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col = uiLayoutColumn(layout, true);
uiItemR(col, ptr, "vector", UI_ITEM_R_EXPAND, "", ICON_NONE);
}
static void node_function_set_butfunc(bNodeType *ntype)
{
switch (ntype->type) {
case FN_NODE_BOOLEAN_MATH:
ntype->draw_buttons = node_function_buts_boolean_math;
break;
case FN_NODE_FLOAT_COMPARE:
ntype->draw_buttons = node_function_buts_float_compare;
break;
case FN_NODE_SWITCH:
ntype->draw_buttons = node_function_buts_switch;
break;
case FN_NODE_INPUT_VECTOR:
ntype->draw_buttons = node_function_buts_input_vector;
break;
}
}
/* ****** init draw callbacks for all tree types, only called in usiblender.c, once ************ */
static void node_property_update_default(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
@ -3612,8 +3225,6 @@ void ED_node_init_butfuncs(void)
ntype->draw_nodetype_prepare = node_update_default;
ntype->select_area_func = node_select_area_default;
ntype->tweak_area_func = node_tweak_area_default;
ntype->draw_buttons = NULL;
ntype->draw_buttons_ex = NULL;
ntype->resize_area_func = node_resize_area_default;
node_common_set_butfunc(ntype);
@ -3621,8 +3232,6 @@ void ED_node_init_butfuncs(void)
node_composit_set_butfunc(ntype);
node_shader_set_butfunc(ntype);
node_texture_set_butfunc(ntype);
node_geometry_set_butfunc(ntype);
node_function_set_butfunc(ntype);
/* define update callbacks for socket properties */
node_template_properties_update(ntype);

View File

@ -26,6 +26,7 @@ set(INC
intern
shader
texture
../editors/include
../blenkernel
../blenlib
../blentranslation

View File

@ -19,6 +19,9 @@
#include "RNA_enum_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_function_util.hh"
static bNodeSocketTemplate fn_node_boolean_math_in[] = {
@ -32,6 +35,11 @@ static bNodeSocketTemplate fn_node_boolean_math_out[] = {
{-1, ""},
};
static void fn_node_boolean_math_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
}
static void node_boolean_math_update(bNodeTree *UNUSED(ntree), bNode *node)
{
bNodeSocket *sockB = (bNodeSocket *)BLI_findlink(&node->inputs, 1);
@ -86,5 +94,6 @@ void register_node_type_fn_boolean_math()
node_type_label(&ntype, node_boolean_math_label);
node_type_update(&ntype, node_boolean_math_update);
ntype.expand_in_mf_network = node_boolean_expand_in_mf_network;
ntype.draw_buttons = fn_node_boolean_math_layout;
nodeRegisterType(&ntype);
}

View File

@ -21,6 +21,9 @@
#include "RNA_enum_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_function_util.hh"
static bNodeSocketTemplate fn_node_float_compare_in[] = {
@ -35,6 +38,11 @@ static bNodeSocketTemplate fn_node_float_compare_out[] = {
{-1, ""},
};
static void geo_node_float_compare_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
}
static void node_float_compare_update(bNodeTree *UNUSED(ntree), bNode *node)
{
bNodeSocket *sockEpsilon = (bNodeSocket *)BLI_findlink(&node->inputs, 2);
@ -105,5 +113,6 @@ void register_node_type_fn_float_compare()
node_type_label(&ntype, node_float_compare_label);
node_type_update(&ntype, node_float_compare_update);
ntype.expand_in_mf_network = node_float_compare_expand_in_mf_network;
ntype.draw_buttons = geo_node_float_compare_layout;
nodeRegisterType(&ntype);
}

View File

@ -18,11 +18,20 @@
#include "BLI_hash.h"
#include "UI_interface.h"
#include "UI_resources.h"
static bNodeSocketTemplate fn_node_input_vector_out[] = {
{SOCK_VECTOR, N_("Vector")},
{-1, ""},
};
static void fn_node_input_vector_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col = uiLayoutColumn(layout, true);
uiItemR(col, ptr, "vector", UI_ITEM_R_EXPAND, "", ICON_NONE);
}
static void fn_node_vector_input_expand_in_mf_network(
blender::nodes::NodeMFNetworkBuilder &builder)
{
@ -50,6 +59,6 @@ void register_node_type_fn_input_vector()
node_type_storage(
&ntype, "NodeInputVector", node_free_standard_storage, node_copy_standard_storage);
ntype.expand_in_mf_network = fn_node_vector_input_expand_in_mf_network;
ntype.draw_buttons = fn_node_input_vector_layout;
nodeRegisterType(&ntype);
}

View File

@ -15,8 +15,17 @@
*/
#include "BLI_listbase.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_function_util.hh"
static void fn_node_switch_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE);
}
static bNodeSocketTemplate fn_node_switch_in[] = {
{SOCK_BOOLEAN, N_("Switch")},
@ -72,5 +81,6 @@ void register_node_type_fn_switch()
fn_node_type_base(&ntype, FN_NODE_SWITCH, "Switch", 0, 0);
node_type_socket_templates(&ntype, fn_node_switch_in, fn_node_switch_out);
node_type_update(&ntype, fn_node_switch_update);
ntype.draw_buttons = fn_node_switch_layout;
nodeRegisterType(&ntype);
}

View File

@ -18,6 +18,9 @@
#include "BLI_math_rotation.h"
#include "UI_interface.h"
#include "UI_resources.h"
static bNodeSocketTemplate geo_node_align_rotation_to_vector_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_STRING, N_("Factor")},
@ -32,6 +35,17 @@ static bNodeSocketTemplate geo_node_align_rotation_to_vector_out[] = {
{-1, ""},
};
static void geo_node_align_rotation_to_vector_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(layout, ptr, "pivot_axis", 0, IFACE_("Pivot"), ICON_NONE);
uiLayout *col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "input_type_factor", 0, IFACE_("Factor"), ICON_NONE);
uiItemR(col, ptr, "input_type_vector", 0, IFACE_("Vector"), ICON_NONE);
}
namespace blender::nodes {
static void align_rotations_auto_pivot(const Float3ReadAttribute &vectors,
@ -202,5 +216,6 @@ void register_node_type_geo_align_rotation_to_vector()
node_free_standard_storage,
node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_align_rotation_to_vector_exec;
ntype.draw_buttons = geo_node_align_rotation_to_vector_layout;
nodeRegisterType(&ntype);
}

View File

@ -18,6 +18,9 @@
#include "BKE_colorband.h"
#include "UI_interface.h"
#include "UI_resources.h"
static bNodeSocketTemplate geo_node_attribute_color_ramp_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_STRING, N_("Attribute")},
@ -30,6 +33,13 @@ static bNodeSocketTemplate geo_node_attribute_color_ramp_out[] = {
{-1, ""},
};
static void geo_node_attribute_color_ramp_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiTemplateColorRamp(layout, ptr, "color_ramp", 0);
}
namespace blender::nodes {
static void execute_on_component(const GeoNodeExecParams &params, GeometryComponent &component)
@ -104,5 +114,6 @@ void register_node_type_geo_attribute_color_ramp()
node_type_init(&ntype, blender::nodes::geo_node_attribute_color_ramp_init);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_color_ramp_exec;
ntype.draw_buttons = geo_node_attribute_color_ramp_layout;
nodeRegisterType(&ntype);
}

View File

@ -26,6 +26,9 @@
#include "DNA_mesh_types.h"
#include "DNA_pointcloud_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "NOD_math_functions.hh"
static bNodeSocketTemplate geo_node_attribute_compare_in[] = {
@ -48,6 +51,15 @@ static bNodeSocketTemplate geo_node_attribute_compare_out[] = {
{-1, ""},
};
static void geo_node_attribute_compare_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
uiItemR(layout, ptr, "input_type_a", 0, IFACE_("Type A"), ICON_NONE);
uiItemR(layout, ptr, "input_type_b", 0, IFACE_("Type B"), ICON_NONE);
}
static void geo_node_attribute_compare_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeCompare *data = (NodeAttributeCompare *)MEM_callocN(sizeof(NodeAttributeCompare),
@ -327,6 +339,7 @@ void register_node_type_geo_attribute_compare()
node_type_socket_templates(
&ntype, geo_node_attribute_compare_in, geo_node_attribute_compare_out);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_compare_exec;
ntype.draw_buttons = geo_node_attribute_compare_layout;
node_type_update(&ntype, blender::nodes::geo_node_attribute_compare_update);
node_type_storage(
&ntype, "NodeAttributeCompare", node_free_standard_storage, node_copy_standard_storage);

View File

@ -21,6 +21,9 @@
#include "DNA_mesh_types.h"
#include "DNA_pointcloud_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
static bNodeSocketTemplate geo_node_attribute_fill_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_STRING, N_("Attribute")},
@ -36,6 +39,12 @@ static bNodeSocketTemplate geo_node_attribute_fill_out[] = {
{-1, ""},
};
static void geo_node_attribute_fill_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE);
// uiItemR(layout, ptr, "domain", 0, "", ICON_NONE);
}
static void geo_node_attribute_fill_init(bNodeTree *UNUSED(tree), bNode *node)
{
node->custom1 = CD_PROP_FLOAT;
@ -131,5 +140,6 @@ void register_node_type_geo_attribute_fill()
node_type_init(&ntype, geo_node_attribute_fill_init);
node_type_update(&ntype, geo_node_attribute_fill_update);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_fill_exec;
ntype.draw_buttons = geo_node_attribute_fill_layout;
nodeRegisterType(&ntype);
}

View File

@ -26,6 +26,9 @@
#include "DNA_mesh_types.h"
#include "DNA_pointcloud_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "NOD_math_functions.hh"
static bNodeSocketTemplate geo_node_attribute_math_in[] = {
@ -45,18 +48,6 @@ static bNodeSocketTemplate geo_node_attribute_math_out[] = {
{-1, ""},
};
static void geo_node_attribute_math_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeMath *data = (NodeAttributeMath *)MEM_callocN(sizeof(NodeAttributeMath),
"NodeAttributeMath");
data->operation = NODE_MATH_ADD;
data->input_type_a = GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE;
data->input_type_b = GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE;
data->input_type_c = GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE;
node->storage = data;
}
static bool operation_use_input_c(const NodeMathOperation operation)
{
return ELEM(operation,
@ -117,6 +108,34 @@ static bool operation_use_input_b(const NodeMathOperation operation)
return false;
}
static void geo_node_attribute_math_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
bNode *node = (bNode *)ptr->data;
NodeAttributeMath *node_storage = (NodeAttributeMath *)node->storage;
NodeMathOperation operation = (NodeMathOperation)node_storage->operation;
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
uiItemR(layout, ptr, "input_type_a", 0, IFACE_("Type A"), ICON_NONE);
if (operation_use_input_b(operation)) {
uiItemR(layout, ptr, "input_type_b", 0, IFACE_("Type B"), ICON_NONE);
}
if (operation_use_input_c(operation)) {
uiItemR(layout, ptr, "input_type_c", 0, IFACE_("Type C"), ICON_NONE);
}
}
static void geo_node_attribute_math_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeMath *data = (NodeAttributeMath *)MEM_callocN(sizeof(NodeAttributeMath), __func__);
data->operation = NODE_MATH_ADD;
data->input_type_a = GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE;
data->input_type_b = GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE;
data->input_type_c = GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE;
node->storage = data;
}
namespace blender::nodes {
static void geo_node_attribute_math_update(bNodeTree *UNUSED(ntree), bNode *node)
@ -267,6 +286,7 @@ void register_node_type_geo_attribute_math()
geo_node_type_base(&ntype, GEO_NODE_ATTRIBUTE_MATH, "Attribute Math", NODE_CLASS_ATTRIBUTE, 0);
node_type_socket_templates(&ntype, geo_node_attribute_math_in, geo_node_attribute_math_out);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_math_exec;
ntype.draw_buttons = geo_node_attribute_math_layout;
node_type_update(&ntype, blender::nodes::geo_node_attribute_math_update);
node_type_init(&ntype, geo_node_attribute_math_init);
node_type_storage(

View File

@ -18,6 +18,9 @@
#include "DNA_material_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_attribute_mix_in[] = {
@ -41,6 +44,15 @@ static bNodeSocketTemplate geo_node_mix_attribute_out[] = {
{-1, ""},
};
static void geo_node_attribute_mix_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "blend_type", 0, "", ICON_NONE);
uiLayout *col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "input_type_factor", 0, IFACE_("Factor"), ICON_NONE);
uiItemR(col, ptr, "input_type_a", 0, IFACE_("A"), ICON_NONE);
uiItemR(col, ptr, "input_type_b", 0, IFACE_("B"), ICON_NONE);
}
namespace blender::nodes {
static void do_mix_operation_float(const int blend_mode,
@ -204,6 +216,7 @@ void register_node_type_geo_attribute_mix()
node_type_socket_templates(&ntype, geo_node_attribute_mix_in, geo_node_mix_attribute_out);
node_type_init(&ntype, blender::nodes::geo_node_attribute_mix_init);
node_type_update(&ntype, blender::nodes::geo_node_attribute_mix_update);
ntype.draw_buttons = geo_node_attribute_mix_layout;
node_type_storage(
&ntype, "NodeAttributeMix", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_mix_exec;

View File

@ -14,17 +14,20 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "BLI_kdopbvh.h"
#include "BLI_kdtree.h"
#include "BLI_task.hh"
#include "BLI_timeit.hh"
#include "DNA_mesh_types.h"
#include "BKE_bvhutils.h"
#include "BLI_kdopbvh.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_geometry_util.hh"
#include "BLI_timeit.hh"
#include "DNA_mesh_types.h"
static bNodeSocketTemplate geo_node_attribute_proximity_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_GEOMETRY, N_("Target")},
@ -37,6 +40,13 @@ static bNodeSocketTemplate geo_node_attribute_proximity_out[] = {
{-1, ""},
};
static void geo_node_attribute_proximity_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "target_geometry_element", 0, "", ICON_NONE);
}
static void geo_attribute_proximity_init(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeGeometryAttributeProximity *node_storage = (NodeGeometryAttributeProximity *)MEM_callocN(
@ -220,5 +230,6 @@ void register_node_type_geo_attribute_proximity()
node_free_standard_storage,
node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_proximity_exec;
ntype.draw_buttons = geo_node_attribute_proximity_layout;
nodeRegisterType(&ntype);
}

View File

@ -19,6 +19,9 @@
#include "BLI_hash.h"
#include "BLI_rand.hh"
#include "UI_interface.h"
#include "UI_resources.h"
#include "DNA_mesh_types.h"
#include "DNA_pointcloud_types.h"
@ -38,6 +41,13 @@ static bNodeSocketTemplate geo_node_attribute_randomize_out[] = {
{-1, ""},
};
static void geo_node_attribute_random_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "data_type", 0, "", ICON_NONE);
}
static void geo_node_attribute_randomize_init(bNodeTree *UNUSED(tree), bNode *node)
{
node->custom1 = CD_PROP_FLOAT;
@ -215,5 +225,6 @@ void register_node_type_geo_attribute_randomize()
node_type_init(&ntype, geo_node_attribute_randomize_init);
node_type_update(&ntype, geo_node_attribute_randomize_update);
ntype.geometry_node_execute = blender::nodes::geo_node_random_attribute_exec;
ntype.draw_buttons = geo_node_attribute_random_layout;
nodeRegisterType(&ntype);
}

View File

@ -22,6 +22,9 @@
#include "RE_texture.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_attribute_sample_texture_in[] = {
@ -36,6 +39,13 @@ static bNodeSocketTemplate geo_node_attribute_sample_texture_out[] = {
{-1, ""},
};
static void geo_node_attribute_sample_texture_layout(uiLayout *layout,
bContext *C,
PointerRNA *ptr)
{
uiTemplateID(layout, C, ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL);
}
namespace blender::nodes {
static void execute_on_component(GeometryComponent &component, const GeoNodeExecParams &params)
@ -103,5 +113,6 @@ void register_node_type_geo_sample_texture()
node_type_socket_templates(
&ntype, geo_node_attribute_sample_texture_in, geo_node_attribute_sample_texture_out);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_sample_texture_exec;
ntype.draw_buttons = geo_node_attribute_sample_texture_layout;
nodeRegisterType(&ntype);
}

View File

@ -26,6 +26,9 @@
#include "DNA_mesh_types.h"
#include "DNA_pointcloud_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "NOD_math_functions.hh"
static bNodeSocketTemplate geo_node_attribute_vector_math_in[] = {
@ -46,25 +49,6 @@ static bNodeSocketTemplate geo_node_attribute_vector_math_out[] = {
{-1, ""},
};
static void geo_node_attribute_vector_math_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeVectorMath *data = (NodeAttributeVectorMath *)MEM_callocN(
sizeof(NodeAttributeVectorMath), __func__);
data->operation = NODE_VECTOR_MATH_ADD;
data->input_type_a = GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE;
data->input_type_b = GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE;
node->storage = data;
}
static CustomDataType operation_get_read_type_b(const NodeVectorMathOperation operation)
{
if (operation == NODE_VECTOR_MATH_SCALE) {
return CD_PROP_FLOAT;
}
return CD_PROP_FLOAT3;
}
static bool operation_use_input_b(const NodeVectorMathOperation operation)
{
return !ELEM(operation,
@ -84,6 +68,44 @@ static bool operation_use_input_c(const NodeVectorMathOperation operation)
return operation == NODE_VECTOR_MATH_WRAP;
}
static void geo_node_attribute_vector_math_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
bNode *node = (bNode *)ptr->data;
const NodeAttributeVectorMath &node_storage = *(NodeAttributeVectorMath *)node->storage;
const NodeVectorMathOperation operation = (const NodeVectorMathOperation)node_storage.operation;
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
uiItemR(layout, ptr, "input_type_a", 0, IFACE_("Type A"), ICON_NONE);
if (operation_use_input_b(operation)) {
uiItemR(layout, ptr, "input_type_b", 0, IFACE_("Type B"), ICON_NONE);
}
if (operation_use_input_c(operation)) {
uiItemR(layout, ptr, "input_type_c", 0, IFACE_("Type C"), ICON_NONE);
}
}
static CustomDataType operation_get_read_type_b(const NodeVectorMathOperation operation)
{
if (operation == NODE_VECTOR_MATH_SCALE) {
return CD_PROP_FLOAT;
}
return CD_PROP_FLOAT3;
}
static void geo_node_attribute_vector_math_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeAttributeVectorMath *data = (NodeAttributeVectorMath *)MEM_callocN(
sizeof(NodeAttributeVectorMath), __func__);
data->operation = NODE_VECTOR_MATH_ADD;
data->input_type_a = GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE;
data->input_type_b = GEO_NODE_ATTRIBUTE_INPUT_ATTRIBUTE;
node->storage = data;
}
static CustomDataType operation_get_result_type(const NodeVectorMathOperation operation)
{
switch (operation) {
@ -419,6 +441,7 @@ void register_node_type_geo_attribute_vector_math()
node_type_socket_templates(
&ntype, geo_node_attribute_vector_math_in, geo_node_attribute_vector_math_out);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_vector_math_exec;
ntype.draw_buttons = geo_node_attribute_vector_math_layout;
node_type_update(&ntype, blender::nodes::geo_node_attribute_vector_math_update);
node_type_init(&ntype, geo_node_attribute_vector_math_init);
node_type_storage(

View File

@ -24,6 +24,9 @@
#include "RNA_enum_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "BKE_mesh.h"
#include "bmesh.h"
@ -42,6 +45,11 @@ static bNodeSocketTemplate geo_node_boolean_out[] = {
{-1, ""},
};
static void geo_node_boolean_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "operation", 0, "", ICON_NONE);
}
static int bm_face_isect_pair(BMFace *f, void *UNUSED(user_data))
{
return BM_elem_flag_test(f, BM_ELEM_DRAW) ? 1 : 0;
@ -147,6 +155,7 @@ void register_node_type_geo_boolean()
geo_node_type_base(&ntype, GEO_NODE_BOOLEAN, "Boolean", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype, geo_node_boolean_in, geo_node_boolean_out);
ntype.draw_buttons = geo_node_boolean_layout;
ntype.geometry_node_execute = blender::nodes::geo_node_boolean_exec;
nodeRegisterType(&ntype);
}

View File

@ -20,6 +20,9 @@
#include "DNA_collection_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
static bNodeSocketTemplate geo_node_collection_info_in[] = {
{SOCK_COLLECTION, N_("Collection")},
{-1, ""},
@ -30,6 +33,11 @@ static bNodeSocketTemplate geo_node_collection_info_out[] = {
{-1, ""},
};
static void geo_node_collection_info_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "transform_space", 0, NULL, ICON_NONE);
}
namespace blender::nodes {
static void geo_node_collection_info_exec(GeoNodeExecParams params)
@ -95,5 +103,6 @@ void register_node_type_geo_collection_info()
node_free_standard_storage,
node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_collection_info_exec;
ntype.draw_buttons = geo_node_collection_info_layout;
nodeRegisterType(&ntype);
}

View File

@ -23,6 +23,9 @@
#include "BLI_math_matrix.h"
#include "UI_interface.h"
#include "UI_resources.h"
static bNodeSocketTemplate geo_node_object_info_in[] = {
{SOCK_OBJECT, N_("Object")},
{-1, ""},
@ -36,6 +39,11 @@ static bNodeSocketTemplate geo_node_object_info_out[] = {
{-1, ""},
};
static void geo_node_object_info_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "transform_space", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
namespace blender::nodes {
static void geo_node_object_info_exec(GeoNodeExecParams params)
{
@ -128,5 +136,6 @@ void register_node_type_geo_object_info()
node_type_storage(
&ntype, "NodeGeometryObjectInfo", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_object_info_exec;
ntype.draw_buttons = geo_node_object_info_layout;
nodeRegisterType(&ntype);
}

View File

@ -33,6 +33,9 @@
#include "BKE_mesh_runtime.h"
#include "BKE_pointcloud.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_point_distribute_in[] = {
@ -49,6 +52,13 @@ static bNodeSocketTemplate geo_node_point_distribute_out[] = {
{-1, ""},
};
static void geo_node_point_distribute_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "distribute_method", 0, "", ICON_NONE);
}
static void node_point_distribute_update(bNodeTree *UNUSED(ntree), bNode *node)
{
bNodeSocket *sock_min_dist = (bNodeSocket *)BLI_findlink(&node->inputs, 1);
@ -485,5 +495,6 @@ void register_node_type_geo_point_distribute()
node_type_socket_templates(&ntype, geo_node_point_distribute_in, geo_node_point_distribute_out);
node_type_update(&ntype, node_point_distribute_update);
ntype.geometry_node_execute = blender::nodes::geo_node_point_distribute_exec;
ntype.draw_buttons = geo_node_point_distribute_layout;
nodeRegisterType(&ntype);
}

View File

@ -24,6 +24,9 @@
#include "BLI_hash.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_point_instance_in[] = {
@ -39,6 +42,14 @@ static bNodeSocketTemplate geo_node_point_instance_out[] = {
{-1, ""},
};
static void geo_node_point_instance_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "instance_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "instance_type") == GEO_NODE_POINT_INSTANCE_TYPE_COLLECTION) {
uiItemR(layout, ptr, "use_whole_collection", 0, NULL, ICON_NONE);
}
}
namespace blender::nodes {
static void geo_node_point_instance_update(bNodeTree *UNUSED(tree), bNode *node)
@ -216,6 +227,7 @@ void register_node_type_geo_point_instance()
node_type_init(&ntype, blender::nodes::geo_node_point_instance_init);
node_type_storage(
&ntype, "NodeGeometryPointInstance", node_free_standard_storage, node_copy_standard_storage);
ntype.draw_buttons = geo_node_point_instance_layout;
node_type_update(&ntype, blender::nodes::geo_node_point_instance_update);
ntype.geometry_node_execute = blender::nodes::geo_node_point_instance_exec;
nodeRegisterType(&ntype);

View File

@ -18,6 +18,9 @@
#include "BLI_math_rotation.h"
#include "UI_interface.h"
#include "UI_resources.h"
static bNodeSocketTemplate geo_node_point_rotate_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_STRING, N_("Axis")},
@ -34,6 +37,23 @@ static bNodeSocketTemplate geo_node_point_rotate_out[] = {
{-1, ""},
};
static void geo_node_point_rotate_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
NodeGeometryRotatePoints *storage = (NodeGeometryRotatePoints *)((bNode *)ptr->data)->storage;
uiItemR(layout, ptr, "type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(layout, ptr, "space", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiLayout *col = uiLayoutColumn(layout, false);
if (storage->type == GEO_NODE_POINT_ROTATE_TYPE_AXIS_ANGLE) {
uiItemR(col, ptr, "input_type_axis", 0, IFACE_("Axis"), ICON_NONE);
uiItemR(col, ptr, "input_type_angle", 0, IFACE_("Angle"), ICON_NONE);
}
else {
uiItemR(col, ptr, "input_type_rotation", 0, IFACE_("Rotation"), ICON_NONE);
}
}
namespace blender::nodes {
static void point_rotate__axis_angle__object_space(const int domain_size,
@ -202,5 +222,6 @@ void register_node_type_geo_point_rotate()
node_type_storage(
&ntype, "NodeGeometryRotatePoints", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_point_rotate_exec;
ntype.draw_buttons = geo_node_point_rotate_layout;
nodeRegisterType(&ntype);
}

View File

@ -18,6 +18,9 @@
#include "BKE_colorband.h"
#include "UI_interface.h"
#include "UI_resources.h"
static bNodeSocketTemplate geo_node_point_scale_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_STRING, N_("Factor")},
@ -30,6 +33,11 @@ static bNodeSocketTemplate geo_node_point_scale_out[] = {
{-1, ""},
};
static void geo_node_point_scale_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "input_type", 0, IFACE_("Type"), ICON_NONE);
}
namespace blender::nodes {
static void execute_on_component(GeoNodeExecParams params, GeometryComponent &component)
@ -96,5 +104,6 @@ void register_node_type_geo_point_scale()
node_type_storage(
&ntype, "NodeGeometryPointScale", node_free_standard_storage, node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_point_scale_exec;
ntype.draw_buttons = geo_node_point_scale_layout;
nodeRegisterType(&ntype);
}

View File

@ -18,6 +18,9 @@
#include "BKE_colorband.h"
#include "UI_interface.h"
#include "UI_resources.h"
static bNodeSocketTemplate geo_node_point_translate_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_STRING, N_("Translation")},
@ -30,6 +33,11 @@ static bNodeSocketTemplate geo_node_point_translate_out[] = {
{-1, ""},
};
static void geo_node_point_translate_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "input_type", 0, IFACE_("Type"), ICON_NONE);
}
namespace blender::nodes {
static void execute_on_component(GeoNodeExecParams params, GeometryComponent &component)
@ -97,5 +105,6 @@ void register_node_type_geo_point_translate()
node_free_standard_storage,
node_copy_standard_storage);
ntype.geometry_node_execute = blender::nodes::geo_node_point_translate_exec;
ntype.draw_buttons = geo_node_point_translate_layout;
nodeRegisterType(&ntype);
}

View File

@ -25,6 +25,9 @@
#include "BKE_lib_id.h"
#include "BKE_volume.h"
#include "UI_interface.h"
#include "UI_resources.h"
static bNodeSocketTemplate geo_node_points_to_volume_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_FLOAT, N_("Density"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, FLT_MAX},
@ -40,6 +43,16 @@ static bNodeSocketTemplate geo_node_point_translate_out[] = {
{-1, ""},
};
static void geo_node_points_to_volume_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, ptr, "resolution_mode", 0, IFACE_("Resolution"), ICON_NONE);
uiItemR(layout, ptr, "input_type_radius", 0, IFACE_("Radius"), ICON_NONE);
}
namespace blender::nodes {
#ifdef WITH_OPENVDB
@ -255,5 +268,6 @@ void register_node_type_geo_points_to_volume()
node_type_init(&ntype, blender::nodes::geo_node_points_to_volume_init);
node_type_update(&ntype, blender::nodes::geo_node_points_to_volume_update);
ntype.geometry_node_execute = blender::nodes::geo_node_points_to_volume_exec;
ntype.draw_buttons = geo_node_points_to_volume_layout;
nodeRegisterType(&ntype);
}

View File

@ -20,6 +20,9 @@
#include "BKE_subdiv.h"
#include "BKE_subdiv_mesh.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_subdivision_surface_in[] = {
@ -36,6 +39,17 @@ static bNodeSocketTemplate geo_node_subdivision_surface_out[] = {
{-1, ""},
};
static void geo_node_subdivision_surface_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *UNUSED(ptr))
{
#ifndef WITH_OPENSUBDIV
uiItemL(layout, IFACE_("Disabled, built without OpenSubdiv"), ICON_ERROR);
#else
UNUSED_VARS(layout);
#endif
}
namespace blender::nodes {
static void geo_node_subdivision_surface_exec(GeoNodeExecParams params)
{
@ -112,5 +126,6 @@ void register_node_type_geo_subdivision_surface()
node_type_socket_templates(
&ntype, geo_node_subdivision_surface_in, geo_node_subdivision_surface_out);
ntype.geometry_node_execute = blender::nodes::geo_node_subdivision_surface_exec;
ntype.draw_buttons = geo_node_subdivision_surface_layout;
nodeRegisterType(&ntype);
}

View File

@ -18,6 +18,9 @@
#include "RNA_enum_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_geometry_util.hh"
extern "C" {
@ -39,6 +42,12 @@ static bNodeSocketTemplate geo_node_triangulate_out[] = {
{-1, ""},
};
static void geo_node_triangulate_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "quad_method", 0, "", ICON_NONE);
uiItemR(layout, ptr, "ngon_method", 0, "", ICON_NONE);
}
static void geo_triangulate_init(bNodeTree *UNUSED(ntree), bNode *node)
{
node->custom1 = GEO_NODE_TRIANGULATE_QUAD_SHORTEDGE;
@ -75,5 +84,6 @@ void register_node_type_geo_triangulate()
node_type_socket_templates(&ntype, geo_node_triangulate_in, geo_node_triangulate_out);
node_type_init(&ntype, geo_triangulate_init);
ntype.geometry_node_execute = blender::nodes::geo_node_triangulate_exec;
ntype.draw_buttons = geo_node_triangulate_layout;
nodeRegisterType(&ntype);
}

View File

@ -31,6 +31,9 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
static bNodeSocketTemplate geo_node_volume_to_mesh_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_STRING, N_("Grid")},
@ -46,6 +49,13 @@ static bNodeSocketTemplate geo_node_volume_to_mesh_out[] = {
{-1, ""},
};
static void geo_node_volume_to_mesh_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
uiItemR(layout, ptr, "resolution_mode", 0, IFACE_("Resolution"), ICON_NONE);
}
namespace blender::nodes {
static void geo_node_volume_to_mesh_init(bNodeTree *UNUSED(ntree), bNode *node)
@ -156,5 +166,6 @@ void register_node_type_geo_volume_to_mesh()
node_type_init(&ntype, blender::nodes::geo_node_volume_to_mesh_init);
node_type_update(&ntype, blender::nodes::geo_node_volume_to_mesh_update);
ntype.geometry_node_execute = blender::nodes::geo_node_volume_to_mesh_exec;
ntype.draw_buttons = geo_node_volume_to_mesh_layout;
nodeRegisterType(&ntype);
}