import_obj_morph_loader_silent,please give me a sample!
578276864_563542692c
Posts: 31
import_obj_morph_loader_silent,please give me a sample!
Comments
Hi,
I just also hit wall because of this. I have done scripts to export .obj files for main limb bendings and now I want to create morphs from them. I wan't to use scripted morph creation because I need to pose using script before generating morph.
Edit:
If I can atleast have API documentation for using it (that whould be very helpfull).
- Juha
Here are some codes(part) I current used to make morph,wish can help!
//tshape is a obj read from file (using DzImporter)
DzVertexMesh *vvmesh = tshape->getModifiableAssemblyGeom(false);
int vlength =vvmesh->getNumVertices();
//node is the node you want add morphs;
DzObject *obj = node->getObject();
DzVertexMesh *gemo = obj->getCachedGeom();
DzQuat rotSubject = node->getWSRot();
DzQuat inversedRotSubject = rotSubject.inverse();
//adding deltas
DzMorphDeltas *morphDeltas =new DzMorphDeltas();
for(int i=0;i<vlength;i++)
{
float dx= vvmesh->getVertex(i).m_x-gemo->getVertex(i).m_x;
float dy= vvmesh->getVertex(i).m_y-gemo->getVertex(i).m_y;
float dz= vvmesh->getVertex(i).m_z-gemo->getVertex(i).m_z;
if( abs(dx) >= 0.01 || abs(dy) >= 0.01 || abs(dz) >= 0.01 )
{
DzVec3 pt = DzVec3(dx,dy,dz);
pt = inversedRotSubject.multVec( pt );
morphDeltas->addDelta( i,pt);
}
}
int findex = dzScene->getFrame();
QString morphName="f"+QString::number(findex);
DzMorph * morpher = (DzMorph *)obj->findModifier(morphName);
if(!morpher)
{
morpher = new DzMorph( morphDeltas );
morpher->setLabel( morphName );
morpher->setName( morphName );
morpher->setStorablePaths("Morphs/Morph Loader/"+morphName);
obj->addModifier( morpher );
}
else
{
morpher->setDeltas( morphDeltas );
morpher->getValueChannel()->setHidden( false );
}
Thanks
Got working. There was litle syntax differences but I got it almost work as I planned.
Also got reminder that FBX bone names aren't same as in original model.
I maybe need to do more automatisation and then maybe post this script here.
This is for exporting FBX models with right JCM when rigging type is changed. 3 axis to single weightmap.
Maybe need to see if I can also expoft/make PBR materials (Albedo/Diffuse, Specular/Metallic, Normal, [Height map, Occulsion, Emission]). Now fbx exports only Diffuce texture with transparency per material (RGBA)
- Juha