Material fixes

This commit is contained in:
Phillip Stephens 2015-09-19 13:36:46 -07:00
parent ea2c5b9722
commit 3acddce766
2 changed files with 40 additions and 12 deletions

View File

@ -567,9 +567,17 @@ def make_pass_tran():
grp_out = new_grp.nodes.new('NodeGroupOutput')
grp_out.location = (0, 0)
# Multiply
mul1 = new_grp.nodes.new('ShaderNodeMath')
mul1.operation = 'MULTIPLY'
mul1.inputs[0].default_value = 1.0
mul1.location = (-400, 0)
# Links
new_grp.links.new(grp_in.outputs[0], grp_out.inputs[0])
new_grp.links.new(grp_in.outputs[2], grp_out.inputs[1])
new_grp.links.new(grp_in.outputs[1], mul1.inputs[0])
new_grp.links.new(grp_in.outputs[2], mul1.inputs[1])
new_grp.links.new(mul1.outputs[0], grp_out.inputs[1])
# Opacity Map Inverted
def make_pass_tran_inv():
@ -590,16 +598,23 @@ def make_pass_tran_inv():
grp_out = new_grp.nodes.new('NodeGroupOutput')
grp_out.location = (0, 0)
# Subtract
sub1 = new_grp.nodes.new('ShaderNodeMath')
sub1.operation = 'SUBTRACT'
sub1.inputs[0].default_value = 1.0
sub1.location = (-400, 0)
# Multiply
mul1 = new_grp.nodes.new('ShaderNodeMath')
mul1.operation = 'MULTIPLY'
mul1.inputs[0].default_value = 1.0
mul1.location = (-400, 0)
# Invert
inv1 = new_grp.nodes.new('ShaderNodeInvert')
inv1.inputs[0].default_value = 1.0
inv1.location = (-600, 0)
# Links
new_grp.links.new(grp_in.outputs[0], sub1.inputs[1])
new_grp.links.new(sub1.outputs[0], grp_out.inputs[0])
new_grp.links.new(grp_in.outputs[2], grp_out.inputs[1])
new_grp.links.new(grp_in.outputs[0], grp_out.inputs[0])
new_grp.links.new(grp_in.outputs[1], mul1.inputs[1])
new_grp.links.new(grp_in.outputs[2], inv1.inputs[1])
new_grp.links.new(inv1.outputs[0], mul1.inputs[0])
new_grp.links.new(mul1.outputs[0], grp_out.inputs[1])
# Incandescence Map
def make_pass_inca():

View File

@ -89,7 +89,9 @@ void MaterialSet::ConstructMaterial(Stream& out,
for (const Material::SectionFactory& factory : material.sections)
{
factory.section->constructNode(out, pakRouter, entry, prevSection, i++, texMapIdx, texMtxIdx, kColorIdx);
prevSection = factory.section.get();
Material::SectionPASS* pass = dynamic_cast<Material::SectionPASS*>(factory.section.get());
if (!pass || (pass && pass->subtype.toUint32() != Material::SectionPASS::RFLV))
prevSection = factory.section.get();
}
/* Connect final PASS */
@ -161,22 +163,33 @@ void Material::SectionPASS::constructNode(HECL::BlenderConnection::PyOutStream&
{
case DIFF:
out << "pnode.node_tree = bpy.data.node_groups['RetroPassDIFF']\n";
linkRAS = true;
break;
case RIML:
out << "pnode.node_tree = bpy.data.node_groups['RetroPassRIML']\n";
if (idx == 0)
linkRAS = true;
break;
case BLOL:
out << "pnode.node_tree = bpy.data.node_groups['RetroPassBLOL']\n";
if (idx == 0)
linkRAS = true;
break;
case BLOD:
out << "pnode.node_tree = bpy.data.node_groups['RetroPassBLOD']\n";
if (idx == 0)
linkRAS = true;
break;
case CLR:
out << "pnode.node_tree = bpy.data.node_groups['RetroPassCLR']\n";
linkRAS = true;
if (idx == 0)
linkRAS = true;
break;
case TRAN:
out << "pnode.node_tree = bpy.data.node_groups['RetroPassTRAN']\n";
if (flags.TRANInvert())
out << "pnode.node_tree = bpy.data.node_groups['RetroPassTRANInv']\n";
else
out << "pnode.node_tree = bpy.data.node_groups['RetroPassTRAN']\n";
break;
case INCA:
out << "pnode.node_tree = bpy.data.node_groups['RetroPassINCA']\n";