def create_render_graph(name): if name not in reference_asset.get_all_nodes(): render_graph = Node.create(name, 'RenderGraph') #rg.move(shaders_GRP) else: render_graph = None return render_graph
def create_new_aov(name, parent, plug=None): with Modifier() as mod: if name not in reference_asset.get_all_nodes(): aov = mod.createnode(name, type='LayerOut', parent=parent) else: aov = reference_asset.get_node_from_name(name) if plug: aov.PlugName.set(plug) return aov
def export_GRP(grp_name, file): if grp_name in get_all_nodes(): node = pynode(grp_name) node.savefile(file) return 1 else: logger.warning( 'Please create a node named "{}" with all the things you wants to export' .format(grp_name)) return 0
def export_node(file, node_name, asset): if node_name in get_all_nodes(): node = pynode(node_name) if type(node).__name__ == defaults._guerilla_node_type_: node.savefile(file) save() wall.wall().publish_event(asset) else: logger.warning('Node "{}" is missing'.format(node_name)) else: logger.warning('Node "{}" is missing'.format(node_name))
def create_shot_rp(self): delete_default_pass() if self.pass_name not in reference_asset.get_all_nodes(): self.main_render_pass = create_render_pass(self.pass_name) else: self.main_render_pass = reference_asset.get_node_from_name( self.pass_name) self.main_render_pass.DisplayDriver.set('exr') if self.main_layer_name not in reference_asset.get_all_nodes(): self.main_layer = create_new_layer(self.main_layer_name, self.main_render_pass) else: self.main_layer = reference_asset.get_node_from_name( self.main_layer_name) layering_rg = create_render_graph(self.main_rg_name) if layering_rg: self.fill_render_main_graph(layering_rg, self.main_layer) create_beauty_aov(self.main_aov_name, self.main_layer)
def add_lighting_layer_to_rg(self, rg, layer): if self.lighting_layer_rg_node not in reference_asset.get_all_nodes(): main_layer_rg_node = reference_asset.get_node_from_name( self.main_layer_rg_node) main_output_rg_node = reference_asset.get_node_from_name( self.output_rg_node) lighting_layer = rg.loadfile( "$(LIBRARY)/rendergraph/renderlayer.gnode") lighting_layer[0].rename(self.lighting_layer_rg_node) lighting_layer[0].Membership.set('layer:{}'.format( layer.getname())) lighting_layer[0].Input1.Plug.connect( main_layer_rg_node.Output1.Plug) main_output_rg_node.Input1.Plug.disconnect( main_layer_rg_node.Output1.Plug) main_output_rg_node.Input1.Plug.connect( lighting_layer[0].Output1.Plug)
def create_lighting_layer(self): if self.lighting_layer_name not in reference_asset.get_all_nodes(): self.lighting_layer = create_new_layer(self.lighting_layer_name, self.main_render_pass) else: self.lighting_layer = reference_asset.get_node_from_name( self.lighting_layer_name) for light in get_all_lights(): add_light_category(light) aov_name = 'lgt_{}'.format(light.getname()) aov = create_new_aov(aov_name, self.lighting_layer, aov_name) aov.LightCategories.set(light.getname()) aov.AcceptPath.set('All') aov.IgnorePath.set('Caustics') self.add_lighting_layer_to_rg( reference_asset.get_node_from_name(self.main_rg_name), self.lighting_layer)
def delete_default_pass(): with Modifier() as mod: if 'RenderPass' in reference_asset.get_all_nodes(): mod.deletenode(reference_asset.get_node_from_name('RenderPass'))