Depsgraph: Expand object data datablocks for drivers
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Jun 2018 10:01:38 +0000 (12:01 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Jun 2018 10:36:52 +0000 (12:36 +0200)
Drivers can reference object data datablock directly, and if there
was no object in the scene with that datablock, blender will crash.

source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.cc

index 607e1389c5f58d7ff46d72df8f2d064568f599e1..8861ffc956a850f2cea40df0d34801de5d1991cf 100644 (file)
@@ -383,12 +383,27 @@ void DepsgraphNodeBuilder::build_id(ID* id) {
                return;
        }
        switch (GS(id->name)) {
+               case ID_AR:
+                       build_armature((bArmature *)id);
+                       break;
+               case ID_CA:
+                       build_camera((Camera *)id);
+                       break;
                case ID_GR:
                        build_collection((Collection *)id);
                        break;
                case ID_OB:
                        build_object(-1, (Object *)id, DEG_ID_LINKED_INDIRECTLY);
                        break;
+               case ID_KE:
+                       build_shapekeys((Key *)id);
+                       break;
+               case ID_LA:
+                       build_lamp((Lamp *)id);
+                       break;
+               case ID_LP:
+                       build_lightprobe((LightProbe *)id);
+                       break;
                case ID_NT:
                        build_nodetree((bNodeTree *)id);
                        break;
@@ -410,8 +425,16 @@ void DepsgraphNodeBuilder::build_id(ID* id) {
                case ID_MC:
                        build_movieclip((MovieClip *)id);
                        break;
+               case ID_ME:
+               case ID_CU:
+               case ID_MB:
+               case ID_LT:
+                       build_object_data_geometry_datablock(id);
+                       break;
                default:
                        fprintf(stderr, "Unhandled ID %s\n", id->name);
+                       BLI_assert(!"Should never happen");
+                       break;
        }
 }
 
index d91d80cead67994a33481d7d86f085b06aee99e2..26f5c167627bc325b95f83562c5d9c6767f4b22b 100644 (file)
@@ -399,12 +399,27 @@ void DepsgraphRelationBuilder::build_id(ID *id)
                return;
        }
        switch (GS(id->name)) {
+               case ID_AR:
+                       build_armature((bArmature *)id);
+                       break;
+               case ID_CA:
+                       build_camera((Camera *)id);
+                       break;
                case ID_GR:
                        build_collection(NULL, (Collection *)id);
                        break;
                case ID_OB:
                        build_object(NULL, (Object *)id);
                        break;
+               case ID_KE:
+                       build_shapekeys((Key *)id);
+                       break;
+               case ID_LA:
+                       build_lamp((Lamp *)id);
+                       break;
+               case ID_LP:
+                       build_lightprobe((LightProbe *)id);
+                       break;
                case ID_NT:
                        build_nodetree((bNodeTree *)id);
                        break;
@@ -423,8 +438,16 @@ void DepsgraphRelationBuilder::build_id(ID *id)
                case ID_MC:
                        build_movieclip((MovieClip *)id);
                        break;
+               case ID_ME:
+               case ID_CU:
+               case ID_MB:
+               case ID_LT:
+                       build_object_data_geometry_datablock(id);
+                       break;
                default:
                        fprintf(stderr, "Unhandled ID %s\n", id->name);
+                       BLI_assert(!"Should never happen");
+                       break;
        }
 }