aboutsummaryrefslogtreecommitdiff
path: root/mayaPlug/shaveItHair.h
blob: 2e62867d0402522dbf6b64dd02ba3fac503cf939 (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
99
100
101
102
103
104
105
106
107
108
#ifndef shaveItHair_h
#define shaveItHair_h

// Shave and a Haircut
// (c) 2019 Epic Games
// US Patent 6720962

#include <maya/MObjectArray.h>
#include <maya/MStatus.h>

#include "shaveAPI.h"


class LIBSHAVEAPI_API shaveItHair
{
public:
    //
    // Clear the iterator and free up its resources.
    //
    // Status Value:
    //
    //     Currently always returns MS::kSuccess
    //
    static MStatus  clear();

    //
    // Set the iterator to iterate over all the hairs in the scene.
    //
    // If 'instances' is true then only shaveNodes with instancing will be
    // included in the iteration.  If false, then only non-instanced
    // shaveNodes will be included.
    //
    // If 'renderable' is true then only hairs from renderable shaveNodes
    // will be included in the iteration.
    //
    // Status Value:
    //
    //      MS::kSuccess        Success.
    //
    //      MS::kNotFound       The scene contains no shaveNodes, or only
    //                          contains shaveNodes which do not match the
    //                          restrictions implied by the 'instances' and
    //                          'renderableOnly' parameters.
    //
    static MStatus  init(bool instances, bool renderableOnly);

    //
    // Set the iterator to iterate over all the hairs from the shaveNodes
    // in the 'shaveNodes' array.
    //
    // If 'instances' is true then only those shaveNodes in the array which
    // have instance geometry will be included in the iteration.  If false
    // then only those shaveNodes which are *not* instanced will be
    // included.
    //
    // Status Value:
    //
    //      MS::kSuccess        Success.
    //
    //      MS::kNotFound       The 'shaveNodes' array is empty or only
    //                          contains node which do not correspond to
    //                          the 'instances' parameter.
    //
    //      MS::kInvalidParameter
    //                          One or more of the objects in the
    //                          'shaveNodes' array is not a shaveNode.
    //
    static MStatus  init(bool instances, MObjectArray& shaveNodes);

    //
    // Returns a HairInfo structure for all of the next hair's strands.
    //
    // The vertex lists will contain either a single curve for each strand,
    // or a set of polys for each strand.  This is determined as follows:
    //
    // If the current iterator is operating on instanced shaveNodes, or if
    // it is operating on non-instanced nodes but the render mode in Shave
    // Globals is set to 'Geometry', then polys will be returned.
    //
    // Otherwise the current iterator must be operating on non-instanced
    // nodes with a render mode of 'Buffer' which case curves will be returned.
    //
    static MStatus  nextHair(shaveAPI::HairInfo* hairInfo);

    //
    // Returns a HairInfo structure for the next hair which contains the
    // counts for all of the hair's strands.  The only fields in 'hairInfo'
    // which will be valid are 'numHairs', 'numVertices' and
    // 'numHairVertices', with 'numHairs' containing the number of strands
    // in the hair, as determined by the shaveNode's multistrand setting.
    //
    // While this method does not return as much information as
    // nextHairCurves(), it is must faster, so use it if you only need a
    // hair's counts.
    //
    // Note that the vertex counts given are only correct for hairs
    // returned as curves, not as polys.
    //
    static MStatus  nextHairCounts(shaveAPI::HairInfo* hairInfo);

    //
    // Resets the iterator back to the very first hair of the very first
    // shaveNode.
    //
    static MStatus  reset();
};

#endif