From 8b777ee6d69d4805c64756cf6a33db894160ce29 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Tue, 19 Jan 2021 17:30:44 +0100 Subject: Geometry Nodes - Object Info: option to apply obj transform to the geometry By design the modified object transformations should still work and affect the geometry nodes results. The current behaviour, however, would make the geometry from the object info to not be affected by the modified object transformations. This patch changes that by default. In a similar fashion the Location, Rotation and Scale sockets outputs should be aware of whether the output should be in the global space or in the space of the nodetree. To solve this, the patch introduces a new transformation space "enum" where users can pick "Original" or "Relative" space. Original -------- Output the geometry relative to the input object transform, and the location, rotation and scale relative to the world origin. Relative -------- Bring the input object geometry, location, rotation and scale into the modified object maintaining the relative position between the two objects in the scene. Relative space violates a bit the design of the nodetree. The geometry in this case is transformed so that moving the modified object doesn't interfere with the geometry. This is particularly useful for the boolean node for instance. "Original" is the default space, but old files are set to "Relative" for backwards compatibility. Differential Revision: https://developer.blender.org/D10124 --- source/blender/editors/space_node/drawnode.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/editors/space_node/drawnode.c') diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index ad975196981..df29950bc59 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -3284,6 +3284,11 @@ static void node_geometry_buts_point_scale(uiLayout *layout, bContext *UNUSED(C) 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_set_butfunc(bNodeType *ntype) { switch (ntype->type) { @@ -3335,6 +3340,9 @@ static void node_geometry_set_butfunc(bNodeType *ntype) 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; } } -- cgit v1.2.3