Merge branch 'master' into blender2.8
[blender.git] / intern / cycles / blender / addon / engine.py
index 08c6a65e5adb95bbc430a19076c04330fdbe3d6b..5c52a8bcce9873d89b74cf7f1ba3755061e2e724 100644 (file)
@@ -125,13 +125,12 @@ def exit():
     _cycles.exit()
 
 
-def create(engine, data, scene, region=None, v3d=None, rv3d=None, preview_osl=False):
-    import bpy
+def create(engine, data, region=None, v3d=None, rv3d=None, preview_osl=False):
     import _cycles
+    import bpy
 
     data = data.as_pointer()
     userpref = bpy.context.user_preferences.as_pointer()
-    scene = scene.as_pointer()
     if region:
         region = region.as_pointer()
     if v3d:
@@ -139,12 +138,8 @@ def create(engine, data, scene, region=None, v3d=None, rv3d=None, preview_osl=Fa
     if rv3d:
         rv3d = rv3d.as_pointer()
 
-    if bpy.app.debug_value == 256:
-        _cycles.debug_flags_update(scene)
-    else:
-        _cycles.debug_flags_reset()
-
-    engine.session = _cycles.create(engine.as_pointer(), userpref, data, scene, region, v3d, rv3d, preview_osl)
+    engine.session = _cycles.create(
+            engine.as_pointer(), userpref, data, region, v3d, rv3d, preview_osl)
 
 
 def free(engine):
@@ -155,38 +150,46 @@ def free(engine):
         del engine.session
 
 
-def render(engine):
+def render(engine, depsgraph):
     import _cycles
     if hasattr(engine, "session"):
-        _cycles.render(engine.session)
+        _cycles.render(engine.session, depsgraph.as_pointer())
 
 
-def bake(engine, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result):
+def bake(engine, depsgraph, obj, pass_type, pass_filter, object_id, pixel_array, num_pixels, depth, result):
     import _cycles
     session = getattr(engine, "session", None)
     if session is not None:
-        _cycles.bake(engine.session, obj.as_pointer(), pass_type, pass_filter, object_id, pixel_array.as_pointer(), num_pixels, depth, result.as_pointer())
+        _cycles.bake(engine.session, depsgraph.as_pointer(), obj.as_pointer(), pass_type, pass_filter, object_id, pixel_array.as_pointer(), num_pixels, depth, result.as_pointer())
 
 
-def reset(engine, data, scene):
+def reset(engine, data, depsgraph):
     import _cycles
+    import bpy
+
+    if bpy.app.debug_value == 256:
+        _cycles.debug_flags_update(depsgraph.scene)
+    else:
+        _cycles.debug_flags_reset()
+
     data = data.as_pointer()
-    scene = scene.as_pointer()
-    _cycles.reset(engine.session, data, scene)
+    depsgraph = depsgraph.as_pointer()
+    _cycles.reset(engine.session, data, depsgraph)
 
 
-def update(engine, data, scene):
+def sync(engine, depsgraph, data):
     import _cycles
-    _cycles.sync(engine.session)
+    _cycles.sync(engine.session, depsgraph.as_pointer())
 
 
-def draw(engine, region, v3d, rv3d):
+def draw(engine, depsgraph, region, v3d, rv3d):
     import _cycles
+    depsgraph = depsgraph.as_pointer()
     v3d = v3d.as_pointer()
     rv3d = rv3d.as_pointer()
 
     # draw render image
-    _cycles.draw(engine.session, v3d, rv3d)
+    _cycles.draw(engine.session, depsgraph, v3d, rv3d)
 
 
 def available_devices():