fix: Collada exporter has similar issue as reproted in T58150
authorGaia Clary <gaia.clary@machinimatrix.org>
Sat, 1 Dec 2018 14:38:18 +0000 (15:38 +0100)
committerGaia Clary <gaia.clary@machinimatrix.org>
Sat, 1 Dec 2018 14:38:18 +0000 (15:38 +0100)
source/blender/collada/BlenderContext.cpp
source/blender/collada/BlenderContext.h
source/blender/collada/collada_utils.cpp

index fcfd92416498530827c91286d20e02bee242a21b..2281b3dd529420c4d2b78bf7e19a3189060a28ec 100644 (file)
@@ -54,6 +54,18 @@ Scene *BlenderContext::get_scene()
        return scene;
 }
 
+Scene *BlenderContext::get_evaluated_scene()
+{
+       Scene *scene_eval = DEG_get_evaluated_scene(get_depsgraph());
+       return scene_eval;
+}
+
+Object *BlenderContext::get_evaluated_object(Object *ob)
+{
+       Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
+       return ob_eval;
+}
+
 ViewLayer *BlenderContext::get_view_layer()
 {
        return view_layer;
index 648d97a7e86fd3ba76ceb12c302a8c682e1a165c..e6157a5a7f26f090bb3f0942f279fa374b4defb4 100644 (file)
@@ -49,6 +49,8 @@ public:
        bContext *get_context();
        Depsgraph *get_depsgraph();
        Scene *get_scene();
+       Scene *get_evaluated_scene();
+       Object *get_evaluated_object(Object *ob);
        ViewLayer *get_view_layer();
        Main *get_main();
 };
index f5be93195abe929175f27b8b3d18f97f43c68033..33f74968782c46472547c57cd0964eb7e3244571 100644 (file)
@@ -263,7 +263,6 @@ Mesh *bc_get_mesh_copy(
        bool triangulate)
 {
        CustomDataMask mask = CD_MASK_MESH;
-       Mesh *mesh = (Mesh *)ob->data;
        Mesh *tmpmesh = NULL;
        if (apply_modifiers) {
 #if 0  /* Not supported by new system currently... */
@@ -281,12 +280,13 @@ Mesh *bc_get_mesh_copy(
                }
 #else
                Depsgraph *depsgraph = blender_context.get_depsgraph();
-               Scene *scene = blender_context.get_scene();
-               tmpmesh = mesh_get_eval_final(depsgraph, scene, ob, mask);
+               Scene *scene_eval = blender_context.get_evaluated_scene();
+               Object *ob_eval = blender_context.get_evaluated_object(ob);
+               tmpmesh = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, mask);
 #endif
        }
        else {
-               tmpmesh = mesh;
+               tmpmesh = (Mesh *)ob->data;
        }
 
        BKE_id_copy_ex(NULL, &tmpmesh->id, (ID **)&tmpmesh,