Copying visualizer settings from upstream

Hi guys,

A cool little feature would be to be able to copy the visualizer settings from the first upstream node that has the visualizer activated.
Maybe even to that by default when the node is created?
Thoughts?

Cheers,
frank

I wrote this snippet for now which adds an option to the properties context menu called “Pull Eddy Viz Settings”. Seems useful:
import nuke

    def traverse_upstream(node):
        '''Find the first upstream node that has it's visualizer turned on and return it'''
        input_node = node.input(0) # only care about main pipe
        
        if 'draw_enabled' in input_node.knobs() and input_node['draw_enabled'].value():
            return input_node
        else:
            travers_upstream(input_node)

    def copy_values(src, trg):
        '''Copy values from src to trg from a predefined set of knobs'''
        src_knobs = ('resolution__s', 'width', 'draw_bounds', 'draw_subbounds', 'force_sdf', 'ss_mult_primary',
                     'ss_mult_secondary', 'density_gain', 'shadow_density_gain', 'light_color', 'light_position',
                     'vector_steps', 'vector_scale', 'vector_min_length', 'vector_max_length', 'vector_transparency',
                     'draw_axis_handles_rec', 'draw_field_selected', 'use_crop_bounds')
        for k in src_knobs:
            trg[k].setValue(src[k].value())

    def copy_viz_values():
        '''Copy vizualiser settings form the first upstream node that has the visulaizer turned on'''
        node = nuke.selectedNode()
        src_node = traverse_upstream(node)
        copy_values(src_node, node)

    ## add to menu.py:
    # import eddy_helpers
    # menu = nuke.menu('Properties')
    # menu.addCommand('Pull Eddy Viz Setings', eddy_helpers.copy_viz_values)
1 Like