Geometry Nodes: Matrix socket type, attribute type, and initial nodes #116166

Merged
Hans Goudey merged 47 commits from HooglyBoogly/blender:nodes-matrix-socket into main 2024-02-13 18:59:46 +01:00
5 changed files with 0 additions and 100 deletions
Showing only changes of commit 7c42c5e993 - Show all commits

View File

@ -1331,7 +1331,6 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, i
#define GEO_NODE_STORE_NAMED_GRID 2122
#define GEO_NODE_SORT_ELEMENTS 2123
#define GEO_NODE_MENU_SWITCH 2124
#define GEO_NODE_OBJECT_TRANSFORM 2125
/** \} */

View File

@ -404,7 +404,6 @@ DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_FACE_OF_CORNER, 0, "FACE_OF_CORNER"
DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_OFFSET_CORNER_IN_FACE, 0, "OFFSET_CORNER_IN_FACE", OffsetCornerInFace, "Offset Corner in Face", "Retrieve corners in the same face as another")
DefNode(GeometryNode, GEO_NODE_MESH_TOPOLOGY_VERTEX_OF_CORNER, 0, "VERTEX_OF_CORNER", VertexOfCorner, "Vertex of Corner", "Retrieve the vertex each face corner is attached to")
DefNode(GeometryNode, GEO_NODE_OBJECT_INFO, 0, "OBJECT_INFO", ObjectInfo, "Object Info", "Retrieve information from an object")
DefNode(GeometryNode, GEO_NODE_OBJECT_TRANSFORM, 0, "OBJECT_TRANSFORM", ObjectTransform, "Object Transform", "Retrieve an object's location, rotation, and scale")
DefNode(GeometryNode, GEO_NODE_OFFSET_POINT_IN_CURVE, 0, "OFFSET_POINT_IN_CURVE", OffsetPointInCurve, "Offset Point in Curve", "Offset a control point index within its curve")
DefNode(GeometryNode, GEO_NODE_TOOL_FACE_SET, 0, "TOOL_FACE_SET", ToolFaceSet, "Face Set", "Each face's sculpt face set value")
DefNode(GeometryNode, GEO_NODE_TOOL_3D_CURSOR, 0, "TOOL_3D_CURSOR", Tool3DCursor, "3D Cursor", "The scene's 3D cursor location and rotation")

View File

@ -144,7 +144,6 @@ set(SRC
nodes/node_geo_mesh_topology_offset_corner_in_face.cc
nodes/node_geo_mesh_topology_vertex_of_corner.cc
nodes/node_geo_object_info.cc
nodes/node_geo_object_transform.cc
nodes/node_geo_offset_point_in_curve.cc
nodes/node_geo_points.cc
nodes/node_geo_points_to_curves.cc

View File

@ -1,94 +0,0 @@
/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BLI_math_matrix.hh"
#include "DNA_object_types.h"
#include "NOD_rna_define.hh"
#include "NOD_socket_search_link.hh"
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "node_geometry_util.hh"
namespace blender::nodes::node_geo_object_transform_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Object>("Object").hide_label();
b.add_output<decl::Matrix>("Transform");
}
static void search_link_ops(GatherLinkSearchOpParams &params)
{
if (U.experimental.use_new_matrix_socket) {
nodes::search_link_ops_for_basic_node(params);
}
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
{
uiItemR(layout, ptr, "transform_space", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
}
static void node_geo_exec(GeoNodeExecParams params)
{
const Object *object = params.get_input<Object *>("Object");
if (!object) {
params.set_default_remaining_outputs();
return;
}
if (params.node().custom1 == GEO_NODE_TRANSFORM_SPACE_RELATIVE) {
params.set_output("Transform",
float4x4(params.self_object()->world_to_object) *
float4x4(object->object_to_world));
}
else {
params.set_output("Transform", float4x4(object->object_to_world));
}
}
static void node_rna(StructRNA *srna)
{
static const EnumPropertyItem rna_node_geometry_object_info_transform_space_items[] = {
{GEO_NODE_TRANSFORM_SPACE_ORIGINAL,
"ORIGINAL",
0,
"Original",
"Output the transform relative to the world origin"},
{GEO_NODE_TRANSFORM_SPACE_RELATIVE,
"RELATIVE",
0,
"Relative",
"Bring the object's transform into the modified object's space, "
"maintaining the relative position between the two objects"},
{0, nullptr, 0, nullptr, nullptr},
};
RNA_def_node_enum(srna,
"transform_space",
"Transform Space",
"",
rna_node_geometry_object_info_transform_space_items,
NOD_inline_enum_accessors(custom1),
GEO_NODE_TRANSFORM_SPACE_ORIGINAL);
}
static void node_register()
{
static bNodeType ntype;
geo_node_type_base(&ntype, GEO_NODE_OBJECT_TRANSFORM, "Object Transform", NODE_CLASS_INPUT);
ntype.declare = node_declare;
ntype.gather_link_search_ops = search_link_ops;
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)
} // namespace blender::nodes::node_geo_object_transform_cc

View File

@ -93,9 +93,6 @@ static bool node_needs_own_transform_relation(const bNode &node)
node.storage);
return storage.transform_space == GEO_NODE_TRANSFORM_SPACE_RELATIVE;
}
if (node.type == GEO_NODE_OBJECT_TRANSFORM) {
return node.custom1 == GEO_NODE_TRANSFORM_SPACE_RELATIVE;
}
if (node.type == GEO_NODE_SELF_OBJECT) {
return true;
}