Added UV Animation 8

This commit is contained in:
Jack Andersen 2015-09-19 14:14:31 -10:00
parent 3acddce766
commit 2de7d91fe7
4 changed files with 84 additions and 6 deletions

View File

@ -402,6 +402,33 @@ def make_uva7():
new_grp.links.new(mult5.outputs[0], add2.inputs[1])
new_grp.links.new(add2.outputs[0], grp_out.inputs[0])
# 8 - Mode 8
def make_uva8():
new_grp = bpy.data.node_groups.new('RetroUVMode8Node', 'ShaderNodeTree')
new_grp.inputs.new('NodeSocketVector', 'UV In')
new_grp.inputs.new('NodeSocketFloat', 'Param1')
new_grp.inputs.new('NodeSocketFloat', 'Param2')
new_grp.inputs.new('NodeSocketFloat', 'Param3')
new_grp.inputs.new('NodeSocketFloat', 'Param4')
new_grp.inputs.new('NodeSocketFloat', 'Param5')
new_grp.inputs.new('NodeSocketFloat', 'Param6')
new_grp.inputs.new('NodeSocketFloat', 'Param7')
new_grp.inputs.new('NodeSocketFloat', 'Param8')
new_grp.inputs.new('NodeSocketFloat', 'Param9')
new_grp.outputs.new('NodeSocketVector', 'UV Out')
new_grp.use_fake_user = True
# Group inputs
grp_in = new_grp.nodes.new('NodeGroupInput')
grp_in.location = (-800, 0)
# Group outputs
grp_out = new_grp.nodes.new('NodeGroupOutput')
grp_out.location = (0, 0)
# Links
new_grp.links.new(grp_in.outputs[0], grp_out.inputs[0])
UV_ANIMATION_GROUPS = (
make_uva0,
make_uva1,
@ -410,7 +437,8 @@ UV_ANIMATION_GROUPS = (
make_uva4,
make_uva5,
make_uva6,
make_uva7
make_uva7,
make_uva8
)
# MP3 / DKCR Material Passes:

View File

@ -215,6 +215,12 @@ public:
{
return GX::Primitive(*m_cur++ & 0xf8);
}
GX::Primitive readPrimitiveAndVat(unsigned& vatOut)
{
atUint8 val = *m_cur++;
vatOut = val & 0x7;
return GX::Primitive(val & 0xf8);
}
atUint16 readVertCount()
{
atUint16 retval = HECL::SBig(*(atUint16*)m_cur);
@ -549,7 +555,6 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
while (dl)
{
GX::Primitive ptype = dl.readPrimitive();
atUint16 vertCount = dl.readVertCount();
@ -570,7 +575,6 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
atUint8 flip = 0;
for (int v=0 ; v<vertCount-2 ; ++v)
{
if (flip)
{
os.format("last_face, last_mesh = add_triangle(bm, bm.verts, (%u,%u,%u), norm_list, (%u,%u,%u), %u, od_list)\n",
@ -646,7 +650,6 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
/* Advance one prim vert */
primVerts[c%3] = dl.readVert(peek);
++c;
}
}
else if (ptype == GX::TRIANGLES)

View File

@ -200,6 +200,30 @@ void Material::AddTextureAnim(Stream& out,
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n",
idx, vals[0], vals[1]);
break;
case UVAnimation::ANIM_MODE_8:
out.format("for link in list(tex_links):\n"
" if link.from_node.label == 'MTX_%u':\n"
" tex_links.remove(link)\n"
" soc_from = link.from_socket\n"
" soc_to = link.to_socket\n"
" node = new_nodetree.nodes.new('ShaderNodeGroup')\n"
" node.node_tree = bpy.data.node_groups['RetroUVMode8Node']\n"
" node.location[0] = link.from_node.location[0] + 50\n"
" node.location[1] = link.from_node.location[1] - 50\n"
" node.inputs[1].default_value = %f\n"
" node.inputs[2].default_value = %f\n"
" node.inputs[3].default_value = %f\n"
" node.inputs[4].default_value = %f\n"
" node.inputs[5].default_value = %f\n"
" node.inputs[6].default_value = %f\n"
" node.inputs[7].default_value = %f\n"
" node.inputs[8].default_value = %f\n"
" node.inputs[9].default_value = %f\n"
" new_nodetree.links.remove(link)\n"
" new_nodetree.links.new(soc_from, node.inputs[0])\n"
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n",
idx, vals[0], vals[1]);
break;
default: break;
}
}

View File

@ -244,9 +244,10 @@ struct MaterialSet : BigDNA
ANIM_HSTRIP,
ANIM_VSTRIP,
ANIM_MODEL,
ANIM_MODE_WHO_MUST_NOT_BE_NAMED
ANIM_MODE_WHO_MUST_NOT_BE_NAMED,
ANIM_MODE_8
} mode;
float vals[4];
float vals[9];
void read(Athena::io::IStreamReader& reader)
{
mode = Mode(reader.readUint32Big());
@ -269,6 +270,17 @@ struct MaterialSet : BigDNA
vals[0] = reader.readFloatBig();
vals[1] = reader.readFloatBig();
break;
case ANIM_MODE_8:
vals[0] = reader.readFloatBig();
vals[1] = reader.readFloatBig();
vals[2] = reader.readFloatBig();
vals[3] = reader.readFloatBig();
vals[4] = reader.readFloatBig();
vals[5] = reader.readFloatBig();
vals[6] = reader.readFloatBig();
vals[7] = reader.readFloatBig();
vals[8] = reader.readFloatBig();
break;
}
}
void write(Athena::io::IStreamWriter& writer) const
@ -293,6 +305,17 @@ struct MaterialSet : BigDNA
writer.writeFloatBig(vals[0]);
writer.writeFloatBig(vals[1]);
break;
case ANIM_MODE_8:
writer.writeFloatBig(vals[0]);
writer.writeFloatBig(vals[1]);
writer.writeFloatBig(vals[2]);
writer.writeFloatBig(vals[3]);
writer.writeFloatBig(vals[4]);
writer.writeFloatBig(vals[5]);
writer.writeFloatBig(vals[6]);
writer.writeFloatBig(vals[7]);
writer.writeFloatBig(vals[8]);
break;
}
}
};