diff options
| author | Ben Marsh <[email protected]> | 2019-10-22 09:07:59 -0400 |
|---|---|---|
| committer | Ben Marsh <[email protected]> | 2019-10-22 09:07:59 -0400 |
| commit | bd0027e737c6512397f841c22786274ed74b927f (patch) | |
| tree | f7ffbdb8f3741bb7f24635616cc189cba5cb865c /mayaPlug/shaveRenderman.cpp | |
| download | archived-shave-and-a-haircut-bd0027e737c6512397f841c22786274ed74b927f.tar.xz archived-shave-and-a-haircut-bd0027e737c6512397f841c22786274ed74b927f.zip | |
Adding Shave-and-a-Haircut 9.6
Diffstat (limited to 'mayaPlug/shaveRenderman.cpp')
| -rw-r--r-- | mayaPlug/shaveRenderman.cpp | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/mayaPlug/shaveRenderman.cpp b/mayaPlug/shaveRenderman.cpp new file mode 100644 index 0000000..df65952 --- /dev/null +++ b/mayaPlug/shaveRenderman.cpp @@ -0,0 +1,98 @@ +// THIS FILE IS OBSOLETE. SEE shaveWriteRib.cpp INSTEAD. + +// Shave and a Haircut +// (c) 2019 Epic Games +// US Patent 6720962 + +#include "shaveIO.h" + +#include <stdio.h> + +#include <maya/MFnDependencyNode.h> +#include <maya/MObjectArray.h> +#include <maya/MPlug.h> +#include <maya/MString.h> + +#include "shaveGlobals.h" +#include "shaveHairShape.h" +#include "shaveRenderer.h" +#include "shaveRenderman.h" +#include "shaveTextureStore.h" + + +MStatus shaveRenderman::dumpAll(MString filename) +{ + shaveRenderer* renderer = shaveRender::getRenderer(); + MObjectArray shaveHairShapes; + + renderer->getRenderableShaveNodes(shaveHairShapes); + + initTexInfoLookup(shaveHairShapes, ""); + + FILE* fp = stdout; + + if (filename != "") + { + fp = fopen(filename.asChar(), "w"); + + if (!fp) + { + MGlobal::displayError( + MString("shaveWriteRib: Could not open file '") + + filename + "' for RIB output." + ); + + return MS::kFailure; + } + } + + // + // Output the RIB file preamble. + // + if (globalRibStuff != "") + fprintf(fp, "%s\n", globalRibStuff.asChar()); + + int prmanCurvesOK = (shaveRibPrimType > 1) ? 0 : 1; + int prmanCurveType = (shaveRibPrimType > 1)?0:shaveRibPrimType; + unsigned int i; + unsigned int numShaveNodes = shaveHairShapes.length(); + + for (i = 0; i < numShaveNodes; i++) + { + MFnDependencyNode nodeFn(shaveHairShapes[i]); + shaveHairShape* theShaveNode = (shaveHairShape*)nodeFn.userNode(); + + // + // Get the shaveHairShape's hair node and make sure it's loaded + // into the shave engine. + // + SHAVENODE* hairNode = theShaveNode->getHairNode(); + + theShaveNode->makeCurrent(); + + // + // Output the RIB preamble for this node. + // + MPlug plug(shaveHairShapes[i], shaveHairShape::ribInsert); + MString nodePreamble; + + plug.getValue(nodePreamble); + + fprintf(fp, "%s\n", nodePreamble.asChar()); + + // + // Output the node's RIB info. + // + SHAVErib_dump_node( + hairNode, + fp, + prmanCurvesOK, + hairNode->shavep.segs[theShaveNode->getHairGroup()], + prmanCurveType + ); + } + + if (filename != "") fclose(fp); + + return MS::kSuccess; +} |