#include <maya/MIOStream.h>
#include <maya/MFnPlugin.h>
#include <maya/MString.h>
#include <maya/MStringResource.h>
#include <maya/MStringResourceId.h>
#include <maya/MArgList.h>
#include <maya/MPxCommand.h>
#include <maya/MSyntax.h>
#include <maya/MArgDatabase.h>
#include <maya/MGlobal.h>
#include <maya/MDagPath.h>
#include <maya/MItSelectionList.h>
#include <maya/MSelectionList.h>
#include <maya/MFnDependencyNode.h>
#include <maya/MPlugArray.h>
#include <maya/MPlug.h>
#define kQuietFlag "-q"
#define kQuietFlagLong "-quiet"
#define rPluginId "nodeInfoCmd"
#define rConnFound MStringResourceId(rPluginId, "rConnFound", \
"Number of connections found: ^1s")
#define rPlugInfo MStringResourceId(rPluginId, "rPlugInfo", \
" Plug Info: ")
#define rPlugDestOf MStringResourceId(rPluginId, "rPlugDestOf",\
" This plug is a dest of: ")
static MStatus registerMStringResources()
{
return MS::kSuccess;
}
{
public:
nodeInfo();
~nodeInfo() override;
static void* creator();
private:
bool quiet;
};
nodeInfo::nodeInfo()
: quiet (false)
{}
nodeInfo::~nodeInfo() {}
void* nodeInfo::creator()
{
return new nodeInfo;
}
{
syntax.
addFlag(kQuietFlag, kQuietFlagLong);
return syntax;
}
{
if (argData.isFlagSet(kQuietFlag))
quiet = true;
return stat;
}
{
stat = parseArgs ( args );
if ( !stat )
return stat;
for ( ; !iter.isDone(); iter.next() )
{
stat = iter.getDependNode( dependNode );
if ( !stat ) {
continue;
}
MString nodeName = fnDependNode.name();
nodeName += ": ";
printType( dependNode, nodeName );
stat = fnDependNode.getConnections( connectedPlugs );
int numberOfPlugs = connectedPlugs.
length();
if ( !quiet )
{
cerr << msg << endl;
}
for ( int i=0; i<numberOfPlugs; i++ )
{
MPlug plug = connectedPlugs[i];
if ( !quiet )
{
cerr << pInfoMsg << pinfo << endl;
}
for (
unsigned int j=0; j<array.
length(); j++ )
{
printType( mnode, dInfoMsg );
}
}
}
return MS::kSuccess;
}
void nodeInfo::printType(
const MObject& node,
const MString& prefix )
{
if ( !quiet)
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"3.0",
"Any");
status = plugin.registerUIStrings(registerMStringResources, "nodeInfoCmdInitStrings");
if (!status) {
status.
perror(
"registerUIStrings");
return status;
}
status = plugin.registerCommand( "nodeInfo",
nodeInfo::creator,
nodeInfo::newSyntax);
if (!status) {
status.
perror(
"registerCommand");
return status;
}
return status;
}
{
status = plugin.deregisterCommand( "nodeInfo" );
if (!status) {
status.
perror(
"deregisterCommand");
return status;
}
return status;
}