custom_shelf/devshelf/Tool/rendu/rd2_render.py

40 lines
838 B
Python

info = {
'icon' : 'RENDER_ANIMATION',
'description' : 'render timed',
}
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()
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