//- // ========================================================================== // Copyright (C) 2005 ATI Technologies Inc. All rights reserved. // // Copyright (C) 1995 - 2005 Alias Systems Corp. and/or its licensors. All // rights reserved. // // The coded instructions, statements, computer programs, and/or related // material (collectively the "Data") in these files are provided by Alias // Systems Corp. ("Alias") and/or its licensors for the exclusive use of the // Customer (as defined in the Alias Software License Agreement that // accompanies this Alias software). Such Customer has the right to use, // modify, and incorporate the Data into other products and to distribute such // products for use by end-users. // // THE DATA IS PROVIDED "AS IS". ALIAS HEREBY DISCLAIMS ALL WARRANTIES // RELATING TO THE DATA, INCLUDING, WITHOUT LIMITATION, ANY AND ALL EXPRESS OR // IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. IN NO EVENT SHALL ALIAS BE LIABLE FOR ANY DAMAGES // WHATSOEVER, WHETHER DIRECT, INDIRECT, SPECIAL, OR PUNITIVE, WHETHER IN AN // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, OR IN EQUITY, // ARISING OUT OF ACCESS TO, USE OF, OR RELIANCE UPON THE DATA. // ========================================================================== //+ // // // fxManagerCmd.cpp // // This file provides the implementation for the effectManager command. // This command is useful for querying additional information from the // shader. Presently, it only supportes listing of the shader text to // aid in debugging. // //////////////////////////////////////////////////////////////////////////////////////////////////// #include #include #include "fxManagerCmd.h" // // fxManagerCmd::doIt // // This is the function used to invoke the command. The // command is not undoable and it does not change any state, // so it does not use the method to call back throught redoIt. ////////////////////////////////////////////////////////////////////// MStatus fxManagerCmd::doIt( const MArgList &args) { MArgDatabase argData( syntax(), args); MString nodeName; glslShaderNode *node = NULL; //check to see if we have a node if (argData.isFlagSet( "-n")) { argData.getFlagArgument( "-n", 0, nodeName); node = glslShaderNode::findNodeByName(nodeName); if (!node) { MGlobal::displayError( MString("Node '") +nodeName +"' does not exist"); return MStatus::kFailure; } } //check if we are in list shader mode if (argData.isFlagSet( "-ls")) { int pass; //are we listing a vertex shader if (argData.isFlagSet( "-vs")) { argData.getFlagArgument( "-vs", 0, pass); if (!node->printVertexShader(pass)) { MGlobal::displayError( MString("No vertex shader available for pass ") + pass); return MStatus::kFailure; } } //are we listing a vertex shader if (argData.isFlagSet( "-ps")) { argData.getFlagArgument( "-ps", 0, pass); if (!node->printPixelShader(pass)) { MGlobal::displayError( MString("No pixel shader available for pass ") + pass); return MStatus::kFailure; } } } return MStatus::kSuccess; } // // There is never anything to undo. ////////////////////////////////////////////////////////////////////// MStatus fxManagerCmd::undoIt(){ return MStatus::kSuccess; } // // There is never really anything to redo. ////////////////////////////////////////////////////////////////////// MStatus fxManagerCmd::redoIt(){ return MStatus::kSuccess; } // // ////////////////////////////////////////////////////////////////////// bool fxManagerCmd::isUndoable() const{ return false; } // // ////////////////////////////////////////////////////////////////////// bool fxManagerCmd::hasSyntax() const { return true; } // // ////////////////////////////////////////////////////////////////////// MSyntax fxManagerCmd::mySyntax() { MSyntax syntax; syntax.addFlag( "-ls", "-listShader"); syntax.addFlag( "-ps", "-pixelShader", MSyntax::kLong); syntax.addFlag( "-vs", "-vertexShader", MSyntax::kLong); syntax.addFlag( "-n", "-node", MSyntax::kString); return syntax; } // // ////////////////////////////////////////////////////////////////////// bool fxManagerCmd::isHistoryOn() const { //what is this supposed to do? return false; } // // ////////////////////////////////////////////////////////////////////// MString fxManagerCmd::commandString() const { return MString(); } // // ////////////////////////////////////////////////////////////////////// MStatus fxManagerCmd::setHistoryOn( bool state ){ //ignore it for now return MStatus::kSuccess; } // // ////////////////////////////////////////////////////////////////////// MStatus fxManagerCmd::setCommandString( const MString &str) { //ignore it for now return MStatus::kSuccess; }