blob: df659523f6f2f8a3c7f29c48c335bcdf067ad079 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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;
}
|