Merge pull request 't3du [ Repe ] - Lightmapper fix: update ShaderNodeMixRGB to ShaderNodeMix and 4. above support' (#55) from Onek8/LNXSDK:main into main
Reviewed-on: #55
This commit is contained in:
@ -191,7 +191,7 @@ def apply_materials(load_atlas=0):
|
|||||||
|
|
||||||
mainNode = outputNode.inputs[0].links[0].from_node.inputs[0].links[0].from_node
|
mainNode = outputNode.inputs[0].links[0].from_node.inputs[0].links[0].from_node
|
||||||
|
|
||||||
if (mainNode.type == "ShaderNodeMixRGB"):
|
if (mainNode.type == "ShaderNodeMix"):
|
||||||
if bpy.context.scene.TLM_SceneProperties.tlm_verbose:
|
if bpy.context.scene.TLM_SceneProperties.tlm_verbose:
|
||||||
print("Mix RGB shader found")
|
print("Mix RGB shader found")
|
||||||
|
|
||||||
@ -199,9 +199,11 @@ def apply_materials(load_atlas=0):
|
|||||||
|
|
||||||
#Add all nodes first
|
#Add all nodes first
|
||||||
#Add lightmap multipliction texture
|
#Add lightmap multipliction texture
|
||||||
mixNode = node_tree.nodes.new(type="ShaderNodeMixRGB")
|
mixNode = node_tree.nodes.new(type="ShaderNodeMix")
|
||||||
mixNode.name = "Lightmap_Multiplication"
|
mixNode.name = "Lightmap_Multiplication"
|
||||||
mixNode.location = -800, 300
|
mixNode.location = -800, 300
|
||||||
|
mixNode.data_type = 'RGBA'
|
||||||
|
mixNode.inputs[0].default_value = 1
|
||||||
if scene.TLM_EngineProperties.tlm_lighting_mode == "indirect" or scene.TLM_EngineProperties.tlm_lighting_mode == "indirectAO":
|
if scene.TLM_EngineProperties.tlm_lighting_mode == "indirect" or scene.TLM_EngineProperties.tlm_lighting_mode == "indirectAO":
|
||||||
mixNode.blend_type = 'MULTIPLY'
|
mixNode.blend_type = 'MULTIPLY'
|
||||||
else:
|
else:
|
||||||
@ -312,8 +314,8 @@ def apply_materials(load_atlas=0):
|
|||||||
else:
|
else:
|
||||||
mat.node_tree.links.new(lightmapNode.outputs[1], DecodeNode.inputs[1]) #Connect lightmap node to decodenode
|
mat.node_tree.links.new(lightmapNode.outputs[1], DecodeNode.inputs[1]) #Connect lightmap node to decodenode
|
||||||
|
|
||||||
mat.node_tree.links.new(DecodeNode.outputs[0], mixNode.inputs[1]) #Connect decode node to mixnode
|
mat.node_tree.links.new(DecodeNode.outputs[0], mixNode.inputs[6]) #Connect decode node to mixnode
|
||||||
mat.node_tree.links.new(ExposureNode.outputs[0], mixNode.inputs[1]) #Connect exposure node to mixnode
|
mat.node_tree.links.new(ExposureNode.outputs[0], mixNode.inputs[6]) #Connect exposure node to mixnode
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
@ -323,10 +325,10 @@ def apply_materials(load_atlas=0):
|
|||||||
else:
|
else:
|
||||||
mat.node_tree.links.new(lightmapNode.outputs[1], DecodeNode.inputs[1]) #Connect lightmap node to decodenode
|
mat.node_tree.links.new(lightmapNode.outputs[1], DecodeNode.inputs[1]) #Connect lightmap node to decodenode
|
||||||
|
|
||||||
mat.node_tree.links.new(DecodeNode.outputs[0], mixNode.inputs[1]) #Connect lightmap node to mixnode
|
mat.node_tree.links.new(DecodeNode.outputs[0], mixNode.inputs[6]) #Connect lightmap node to mixnode
|
||||||
|
|
||||||
mat.node_tree.links.new(baseColorNode.outputs[0], mixNode.inputs[2]) #Connect basecolor to pbr node
|
mat.node_tree.links.new(baseColorNode.outputs[0], mixNode.inputs[7]) #Connect basecolor to pbr node
|
||||||
mat.node_tree.links.new(mixNode.outputs[0], mainNode.inputs[0]) #Connect mixnode to pbr node
|
mat.node_tree.links.new(mixNode.outputs[2], mainNode.inputs[0]) #Connect mixnode to pbr node
|
||||||
|
|
||||||
if not scene.TLM_EngineProperties.tlm_target == "vertex":
|
if not scene.TLM_EngineProperties.tlm_target == "vertex":
|
||||||
mat.node_tree.links.new(UVLightmap.outputs[0], lightmapNode.inputs[0]) #Connect uvnode to lightmapnode
|
mat.node_tree.links.new(UVLightmap.outputs[0], lightmapNode.inputs[0]) #Connect uvnode to lightmapnode
|
||||||
@ -338,11 +340,11 @@ def apply_materials(load_atlas=0):
|
|||||||
|
|
||||||
if(scene.TLM_EngineProperties.tlm_exposure_multiplier > 0):
|
if(scene.TLM_EngineProperties.tlm_exposure_multiplier > 0):
|
||||||
mat.node_tree.links.new(lightmapNode.outputs[0], ExposureNode.inputs[0]) #Connect lightmap node to mixnode
|
mat.node_tree.links.new(lightmapNode.outputs[0], ExposureNode.inputs[0]) #Connect lightmap node to mixnode
|
||||||
mat.node_tree.links.new(ExposureNode.outputs[0], mixNode.inputs[1]) #Connect lightmap node to mixnode
|
mat.node_tree.links.new(ExposureNode.outputs[0], mixNode.inputs[6]) #Connect lightmap node to mixnode
|
||||||
else:
|
else:
|
||||||
mat.node_tree.links.new(lightmapNode.outputs[0], mixNode.inputs[1]) #Connect lightmap node to mixnode
|
mat.node_tree.links.new(lightmapNode.outputs[0], mixNode.inputs[6]) #Connect lightmap node to mixnode
|
||||||
mat.node_tree.links.new(baseColorNode.outputs[0], mixNode.inputs[2]) #Connect basecolor to pbr node
|
mat.node_tree.links.new(baseColorNode.outputs[0], mixNode.inputs[7]) #Connect basecolor to pbr node
|
||||||
mat.node_tree.links.new(mixNode.outputs[0], mainNode.inputs[0]) #Connect mixnode to pbr node
|
mat.node_tree.links.new(mixNode.outputs[0], mainNode.inputs[2]) #Connect mixnode to pbr node
|
||||||
if not scene.TLM_EngineProperties.tlm_target == "vertex":
|
if not scene.TLM_EngineProperties.tlm_target == "vertex":
|
||||||
mat.node_tree.links.new(UVLightmap.outputs[0], lightmapNode.inputs[0]) #Connect uvnode to lightmapnode
|
mat.node_tree.links.new(UVLightmap.outputs[0], lightmapNode.inputs[0]) #Connect uvnode to lightmapnode
|
||||||
|
|
||||||
@ -491,8 +493,9 @@ def applyAOPass():
|
|||||||
AOMap.image = AOImage
|
AOMap.image = AOImage
|
||||||
AOMap.location = -800, 0
|
AOMap.location = -800, 0
|
||||||
|
|
||||||
AOMult = nodes.new(type="ShaderNodeMixRGB")
|
AOMult = nodes.new(type="ShaderNodeMix")
|
||||||
AOMult.name = "TLM_AOMult"
|
AOMult.name = "TLM_AOMult"
|
||||||
|
AOMult.data_type = 'RGBA'
|
||||||
AOMult.blend_type = 'MULTIPLY'
|
AOMult.blend_type = 'MULTIPLY'
|
||||||
AOMult.inputs[0].default_value = 1.0
|
AOMult.inputs[0].default_value = 1.0
|
||||||
AOMult.location = -300, 300
|
AOMult.location = -300, 300
|
||||||
|
@ -518,7 +518,7 @@ def configure_meshes(self):
|
|||||||
if bpy.context.scene.TLM_SceneProperties.tlm_verbose:
|
if bpy.context.scene.TLM_SceneProperties.tlm_verbose:
|
||||||
print("The material group is not supported!")
|
print("The material group is not supported!")
|
||||||
|
|
||||||
if (mainNode.type == "ShaderNodeMixRGB"):
|
if (mainNode.type == "ShaderNodeMix"):
|
||||||
if bpy.context.scene.TLM_SceneProperties.tlm_verbose:
|
if bpy.context.scene.TLM_SceneProperties.tlm_verbose:
|
||||||
print("Mix shader found")
|
print("Mix shader found")
|
||||||
|
|
||||||
@ -811,7 +811,7 @@ def set_settings():
|
|||||||
|
|
||||||
print(bpy.app.version)
|
print(bpy.app.version)
|
||||||
|
|
||||||
if bpy.app.version[0] == 3:
|
if bpy.app.version[0] == 3 or byp.app.version[0] == 4:
|
||||||
if cycles.device == "GPU":
|
if cycles.device == "GPU":
|
||||||
scene.cycles.tile_size = 256
|
scene.cycles.tile_size = 256
|
||||||
else:
|
else:
|
||||||
|
@ -28,7 +28,11 @@ class ViewportDraw:
|
|||||||
w = 400
|
w = 400
|
||||||
h = 200
|
h = 200
|
||||||
|
|
||||||
self.shader = gpu.shader.from_builtin('2D_IMAGE')
|
if bpy.app.version[0] == 3:
|
||||||
|
self.shader = gpu.shader.from_builtin('2D_IMAGE')
|
||||||
|
else:
|
||||||
|
self.shader = gpu.shader.from_builtin('IMAGE')
|
||||||
|
|
||||||
self.batch = batch_for_shader(
|
self.batch = batch_for_shader(
|
||||||
self.shader, 'TRI_FAN',
|
self.shader, 'TRI_FAN',
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ class Shader_Node_Types:
|
|||||||
normal = "ShaderNodeNormalMap"
|
normal = "ShaderNodeNormalMap"
|
||||||
ao = "ShaderNodeAmbientOcclusion"
|
ao = "ShaderNodeAmbientOcclusion"
|
||||||
uv = "ShaderNodeUVMap"
|
uv = "ShaderNodeUVMap"
|
||||||
mix = "ShaderNodeMixRGB"
|
mix = "ShaderNodeMix"
|
||||||
|
|
||||||
def select_object(self,obj):
|
def select_object(self,obj):
|
||||||
C = bpy.context
|
C = bpy.context
|
||||||
|
Reference in New Issue
Block a user