HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CHOP_ChannelLayers.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: CHOP_ChannelLayers.h (UI library, C++)
7  *
8  * COMMENTS:
9  * This class was extracted from FUI_ChannelLayers to provide scripting
10  * support for animation later.
11  */
12 
13 #ifndef _CHOP_CHANNELLAYERS_H_
14 #define _CHOP_CHANNELLAYERS_H_
15 
16 #include "CHOP_API.h"
17 #include <OP/OP_Node.h>
18 #include <OP/OP_Node.h>
19 
20 class CH_ScopedChannels;
22 
24 {
25 public:
26 
27  // Get/Set Active layer
28  static int getActiveLayer( PRM_Parm * weight_inst_parm );
29  static void setActiveLayer( PRM_Parm * weight_inst_parm, int layer_index );
30 
31  // Get the Layer Multi Parm and the layer count
32  static PRM_Parm *getLayerMulti( PRM_Parm * weight_inst_parm );
33  static PRM_Parm * getLayerMulti( OP_Node *node );
34  static int getLayerCount( PRM_Parm * weight_inst_parm );
35 
36  // Search for a layer by comparing the name parameter value
37  // returns -1 on failure
38  static int getLayerIndexByName( OP_Node *node, const UT_String &name );
39 
40  // Get Layer by index
41  static int getLayerIndex( PRM_Parm * weight_inst_parm );
42 
43  // Get/Set Layer Name
44  static void getLayerName( PRM_Parm * weight_inst_parm, UT_String &name );
45  static void setLayerName( PRM_Parm * weight_inst_parm, const UT_String &name );
46 
47  // Get a Layer Parm by name and layer_index
48  // ActiveLayer and nlayers ignore the layer index
49  static PRM_Parm *getLayerParm( OP_Node *node, const UT_StringHolder &parm_name, int layer_index );
50 
51  // get a layer parameter from a name and the scoped layer weight_inst_parm
52  // If layer_index is given and is equal to -1, the layer index will be queried and returned in layer_index.
53  // If layer_index is greater or equal to 0, the layer index will be used as as to query the parm pointer.
54  static PRM_Parm *getLayerParm( PRM_Parm * weight_inst_parm, const UT_StringHolder &parm_name );
55  static PRM_Parm *getLayerParm( PRM_Parm * weight_inst_parm, const UT_StringHolder &parm_name, int& layer_index );
56 
57  // get layer parameters from an array of names and the scoped layer weight_inst_parm
58  // If layer_index is given and is equal to -1, the layer index will be queried and returned in layer_index.
59  // If layer_index is greater or equal to 0, the layer index will be used as as to query the parm pointer.
60  static void getLayerParms( UT_Array<PRM_Parm*> &ret, PRM_Parm * weight_inst_parm, const UT_StringArray &parm_names );
61  static void getLayerParms( UT_Array<PRM_Parm*> &ret, PRM_Parm * weight_inst_parm, const UT_StringArray &parm_names, int& layer_index );
62 
63 
64  // Retrieve the connected Channel CHOP given a weight_inst_parm
65  static OP_Node *getLayerChannelCHOP( PRM_Parm *weight_inst_parm );
66 
67  // Retrieve all the connected Channel CHOPs given a weight_inst_parm
68  // (All, not only the ones from the parm index.)
69  static void getLayerChannelCHOPs( OP_Node* node, OP_NodeList &chan_chops );
70 
71  // save the undo info by name and layer index
72  static void saveLayerParmForUndo( OP_Node* node, const UT_StringHolder &name, int index=0 );
73 
74  // save the undo info of a PRM_Parm
75  static void saveParmForUndo( PRM_Parm *parm );
76 
77  // Bake down the effect of the layer to the previous layer
78  static void mergeDownLayer( PRM_Parm *weight_inst_parm );
79 
80  // Get all the channels parms on the Channel CHOP corresponding the the layer weight parm index
81  // Also returns the evaluated size of each channel parm.
83  static void getLayerChannelCHOPParms( PRM_Parm *weight_index_parm, ParmAndSizeArray &out );
84 
85  // Combine a source channel/weight with destination channel/weight at the parm index.
86  // This modifies the dst_channel and leaves the dst_weight intact.
87  static void combineChannels( PRM_Parm *src_parm, PRM_Parm *dst_parm, PRM_Parm *src_w, PRM_Parm *dst_w, int index );
88 
89  // Scope all the channel values corresponding to the weight instance parameter
90  // The Channel CHOP is looked up and all the params are scoped
91  static void scopeLayerChannels( CH_ScopedChannels &fsc, PRM_Parm *weight_inst_parm, fpreal t, bool on_off );
92 
93  // Create a new Layer Mixer CHOP and a base layer clip from the scopped channels
94  static bool createLayerMixerCHOP(const UT_String &full_name, const CH_ScopedChannels &fsc,
96 
97  // Add/Remove/Edit Channels referenced by the Channel Chops
98  static void addLayerChannels(OP_Node *node, int active_layer, CH_ScopedChannels &fsc); static void removeLayerChannels(OP_Node *node, int active_layer, CH_ScopedChannels &fsc);
99 
100  // Add/Remove Layers
101  static OP_Node* addLayer(OP_Node *node, CH_ScopedChannels &fsc, const UT_StringHolder &layer_name );
102  static bool removeLayer(OP_Node *node, PRM_Parm *parm, bool merge_down );
103  static bool removeLayer(OP_Node *node, const UT_StringHolder &layer_name, bool merge_down );
104 };
105 
106 #endif // _CHOP_CHANNELLAYERS_H_
107 
108 
#define CHOP_API
Definition: CHOP_API.h:10
UT_Array< std::pair< PRM_Parm *, int > > ParmAndSizeArray
GLuint const GLchar * name
Definition: glcorearb.h:786
GLdouble t
Definition: glad.h:2397
fpreal64 fpreal
Definition: SYS_Types.h:277
GLuint index
Definition: glcorearb.h:786