fix node coloring
parent
364b45e473
commit
df0231ac28
|
@ -167,7 +167,7 @@ class GPEXP_OT_merge_selected_dopesheet_layers(bpy.types.Operator):
|
||||||
rlayers.append(rl)
|
rlayers.append(rl)
|
||||||
|
|
||||||
color = None
|
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
|
color = act.channel_color
|
||||||
merge_layers(rlayers, disconnect=self.disconnect, color=color)
|
merge_layers(rlayers, disconnect=self.disconnect, color=color)
|
||||||
|
|
||||||
|
|
17
fn.py
17
fn.py
|
@ -2,7 +2,7 @@ import bpy
|
||||||
import re
|
import re
|
||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from math import isclose
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ def create_node(type, tree=None, **kargs):
|
||||||
def new_aa_node(tree):
|
def new_aa_node(tree):
|
||||||
'''create AA node'''
|
'''create AA node'''
|
||||||
aa = create_node('CompositorNodeAntiAliasing', tree) # type = ANTIALIASING
|
aa = create_node('CompositorNodeAntiAliasing', tree) # type = ANTIALIASING
|
||||||
aa.threshold = 0.5
|
aa.threshold = 0.5 # 1.0
|
||||||
aa.contrast_limit = 0.5
|
aa.contrast_limit = 0.5 # 0.25
|
||||||
aa.corner_rounding = 0.25
|
aa.corner_rounding = 0.25
|
||||||
aa.hide = True
|
aa.hide = True
|
||||||
return aa
|
return aa
|
||||||
|
@ -72,7 +72,7 @@ def get_render_scene():
|
||||||
render = bpy.data.scenes.new('Render')
|
render = bpy.data.scenes.new('Render')
|
||||||
## copy original settings over to new scene
|
## copy original settings over to new scene
|
||||||
# copy_settings(current, render) # BAD
|
# 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))
|
setattr(render, attr, getattr(current, attr))
|
||||||
copy_settings(current.render, render.render)
|
copy_settings(current.render, render.render)
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ def get_render_scene():
|
||||||
render.collection.objects.link(ob)
|
render.collection.objects.link(ob)
|
||||||
|
|
||||||
# use same cam and world
|
# use same cam and world
|
||||||
render.camera = current.camera
|
# render.camera = current.camera
|
||||||
render.world = current.world
|
# render.world = current.world
|
||||||
|
|
||||||
# set adapted render settings (no AA)
|
# set adapted render settings (no AA)
|
||||||
set_settings(render)
|
set_settings(render)
|
||||||
|
@ -523,6 +523,11 @@ def renumber_keep_existing(fo, offset=10):
|
||||||
ct += offset
|
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:
|
## confirm pop-up message:
|
||||||
def show_message_box(_message = "", _title = "Message Box", _icon = 'INFO'):
|
def show_message_box(_message = "", _title = "Message Box", _icon = 'INFO'):
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
|
|
|
@ -285,6 +285,10 @@ def get_set_viewlayer_from_gp(ob, l, scene=None):
|
||||||
|
|
||||||
cp = add_rlayer(vl_name, scene=scene, location=loc)
|
cp = add_rlayer(vl_name, scene=scene, location=loc)
|
||||||
cp.parent = frame
|
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)
|
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}')
|
print(f'problem with {cp}: {cp.layer} != {vl_name}')
|
||||||
return
|
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]
|
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
|
rl_nodes = frame_dic[frame.label] # get nodes from
|
||||||
if rl_nodes:
|
if rl_nodes:
|
||||||
|
|
Loading…
Reference in New Issue