fix: Collada Exporter: improve usage of viewlayer and depsgraph

* The exporter now gets the view layer from the context
  instead of the depsgraph.
* The depsgrap is now fetched only on demand since the graph
  is not always needed for exporting (currently only for armature exports).
This commit is contained in:
Gaia Clary 2018-11-27 12:14:03 +01:00
parent dcb86689b0
commit 4c1a01d1a0
1 changed files with 6 additions and 2 deletions

View File

@ -25,14 +25,15 @@
*/
#include "BlenderContext.h"
#include "BKE_scene.h"
BlenderContext::BlenderContext(bContext *C)
{
context = C;
main = CTX_data_main(C);
depsgraph = CTX_data_depsgraph(C);
scene = CTX_data_scene(C);
view_layer = DEG_get_evaluated_view_layer(depsgraph);
view_layer = CTX_data_view_layer(C);
depsgraph = nullptr; // create only when needed
}
bContext *BlenderContext::get_context()
@ -42,6 +43,9 @@ bContext *BlenderContext::get_context()
Depsgraph *BlenderContext::get_depsgraph()
{
if (!depsgraph) {
depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
}
return depsgraph;
}