fixes ui scene settings and clean
0.2.3 - fix: ui errors - fix: scene settings - fix: clean nodesmain
parent
89f48d90f9
commit
d52960acb9
|
@ -9,6 +9,12 @@ OR always duplicate (safe but heavy scenes...)
|
||||||
if duplicate, need to "connect" with namespace ('_duprender') or something
|
if duplicate, need to "connect" with namespace ('_duprender') or something
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
0.2.3
|
||||||
|
|
||||||
|
- fix: ui errors
|
||||||
|
- fix: scene settings
|
||||||
|
- fix: clean nodes
|
||||||
|
|
||||||
0.2.2
|
0.2.2
|
||||||
|
|
||||||
- feat: quick scene switch with a button in `node_editor > view`
|
- feat: quick scene switch with a button in `node_editor > view`
|
||||||
|
|
|
@ -117,7 +117,8 @@ class GPEXP_OT_clean_compo_tree(bpy.types.Operator):
|
||||||
|
|
||||||
if self.reorder_inputs:
|
if self.reorder_inputs:
|
||||||
for n in nodes:
|
for n in nodes:
|
||||||
if n.name.startswith('NG_'):
|
if n.type != 'GROUP' or not n.name.startswith('NG_'):
|
||||||
|
continue
|
||||||
fn.reorder_inputs(n)
|
fn.reorder_inputs(n)
|
||||||
fn.reorder_outputs(n)
|
fn.reorder_outputs(n)
|
||||||
|
|
||||||
|
@ -132,6 +133,9 @@ class GPEXP_OT_clean_compo_tree(bpy.types.Operator):
|
||||||
if out:
|
if out:
|
||||||
fn.reorder_fileout(out, ng=n)
|
fn.reorder_fileout(out, ng=n)
|
||||||
|
|
||||||
|
# Clear input that do not exists
|
||||||
|
fn.clean_nodegroup_inputs(n, skip_existing_pass=True)
|
||||||
|
|
||||||
if self.fo_clear_disconnected:
|
if self.fo_clear_disconnected:
|
||||||
for fo in nodes:
|
for fo in nodes:
|
||||||
if fo.type != 'OUTPUT_FILE':
|
if fo.type != 'OUTPUT_FILE':
|
||||||
|
|
|
@ -2,7 +2,7 @@ bl_info = {
|
||||||
"name": "GP exporter",
|
"name": "GP exporter",
|
||||||
"description": "Organise export of gp layers through compositor output",
|
"description": "Organise export of gp layers through compositor output",
|
||||||
"author": "Samuel Bernou",
|
"author": "Samuel Bernou",
|
||||||
"version": (0, 2, 2),
|
"version": (0, 2, 3),
|
||||||
"blender": (2, 93, 0),
|
"blender": (2, 93, 0),
|
||||||
"location": "View3D",
|
"location": "View3D",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
|
|
41
fn.py
41
fn.py
|
@ -28,11 +28,34 @@ def new_aa_node(tree):
|
||||||
return aa
|
return aa
|
||||||
|
|
||||||
|
|
||||||
|
def copy_settings(obj_a, obj_b):
|
||||||
|
exclusion = ['bl_rna', 'id_data', 'identifier','name_property','rna_type','properties', 'stamp_note_text','use_stamp_note',
|
||||||
|
'settingsFilePath', 'settingsStamp', 'select', 'matrix_local', 'matrix_parent_inverse',
|
||||||
|
'matrix_basis','location','rotation_euler', 'rotation_quaternion', 'rotation_axis_angle', 'scale']
|
||||||
|
|
||||||
|
for attr in dir(obj_a):
|
||||||
|
if attr.startswith('__'):
|
||||||
|
continue
|
||||||
|
if attr in exclusion:
|
||||||
|
continue
|
||||||
|
# print('attr: ', attr)
|
||||||
|
# if obj_a.is_property_readonly(attr): # block when things aren't attribute
|
||||||
|
# continue
|
||||||
|
try:
|
||||||
|
val = getattr(obj_a, attr)
|
||||||
|
except AttributeError:
|
||||||
|
print(f'cant get {attr}')
|
||||||
|
|
||||||
|
try:
|
||||||
|
setattr(obj_b, attr, val)
|
||||||
|
except:
|
||||||
|
print(f"can't set {attr}")
|
||||||
|
|
||||||
|
|
||||||
def set_settings(scene=None):
|
def set_settings(scene=None):
|
||||||
if not scene:
|
if not scene:
|
||||||
scene = bpy.context.scene
|
scene = bpy.context.scene
|
||||||
# specify scene settings for these kind of render
|
# specify scene settings for these kind of render
|
||||||
scene = bpy.context.scene
|
|
||||||
scene.eevee.taa_render_samples = 1
|
scene.eevee.taa_render_samples = 1
|
||||||
scene.grease_pencil_settings.antialias_threshold = 0
|
scene.grease_pencil_settings.antialias_threshold = 0
|
||||||
scene.render.film_transparent = True
|
scene.render.film_transparent = True
|
||||||
|
@ -43,13 +66,21 @@ def get_render_scene():
|
||||||
'''Get / Create a scene named Render'''
|
'''Get / Create a scene named Render'''
|
||||||
render = bpy.data.scenes.get('Render')
|
render = bpy.data.scenes.get('Render')
|
||||||
if not render:
|
if not render:
|
||||||
|
current = bpy.context.scene
|
||||||
render = bpy.data.scenes.new('Render')
|
render = bpy.data.scenes.new('Render')
|
||||||
|
## copy original settings over to new scene
|
||||||
|
# copy_settings(current, render) # BAD
|
||||||
|
for attr in ['frame_start', 'frame_end']:
|
||||||
|
setattr(render, attr, getattr(current, attr))
|
||||||
|
copy_settings(current.render, render.render)
|
||||||
|
|
||||||
## link cameras (and lights ?)
|
## link cameras (and lights ?)
|
||||||
for ob in bpy.context.scene.objects:
|
for ob in bpy.context.scene.objects:
|
||||||
if ob.type in ('CAMERA', 'LIGHT'):
|
if ob.type in ('CAMERA', 'LIGHT'):
|
||||||
render.collection.objects.link(ob)
|
render.collection.objects.link(ob)
|
||||||
|
|
||||||
|
render.camera = current.camera
|
||||||
|
|
||||||
# set adapted render settings (no AA)
|
# set adapted render settings (no AA)
|
||||||
set_settings(render)
|
set_settings(render)
|
||||||
render.use_nodes = True
|
render.use_nodes = True
|
||||||
|
@ -289,12 +320,16 @@ def clear_nodegroup_content_if_disconnected(ngroup):
|
||||||
if not connect_to_group_input(n) and not connect_to_group_output(n): # is disconnected from both side
|
if not connect_to_group_input(n) and not connect_to_group_output(n): # is disconnected from both side
|
||||||
ngroup.nodes.remove(n)
|
ngroup.nodes.remove(n)
|
||||||
|
|
||||||
def clean_nodegroup_inputs(ng):
|
def clean_nodegroup_inputs(ng, skip_existing_pass=True):
|
||||||
'''Clear inputs to output of passed nodegroup if not connected'''
|
'''Clear inputs to output of passed nodegroup if not connected'''
|
||||||
ngroup = ng.node_tree
|
ngroup = ng.node_tree
|
||||||
|
rl_nodes = [n.layer for n in ng.id_data.nodes if n.type == 'R_LAYERS']
|
||||||
for i in range(len(ng.inputs))[::-1]:
|
for i in range(len(ng.inputs))[::-1]:
|
||||||
print(i)
|
print(i)
|
||||||
if not ng.inputs[i].is_linked: # and not any(x.layer == s.name for x in rl_nodes)
|
if not ng.inputs[i].is_linked:
|
||||||
|
if skip_existing_pass and any(ng.inputs[i].name == x for x in rl_nodes):
|
||||||
|
# a render layer of this name still exists
|
||||||
|
continue
|
||||||
ngroup.inputs.remove(ngroup.inputs[i])
|
ngroup.inputs.remove(ngroup.inputs[i])
|
||||||
|
|
||||||
# clear_nodegroup_content_if_disconnected(ngroup)
|
# clear_nodegroup_content_if_disconnected(ngroup)
|
||||||
|
|
4
ui.py
4
ui.py
|
@ -40,7 +40,11 @@ class GPEXP_PT_gp_node_ui(Panel):
|
||||||
|
|
||||||
row = col.row()
|
row = col.row()
|
||||||
n = context.scene.node_tree.nodes.active
|
n = context.scene.node_tree.nodes.active
|
||||||
|
if n:
|
||||||
row.enabled = n and n.type == 'R_LAYERS' and not n.outputs[0].is_linked
|
row.enabled = n and n.type == 'R_LAYERS' and not n.outputs[0].is_linked
|
||||||
|
else:
|
||||||
|
row.enabled = False
|
||||||
|
|
||||||
row.operator('gp.reconnect_render_layer', icon='ANIM', text='Reconnect')
|
row.operator('gp.reconnect_render_layer', icon='ANIM', text='Reconnect')
|
||||||
|
|
||||||
col.operator('gp.clean_compo_tree', icon='BRUSHES_ALL', text='Clean Nodes') # NODE_CORNER
|
col.operator('gp.clean_compo_tree', icon='BRUSHES_ALL', text='Clean Nodes') # NODE_CORNER
|
||||||
|
|
Loading…
Reference in New Issue