HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PRM_Utils.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: PRM_Utils.h (Parameter Library)
7  */
8 
9 #ifndef __PRM_Utils_h__
10 #define __PRM_Utils_h__
11 
12 #include "PRM_API.h"
13 #include <UT/UT_ErrorManager.h>
14 #include <UT/UT_Thread.h>
15 #include <EXPR/EX_Error.h>
16 
17 class UT_BitArray;
18 class PRM_ParmList;
19 class PRM_Parm;
20 
21 /// A set of useful functions for working with parameters.
23 {
24 public:
25  typedef void (*TraverseParmFunc)(const PRM_ParmList &, PRM_Parm *,
26  int, void *data);
27 
28  /// Traverse the parameters in the specified folder of the given switcher
29  /// and optionally execute a function on each parameter.
30  ///
31  /// folder_start_index
32  /// - index into the parmlist pointing to first eligible parameter
33  /// for the folder
34  /// traverse_multi_instances
35  /// - call the specified function on the instances of any embedded
36  /// multiparms
37  ///
38  /// Returns the number of parameters to skip in the parmlist to step over
39  /// the folder. Note that this happens whether or not a traverse function
40  /// is provided, and does not account for any embedded multiparm instances.
41  static int traverseFolder(PRM_ParmList &parmlist, PRM_Parm *switcher,
42  int folder, int folder_start_index,
43  bool traverse_multi_instances,
44  TraverseParmFunc function, void *data);
45 
46  // Flag the instances associated with the given multiparm in the provided
47  // bit array.
48  static void flagMultiParmInstances(const PRM_ParmList &parmlist,
49  PRM_Parm *multi, UT_BitArray &flags);
50 };
51 
52 /// Use this to block evaluation errors. This is necessary whenever setting
53 /// or getting parameters outside of the cooking code path
55 {
56 public:
57  PRM_AutoBlockErrors(int thread = -1)
58  : myScope(thread)
59  {
60  myErrNo = ev_GetErrNo(myScope.getThread());
61  myScope.getErrorManager().setDisabled(true);
62  }
64  {
65  ev_SetErrNo(myErrNo, myScope.getThread());
66  ev_ClearCycles(myScope.getThread());
67  }
68 
69 private:
70  UT_ErrorManager::Scope myScope;
71  int myErrNo;
72 };
73 
74 
75 #endif
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLbitfield flags
Definition: glcorearb.h:1595
PRM_AutoBlockErrors(int thread=-1)
Definition: PRM_Utils.h:57
GLboolean * data
Definition: glcorearb.h:130
typedef int
Definition: png.h:1175
A set of useful functions for working with parameters.
Definition: PRM_Utils.h:22
#define PRM_API
Definition: PRM_API.h:10
EXPR_API void ev_ClearCycles(int thread)