[Bf-blender-cvs] [321f92424e2] soc-2019-npr: LANPR: Remove composition operators.
YimingWu
noreply at git.blender.org
Thu Jul 4 07:25:40 CEST 2019
Commit: 321f92424e2999a56a0b93e7e8c4785b39e6235e
Author: YimingWu
Date: Thu Jul 4 13:25:09 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB321f92424e2999a56a0b93e7e8c4785b39e6235e
LANPR: Remove composition operators.
===================================================================
M release/scripts/startup/bl_operators/lanpr.py
M source/blender/makesdna/DNA_scene_types.h
===================================================================
diff --git a/release/scripts/startup/bl_operators/lanpr.py b/release/scripts/startup/bl_operators/lanpr.py
index 64833ea6491..c296ffb1347 100644
--- a/release/scripts/startup/bl_operators/lanpr.py
+++ b/release/scripts/startup/bl_operators/lanpr.py
@@ -21,218 +21,6 @@
import bpy
import string
-GLOBAL_OUTPUT_PATH = ''
-
-def lanpr_get_composition_scene(scene):
- n = scene.name+'_lanpr_comp'
- for s in bpy.data.scenes:
- if s.name == n: return s
- return None
-
-def lanpr_make_composition_scene(scene):
- name = scene.name;
- new_name = scene.name+'_lanpr_comp'
- scene.name = new_name
- bpy.ops.scene.new(type='LINK_COPY')
- for s in bpy.data.scenes:
- if s.name == new_name+'.001':
- new_scene = s
- break
- scene.name = name
- new_scene.name = new_name
-
- s = new_scene
-
- s.render.engine = 'BLENDER_LANPR'
- s.use_nodes = True
-
- comp = s.node_tree
-
- comp.nodes.clear()
- n1 = comp.nodes.new("CompositorNodeRLayers")
- n1.scene = scene
- n1.location = (0,0)
- n2 = comp.nodes.new("CompositorNodeRLayers")
- n2.scene = s
- n2.location = (0,-300)
-
- mix = comp.nodes.new("CompositorNodeAlphaOver")
- mix.location = (300,-150)
- comp.links.new(n1.outputs['Image'],mix.inputs[1])
- comp.links.new(n2.outputs['Image'],mix.inputs[2])
-
- out = comp.nodes.new("CompositorNodeComposite")
- out.location = (500,-150)
- comp.links.new(mix.outputs['Image'],out.inputs['Image'])
-
-
-class LANPR_make_composition_scene(bpy.types.Operator):
- """Make Composition Scene"""
- bl_idname = "lanpr.make_composition_scene"
- bl_label = "Make Composition Scene"
-
- @classmethod
- def poll(cls, context):
- return (lanpr_get_composition_scene(context.scene) is None)
-
- def execute(self, context):
- lanpr_make_composition_scene(context.scene)
- return {'FINISHED'}
-
-def lanpr_remove_composition_scene(scene):
- bpy.data.scenes.remove(lanpr_get_composition_scene(scene))
-
-class LANPR_remove_composition_scene(bpy.types.Operator):
- """Remove Composition Scene"""
- bl_idname = "lanpr.remove_composition_scene"
- bl_label = "Remove Composition Scene"
-
- @classmethod
- def poll(cls, context):
- return (lanpr_get_composition_scene(context.scene) is not None)
-
- def execute(self, context):
- lanpr_remove_composition_scene(context.scene)
- return {'FINISHED'}
-
-def lanpr_is_composition_scene(scene):
- return scene.name.endswith('_lanpr_comp')
-
-def lanpr_get_original_scene(scene):
- name = scene.name[:-len('_lanpr_comp')]
- for s in bpy.data.scenes:
- if s.name == name: return s
- return None
-
-def lanpr_goto_original_scene(scene):
- s = lanpr_get_original_scene(scene)
- if s: bpy.context.window.scene = s
-
-
-class LANPR_goto_original_scene(bpy.types.Operator):
- """Goto Original Scene"""
- bl_idname = "lanpr.goto_original_scene"
- bl_label = "Goto Original Scene"
-
- @classmethod
- def poll(cls, context):
- return lanpr_is_composition_scene(context.scene)
-
- def execute(self, context):
- lanpr_goto_original_scene(context.scene)
- return {'FINISHED'}
-
-def lanpr_goto_composition_scene(scene):
- name = scene.name+'_lanpr_comp'
- for s in bpy.data.scenes:
- if s.name == name:
- bpy.context.window.scene = s
- break
-
-class LANPR_goto_composition_scene(bpy.types.Operator):
- """Goto Composition Scene"""
- bl_idname = "lanpr.goto_composition_scene"
- bl_label = "Goto Composition Scene"
-
- @classmethod
- def poll(cls, context):
- return lanpr_get_composition_scene(context.scene) is not None
-
- def execute(self, context):
- lanpr_goto_composition_scene(context.scene)
- return {'FINISHED'}
-
-
-#callbacks
-
-GC = None
-
-def lanpr_render_next_frame(sc):
- global GLOBAL_OUTPUT_PATH
- sc.frame_current = sc.frame_current+1
- if sc.frame_current>sc.frame_end:
- bpy.app.handlers.render_complete.remove(lanpr_render_next_frame)
- bpy.context.scene.render.filepath = GLOBAL_OUTPUT_PATH
- return
-
- #bpy.app.handlers.render_cancel.append(lanpr_render_canceled)
- #bpy.app.handlers.render_complete.remove(lanpr_render_next_frame)
-
- #lanpr_render_backdrop_first(sc)
-
-def lanpr_render_this_scene_next(scene):
-
- #bpy.app.handlers.render_complete.remove(lanpr_render_this_scene_next)
- #bpy.app.handlers.render_cancel.remove(lanpr_render_canceled)
-
- #bpy.app.handlers.render_cancel.append(lanpr_render_canceled)
-
- sc = scene #lanpr_get_composition_scene(scene)
- write = sc.lanpr.composite_render_animation
-
- bpy.context.scene.render.filepath = GLOBAL_OUTPUT_PATH + '/%04d'%sc.frame_current + bpy.context.scene.render.file_extension
-
- if sc.lanpr.composite_render_animation:
- #bpy.app.handlers.render_complete.append(lanpr_render_next_frame)
- global GC
- bpy.ops.render.render(scene=sc.name, write_still = write)
- else:
- #'INVOKE_DEAFULT' still cause trouble on windows.
- #bpy.ops.render.render(GC,'INVOKE_DEFAULT',scene=sc.name)
- bpy.ops.render.render(scene=sc.name)
-
-def lanpr_render_canceled(scene):
-
- bpy.app.handlers.render_complete.remove(lanpr_render_this_scene_next)
-
- bpy.app.handlers.render_cancel.remove(lanpr_render_canceled)
-
-def lanpr_render_backdrop_first(this_scene):
- s = lanpr_get_original_scene(this_scene)
- if not s: return
-
- s.frame_current = this_scene.frame_current
- #bpy.app.handlers.render_complete.append(lanpr_render_this_scene_next)
- bpy.ops.render.render(scene=s.name)
-
-class LANPR_render_composited(bpy.types.Operator):
- """Render Composited"""
- bl_idname = "lanpr.render_composited"
- bl_label = "Render Composited"
-
- @classmethod
- def poll(cls, context):
- return True
-
- def execute(self, context):
- if bpy.context.scene.lanpr.composite_render_animation:
- s = lanpr_get_original_scene(bpy.context.scene)
- bpy.context.scene.frame_current = bpy.context.scene.frame_start
- s.frame_current = bpy.context.scene.frame_start
- bpy.context.scene.frame_end = s.frame_end
- bpy.context.scene.render.filepath = s.render.filepath
-
- global GLOBAL_OUTPUT_PATH
- GLOBAL_OUTPUT_PATH = bpy.context.scene.render.filepath
-
- bpy.app.handlers.render_cancel.append(lanpr_render_canceled)
- global GC
- GC = bpy.context.copy()
-
- while True :
-
- #Seems that backdrop is now rendered ever time?
- #lanpr_render_backdrop_first(bpy.context.scene)
-
- lanpr_render_this_scene_next(bpy.context.scene)
-
- bpy.context.scene.frame_current = bpy.context.scene.frame_current+1
- if not bpy.context.scene.lanpr.composite_render_animation or bpy.context.scene.frame_current>bpy.context.scene.frame_end:
- bpy.context.scene.render.filepath = GLOBAL_OUTPUT_PATH
- return {'FINISHED'}
-
- return {'FINISHED'}
-
class LANPR_reset_object_transfromations(bpy.types.Operator):
"""Reset Transformations"""
bl_idname = "lanpr.reset_object_transfromations"
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 87968e1eab3..20c80badbcc 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1696,8 +1696,7 @@ typedef struct SceneLANPR {
float chaining_geometry_threshold;
float chaining_image_threshold;
- /* composite utility */
- int composite_render_animation;
+ int max_occlusion; /* Defaults to 1 to increase speed in complex scenes. */
} SceneLANPR;
More information about the Bf-blender-cvs
mailing list