custom_shelf initial commit

This commit is contained in:
Cos_Min
2022-03-04 12:28:53 +01:00
parent 705b6f2017
commit 232e5cc7f6
45 changed files with 4221 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
# coding: utf-8
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
C = bpy.context
D = bpy.data
scene = C.scene
print('====')
'''
for i in range(0, 8):
ao = i * 0.25
scene.eevee.gtao_distance = ao
scene.render.filepath = join(dirname(D.filepath), f'{splitext(basename(D.filepath))[0]}-{scene.frame_current}_AO{i}-{ao}')
bpy.ops.render.render(animation=False, write_still=True)
'''
for i in range(0, 8):
fac = 1 - i * 0.1
#scene.eevee.gtao_distance = ao
scene.eevee.gtao_factor = fac
scene.render.filepath = join(dirname(D.filepath), f'{splitext(basename(D.filepath))[0]}-{scene.frame_current}_AOfac{i}-{fac}')
bpy.ops.render.render(animation=False, write_still=True)
print('done')
+37
View File
@@ -0,0 +1,37 @@
# coding: utf-8
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
C = bpy.context
D = bpy.data
scene = C.scene
print('====')
def more_sss(val=0.04):
for mat in D.materials:
if not mat.use_nodes:continue
nodes = mat.node_tree
if not nodes: continue
nodes = nodes.nodes
for n in nodes:
if n.type == 'GROUP':
sss = n.inputs.get('Subsurface')
if not sss: continue
#print(f'{mat.name} : {sss.default_value}')
current = sss.default_value
new = current + val
print(f'{mat.name} : {current} >> {new}')
sss.default_value = new
value = 0.06
for i in range(0, 8):
scene.render.filepath = join(dirname(D.filepath), f'{splitext(basename(D.filepath))[0]}-{scene.frame_current}_sss_plus_0.{str(i*6).zfill(2)}')
bpy.ops.render.render(animation=False, write_still=True)
more_sss(value)
+32
View File
@@ -0,0 +1,32 @@
# coding: utf-8
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
C = bpy.context
D = bpy.data
scene = C.scene
print('====')
def print_sss():
for mat in D.materials:
if not mat.use_nodes:continue
nodes = mat.node_tree
if not nodes: continue
nodes = nodes.nodes
for n in nodes:
if n.type == 'GROUP':
sss = n.inputs.get('Subsurface')
if not sss: continue
print(f'{mat.name} : {sss.default_value}')
if n.type == 'BSDF_PRINCIPLED':
sss = n.inputs.get('Subsurface')
if not sss: continue
print(f'PRINCIPLED : {mat.name} : {sss.default_value}')
print_sss()
@@ -0,0 +1,58 @@
info = {
'icon' : 'LINENUMBERS_ON',
'description' : 'Note and render',
'render' : False,
}
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
C = bpy.context
D = bpy.data
scene = C.scene
print('====')
scene.render.use_stamp_note = True
dist = scene.eevee.gtao_distance
fac = scene.eevee.gtao_factor
print('dist: ', dist)
print('fac: ', fac)
dist = round(dist, 2)
fac = round(fac, 2)
scene.render.stamp_note_text = f'AO dist {dist} fac {fac}'
if scene.view_settings.look != 'Filmic - Medium Contrast':
scene.render.stamp_note_text += f' - {scene.view_settings.look}'
org = scene.render.filepath
print(f'filepath was : {org}')
## full filename
# scene.render.filepath = join(dirname(D.filepath), f'{splitext(basename(D.filepath))[0]}-{scene.frame_current}_AO-dist{dist}-fac{fac}')
## custom filename
ep = int(re.search(r"(\d{3})", splitext(basename(D.filepath))[0]).group(1))
print('ep: ', ep)
scene.render.filepath = join(dirname(D.filepath), f'twu_{ep}-{scene.frame_current}_AO-dist{dist}-fac{fac}')
i = 2#increment if needed
while exists(scene.render.filepath + '.png'):
scene.render.filepath = join(dirname(D.filepath), f'twu_{ep}-{scene.frame_current}_AO-dist{dist}-fac{fac}_{i}')
if info['render']:
bpy.ops.render.render(animation=False, write_still=True)
# restore old sauce ?
scene.render.filepath = org
print('done')