[Bf-blender-cvs] [78b545f1fe1] temp-test-point-cloud-simulation-depsgraph-integration: better handling when id has wrong type

Jacques Lucke noreply at git.blender.org
Wed Apr 15 18:27:09 CEST 2020


Commit: 78b545f1fe1511fd8ffe56f3f089ea5cc90feb94
Author: Jacques Lucke
Date:   Wed Apr 1 11:44:02 2020 +0200
Branches: temp-test-point-cloud-simulation-depsgraph-integration
https://developer.blender.org/rB78b545f1fe1511fd8ffe56f3f089ea5cc90feb94

better handling when id has wrong type

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

M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index df605b28fee..98a3cfac125 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2170,7 +2170,13 @@ static void rna_SpaceNodeEditor_node_tree_update(const bContext *C, PointerRNA *
 static PointerRNA rna_SpaceNodeEditor_simulation_get(PointerRNA *ptr)
 {
   SpaceNode *snode = (SpaceNode *)ptr->data;
-  return rna_pointer_inherit_refine(ptr, &RNA_Simulation, snode->id);
+  ID *id = snode->id;
+  if (id && GS(id->name) == ID_SIM) {
+    return rna_pointer_inherit_refine(ptr, &RNA_Simulation, snode->id);
+  }
+  else {
+    return PointerRNA_NULL;
+  }
 }
 
 static void rna_SpaceNodeEditor_simulation_set(PointerRNA *ptr,
@@ -2178,6 +2184,10 @@ static void rna_SpaceNodeEditor_simulation_set(PointerRNA *ptr,
                                                struct ReportList *UNUSED(reports))
 {
   SpaceNode *snode = (SpaceNode *)ptr->data;
+  if (!STREQ(snode->tree_idname, "SimulationNodeTree")) {
+    return;
+  }
+
   Simulation *sim = (Simulation *)value.data;
   if (sim != NULL) {
     bNodeTree *ntree = sim->nodetree;



More information about the Bf-blender-cvs mailing list