fix: some file didn't have the svn:eol-style native yet
This commit is contained in:
@@ -1,133 +1,133 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dHingeConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "hingeConstraintNode.h"
|
||||
#include "dHingeConstraintCmd.h"
|
||||
|
||||
|
||||
MString dHingeConstraintCmd::typeName("dHingeConstraint");
|
||||
|
||||
dHingeConstraintCmd::dHingeConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dHingeConstraintCmd::~dHingeConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dHingeConstraintCmd::creator()
|
||||
{
|
||||
return new dHingeConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dHingeConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dHingeConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dHingeConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dHingeConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dHingeConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(hingeConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dHingeConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "hingeConstraintNode.h"
|
||||
#include "dHingeConstraintCmd.h"
|
||||
|
||||
|
||||
MString dHingeConstraintCmd::typeName("dHingeConstraint");
|
||||
|
||||
dHingeConstraintCmd::dHingeConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dHingeConstraintCmd::~dHingeConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dHingeConstraintCmd::creator()
|
||||
{
|
||||
return new dHingeConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dHingeConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dHingeConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dHingeConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dHingeConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dHingeConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(hingeConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dHingeConstraintCmd.h
|
||||
|
||||
#ifndef DYN_HINGE_CONSTRAINT_CMD_H
|
||||
#define DYN_HINGE_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dHingeConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dHingeConstraintCmd();
|
||||
virtual ~dHingeConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif //DYN_HINGE_CONSTRAINT_CMD_H
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dHingeConstraintCmd.h
|
||||
|
||||
#ifndef DYN_HINGE_CONSTRAINT_CMD_H
|
||||
#define DYN_HINGE_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dHingeConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dHingeConstraintCmd();
|
||||
virtual ~dHingeConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif //DYN_HINGE_CONSTRAINT_CMD_H
|
||||
|
||||
@@ -1,133 +1,133 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//dNailConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "nailConstraintNode.h"
|
||||
#include "dNailConstraintCmd.h"
|
||||
|
||||
|
||||
MString dNailConstraintCmd::typeName("dNailConstraint");
|
||||
|
||||
dNailConstraintCmd::dNailConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dNailConstraintCmd::~dNailConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dNailConstraintCmd::creator()
|
||||
{
|
||||
return new dNailConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dNailConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dNailConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dNailConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dNailConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dNailConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(nailConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//dNailConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "nailConstraintNode.h"
|
||||
#include "dNailConstraintCmd.h"
|
||||
|
||||
|
||||
MString dNailConstraintCmd::typeName("dNailConstraint");
|
||||
|
||||
dNailConstraintCmd::dNailConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dNailConstraintCmd::~dNailConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dNailConstraintCmd::creator()
|
||||
{
|
||||
return new dNailConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dNailConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dNailConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dNailConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dNailConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dNailConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(nailConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//dNailConstraintCmd.h
|
||||
|
||||
#ifndef DYN_NAIL_CONSTRAINT_CMD_H
|
||||
#define DYN_NAIL_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dNailConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dNailConstraintCmd();
|
||||
virtual ~dNailConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Walt Disney Studios
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Nicola Candussi <nicola@fluidinteractive.com>
|
||||
*/
|
||||
|
||||
//dNailConstraintCmd.h
|
||||
|
||||
#ifndef DYN_NAIL_CONSTRAINT_CMD_H
|
||||
#define DYN_NAIL_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dNailConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dNailConstraintCmd();
|
||||
virtual ~dNailConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,133 +1,133 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSliderConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "sliderConstraintNode.h"
|
||||
#include "dSliderConstraintCmd.h"
|
||||
|
||||
|
||||
MString dSliderConstraintCmd::typeName("dSliderConstraint");
|
||||
|
||||
dSliderConstraintCmd::dSliderConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dSliderConstraintCmd::~dSliderConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dSliderConstraintCmd::creator()
|
||||
{
|
||||
return new dSliderConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dSliderConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSliderConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSliderConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSliderConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dSliderConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(sliderConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSliderConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "sliderConstraintNode.h"
|
||||
#include "dSliderConstraintCmd.h"
|
||||
|
||||
|
||||
MString dSliderConstraintCmd::typeName("dSliderConstraint");
|
||||
|
||||
dSliderConstraintCmd::dSliderConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dSliderConstraintCmd::~dSliderConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dSliderConstraintCmd::creator()
|
||||
{
|
||||
return new dSliderConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dSliderConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSliderConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSliderConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSliderConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dSliderConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(sliderConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSliderConstraintCmd.h
|
||||
|
||||
#ifndef DYN_SLIDER_CONSTRAINT_CMD_H
|
||||
#define DYN_SLIDER_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dSliderConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dSliderConstraintCmd();
|
||||
virtual ~dSliderConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif //DYN_SLIDER_CONSTRAINT_CMD_H
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSliderConstraintCmd.h
|
||||
|
||||
#ifndef DYN_SLIDER_CONSTRAINT_CMD_H
|
||||
#define DYN_SLIDER_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dSliderConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dSliderConstraintCmd();
|
||||
virtual ~dSliderConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif //DYN_SLIDER_CONSTRAINT_CMD_H
|
||||
|
||||
@@ -1,133 +1,133 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSixdofConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "sixdofConstraintNode.h"
|
||||
#include "dsixdofConstraintCmd.h"
|
||||
|
||||
|
||||
MString dSixdofConstraintCmd::typeName("dSixdofConstraint");
|
||||
|
||||
dSixdofConstraintCmd::dSixdofConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dSixdofConstraintCmd::~dSixdofConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dSixdofConstraintCmd::creator()
|
||||
{
|
||||
return new dSixdofConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dSixdofConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSixdofConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSixdofConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSixdofConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dSixdofConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(sixdofConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSixdofConstraintCmd.cpp
|
||||
|
||||
#include <maya/MGlobal.h>
|
||||
#include <maya/MItDependencyNodes.h>
|
||||
#include <maya/MSyntax.h>
|
||||
|
||||
#include "sixdofConstraintNode.h"
|
||||
#include "dsixdofConstraintCmd.h"
|
||||
|
||||
|
||||
MString dSixdofConstraintCmd::typeName("dSixdofConstraint");
|
||||
|
||||
dSixdofConstraintCmd::dSixdofConstraintCmd()
|
||||
: m_argDatabase(0),
|
||||
m_dagModifier(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
dSixdofConstraintCmd::~dSixdofConstraintCmd()
|
||||
{
|
||||
if (m_argDatabase) {
|
||||
delete m_argDatabase;
|
||||
}
|
||||
|
||||
if (m_dagModifier) {
|
||||
delete m_dagModifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
dSixdofConstraintCmd::creator()
|
||||
{
|
||||
return new dSixdofConstraintCmd;
|
||||
}
|
||||
|
||||
|
||||
MSyntax
|
||||
dSixdofConstraintCmd::syntax()
|
||||
{
|
||||
MSyntax syntax;
|
||||
syntax.enableQuery(false);
|
||||
syntax.enableEdit(false);
|
||||
|
||||
syntax.addFlag("-n", "-name", MSyntax::kString);
|
||||
// syntax.addFlag("-fn", "-filename", MSyntax::kString);
|
||||
// syntax.addFlag("-col", "-color", MSyntax::kString);
|
||||
// syntax.addFlag("-dia", "-diameter", MSyntax::kDouble);
|
||||
|
||||
return syntax;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSixdofConstraintCmd::doIt(const MArgList &args)
|
||||
{
|
||||
MStatus stat;
|
||||
m_argDatabase = new MArgDatabase(syntax(), args, &stat);
|
||||
if (stat == MS::kFailure) {
|
||||
return stat;
|
||||
}
|
||||
return redoIt();
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSixdofConstraintCmd::undoIt()
|
||||
{
|
||||
MGlobal::setActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
if (m_dagModifier) {
|
||||
m_dagModifier->undoIt();
|
||||
delete m_dagModifier;
|
||||
m_dagModifier = 0;
|
||||
}
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
MStatus
|
||||
dSixdofConstraintCmd::redoIt()
|
||||
{
|
||||
MGlobal::getActiveSelectionList(m_undoSelectionList);
|
||||
|
||||
MString name;
|
||||
if (m_argDatabase->isFlagSet("-name")) {
|
||||
m_argDatabase->getFlagArgument("-name", 0, name);
|
||||
}
|
||||
if (!name.length()) {
|
||||
name = "dSixdofConstraint";
|
||||
}
|
||||
|
||||
m_dagModifier = new MDagModifier;
|
||||
|
||||
MObject parentObj = m_dagModifier->createNode("transform");
|
||||
m_dagModifier->renameNode(parentObj, name + "#");
|
||||
m_dagModifier->doIt();
|
||||
|
||||
MObject dConstraintObj = m_dagModifier->createNode(sixdofConstraintNode::typeId, parentObj);
|
||||
std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar();
|
||||
std::string::size_type pos = dConstraintName.find_last_not_of("0123456789");
|
||||
dConstraintName.insert(pos + 1, "Shape");
|
||||
m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str());
|
||||
m_dagModifier->doIt();
|
||||
|
||||
setResult(MFnDependencyNode(dConstraintObj).name());
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSixdofConstraintCmd.h
|
||||
|
||||
#ifndef DYN_SIXDOF_CONSTRAINT_CMD_H
|
||||
#define DYN_SIXDOF_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dSixdofConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dSixdofConstraintCmd();
|
||||
virtual ~dSixdofConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif //DYN_SIXDOF_CONSTRAINT_CMD_H
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library Maya Plugin
|
||||
Copyright (c) 2008 Herbert Law
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising
|
||||
from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Written by: Herbert Law <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//dSixdofConstraintCmd.h
|
||||
|
||||
#ifndef DYN_SIXDOF_CONSTRAINT_CMD_H
|
||||
#define DYN_SIXDOF_CONSTRAINT_CMD_H
|
||||
|
||||
#include <maya/MArgDatabase.h>
|
||||
#include <maya/MDagModifier.h>
|
||||
#include <maya/MSelectionList.h>
|
||||
|
||||
#include <maya/MPxCommand.h>
|
||||
|
||||
class dSixdofConstraintCmd : public MPxCommand
|
||||
{
|
||||
public:
|
||||
dSixdofConstraintCmd();
|
||||
virtual ~dSixdofConstraintCmd();
|
||||
|
||||
static void *creator();
|
||||
static MSyntax syntax();
|
||||
|
||||
MStatus doIt(const MArgList &i_mArgList);
|
||||
MStatus redoIt();
|
||||
MStatus undoIt();
|
||||
bool isUndoable() const { return true; }
|
||||
bool hasSyntax() const { return true; }
|
||||
|
||||
static MString typeName;
|
||||
|
||||
protected:
|
||||
MArgDatabase *m_argDatabase;
|
||||
MDagModifier *m_dagModifier;
|
||||
|
||||
MSelectionList m_undoSelectionList;
|
||||
};
|
||||
|
||||
#endif //DYN_SIXDOF_CONSTRAINT_CMD_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user