|
@@ -54,6 +54,7 @@
|
|
|
#include "materials/materialFeatureTypes.h"
|
|
|
#include "console/engineAPI.h"
|
|
|
#include "T3D/accumulationVolume.h"
|
|
|
+#include "math/mTransform.h"
|
|
|
|
|
|
#include "gui/editor/inspector/group.h"
|
|
|
#include "console/typeValidators.h"
|
|
@@ -1863,3 +1864,31 @@ void TSStatic::setSelectionFlags(U8 flags)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void TSStatic::getNodeTransform(const char *nodeName, const MatrixF &xfm, MatrixF *outMat)
|
|
|
+{
|
|
|
+
|
|
|
+ S32 nodeIDx = getShapeResource()->findNode(nodeName);
|
|
|
+
|
|
|
+ MatrixF mountTransform = mShapeInstance->mNodeTransforms[nodeIDx];
|
|
|
+ mountTransform.mul(xfm);
|
|
|
+ const Point3F &scale = getScale();
|
|
|
+ // The position of the mount point needs to be scaled.
|
|
|
+ Point3F position = mountTransform.getPosition();
|
|
|
+ position.convolve(scale);
|
|
|
+ mountTransform.setPosition(position);
|
|
|
+ // Also we would like the object to be scaled to the model.
|
|
|
+ outMat->mul(mObjToWorld, mountTransform);
|
|
|
+ return;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+DefineEngineMethod(TSStatic, getNodeTransform, TransformF, (const char *nodeName), ,
|
|
|
+ "@brief Get the world transform of the specified mount slot.\n\n"
|
|
|
+
|
|
|
+ "@param slot Image slot to query\n"
|
|
|
+ "@return the mount transform\n\n")
|
|
|
+{
|
|
|
+ MatrixF xf(true);
|
|
|
+ object->getNodeTransform(nodeName, MatrixF::Identity, &xf);
|
|
|
+ return xf;
|
|
|
+}
|