fix node coloring

main
Pullusb 2021-09-17 18:36:15 +02:00
parent 364b45e473
commit df0231ac28
3 changed files with 20 additions and 7 deletions

View File

@ -167,7 +167,7 @@ class GPEXP_OT_merge_selected_dopesheet_layers(bpy.types.Operator):
rlayers.append(rl)
color = None
if not any(isclose(i, 0.2, abs_tol=0.0001) for i in act.channel_color): # and bpy.context.preferences.edit.use_anim_channel_group_colors
if fn.has_channel_color(act): # and bpy.context.preferences.edit.use_anim_channel_group_colors
color = act.channel_color
merge_layers(rlayers, disconnect=self.disconnect, color=color)

17
fn.py
View File

@ -2,7 +2,7 @@ import bpy
import re
from mathutils import Vector
from pathlib import Path
from math import isclose
from collections import defaultdict
@ -21,8 +21,8 @@ def create_node(type, tree=None, **kargs):
def new_aa_node(tree):
'''create AA node'''
aa = create_node('CompositorNodeAntiAliasing', tree) # type = ANTIALIASING
aa.threshold = 0.5
aa.contrast_limit = 0.5
aa.threshold = 0.5 # 1.0
aa.contrast_limit = 0.5 # 0.25
aa.corner_rounding = 0.25
aa.hide = True
return aa
@ -72,7 +72,7 @@ def get_render_scene():
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']:
for attr in ['frame_start', 'frame_end', 'frame_current', 'camera', 'world']:
setattr(render, attr, getattr(current, attr))
copy_settings(current.render, render.render)
@ -82,8 +82,8 @@ def get_render_scene():
render.collection.objects.link(ob)
# use same cam and world
render.camera = current.camera
render.world = current.world
# render.camera = current.camera
# render.world = current.world
# set adapted render settings (no AA)
set_settings(render)
@ -523,6 +523,11 @@ def renumber_keep_existing(fo, offset=10):
ct += offset
def has_channel_color(layer):
'''Return True if gp_layer.channel_color is different than the default (0.2, 0.2, 0.2) '''
if not any(isclose(i, 0.2, abs_tol=0.001) for i in layer.channel_color):
return True
## confirm pop-up message:
def show_message_box(_message = "", _title = "Message Box", _icon = 'INFO'):
def draw(self, context):

View File

@ -285,6 +285,10 @@ def get_set_viewlayer_from_gp(ob, l, scene=None):
cp = add_rlayer(vl_name, scene=scene, location=loc)
cp.parent = frame
# use same color as layer
if fn.has_channel_color(l):
cp.use_custom_color = True
cp.color = l.channel_color
connect_render_layer(cp, frame=frame)
@ -302,6 +306,10 @@ def get_set_viewlayer_from_gp(ob, l, scene=None):
print(f'problem with {cp}: {cp.layer} != {vl_name}')
return
if fn.has_channel_color(l):
cp.use_custom_color = True
cp.color = l.channel_color
frame = [f for f in nodes if f.type == 'FRAME' and f.label == ob.name][0]
rl_nodes = frame_dic[frame.label] # get nodes from
if rl_nodes: