Added object offsets to exporters, converted tabs to spaces, added
method to get model nodes anywhere in the hierarchy by name, update model bounds in SkinMesh after deforming mesh. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4038 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -64,6 +64,26 @@ public class ModelNode extends Node
|
|||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively searches the scene graph rooted at this node for a
|
||||||
|
* node with the provided name.
|
||||||
|
*/
|
||||||
|
public Spatial getDescendant (String name)
|
||||||
|
{
|
||||||
|
for (int ii = 0, nn = getQuantity(); ii < nn; ii++) {
|
||||||
|
Spatial child = getChild(ii);
|
||||||
|
if (child.getName().equals(name)) {
|
||||||
|
return child;
|
||||||
|
} else if (child instanceof ModelNode) {
|
||||||
|
child = ((ModelNode)child).getDescendant(name);
|
||||||
|
if (child != null) {
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a reference to the model space transform of the node.
|
* Returns a reference to the model space transform of the node.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -269,6 +269,7 @@ public class SkinMesh extends ModelMesh
|
|||||||
BufferUtils.setInBuffer(_normal, nbuf, idx);
|
BufferUtils.setInBuffer(_normal, nbuf, idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateModelBound();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The groups of vertices influenced by different sets of bones. */
|
/** The groups of vertices influenced by different sets of bones. */
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ macroScript TRAnimationExporter category:"File" \
|
|||||||
if node.parent != undefined do (
|
if node.parent != undefined do (
|
||||||
xform = xform * (inverse node.parent.transform)
|
xform = xform * (inverse node.parent.transform)
|
||||||
)
|
)
|
||||||
|
if isKindOf node Editable_Mesh do (
|
||||||
|
xform = preTranslate xform node.objectOffsetPos
|
||||||
|
xform = preRotate xform node.objectOffsetRot
|
||||||
|
xform = preScale xform node.objectOffsetScale
|
||||||
|
)
|
||||||
writePoint3Attr " translation" xform.translationPart outFile
|
writePoint3Attr " translation" xform.translationPart outFile
|
||||||
writeQuatAttr " rotation" (inverse xform.rotationPart) outFile
|
writeQuatAttr " rotation" (inverse xform.rotationPart) outFile
|
||||||
writePoint3Attr " scale" xform.scalePart outFile
|
writePoint3Attr " scale" xform.scalePart outFile
|
||||||
|
|||||||
@@ -112,6 +112,11 @@ macroScript TRModelExporter category:"File" \
|
|||||||
xform = xform * (inverse node.parent.transform)
|
xform = xform * (inverse node.parent.transform)
|
||||||
format " parent=\"%\"" node.parent.name to:outFile
|
format " parent=\"%\"" node.parent.name to:outFile
|
||||||
)
|
)
|
||||||
|
if isMesh do (
|
||||||
|
xform = preTranslate xform node.objectOffsetPos
|
||||||
|
xform = preRotate xform node.objectOffsetRot
|
||||||
|
xform = preScale xform node.objectOffsetScale
|
||||||
|
)
|
||||||
writePoint3Attr " translation" xform.translationPart \
|
writePoint3Attr " translation" xform.translationPart \
|
||||||
outFile
|
outFile
|
||||||
writeQuatAttr " rotation" (inverse xform.rotationPart) \
|
writeQuatAttr " rotation" (inverse xform.rotationPart) \
|
||||||
|
|||||||
Reference in New Issue
Block a user