diff options
author | Hans Goudey <h.goudey@me.com> | 2021-03-26 20:09:35 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-03-26 20:09:35 +0300 |
commit | 80530edcae5fe122f14a5e8acf22853daf5a3ecf (patch) | |
tree | 20c94161b5d377b4d92a44f2d73864a320e66004 | |
parent | e684c170f9f8fb1aaeb7e59c9d1a14ba94b6791d (diff) |
Geometry Nodes: Rename "Plane" primitive to "Grid"
Although "Grid" may not be techincally correct since a grid could be 3D,
it was decided to rename the "Plane" primtive to "Grid". The primitive
node allows subdivisions, so the name is more consistent with the
operator in the 3D view.
Ref T86819
This commit includes a file subversion bump for the versioning.
-rw-r--r-- | release/scripts/startup/nodeitems_builtins.py | 11 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_blender_version.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.cc | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 12 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_userdef.c | 25 | ||||
-rw-r--r-- | source/blender/nodes/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/nodes/NOD_geometry.h | 2 | ||||
-rw-r--r-- | source/blender/nodes/NOD_static_types.h | 2 | ||||
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc (renamed from source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc) | 18 |
10 files changed, 46 insertions, 32 deletions
diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py index 38d63ff8eca..b573a7a75fb 100644 --- a/release/scripts/startup/nodeitems_builtins.py +++ b/release/scripts/startup/nodeitems_builtins.py @@ -522,17 +522,16 @@ geometry_node_categories = [ NodeItem("GeometryNodeEdgeSplit"), NodeItem("GeometryNodeSubdivisionSurface"), NodeItem("GeometryNodeSubdivide"), - ]), GeometryNodeCategory("GEO_PRIMITIVES", "Mesh Primitives", items=[ - NodeItem("GeometryNodeMeshCube"), NodeItem("GeometryNodeMeshCircle"), - NodeItem("GeometryNodeMeshUVSphere"), - NodeItem("GeometryNodeMeshIcoSphere"), - NodeItem("GeometryNodeMeshCylinder"), NodeItem("GeometryNodeMeshCone"), + NodeItem("GeometryNodeMeshCube"), + NodeItem("GeometryNodeMeshCylinder"), + NodeItem("GeometryNodeMeshGrid"), + NodeItem("GeometryNodeMeshIcoSphere"), NodeItem("GeometryNodeMeshLine"), - NodeItem("GeometryNodeMeshPlane"), + NodeItem("GeometryNodeMeshUVSphere"), ]), GeometryNodeCategory("GEO_POINT", "Point", items=[ NodeItem("GeometryNodePointDistribute"), diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index c9585430ae2..0fcc2fe8f46 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -39,7 +39,7 @@ extern "C" { /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 14 +#define BLENDER_FILE_SUBVERSION 15 /* Minimum Blender version that supports reading file written with the current * version. Older Blender versions will test this and show a warning if the file diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 22a0ff3746e..40d9662f814 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1393,7 +1393,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree, #define GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE 1036 #define GEO_NODE_MESH_PRIMITIVE_CONE 1037 #define GEO_NODE_MESH_PRIMITIVE_LINE 1038 -#define GEO_NODE_MESH_PRIMITIVE_PLANE 1039 +#define GEO_NODE_MESH_PRIMITIVE_GRID 1039 #define GEO_NODE_ATTRIBUTE_MAP_RANGE 1040 #define GEO_NODE_ATTRIBUTE_CLAMP 1041 diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 9263071241d..1a136cb46a0 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -4926,9 +4926,9 @@ static void registerGeometryNodes() register_node_type_geo_mesh_primitive_cone(); register_node_type_geo_mesh_primitive_cube(); register_node_type_geo_mesh_primitive_cylinder(); + register_node_type_geo_mesh_primitive_grid(); register_node_type_geo_mesh_primitive_ico_sphere(); register_node_type_geo_mesh_primitive_line(); - register_node_type_geo_mesh_primitive_plane(); register_node_type_geo_mesh_primitive_uv_sphere(); register_node_type_geo_object_info(); register_node_type_geo_point_distribute(); diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 31e4b659c2f..aae5a2ec190 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -1925,6 +1925,18 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + if (!MAIN_VERSION_ATLEAST(bmain, 293, 15)) { + LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) { + if (ntree->type == NTREE_GEOMETRY) { + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { + if (STREQ(node->idname, "GeometryNodeMeshPlane")) { + STRNCPY(node->idname, "GeometryNodeMeshGrid"); + } + } + } + } + } + /** * Versioning code until next subversion bump goes here. * diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index 8cbedb05931..847b10192f8 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -261,17 +261,7 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) FROM_DEFAULT_V4_UCHAR(space_node.nodeclass_shader); } - /** - * Versioning code until next subversion bump goes here. - * - * \note Be sure to check when bumping the version: - * - #blo_do_versions_userdef in this file. - * - "versioning_{BLENDER_VERSION}.c" - * - * \note Keep this message at the bottom of the function. - */ - { - /* Keep this block, even when empty. */ + if (!USER_VERSION_ATLEAST(293, 15)) { FROM_DEFAULT_V4_UCHAR(space_properties.active); FROM_DEFAULT_V4_UCHAR(space_info.info_error); @@ -286,6 +276,19 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) btheme->space_spreadsheet = btheme->space_outliner; } + /** + * Versioning code until next subversion bump goes here. + * + * \note Be sure to check when bumping the version: + * - #blo_do_versions_userdef in this file. + * - "versioning_{BLENDER_VERSION}.c" + * + * \note Keep this message at the bottom of the function. + */ + { + /* Keep this block, even when empty. */ + } + #undef FROM_DEFAULT_V4_UCHAR #undef USER_VERSION_ATLEAST diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index e8b26b8e08f..aba3c3e041a 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -164,9 +164,9 @@ set(SRC geometry/nodes/node_geo_mesh_primitive_cone.cc geometry/nodes/node_geo_mesh_primitive_cube.cc geometry/nodes/node_geo_mesh_primitive_cylinder.cc + geometry/nodes/node_geo_mesh_primitive_grid.cc geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc geometry/nodes/node_geo_mesh_primitive_line.cc - geometry/nodes/node_geo_mesh_primitive_plane.cc geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc geometry/nodes/node_geo_object_info.cc geometry/nodes/node_geo_point_distribute.cc diff --git a/source/blender/nodes/NOD_geometry.h b/source/blender/nodes/NOD_geometry.h index def211d0b45..3a26f38d6ba 100644 --- a/source/blender/nodes/NOD_geometry.h +++ b/source/blender/nodes/NOD_geometry.h @@ -49,8 +49,8 @@ void register_node_type_geo_join_geometry(void); void register_node_type_geo_mesh_primitive_circle(void); void register_node_type_geo_mesh_primitive_cone(void); void register_node_type_geo_mesh_primitive_cube(void); -void register_node_type_geo_mesh_primitive_plane(void); void register_node_type_geo_mesh_primitive_cylinder(void); +void register_node_type_geo_mesh_primitive_grid(void); void register_node_type_geo_mesh_primitive_ico_sphere(void); void register_node_type_geo_mesh_primitive_line(void); void register_node_type_geo_mesh_primitive_uv_sphere(void); diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 0e19db6866e..b3463f79a6e 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -305,7 +305,7 @@ DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CYLINDER, def_geo_mesh_cylinder, " DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE, 0, "MESH_PRIMITIVE_ICO_SPHERE", MeshIcoSphere, "Ico Sphere", "") DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_CONE, def_geo_mesh_cone, "MESH_PRIMITIVE_CONE", MeshCone, "Cone", "") DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_LINE, def_geo_mesh_line, "MESH_PRIMITIVE_LINE", MeshLine, "Line", "") -DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_PLANE, 0, "MESH_PRIMITIVE_PLANE", MeshPlane, "Plane", "") +DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_GRID, 0, "MESH_PRIMITIVE_GRID", MeshGrid, "Grid", "") DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_MAP_RANGE, def_geo_attribute_map_range, "ATTRIBUTE_MAP_RANGE", AttributeMapRange, "Attribute Map Range", "") DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_CLAMP, def_geo_attribute_clamp, "ATTRIBUTE_CLAMP", AttributeClamp, "Attribute Clamp", "") diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc index b2d418d3c80..df4fd70d2b0 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_plane.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc @@ -27,14 +27,14 @@ #include "node_geometry_util.hh" -static bNodeSocketTemplate geo_node_mesh_primitive_plane_in[] = { +static bNodeSocketTemplate geo_node_mesh_primitive_grid_in[] = { {SOCK_FLOAT, N_("Size"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, FLT_MAX, PROP_DISTANCE}, {SOCK_INT, N_("Vertices X"), 10, 0.0f, 0.0f, 0.0f, 2, 1000}, {SOCK_INT, N_("Vertices Y"), 10, 0.0f, 0.0f, 0.0f, 2, 1000}, {-1, ""}, }; -static bNodeSocketTemplate geo_node_mesh_primitive_plane_out[] = { +static bNodeSocketTemplate geo_node_mesh_primitive_grid_out[] = { {SOCK_GEOMETRY, N_("Geometry")}, {-1, ""}, }; @@ -58,7 +58,7 @@ static void calculate_uvs(Mesh *mesh, Span<MVert> verts, Span<MLoop> loops, cons uv_attribute.apply_span_and_save(); } -static Mesh *create_plane_mesh(const int verts_x, const int verts_y, const float size) +static Mesh *create_grid_mesh(const int verts_x, const int verts_y, const float size) { const int edges_x = verts_x - 1; const int edges_y = verts_y - 1; @@ -147,7 +147,7 @@ static Mesh *create_plane_mesh(const int verts_x, const int verts_y, const float return mesh; } -static void geo_node_mesh_primitive_plane_exec(GeoNodeExecParams params) +static void geo_node_mesh_primitive_grid_exec(GeoNodeExecParams params) { const float size = params.extract_input<float>("Size"); const int verts_x = params.extract_input<int>("Vertices X"); @@ -157,7 +157,7 @@ static void geo_node_mesh_primitive_plane_exec(GeoNodeExecParams params) return; } - Mesh *mesh = create_plane_mesh(verts_x, verts_y, size); + Mesh *mesh = create_grid_mesh(verts_x, verts_y, size); BLI_assert(BKE_mesh_is_valid(mesh)); params.set_output("Geometry", GeometrySet::create_with_mesh(mesh)); @@ -165,13 +165,13 @@ static void geo_node_mesh_primitive_plane_exec(GeoNodeExecParams params) } // namespace blender::nodes -void register_node_type_geo_mesh_primitive_plane() +void register_node_type_geo_mesh_primitive_grid() { static bNodeType ntype; - geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_PLANE, "Plane", NODE_CLASS_GEOMETRY, 0); + geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_GRID, "Grid", NODE_CLASS_GEOMETRY, 0); node_type_socket_templates( - &ntype, geo_node_mesh_primitive_plane_in, geo_node_mesh_primitive_plane_out); - ntype.geometry_node_execute = blender::nodes::geo_node_mesh_primitive_plane_exec; + &ntype, geo_node_mesh_primitive_grid_in, geo_node_mesh_primitive_grid_out); + ntype.geometry_node_execute = blender::nodes::geo_node_mesh_primitive_grid_exec; nodeRegisterType(&ntype); } |