custom_shelf/devshelf/Tool/rendu/rd2_render_openGL.py

39 lines
859 B
Python
Raw Normal View History

2022-03-04 12:28:53 +01:00
info = {
'icon' : 'RENDER_ANIMATION',
'description' : 'render this viewport openGL',
}
import bpy
import os
from os import listdir
from os.path import join, dirname, basename, exists, isfile, isdir, splitext
import re, fnmatch, glob
from mathutils import Vector, Matrix
from math import radians, degrees
from time import time
import datetime
C = bpy.context
D = bpy.data
scn = scene = C.scene
rd = scn.render
def render_anim(GL=False):
#openGl render
if GL:
bpy.ops.render.opengl(animation=True, view_context=True)#view_context False > look throughcam
else:
bpy.ops.render.render(animation=True)
start = time()
render_anim(GL=True)
secs = time() - start
timesec_str = f'elapsed {secs} seconds'
time_str = str(datetime.timedelta(seconds=secs))
print(timesec_str)
print(time_str)
C.window_manager.clipboard = time_str