diff options
author | Jacques Lucke <jacques@blender.org> | 2022-01-21 19:34:47 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-01-21 19:34:47 +0300 |
commit | d034b85f3325379c40981502e44a07e5ef4c7d14 (patch) | |
tree | 76d75daea2db72f16961f5e8c001b8e6441d72c8 /source/blender/makesrna | |
parent | c39d514a4eacd4a883775a3fcd8b5a7d8e8e52cc (diff) |
Geometry Nodes: new Scale Elements nodes
This node can scale individual edges and faces. When multiple selected
faces/edges share the same vertices, they are scaled together.
The center and scaling factor is averaged in this case.
For some examples see D13757.
Differential Revision: https://developer.blender.org/D13757
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index adb6b1e4e34..c506c35e281 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -11422,6 +11422,53 @@ static void def_geo_field_at_index(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, NULL, 0, NULL, NULL}, + }; + + 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, NULL, 0, NULL, NULL}, + + }; + + prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "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, NULL, "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) |