Cleanup: move some node rna definitions to node files
This is a continuation of f7c0ef1f73.
Pull Request: https://projects.blender.org/blender/blender/pulls/110987
This commit is contained in:
@@ -10036,33 +10036,6 @@ static void def_geo_points_to_sdf_volume(StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
|
||||
}
|
||||
|
||||
static void def_geo_uv_unwrap(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static EnumPropertyItem rna_node_geometry_uv_unwrap_method_items[] = {
|
||||
{GEO_NODE_UV_UNWRAP_METHOD_ANGLE_BASED,
|
||||
"ANGLE_BASED",
|
||||
0,
|
||||
"Angle Based",
|
||||
"This method gives a good 2D representation of a mesh"},
|
||||
{GEO_NODE_UV_UNWRAP_METHOD_CONFORMAL,
|
||||
"CONFORMAL",
|
||||
0,
|
||||
"Conformal",
|
||||
"Uses LSCM (Least Squares Conformal Mapping). This usually gives a less accurate UV "
|
||||
"mapping than Angle Based, but works better for simpler objects"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeGeometryUVUnwrap", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "method", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, rna_node_geometry_uv_unwrap_method_items);
|
||||
RNA_def_property_ui_text(prop, "Method", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_geo_collection_info(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
@@ -10126,37 +10099,6 @@ static void def_geo_proximity(StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
|
||||
}
|
||||
|
||||
static void def_geo_volume_to_mesh(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static EnumPropertyItem resolution_mode_items[] = {
|
||||
{VOLUME_TO_MESH_RESOLUTION_MODE_GRID,
|
||||
"GRID",
|
||||
0,
|
||||
"Grid",
|
||||
"Use resolution of the volume grid"},
|
||||
{VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT,
|
||||
"VOXEL_AMOUNT",
|
||||
0,
|
||||
"Amount",
|
||||
"Desired number of voxels along one axis"},
|
||||
{VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE,
|
||||
"VOXEL_SIZE",
|
||||
0,
|
||||
"Size",
|
||||
"Desired voxel side length"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeGeometryVolumeToMesh", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "resolution_mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, resolution_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Resolution Mode", "How the voxel size is specified");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
|
||||
}
|
||||
|
||||
static void def_geo_mesh_to_volume(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
@@ -10462,32 +10404,6 @@ static void def_geo_mesh_to_points(StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||
}
|
||||
|
||||
static void def_geo_curve_trim(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static EnumPropertyItem mode_items[] = {
|
||||
{GEO_NODE_CURVE_SAMPLE_FACTOR,
|
||||
"FACTOR",
|
||||
0,
|
||||
"Factor",
|
||||
"Find the endpoint positions using a factor of each spline's length"},
|
||||
{GEO_NODE_CURVE_RESAMPLE_LENGTH,
|
||||
"LENGTH",
|
||||
0,
|
||||
"Length",
|
||||
"Find the endpoint positions using a length from the start of each spline"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeGeometryCurveTrim", "storage");
|
||||
|
||||
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, mode_items);
|
||||
RNA_def_property_ui_text(prop, "Mode", "How to find endpoint positions for the trimmed spline");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
|
||||
}
|
||||
|
||||
static void def_geo_sample_index(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
@@ -10990,53 +10906,6 @@ static void def_geo_evaluate_on_domain(StructRNA *srna)
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
|
||||
}
|
||||
|
||||
static void def_geo_scale_elements(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem domain_items[] = {
|
||||
{ATTR_DOMAIN_FACE,
|
||||
"FACE",
|
||||
ICON_NONE,
|
||||
"Face",
|
||||
"Scale individual faces or neighboring face islands"},
|
||||
{ATTR_DOMAIN_EDGE,
|
||||
"EDGE",
|
||||
ICON_NONE,
|
||||
"Edge",
|
||||
"Scale individual edges or neighboring edge islands"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem scale_mode_items[] = {
|
||||
{GEO_NODE_SCALE_ELEMENTS_UNIFORM,
|
||||
"UNIFORM",
|
||||
ICON_NONE,
|
||||
"Uniform",
|
||||
"Scale elements by the same factor in every direction"},
|
||||
{GEO_NODE_SCALE_ELEMENTS_SINGLE_AXIS,
|
||||
"SINGLE_AXIS",
|
||||
ICON_NONE,
|
||||
"Single Axis",
|
||||
"Scale elements in a single direction"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
|
||||
};
|
||||
|
||||
prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "custom1");
|
||||
RNA_def_property_enum_items(prop, domain_items);
|
||||
RNA_def_property_enum_default(prop, ATTR_DOMAIN_FACE);
|
||||
RNA_def_property_ui_text(prop, "Domain", "Element type to transform");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
|
||||
|
||||
prop = RNA_def_property(srna, "scale_mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "custom2");
|
||||
RNA_def_property_enum_items(prop, scale_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Scale Mode", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_GeometryNode_socket_update");
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
static void rna_def_shader_node(BlenderRNA *brna)
|
||||
|
||||
@@ -6,30 +6,27 @@
|
||||
|
||||
#include "RNA_define.h"
|
||||
|
||||
/**
|
||||
* Generates accessor methods for a property stored in `bNode->storage`. This is expected to be
|
||||
* used in a node file that uses #NODE_STORAGE_FUNCS.
|
||||
*/
|
||||
#define RNA_def_property_enum_node_storage(prop, member) \
|
||||
RNA_def_property_enum_funcs_runtime( \
|
||||
prop, \
|
||||
[](PointerRNA *ptr, PropertyRNA * /*prop*/) -> int { \
|
||||
const bNode &node = *static_cast<const bNode *>(ptr->data); \
|
||||
return node_storage(node).member; \
|
||||
}, \
|
||||
[](PointerRNA *ptr, PropertyRNA * /*prop*/, const int value) { \
|
||||
bNode &node = *static_cast<bNode *>(ptr->data); \
|
||||
node_storage(node).member = value; \
|
||||
}, \
|
||||
nullptr)
|
||||
void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr);
|
||||
void rna_Node_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr);
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
struct EnumRNAAccessors {
|
||||
EnumPropertyGetFunc getter;
|
||||
EnumPropertySetFunc setter;
|
||||
|
||||
EnumRNAAccessors(EnumPropertyGetFunc getter, EnumPropertySetFunc setter)
|
||||
: getter(getter), setter(setter)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates accessor methods for a property stored directly in the `bNode`, typically
|
||||
* `bNode->custom1` or similar.
|
||||
*/
|
||||
#define RNA_def_property_enum_node(prop, member) \
|
||||
RNA_def_property_enum_funcs_runtime( \
|
||||
prop, \
|
||||
#define NOD_inline_enum_accessors(member) \
|
||||
EnumRNAAccessors( \
|
||||
[](PointerRNA *ptr, PropertyRNA * /*prop*/) -> int { \
|
||||
const bNode &node = *static_cast<const bNode *>(ptr->data); \
|
||||
return node.member; \
|
||||
@@ -37,8 +34,42 @@
|
||||
[](PointerRNA *ptr, PropertyRNA * /*prop*/, const int value) { \
|
||||
bNode &node = *static_cast<bNode *>(ptr->data); \
|
||||
node.member = value; \
|
||||
}, \
|
||||
nullptr)
|
||||
})
|
||||
|
||||
void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr);
|
||||
void rna_Node_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr);
|
||||
/**
|
||||
* Generates accessor methods for a property stored in `bNode->storage`. This is expected to be
|
||||
* used in a node file that uses #NODE_STORAGE_FUNCS.
|
||||
*/
|
||||
#define NOD_storage_enum_accessors(member) \
|
||||
EnumRNAAccessors( \
|
||||
[](PointerRNA *ptr, PropertyRNA * /*prop*/) -> int { \
|
||||
const bNode &node = *static_cast<const bNode *>(ptr->data); \
|
||||
return node_storage(node).member; \
|
||||
}, \
|
||||
[](PointerRNA *ptr, PropertyRNA * /*prop*/, const int value) { \
|
||||
bNode &node = *static_cast<bNode *>(ptr->data); \
|
||||
node_storage(node).member = value; \
|
||||
})
|
||||
|
||||
inline PropertyRNA *RNA_def_node_enum(StructRNA *srna,
|
||||
const char *identifier,
|
||||
const char *ui_name,
|
||||
const char *ui_description,
|
||||
const EnumPropertyItem *static_items,
|
||||
const EnumRNAAccessors accessors,
|
||||
std::optional<int> default_value = std::nullopt,
|
||||
const EnumPropertyItemFunc item_func = nullptr)
|
||||
{
|
||||
PropertyRNA *prop = RNA_def_property(srna, identifier, PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_funcs_runtime(prop, accessors.getter, accessors.setter, item_func);
|
||||
RNA_def_property_enum_items(prop, static_items);
|
||||
if (default_value.has_value()) {
|
||||
RNA_def_property_enum_default(prop, *default_value);
|
||||
}
|
||||
RNA_def_property_ui_text(prop, ui_name, ui_description);
|
||||
RNA_def_property_update_runtime(prop, rna_Node_socket_update);
|
||||
RNA_def_property_update_notifier(prop, NC_NODE | NA_EDITED);
|
||||
return prop;
|
||||
}
|
||||
|
||||
} // namespace blender::nodes
|
||||
|
||||
@@ -413,7 +413,7 @@ DefNode(GeometryNode, GEO_NODE_SAMPLE_NEAREST_SURFACE, def_geo_sample_nearest_su
|
||||
DefNode(GeometryNode, GEO_NODE_SAMPLE_NEAREST, def_geo_sample_nearest, "SAMPLE_NEAREST", SampleNearest, "Sample Nearest", "Find the element of a geometry closest to a position. Similar to the \"Index of Nearest\" node")
|
||||
DefNode(GeometryNode, GEO_NODE_SAMPLE_UV_SURFACE, def_geo_sample_uv_surface, "SAMPLE_UV_SURFACE", SampleUVSurface, "Sample UV Surface", "Calculate the interpolated values of a mesh attribute at a UV coordinate")
|
||||
DefNode(GeometryNode, GEO_NODE_SAMPLE_VOLUME, def_geo_sample_volume, "SAMPLE_VOLUME", SampleVolume, "Sample Volume", "Calculate the interpolated values of a Volume grid at the specified position")
|
||||
DefNode(GeometryNode, GEO_NODE_SCALE_ELEMENTS, def_geo_scale_elements, "SCALE_ELEMENTS", ScaleElements, "Scale Elements", "Scale groups of connected edges and faces")
|
||||
DefNode(GeometryNode, GEO_NODE_SCALE_ELEMENTS, 0, "SCALE_ELEMENTS", ScaleElements, "Scale Elements", "Scale groups of connected edges and faces")
|
||||
DefNode(GeometryNode, GEO_NODE_SCALE_INSTANCES, 0, "SCALE_INSTANCES", ScaleInstances, "Scale Instances", "Scale geometry instances in local or global space")
|
||||
DefNode(GeometryNode, GEO_NODE_SDF_VOLUME_SPHERE, 0, "SDF_VOLUME_SPHERE", SDFVolumeSphere, "SDF Volume Sphere", "Generate an SDF Volume Sphere")
|
||||
DefNode(GeometryNode, GEO_NODE_SELF_OBJECT, 0, "SELF_OBJECT", SelfObject, "Self Object", "Retrieve the object that contains the geometry nodes modifier currently being executed")
|
||||
@@ -444,12 +444,12 @@ DefNode(GeometryNode, GEO_NODE_SWITCH, def_geo_switch, "SWITCH", Switch, "Switch
|
||||
DefNode(GeometryNode, GEO_NODE_TRANSFORM_GEOMETRY, 0, "TRANSFORM_GEOMETRY", Transform, "Transform Geometry", "Translate, rotate or scale the geometry")
|
||||
DefNode(GeometryNode, GEO_NODE_TRANSLATE_INSTANCES, 0, "TRANSLATE_INSTANCES",TranslateInstances, "Translate Instances", "Move top-level geometry instances in local or global space")
|
||||
DefNode(GeometryNode, GEO_NODE_TRIANGULATE, def_geo_triangulate, "TRIANGULATE", Triangulate, "Triangulate", "Convert all faces in a mesh to triangular faces")
|
||||
DefNode(GeometryNode, GEO_NODE_TRIM_CURVE, def_geo_curve_trim, "TRIM_CURVE", TrimCurve, "Trim Curve", "Shorten curves by removing portions at the start or end")
|
||||
DefNode(GeometryNode, GEO_NODE_TRIM_CURVE, 0, "TRIM_CURVE", TrimCurve, "Trim Curve", "Shorten curves by removing portions at the start or end")
|
||||
DefNode(GeometryNode, GEO_NODE_UV_PACK_ISLANDS, 0, "UV_PACK_ISLANDS", UVPackIslands, "Pack UV Islands", "Scale islands of a UV map and move them so they fill the UV space as much as possible")
|
||||
DefNode(GeometryNode, GEO_NODE_UV_UNWRAP, def_geo_uv_unwrap, "UV_UNWRAP", UVUnwrap, "UV Unwrap", "Generate a UV map based on seam edges")
|
||||
DefNode(GeometryNode, GEO_NODE_UV_UNWRAP, 0, "UV_UNWRAP", UVUnwrap, "UV Unwrap", "Generate a UV map based on seam edges")
|
||||
DefNode(GeometryNode, GEO_NODE_VIEWER, def_geo_viewer, "VIEWER", Viewer, "Viewer", "Display the input data in the Spreadsheet Editor")
|
||||
DefNode(GeometryNode, GEO_NODE_VOLUME_CUBE, 0, "VOLUME_CUBE", VolumeCube, "Volume Cube", "Generate a dense volume with a field that controls the density at each grid voxel based on its position")
|
||||
DefNode(GeometryNode, GEO_NODE_VOLUME_TO_MESH, def_geo_volume_to_mesh, "VOLUME_TO_MESH", VolumeToMesh, "Volume to Mesh", "Generate a mesh on the \"surface\" of a volume")
|
||||
DefNode(GeometryNode, GEO_NODE_VOLUME_TO_MESH, 0, "VOLUME_TO_MESH", VolumeToMesh, "Volume to Mesh", "Generate a mesh on the \"surface\" of a volume")
|
||||
|
||||
DefNode(GeometryNode, GEO_NODE_INTERPOLATE_CURVES, 0, "INTERPOLATE_CURVES", InterpolateCurves, "Interpolate Curves", "Generate new curves on points by interpolating between existing curves")
|
||||
|
||||
|
||||
@@ -110,8 +110,6 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
static void node_rna(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
static EnumPropertyItem mode_items[] = {
|
||||
{GEO_NODE_CURVE_RESAMPLE_EVALUATED,
|
||||
"EVALUATED",
|
||||
@@ -133,12 +131,12 @@ static void node_rna(StructRNA *srna)
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_node_storage(prop, mode);
|
||||
RNA_def_property_enum_items(prop, mode_items);
|
||||
RNA_def_property_ui_text(prop, "Mode", "How to specify the amount of samples");
|
||||
RNA_def_property_update_runtime(prop, rna_Node_socket_update);
|
||||
RNA_def_property_update_notifier(prop, NC_NODE | NA_EDITED);
|
||||
RNA_def_node_enum(srna,
|
||||
"mode",
|
||||
"Mode",
|
||||
"How to specify the amount of samples",
|
||||
mode_items,
|
||||
NOD_storage_enum_accessors(mode));
|
||||
}
|
||||
|
||||
static void node_register()
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
#include "GEO_trim_curves.hh"
|
||||
|
||||
#include "NOD_rna_define.hh"
|
||||
|
||||
#include "node_geometry_util.hh"
|
||||
|
||||
namespace blender::nodes::node_geo_curve_trim_cc {
|
||||
@@ -181,6 +183,30 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
params.set_output("Curve", std::move(geometry_set));
|
||||
}
|
||||
|
||||
static void node_rna(StructRNA *srna)
|
||||
{
|
||||
static EnumPropertyItem mode_items[] = {
|
||||
{GEO_NODE_CURVE_SAMPLE_FACTOR,
|
||||
"FACTOR",
|
||||
0,
|
||||
"Factor",
|
||||
"Find the endpoint positions using a factor of each spline's length"},
|
||||
{GEO_NODE_CURVE_RESAMPLE_LENGTH,
|
||||
"LENGTH",
|
||||
0,
|
||||
"Length",
|
||||
"Find the endpoint positions using a length from the start of each spline"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
RNA_def_node_enum(srna,
|
||||
"mode",
|
||||
"Mode",
|
||||
"How to find endpoint positions for the trimmed spline",
|
||||
mode_items,
|
||||
NOD_storage_enum_accessors(mode));
|
||||
}
|
||||
|
||||
static void node_register()
|
||||
{
|
||||
static bNodeType ntype;
|
||||
@@ -194,6 +220,8 @@ static void node_register()
|
||||
ntype.updatefunc = node_update;
|
||||
ntype.gather_link_search_ops = node_gather_link_searches;
|
||||
nodeRegisterType(&ntype);
|
||||
|
||||
node_rna(ntype.rna_ext.srna);
|
||||
}
|
||||
NOD_REGISTER_NODE(node_register)
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
#include "BKE_mesh.hh"
|
||||
|
||||
#include "NOD_rna_define.hh"
|
||||
|
||||
#include "node_geometry_util.hh"
|
||||
|
||||
namespace blender::nodes::node_geo_scale_elements_cc {
|
||||
@@ -450,6 +452,48 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
params.set_output("Geometry", std::move(geometry));
|
||||
}
|
||||
|
||||
static void node_rna(StructRNA *srna)
|
||||
{
|
||||
static const EnumPropertyItem domain_items[] = {
|
||||
{ATTR_DOMAIN_FACE,
|
||||
"FACE",
|
||||
ICON_NONE,
|
||||
"Face",
|
||||
"Scale individual faces or neighboring face islands"},
|
||||
{ATTR_DOMAIN_EDGE,
|
||||
"EDGE",
|
||||
ICON_NONE,
|
||||
"Edge",
|
||||
"Scale individual edges or neighboring edge islands"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem scale_mode_items[] = {
|
||||
{GEO_NODE_SCALE_ELEMENTS_UNIFORM,
|
||||
"UNIFORM",
|
||||
ICON_NONE,
|
||||
"Uniform",
|
||||
"Scale elements by the same factor in every direction"},
|
||||
{GEO_NODE_SCALE_ELEMENTS_SINGLE_AXIS,
|
||||
"SINGLE_AXIS",
|
||||
ICON_NONE,
|
||||
"Single Axis",
|
||||
"Scale elements in a single direction"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
RNA_def_node_enum(srna,
|
||||
"domain",
|
||||
"Domain",
|
||||
"Element type to transform",
|
||||
domain_items,
|
||||
NOD_inline_enum_accessors(custom1),
|
||||
ATTR_DOMAIN_FACE);
|
||||
|
||||
RNA_def_node_enum(
|
||||
srna, "scale_mode", "Scale Mode", "", scale_mode_items, NOD_inline_enum_accessors(custom2));
|
||||
}
|
||||
|
||||
static void node_register()
|
||||
{
|
||||
static bNodeType ntype;
|
||||
@@ -461,6 +505,8 @@ static void node_register()
|
||||
ntype.initfunc = node_init;
|
||||
ntype.updatefunc = node_update;
|
||||
nodeRegisterType(&ntype);
|
||||
|
||||
node_rna(ntype.rna_ext.srna);
|
||||
}
|
||||
NOD_REGISTER_NODE(node_register)
|
||||
|
||||
|
||||
@@ -64,14 +64,12 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
static void node_rna(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_node(prop, custom1);
|
||||
RNA_def_property_enum_items(prop, rna_enum_curve_normal_modes);
|
||||
RNA_def_property_ui_text(prop, "Mode", "Mode for curve normal evaluation");
|
||||
RNA_def_property_update_runtime(prop, rna_Node_update);
|
||||
RNA_def_property_update_notifier(prop, NC_NODE | NA_EDITED);
|
||||
RNA_def_node_enum(srna,
|
||||
"mode",
|
||||
"Mode",
|
||||
"Mode for curve normal evaluation",
|
||||
rna_enum_curve_normal_modes,
|
||||
NOD_inline_enum_accessors(custom1));
|
||||
}
|
||||
|
||||
static void node_register()
|
||||
|
||||
@@ -196,23 +196,21 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
|
||||
static void node_rna(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
RNA_def_node_enum(srna,
|
||||
"uv_smooth",
|
||||
"UV Smooth",
|
||||
"Controls how smoothing is applied to UVs",
|
||||
rna_enum_subdivision_uv_smooth_items,
|
||||
NOD_storage_enum_accessors(uv_smooth),
|
||||
SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES);
|
||||
|
||||
prop = RNA_def_property(srna, "uv_smooth", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_node_storage(prop, uv_smooth);
|
||||
RNA_def_property_enum_items(prop, rna_enum_subdivision_uv_smooth_items);
|
||||
RNA_def_property_enum_default(prop, SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES);
|
||||
RNA_def_property_ui_text(prop, "UV Smooth", "Controls how smoothing is applied to UVs");
|
||||
RNA_def_property_update_runtime(prop, rna_Node_update);
|
||||
RNA_def_property_update_notifier(prop, NC_NODE | NA_EDITED);
|
||||
|
||||
prop = RNA_def_property(srna, "boundary_smooth", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_node_storage(prop, boundary_smooth);
|
||||
RNA_def_property_enum_items(prop, rna_enum_subdivision_boundary_smooth_items);
|
||||
RNA_def_property_enum_default(prop, SUBSURF_BOUNDARY_SMOOTH_ALL);
|
||||
RNA_def_property_ui_text(prop, "Boundary Smooth", "Controls how open boundaries are smoothed");
|
||||
RNA_def_property_update_runtime(prop, rna_Node_update);
|
||||
RNA_def_property_update_notifier(prop, NC_NODE | NA_EDITED);
|
||||
RNA_def_node_enum(srna,
|
||||
"boundary_smooth",
|
||||
"Boundary Smooth",
|
||||
"Controls how open boundaries are smoothed",
|
||||
rna_enum_subdivision_boundary_smooth_items,
|
||||
NOD_storage_enum_accessors(boundary_smooth),
|
||||
SUBSURF_BOUNDARY_SMOOTH_ALL);
|
||||
}
|
||||
|
||||
static void node_register()
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "UI_interface.hh"
|
||||
#include "UI_resources.hh"
|
||||
|
||||
#include "NOD_rna_define.hh"
|
||||
|
||||
#include "node_geometry_util.hh"
|
||||
|
||||
namespace blender::nodes::node_geo_uv_unwrap_cc {
|
||||
@@ -187,6 +189,27 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
selection_field, seam_field, fill_holes, margin, method)));
|
||||
}
|
||||
|
||||
static void node_rna(StructRNA *srna)
|
||||
{
|
||||
static EnumPropertyItem method_items[] = {
|
||||
{GEO_NODE_UV_UNWRAP_METHOD_ANGLE_BASED,
|
||||
"ANGLE_BASED",
|
||||
0,
|
||||
"Angle Based",
|
||||
"This method gives a good 2D representation of a mesh"},
|
||||
{GEO_NODE_UV_UNWRAP_METHOD_CONFORMAL,
|
||||
"CONFORMAL",
|
||||
0,
|
||||
"Conformal",
|
||||
"Uses LSCM (Least Squares Conformal Mapping). This usually gives a less accurate UV "
|
||||
"mapping than Angle Based, but works better for simpler objects"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
RNA_def_node_enum(
|
||||
srna, "method", "Method", "", method_items, NOD_storage_enum_accessors(method));
|
||||
}
|
||||
|
||||
static void node_register()
|
||||
{
|
||||
static bNodeType ntype;
|
||||
@@ -199,6 +222,8 @@ static void node_register()
|
||||
ntype.geometry_node_execute = node_geo_exec;
|
||||
ntype.draw_buttons = node_layout;
|
||||
nodeRegisterType(&ntype);
|
||||
|
||||
node_rna(ntype.rna_ext.srna);
|
||||
}
|
||||
NOD_REGISTER_NODE(node_register)
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
|
||||
#include "NOD_rna_define.hh"
|
||||
|
||||
#include "UI_interface.hh"
|
||||
#include "UI_resources.hh"
|
||||
|
||||
@@ -211,6 +213,35 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void node_rna(StructRNA *srna)
|
||||
{
|
||||
static EnumPropertyItem resolution_mode_items[] = {
|
||||
{VOLUME_TO_MESH_RESOLUTION_MODE_GRID,
|
||||
"GRID",
|
||||
0,
|
||||
"Grid",
|
||||
"Use resolution of the volume grid"},
|
||||
{VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT,
|
||||
"VOXEL_AMOUNT",
|
||||
0,
|
||||
"Amount",
|
||||
"Desired number of voxels along one axis"},
|
||||
{VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE,
|
||||
"VOXEL_SIZE",
|
||||
0,
|
||||
"Size",
|
||||
"Desired voxel side length"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
RNA_def_node_enum(srna,
|
||||
"resolution_mode",
|
||||
"Resolution Mode",
|
||||
"How the voxel size is specified",
|
||||
resolution_mode_items,
|
||||
NOD_storage_enum_accessors(resolution_mode));
|
||||
}
|
||||
|
||||
static void node_register()
|
||||
{
|
||||
static bNodeType ntype;
|
||||
@@ -225,6 +256,8 @@ static void node_register()
|
||||
ntype.geometry_node_execute = node_geo_exec;
|
||||
ntype.draw_buttons = node_layout;
|
||||
nodeRegisterType(&ntype);
|
||||
|
||||
node_rna(ntype.rna_ext.srna);
|
||||
}
|
||||
NOD_REGISTER_NODE(node_register)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user