Merge pull request #835 from Azaezel/alpha40/pathShapeSillies

pathshape cleanups and callbacks
This commit is contained in:
Brian Roberts 2022-07-29 17:22:46 -05:00 committed by GitHub
commit 332193b53a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 21 deletions

View file

@ -51,7 +51,7 @@ CameraSpline::Knot::Knot(const Knot &k)
prev = NULL; next = NULL;
}
CameraSpline::Knot::Knot(const Point3F &p, const QuatF &r, F32 s, Knot::Type type, Knot::Path path)
CameraSpline::Knot::Knot(const Point3F &p, const QuatF &r, F32 s, Knot::Type type, Knot::Path path, String hitCommand)
{
mPosition = p;
mRotation = r;
@ -59,6 +59,7 @@ CameraSpline::Knot::Knot(const Point3F &p, const QuatF &r, F32 s, Knot::Type typ
mType = type;
mPath = path;
mDistance = 0.0f;
mHitCommand = hitCommand;
prev = NULL; next = NULL;
}

View file

@ -37,6 +37,7 @@ public:
Point3F mPosition;
QuatF mRotation;
F32 mSpeed; /// in meters per second
String mHitCommand;
enum Type {
NORMAL,
POSITION_ONLY,
@ -56,7 +57,7 @@ public:
Knot();
Knot(const Knot &k);
Knot(const Point3F &p, const QuatF &r, F32 s, Knot::Type type = NORMAL, Knot::Path path = SPLINE);
Knot(const Point3F &p, const QuatF &r, F32 s, Knot::Type type = NORMAL, Knot::Path path = SPLINE, String hitCommand = String::EmptyString);
};

View file

@ -76,11 +76,10 @@ PathShape::PathShape()
mTarget = 0;
mTargetSet = false;
MatrixF mat(1);
mat.setPosition(Point3F(0,0,700));
MatrixF mat = MatrixF::Identity;
mLastXform = MatrixF::Identity;
Parent::setTransform(mat);
mLastXform = mat;
for (U32 i = 0; i < 4; i++)
{
mControl[i] = StringTable->insert("");
@ -350,7 +349,10 @@ void PathShape::popFront()
void PathShape::onNode(S32 node)
{
if (!isGhost())
Con::executef(mDataBlock,"onNode",getIdString(), Con::getIntArg(node));
{
Con::executef(mDataBlock, "onNode", getIdString(), Con::getIntArg(node));
Con::executef(mDataBlock, mSpline.getKnot(node)->mHitCommand.c_str(), getIdString());
}
}
@ -523,8 +525,8 @@ static CameraSpline::Knot::Path resolveKnotPath(const char *arg)
return CameraSpline::Knot::SPLINE;
}
DefineEngineMethod(PathShape, pushBack, void, (TransformF transform, F32 speed, const char* type, const char* path),
(TransformF::Identity, 1.0f, "Normal", "Linear"),
DefineEngineMethod(PathShape, pushBack, void, (TransformF transform, F32 speed, const char* type, const char* path, const char *hitCommand),
(TransformF::Identity, 1.0f, "Normal", "Linear",""),
"@brief Adds a new knot to the back of a path camera's path.\n"
"@param transform Transform for the new knot. In the form of \"x y z ax ay az aa\" such as returned by SceneObject::getTransform()\n"
"@param speed Speed setting for this knot.\n"
@ -545,7 +547,7 @@ DefineEngineMethod(PathShape, pushBack, void, (TransformF transform, F32 speed,
{
QuatF rot(transform.getOrientation());
object->pushBack(new CameraSpline::Knot(transform.getPosition(), rot, speed, resolveKnotType(type), resolveKnotPath(path)));
object->pushBack(new CameraSpline::Knot(transform.getPosition(), rot, speed, resolveKnotType(type), resolveKnotPath(path), String(hitCommand)));
}
DefineEngineMethod(PathShape, pushFront, void, (TransformF transform, F32 speed, const char* type, const char* path),