[Bf-blender-cvs] [c1402712de1] temp-modifiers-instancing: add rotation and scale output

Jacques Lucke noreply at git.blender.org
Tue Nov 10 18:09:42 CET 2020


Commit: c1402712de1f1ff3d28950af875d26d1abc89887
Author: Jacques Lucke
Date:   Tue Nov 10 17:36:35 2020 +0100
Branches: temp-modifiers-instancing
https://developer.blender.org/rBc1402712de1f1ff3d28950af875d26d1abc89887

add rotation and scale output

===================================================================

M	source/blender/nodes/geometry/nodes/node_geo_object_info.cc

===================================================================

diff --git a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
index 628cff97913..7c05468eebc 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
@@ -23,6 +23,8 @@ static bNodeSocketTemplate geo_node_object_info_in[] = {
 
 static bNodeSocketTemplate geo_node_object_info_out[] = {
     {SOCK_VECTOR, N_("Location")},
+    {SOCK_VECTOR, N_("Rotation")},
+    {SOCK_VECTOR, N_("Scale")},
     {-1, ""},
 };
 
@@ -34,12 +36,18 @@ static void geo_object_info_exec(bNode *UNUSED(node), GeoNodeInputs inputs, GeoN
   Object *object = inputs.handle_map().lookup(object_handle);
 
   float3 location = {0, 0, 0};
+  float3 rotation = {0, 0, 0};
+  float3 scale = {0, 0, 0};
 
   if (object != nullptr) {
-    location = object->obmat[3];
+    float quaternion[4];
+    mat4_decompose(location, quaternion, scale, object->obmat);
+    quat_to_eul(rotation, quaternion);
   }
 
   outputs.set("Location", location);
+  outputs.set("Rotation", rotation);
+  outputs.set("Scale", scale);
 }
 }  // namespace blender::nodes



More information about the Bf-blender-cvs mailing list