forked from LeenkxTeam/LNXSDK
Update
This commit is contained in:
@ -1007,7 +1007,7 @@ def make_texture(
|
||||
if max_size > 0 and image is not None:
|
||||
original_filepath = filepath
|
||||
filepath = resize_texture_if_needed(image, filepath, max_size)
|
||||
|
||||
|
||||
if filepath != original_filepath:
|
||||
resized_filename = lnx.utils.extract_filename(filepath)
|
||||
tex['file'] = lnx.utils.safestr(resized_filename)
|
||||
|
||||
@ -150,7 +150,7 @@ if bpy.app.version > (4, 1, 0):
|
||||
if state.parse_surface:
|
||||
c.write_normal(node.inputs[5])
|
||||
state.out_basecol = c.parse_vector_input(node.inputs[0])
|
||||
|
||||
|
||||
sss_input = node.inputs.get('Subsurface Weight') or node.inputs.get('Subsurface')
|
||||
if sss_input is not None:
|
||||
if sss_input.is_linked or sss_input.default_value > 0.0:
|
||||
|
||||
@ -310,7 +310,6 @@ def parse_tex_noise(node: bpy.types.ShaderNodeTexNoise, out_socket: bpy.types.No
|
||||
if bpy.app.version < (5, 0, 0):
|
||||
def parse_tex_pointdensity(node: bpy.types.ShaderNodeTexPointDensity, out_socket: bpy.types.NodeSocket, state: ParserState) -> Union[floatstr, vec3str]:
|
||||
# Pass through
|
||||
|
||||
# Color
|
||||
if out_socket == node.outputs[0]:
|
||||
return c.to_vec3([0.0, 0.0, 0.0])
|
||||
|
||||
@ -166,18 +166,14 @@ def material_needs_sss(material: Material) -> bool:
|
||||
if sss_node is not None and sss_node.outputs[0].is_linked:
|
||||
return True
|
||||
|
||||
for sss_node in lnx.node_utils.iter_nodes_by_type(material.node_tree, 'BSDF_PRINCIPLED'):
|
||||
if sss_node is not None and sss_node.outputs[0].is_linked and (sss_node.inputs[1].is_linked or sss_node.inputs[1].default_value != 0.0):
|
||||
return True
|
||||
|
||||
for sss_node in mat_utils.iter_nodes_leenkxpbr(material.node_tree):
|
||||
if sss_node is not None and sss_node.outputs[0].is_linked and (sss_node.inputs[8].is_linked or sss_node.inputs[8].default_value != 0.0):
|
||||
return True
|
||||
|
||||
for principled_node in lnx.node_utils.iter_nodes_by_type(material.node_tree, 'BSDF_PRINCIPLED'):
|
||||
if principled_node is not None and principled_node.outputs[0].is_linked:
|
||||
sss_input = principled_node.inputs.get('Subsurface Weight') or principled_node.inputs.get('Subsurface')
|
||||
if sss_input is not None and (sss_input.is_linked or sss_input.default_value > 0.0):
|
||||
return True
|
||||
|
||||
for sss_node in mat_utils.iter_nodes_leenkxpbr(material.node_tree):
|
||||
if sss_node is not None and sss_node.outputs[0].is_linked and (sss_node.inputs[8].is_linked or sss_node.inputs[8].default_value != 0.0):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
@ -94,15 +94,16 @@ def make(context_id, rpasses, shadowmap=False, shadowmap_transparent=False):
|
||||
make_attrib.write_norpos(con_depth, vert)
|
||||
frag.write_attrib('vec3 n = normalize(wnormal);')
|
||||
cycles.parse(mat_state.nodes, con_depth, vert, frag, geom, tesc, tese, basecol_only=True, parse_opacity=True)
|
||||
elif parse_opacity:
|
||||
frag.write('float opacity;')
|
||||
frag.write('float ior;')
|
||||
else:
|
||||
if parse_opacity:
|
||||
frag.write('float opacity;')
|
||||
frag.write('float ior;')
|
||||
|
||||
if(con_depth).is_elem('morph'):
|
||||
make_morph_target.morph_pos(vert)
|
||||
if(con_depth).is_elem('morph'):
|
||||
make_morph_target.morph_pos(vert)
|
||||
|
||||
if con_depth.is_elem('bone'):
|
||||
make_skin.skin_pos(vert)
|
||||
if con_depth.is_elem('bone'):
|
||||
make_skin.skin_pos(vert)
|
||||
|
||||
if (not is_disp and parse_custom_particle):
|
||||
cycles.parse(mat_state.nodes, con_depth, vert, frag, geom, tesc, tese, parse_surface=False, parse_opacity=parse_opacity)
|
||||
|
||||
@ -133,6 +133,7 @@ def build(material: Material, mat_users: Dict[Material, List[Object]], mat_lnxus
|
||||
shader_data_path = lnx.utils.get_fp_build() + '/compiled/Shaders/' + shader_data_name + '.lnx'
|
||||
assets.add_shader_data(shader_data_path)
|
||||
|
||||
# Store SSS state in the return tuple so it's preserved per-material
|
||||
needs_sss_result = mat_state.needs_sss
|
||||
return rpasses, mat_state.data, shader_data_name, bind_constants, bind_textures, needs_sss_result
|
||||
|
||||
@ -172,10 +173,9 @@ def write_shader(rel_path: str, shader: Shader, ext: str, rpass: str, matname: s
|
||||
shader_path = lnx.utils.get_fp() + '/' + rel_path + '/' + shader_file
|
||||
assets.add_shader(shader_path)
|
||||
if not os.path.isfile(shader_path) or not keep_cache:
|
||||
with open(shader_path, 'w') as f:
|
||||
f.write(shader.get())
|
||||
written = lnx.utils.write_if_changed(shader_path, shader.get())
|
||||
|
||||
if shader.noprocessing:
|
||||
if written and shader.noprocessing:
|
||||
cwd = os.getcwd()
|
||||
os.chdir(lnx.utils.get_fp() + '/' + rel_path)
|
||||
hlslbin_path = lnx.utils.get_sdk_path() + '/lib/leenkx_tools/hlslbin/hlslbin.exe'
|
||||
|
||||
Reference in New Issue
Block a user