def create_render_pass(name): with Modifier() as mod: render_pass = mod.createnode(name, type='RenderPass') mod.connect(render_pass.Width, Document().ProjectWidth) mod.connect(render_pass.Height, Document().ProjectHeight) mod.connect(render_pass.AspectRatio, Document().ProjectAspectRatio) return render_pass
def set_range(): asset = asset_core.string_to_asset(os.environ[defaults._asset_var_]) range = prefs().asset(asset).name.range start = int(range[0]) end = int(range[-1]) Document().FirstFrame.set(start) Document().LastFrame.set(end)
def openAsset(self): assetDir = project_dir + '/prod/assets' assetType = str(self.typeBox.currentText()) assetName = str(self.assetBox.currentText()) assetVersion = str(self.versionBox.currentText()) asset_file = assetDir + '/' + assetType + '/' + assetName + '/lookdev/guerilla/' + assetVersion + '/lookdev.gproject' d = Document() d.load(asset_file)
def openFolder(self): import subprocess doc = Document() file_name = doc.getfilename() charvalue = str(file_name).split('/') charvalue.pop(-1) charvalue.pop(-1) charvalue.pop(-1) file_name = '\\'.join(charvalue) subprocess.call('explorer ' + file_name, shell=True)
def set_format(half=None): format = prefs().format if not half: width = format[0] height = format[1] else: width = int(format[0]) / 2 height = int(format[1]) / 2 Document().ProjectWidth.set(width) Document().ProjectHeight.set(height) Document().ProjectAspectRatio.set(1)
def openAsset(self): assSeq = str(self.assSeq.currentText()) assetDir = project_dir + '/prod/' + assSeq assetType = str(self.typeBox.currentText()) assetName = str(self.assetBox.currentText()) assetVersion= str(self.versionBox.currentText()) if assSeq == 'assets': asset_file = assetDir + '/' + assetType + '/' + assetName + '/lookdev/guerilla/' + assetVersion + '/lookdev.gproject' elif assetName == 'lookdev': asset_file = assetDir + '/' + assetType + '/' + assetName + '/guerilla/' + assetVersion + '/lookdev.gproject' else: asset_file = assetDir + '/' + assetType + '/shots/' + assetName + '/lookdev/guerilla/' + assetVersion + '/lookdev.gproject' d = Document() d.load(asset_file)
def save(): asset = asset_core.string_to_asset(os.environ[defaults._asset_var_]) asset.version = prefs().asset(asset).software.get_new_version() Document().save(asset.file) string_asset = utils.asset_to_string(asset) os.environ[defaults._asset_var_] = string_asset send_signal.save_request_signal(asset.file, string_asset)
from variables import * from guerilla import Document, Modifier, pynode import guerilla import utils.get_extension as ext import os import sys import grender.render as render import grender.scene_init li = liquerillaInit() doc = Document() # ------------------------------------------------------------------------- # IMPORTE L'ASSET DANS GUERILLA ET CREE UNE V000 # # # bugs a fixer : # # - taille en 720/720 (carre semble bien pour assets) - OK # - cyclo a bien centrer, cam, ect... - OK # - RenderPass a NE PAS EXPORTER - OK # - Geometry a NE PAS EXPORTER - OK # - Integrer deadline pour rendus tests / ou mettre ces tests ? - OK # - Virer dossier "wip" ailleurs # - Passer en mode "tags" # - Changer render_path (render.build_path) - OK # - # ------------------------------------------------------------------------- suffix_rg = '__rg' doc.new(warn=False)
def export_cyclo(asset): file = asset.export('{}_{}'.format(asset.name, asset.variant), from_asset=asset) Document().save(file) save() wall.wall().publish_event(asset)
def get_all_nodes(): nodes_list = [] for node in Document().children(recursive=True): nodes_list.append(node.getname()) return nodes_list
def __init__(self): self.renderpass = guerillabank self.charvalue = None self.doc = Document()
class liquerillaInit(): def __init__(self): self.renderpass = guerillabank self.charvalue = None self.doc = Document() def clear_variables(self): ''' Flushes the cache of the RenderPass and go back to the variable of you project. ''' self.renderpass = guerillabank def scene_location(self): file_name = self.doc.getfilename() self.charvalue = str(file_name).split('/') if not project_name in self.charvalue: raise ValueError('You are not working in the project !') def clear_rPasses(self): for renderpass in self.doc.children(type="RenderPass", recursive=True): with Modifier() as mod: mod.deletenode(renderpass) def set_layer(self): self.clear_variables() self.scene_location() self.clear_rPasses() print(self.charvalue) if 'seq' in self.charvalue: self.renderpass += '/renderPass_sequence.glayer' else: self.renderpass += '/renderPass_asset.glayer' self.doc.loadfile(self.renderpass) def get_fileversion(self): self.scene_location() print('You are working on ' + self.charvalue[-2]) def get_Rpass(self): rList = [] for renderpass in self.doc.children(type="RenderPass", recursive=True): rList.append(renderpass) if not len(rList) == 1: raise ValueError( 'You Must have only one RenderPass in your scene.') rPass = rList[0] return rPass def set_gamma(self, g=1): ''' Sets the Project Gamma to a float value you enter. Linear = 1 sRGB = 2.2 set_gamma(1) ''' self.doc.Preferences.ProjectGamma.set(g)
from variables import * from guerilla import Document, pynode, Modifier import guerilla import utils.get_extension as ext import padding_numbers import os import sys import datetime import grender.scene_init li = grender.scene_init.liquerillaInit() doc = Document() # -------------------------------------------- # # RENDER WITH GUERILLA # # # - empecher de faire des trucs si on nest pas dans le projet # - log (lance de quelle version, quelle heure, ect...) # # Parametres pour rendu # # ecrire <liquefacteur_> + <HD_/LD_/TEST_> + <nom_du_rendu> # # LD = frames illimitees mais timeout 10min / priority 50 max. # HD = frames illimitees et temps illimite / priority 49 max. # TEST = 3 frames mais temps illimite / priority 75 max. # # # --------------------------------------------
def get_all_lights(): lights_list = [] for light in Document().children(recursive=True, type="Light"): lights_list.append(light) return lights_list
def get_node_from_name(name): nodes_list = [] for node in Document().children(recursive=True): if node.getname() == name: break return node
def import_light_rig(reload=0): asset_list = get_asset_list() for imported_asset in asset_list: if imported_asset[0].stage == defaults._light_rig_: if imported_asset[1] in get_all_nodes(): if reload: lr_GRP = add_GRP('LIGHT_RIGS') lr_GRP.getchild(imported_asset[1]).delete() rg_node = Document().loadfile(imported_asset[2])[0] rg_node.move(lr_GRP) rg_node.rename(imported_asset[1]) else: if not reload: lr_GRP = add_GRP('LIGHT_RIGS') rg_node = Document().loadfile(imported_asset[2])[0] rg_node.move(lr_GRP) rg_node.rename(imported_asset[1])
def import_render_graph(reload=0): asset_list = get_asset_list() for imported_asset in asset_list: if imported_asset[0].stage == defaults._render_graph_: if imported_asset[1] in get_all_nodes(): if reload: rg_GRP = add_GRP('RENDER_GRAPHS') rg_GRP.getchild(imported_asset[1]).delete() rg_node = Document().loadfile(imported_asset[2])[0] rg_node.move(rg_GRP) rg_node.rename(imported_asset[1]) else: if not reload: rg_GRP = add_GRP('RENDER_GRAPHS') rg_node = Document().loadfile(imported_asset[2])[0] rg_node.move(rg_GRP) rg_node.rename(imported_asset[1])
def import_shading(reload=0): asset_list = get_asset_list() for imported_asset in asset_list: if imported_asset[0].stage == defaults._shading_: if imported_asset[1] in get_all_nodes(): if reload: shading_GRP = add_GRP('SHADING') shading_GRP.getchild(imported_asset[1]).delete() rg_node = Document().loadfile(imported_asset[2])[0] rg_node.move(shading_GRP) rg_node.rename(imported_asset[1]) else: if not reload: shading_GRP = add_GRP('SHADING') rg_node = Document().loadfile(imported_asset[2])[0] rg_node.move(shading_GRP) rg_node.rename(imported_asset[1])
def set_frame_rate(): frame_rate = prefs().frame_rate Document().Preferences.FrameRate.set(frame_rate)
def get_all_render_passes(): rp_list = [] for rp in Document().children(recursive=True, type="RenderPass"): rp_list.append(rp) return rp_list