[Bf-extensions-cvs] [7055f9f] master: Use a context override dictionary when calling the export operator.

Lukas Tönne noreply at git.blender.org
Thu Feb 5 17:55:59 CET 2015


Commit: 7055f9f75a6485dfd26cac14b1b09587bd474204
Author: Lukas Tönne
Date:   Thu Feb 5 17:53:49 2015 +0100
Branches: master
https://developer.blender.org/rBAC7055f9f75a6485dfd26cac14b1b09587bd474204

Use a context override dictionary when calling the export operator.

This enables the operator to work with linked data as well.

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

M	cacharanth/meshcache.py

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

diff --git a/cacharanth/meshcache.py b/cacharanth/meshcache.py
index 69f4104..ef6417b 100644
--- a/cacharanth/meshcache.py
+++ b/cacharanth/meshcache.py
@@ -34,9 +34,18 @@ def meshcache_export(context, objects):
                 if mo.type == 'SUBSURF':
                     mo.show_viewport = False
 
-        context.scene.objects.active = ob
-
-        bpy.ops.export_shape.mdd(filepath=filename,
+        override = {
+            'blend_data' : context.blend_data,
+            'window' : context.window,
+            'screen' : context.screen,
+            'area' : context.area,
+            'region' : context.region,
+            'scene' : scene,
+            'active_object' : ob,
+            'object' : ob,
+            }
+        bpy.ops.export_shape.mdd(override,
+                                 filepath=filename,
                                  frame_start=scene.meshcache_frame_start,
                                  frame_end=scene.meshcache_frame_end,
                                  fps=scene.meshcache_frame_rate)



More information about the Bf-extensions-cvs mailing list