User Tools

Site Tools


blender_export_opengl

====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

blender_export_opengl [2015/08/20 15:44]
flavio created
blender_export_opengl [2015/08/20 15:45] (current)
flavio
Line 1: Line 1:
 This code captures the 3d view and save an image in the provided outputPath This code captures the 3d view and save an image in the provided outputPath
 +<code python>
 +import bpy
  
-  import bpy + 
-   +def captGL(outputPath):​ 
-  ​ +    '''​Capture opengl in blender viewport and save the render'''​ 
-  def captGL(outputPath):​ +    # save current render outputPath 
-      '''​Capture opengl in blender viewport and save the render'''​ +    temp = bpy.context.scene.render.filepath 
-      # save current render outputPath +    # Update output 
-      temp = bpy.context.scene.render.filepath +    bpy.context.scene.render.filepath = outputPath 
-      # Update output +    # render opengl and write the render 
-      bpy.context.scene.render.filepath = outputPath +    bpy.ops.render.opengl(write_still=True) 
-      # render opengl and write the render +    # restore previous output path 
-      bpy.ops.render.opengl(write_still=True) +    bpy.context.scene.render.filepath = temp 
-      # restore previous output path + 
-      bpy.context.scene.render.filepath = temp +# Capture the opengl view and save it in the provided path 
-   +captGL("/​u/​temp/​tmp.png"​) 
-  # Capture the opengl view and save it in the provided path +</​code>​
-  captGL("/​u/​temp/​tmp.png"​)+
blender_export_opengl.1440085485.txt.gz · Last modified: 2015/08/20 15:44 by flavio