def make_draw_material_quad(stage, node_group, node, context_index=1): stage['command'] = 'draw_material_quad' material_context = node.inputs[context_index].default_value stage['params'].append(material_context) # Include data and shaders shader_context = node.inputs[context_index].default_value scon = shader_context.split('/') dir_name = scon[2] # No world defs for material passes data_name = scon[2] assets.add_shader2(dir_name, data_name)
def make_draw_quad(stage, node_group, node, context_index=1, shader_context=None): stage['command'] = 'draw_shader_quad' # Append world defs to get proper context world_defs = bpy.data.worlds['Arm'].world_defs if shader_context == None: shader_context = node.inputs[context_index].default_value scon = shader_context.split('/') stage['params'].append(scon[0] + world_defs + '/' + scon[1] + world_defs + '/' + scon[2]) # Include data and shaders dir_name = scon[0] # Append world defs data_name = scon[1] + world_defs assets.add_shader2(dir_name, data_name)
def make_draw_compositor(stage, node_group, node, with_fxaa=False): scon = 'compositor_pass' wrd = bpy.data.worlds['Arm'] world_defs = wrd.world_defs + wrd.rp_defs compositor_defs = make_compositor.parse_defs( bpy.data.scenes[0].node_tree) # Thrown in scene 0 for now compositor_defs += '_CTone' + wrd.generate_tonemap # Additional compositor flags compo_depth = False # Read depth # compo_pos = False # Construct position from depth if with_fxaa: # FXAA directly in compositor, useful for forward path compositor_defs += '_CFXAA' if wrd.generate_letterbox: compositor_defs += '_CLetterbox' if wrd.generate_grain: compositor_defs += '_CGrain' if bpy.data.scenes[0].cycles.film_exposure != 1.0: compositor_defs += '_CExposure' if wrd.generate_fog: compositor_defs += '_CFog' # compo_pos = True if build_node_tree.cam.dof_distance > 0.0: compositor_defs += '_CDOF' compo_depth = True # if compo_pos: # compositor_defs += '_CPos' # compo_depth = True if compo_depth: compositor_defs += '_CDepth' if wrd.generate_lens_texture != '': compositor_defs += '_CLensTex' assets.add_embedded_data('lenstexture.jpg') if wrd.generate_fisheye: compositor_defs += '_CFishEye' if wrd.generate_vignette: compositor_defs += '_CVignette' wrd.compo_defs = compositor_defs defs = world_defs + compositor_defs data_name = scon + defs stage['command'] = 'draw_shader_quad' stage['params'].append(data_name + '/' + data_name + '/' + scon) # Include data and shaders assets.add_shader2(scon, data_name)
def write_output(output): # Add datas to khafile dir_name = 'world' # Append world defs wrd = bpy.data.worlds['Arm'] data_name = 'world' + wrd.world_defs + wrd.rp_defs # Reference correct shader context dat = output['material_datas'][0] dat['shader'] = data_name + '/' + data_name assets.add_shader2(dir_name, data_name) # Write material json path = 'build/compiled/Assets/materials/' asset_path = path + dat['name'] + '.arm' armutils.write_arm(asset_path, output) assets.add(asset_path)
def make_draw_quad(stage, node_group, node, context_index=1, shader_context=None): stage['command'] = 'draw_shader_quad' # Append world defs to get proper context world_defs = bpy.data.worlds['Arm'].world_defs + bpy.data.worlds[ 'Arm'].rp_defs if shader_context == None: shader_context = node.inputs[context_index].default_value scon = shader_context.split('/') stage['params'].append(scon[0] + world_defs + '/' + scon[1] + world_defs + '/' + scon[2]) # Include data and shaders dir_name = scon[0] # Append world defs data_name = scon[1] + world_defs assets.add_shader2(dir_name, data_name)
def make_draw_compositor(stage, node_group, node, with_fxaa=False): scon = 'compositor_pass' wrd = bpy.data.worlds['Arm'] world_defs = wrd.world_defs compositor_defs = make_compositor.parse_defs(bpy.data.scenes[0].node_tree) # Thrown in scene 0 for now # Additional compositor flags compo_depth = False # Read depth # compo_pos = False # Construct position from depth if with_fxaa: # FXAA directly in compositor, useful for forward path compositor_defs += '_CompoFXAA' if wrd.generate_letterbox: compositor_defs += '_CompoLetterbox' if wrd.generate_grain: compositor_defs += '_CompoGrain' if bpy.data.scenes[0].cycles.film_exposure != 1.0: compositor_defs += '_CompoExposure' if wrd.generate_fog: compositor_defs += '_CompoFog' # compo_pos = True if build_node_tree.cam.dof_distance > 0.0: compositor_defs += '_CompoDOF' compo_depth = True # if compo_pos: # compositor_defs += '_CompoPos' # compo_depth = True if compo_depth: compositor_defs += '_CompoDepth' wrd.compo_defs = compositor_defs defs = world_defs + compositor_defs data_name = scon + defs stage['command'] = 'draw_shader_quad' stage['params'].append(data_name + '/' + data_name + '/' + scon) # Include data and shaders assets.add_shader2(scon, data_name)