[Bf-blender-cvs] [92493a5fa74] blender-v3.3-release: Fix: Node editor context path for curves objects

Hans Goudey noreply at git.blender.org
Wed Aug 17 17:11:40 CEST 2022


Commit: 92493a5fa74ac2926cb83fbb1182ba82f047782f
Author: Hans Goudey
Date:   Wed Aug 17 11:11:28 2022 -0400
Branches: blender-v3.3-release
https://developer.blender.org/rB92493a5fa74ac2926cb83fbb1182ba82f047782f

Fix: Node editor context path for curves objects

The object data path item wasn't added properly.
Also remove some of the unnecessary variables and forward declarations.

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

M	source/blender/editors/space_node/node_context_path.cc

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

diff --git a/source/blender/editors/space_node/node_context_path.cc b/source/blender/editors/space_node/node_context_path.cc
index b9bee3ed15e..4f7497b5f49 100644
--- a/source/blender/editors/space_node/node_context_path.cc
+++ b/source/blender/editors/space_node/node_context_path.cc
@@ -28,27 +28,26 @@
 
 #include "node_intern.hh"
 
-struct Curve;
-struct Light;
 struct Material;
-struct Mesh;
-struct World;
 
 namespace blender::ed::space_node {
 
 static void context_path_add_object_data(Vector<ui::ContextPathItem> &path, Object &object)
 {
-  if (object.type == OB_MESH && object.data) {
-    Mesh *mesh = (Mesh *)object.data;
-    ui::context_path_add_generic(path, RNA_Mesh, mesh);
+  if (!object.data) {
+    return;
   }
-  if (object.type == OB_LAMP && object.data) {
-    Light *light = (Light *)object.data;
-    ui::context_path_add_generic(path, RNA_Light, light);
+  if (object.type == OB_MESH) {
+    ui::context_path_add_generic(path, RNA_Mesh, object.data);
   }
-  if (ELEM(object.type, OB_CURVES_LEGACY, OB_FONT, OB_SURF) && object.data) {
-    Curve *curve = (Curve *)object.data;
-    ui::context_path_add_generic(path, RNA_Curve, curve);
+  else if (object.type == OB_CURVES) {
+    ui::context_path_add_generic(path, RNA_Curves, object.data);
+  }
+  else if (object.type == OB_LAMP) {
+    ui::context_path_add_generic(path, RNA_Light, object.data);
+  }
+  else if (ELEM(object.type, OB_CURVES_LEGACY, OB_FONT, OB_SURF)) {
+    ui::context_path_add_generic(path, RNA_Curve, object.data);
   }
 }
 
@@ -71,8 +70,7 @@ static void get_context_path_node_shader(const bContext &C,
       Scene *scene = CTX_data_scene(&C);
       ui::context_path_add_generic(path, RNA_Scene, scene);
       if (scene != nullptr) {
-        World *world = scene->world;
-        ui::context_path_add_generic(path, RNA_World, world);
+        ui::context_path_add_generic(path, RNA_World, scene->world);
       }
       /* Skip the base node tree here, because the world contains a node tree already. */
       context_path_add_node_tree_and_node_groups(snode, path, true);
@@ -95,8 +93,7 @@ static void get_context_path_node_shader(const bContext &C,
       Scene *scene = CTX_data_scene(&C);
       ui::context_path_add_generic(path, RNA_Scene, scene);
       if (scene != nullptr) {
-        World *world = scene->world;
-        ui::context_path_add_generic(path, RNA_World, world);
+        ui::context_path_add_generic(path, RNA_World, scene->world);
       }
     }
 #ifdef WITH_FREESTYLE



More information about the Bf-blender-cvs mailing list