HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PI_ResourceManager.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: PI_ResourceManager.h ( Direct Manipulation Library, C++)
7  *
8  * COMMENTS:
9  * This class maintains a table of all states, handles, op-handle links,
10  * and input selectors. All state, handle, and op-handle link objects
11  * are created and deleted through a PI_ResourceManager. The active one
12  * is obtained via the global function BMgetResourceManager().
13  */
14 
15 #ifndef __PI_ResourceManager_H__
16 #define __PI_ResourceManager_H__
17 
18 #include "PI_API.h"
19 #include "PI_ResourceTemplate.h"
20 #include "PI_SettingList.h"
21 #include "PI_PythonResourceTypes.h"
22 
23 #include <OP/OP_Error.h>
24 #include <OP/OP_OperatorTable.h>
25 #include <UT/UT_Array.h>
26 #include <UT/UT_String.h>
27 #include <UT/UT_StringMap.h>
28 #include <UT/UT_SymbolTable.h>
29 #include <UT/UT_ValArray.h>
30 #include <SYS/SYS_Hash.h>
31 #include <SYS/SYS_TypeDecorate.h>
32 #include <utility>
33 
34 class CPP_Manager;
35 class PRM_Template;
36 class OP_Operator;
37 class OP_OperatorTable;
38 class OP_Node;
39 class CMD_Args;
40 class PI_OpHandleLink;
41 class pi_OpHandleBinding;
42 class pi_OpSelectorBinding;
43 
44 namespace PI_PythonState
45 {
46  struct Info;
47  class Template;
48 }
49 
50 namespace PI_PythonHandle
51 {
52  class Template;
53 }
54 
55 /// Error codes retured by PI_ResourceManager bind methods
56 /// @{
57 #define PI_BIND_OK 1
58 #define PI_NO_TEMPLATE_FOR_HANDLE -2
59 #define PI_INVALID_OP_PARM -3
60 #define PI_INVALID_PI_PARM -4
61 #define PI_BINDING_EXISTS -5
62 #define PI_INVALID_OP_FOR_PI -6
63 /// @}
64 
65 typedef void (*PI_SaveCallback)(void *data);
66 
68 {
69 public:
71 
72  // Note this is the channel name: the receiver should do a
73  // PRM_ParmList::getParmPtrFromChannel to get the parm.
74  const UT_String &getOpParm() const
75  { return myOpParm; }
76  const UT_String &getPIParm() const
77  { return myPIParm; }
78  int operator==(const PI_BindingParmInfo &i) const
79  { return (this == &i); }
80 
81 private:
82  UT_String myOpParm;
83  UT_String myPIParm;
84  friend class pi_OpHandleBinding;
85 };
86 
91 
93 {
94 public:
96 
97  const UT_String &getPIName() const
98  { return myPIName; }
99  const UT_String &getPIDescription() const
100  { return myPIDescription; }
102  { return myDefaultSettings; }
103  int getId() const
104  { return myId; }
106  { return myBindings; }
107  int operator==(const PI_BindingHandleInfo &i) const
108  { return (this == &i); }
109 
110 private:
111  UT_String myPIName;
112  UT_String myPIDescription;
113  PI_SettingList myDefaultSettings;
114  int myId;
115  PI_BindingParmArray myBindings;
116  friend class pi_OpHandleBinding;
117 };
118 
120 
122 
123 // See the bindSelector function for a description of all the data
124 // members of this class. They map directly to the bindSelector parameters.
126 {
127 public:
129 
130  const UT_String &getName() const
131  { return myName; }
132  const UT_String &getDescription() const
133  { return myDescription; }
134  const UT_String &getPrompt() const
135  { return myPrompt; }
136  const UT_String &getOpParm() const
137  { return myOpParm; }
138  const UT_String &getMenu() const
139  { return myMenu; }
140  const UT_String &getPrimMask() const
141  { return myPrimMask; }
142  int getOpInput() const
143  { return myOpInput; }
144  bool getOpInputReq() const
145  { return myOpInputReq; }
146  bool getAllowDrag() const
147  { return myAllowDrag; }
148  bool getAstSelAll() const
149  { return myAstSelAll; }
150  const UT_String &getExtraInfo() const
151  { return myExtraInfo; }
152  int operator==(const PI_BindingSelectorInfo &i) const
153  { return (this == &i); }
154 
155 private:
156  UT_String myName;
157  UT_String myDescription;
158  UT_String myPrompt;
159  UT_String myOpParm;
160  UT_String myMenu;
161  UT_String myPrimMask;
162  int myOpInput;
163  bool myOpInputReq;
164  bool myAllowDrag;
165  bool myAstSelAll;
166  UT_String myExtraInfo;
167  friend class pi_OpSelectorBinding;
168 };
170 
173 {
174 public:
176  ~PI_ResourceManager() override;
177 
178  // Return 1 on success and 0 if the state/handle/op-handle link
179  // is already registered.
180  virtual int registerState(PI_StateTemplate *type);
181  virtual int registerHandle(PI_HandleTemplate *type);
182  virtual int registerOpHandleLink(PI_PITemplate *type);
183  virtual int registerSelector(PI_SelectorTemplate *type);
184 
185  bool containsState(const char *name,
186  PI_ViewerType viewer_type,
187  unsigned netmask) const;
188  bool containsHandle(const char *name) const;
189  bool containsOpHandleLink(const char *name) const;
190  bool containsSelector(const char *name) const;
191 
192  // Get all the bound handles and parms for a given op type.
194  *getBindingHandles(OP_Operator *op) const;
195  // Get all the bound selectors for a given op type.
197  *getBindingSelectors(OP_Operator *op) const;
198 
199  // Return the list of states that can be used in a viewer for the
200  // specified network type.
202  &stateList(PI_ViewerType viewer_type,
203  const char *network_type) const;
205  &stateList(PI_ViewerType viewer_type,
206  PI_NetworkType net_type) const;
207  PI_StateTemplate *getStateTemplate(const char *name,
208  PI_ViewerType viewer_type,
209  const char *type) const;
210  PI_StateTemplate *getStateTemplate(OP_Operator *op,
211  PI_ViewerType viewer_type,
212  const char *type) const;
213 
214  // Rebuild the volatile keys for all state templates.
215  void rebuildVolatileKeys();
216 
217  // Register all viewer resources such as viewer states and handles.
218  virtual PI_PythonResource::Status registerViewerResources();
219 
220  // Viewer state handling
221  // Return the registration status of a state template.
223  getViewerStateRegisterStatus(
224  const char* state_name, PI_ViewerType viewer_type, const char* type) const;
225 
226  // Fires a register viewer state event callback
227  virtual void fireResourceEvent(
230  PI_PythonResource::EventMessage::Data const& event_data);
231 
232  // return true if the state name is valid
233  bool validStateTemplateName(const char* name) const;
234 
235  // unregister a python viewer state
236  virtual PI_PythonResource::Status unregisterViewerState(const char* name);
237 
238  // return true if a viewer state is registered
239  virtual bool isRegisteredViewerState(const char* name) const;
240 
241  // return a viewer state given a name
242  virtual PI_PythonState::Template const * viewerStateTemplate(const char * state_name) const;
243  virtual PI_PythonState::Template * viewerStateTemplate(const char * state_name) ;
244 
245  // Unbind all volatile viewer handles contained in a viewer state
246  virtual PI_PythonResource::Status unbindVolatileViewerHandles(PI_PythonState::Info& state_template_info);
247 
248  virtual bool hasDualStateSupport(OP_OpTypeId op_typeid) const;
249 
250  // Viewer Handles
251  virtual PI_PythonResource::Status unregisterViewerHandle(const char* name);
252  virtual bool isRegisteredViewerHandle(const char* name) const;
253 
254  virtual PI_PythonHandle::Template const*
255  viewerHandleTemplate(const char* handle_name) const;
256 
257  // Returns the registered viewer handle types (PI template name)
258  virtual UT_StringArray const & getViewerHandleTypeNames() const;
259 
260  // These are functions which are called from commands that allow
261  // for dynamic binding of handles to parameters
262  int unbind(OP_Operator *op, const char *pidescription,
263  const UT_String &opparm);
264  int bind(OP_Operator *op, const char *piname,
265  const char *pidescription,
266  const UT_String &opparm,
267  const UT_String &piparm,
268  const char *default_settings);
269  // this API is typically used for handle late-binding e.g. python states
270  // would provide functions for binding handle parms
271  int bind(OP_Operator *op, const char *piname,
272  const char *pidescription,
273  const char *default_settings);
274  int bindScriptOp(OP_Operator *op, const char *piname,
275  const char *pidescription,
276  const UT_String &opparm,
277  const UT_String &piparm,
278  const char *default_settings);
279 
280  // Used for binding node operators to registered viewer states (i..e. python states)
281  // returns true if the operation succeeded
282  virtual bool bindOperatorToViewerState(const char* state_name, OP_Operator* op);
283 
284  // Returns true if a state is expected to exist for an operator of a given
285  // network type. By design, management operators are not expected to operate
286  // outside their own network, this function will return false in this case.
287  //
288  // op_name: operator name
289  // op_type: operator type e.g. DOP
290  bool operatorStateMandatory(const char* op_name, const char* op_type) const;
291 
292  /// Unbind the given selector from an operator. Uses the short description
293  /// when bound using bindSelector()
294  int unbindSelector(OP_Operator *op,
295  const char *seldescription);
296 
297  /// Dynamic binding of a selector to an operator
298  ///
299  /// @param op Operator type that we want to bind a selector to
300  /// @param sname Selector type
301  /// @param seldescription Short description that identifies this selector
302  /// in the context of a one operator (used to
303  /// unbind the selector).
304  /// @param prompt Text in the status area when the selector is
305  /// active.
306  /// @param opparm Operator parameter where the selection string
307  /// is put.
308  /// @param opinput Wire input index where the op owning the
309  /// selected geometry is attached to our op.
310  /// @param opinputreq Is an input is required?
311  /// @param primmask Mask of which primitive types can be in the
312  /// selection. This uses the *_FILEID enum in
313  /// GEO_PrimTypeCompat.h. A regular
314  /// GEO_PrimTypeCompat mask can be used if you
315  /// first convert it using
316  /// GEO_PrimTypeCompat::convertToFileFromMask()
317  /// @param allowdrag Determines if click-and-drag operations are
318  /// allowed.
319  /// @param menu Operator menu parameter where we choose the
320  /// selection type.
321  /// @param astselall If an asterisk is required in the selection
322  /// string to indicate selecting all the input.
323  /// Otherwise we assume an empty string indicates
324  /// that the whole geometry is selected.
325  /// @param extrainfo String that is passed to the selector,
326  /// particular selectors may need specific
327  /// parameters that can be passed through this
328  /// mechanism.
329  /// @param fromScriptOp Used by our dialog script parser to avoid
330  /// infinite recursion. Setting this flag decreases
331  /// the error checking we do.
332  ///
333  /// @return PI_BIND_OK upon success, else see of one of the other potential
334  /// error codes at the top of PI_ResourceManager.h
335  int bindSelector(OP_Operator *op, const char *sname,
336  const char *seldescription,
337  const char *prompt, const char *opparm,
338  int opinput, int opinputreq,
339  const char *primmask, int allowdrag,
340  const char *menu, int astselall,
341  const char *extrainfo, bool fromScriptOp);
342 
343  //Helper functions for the above
344  PRM_Template *getTemplateAndVecId(const UT_String &,
345  OP_Operator *,
346  int &) const;
347 
348  // This is for converting old style "t 2" into new style "tz". It
349  // only works if the operator has the template already, else it
350  // assumes channel name == parmname. Thus, it won't work on
351  // multiparms that only exist with OP_Node, not OP_Operator.
352  void getChannelNameFromParmAndVec(UT_String &chan,
353  OP_Operator *op, const char *parmname,
354  int vecidx);
355 
356  int checkForPIName( const char *pi_name,
357  const char *pi_parm ) const;
358 
359  OP_Operator *findOperator(PI_NetworkType net_type,
360  const char *op_name,
361  bool display_warning = true) const;
362  OP_Operator *findOperator(const char *opbindname,
363  UT_String *optype = 0) const;
364 
365  virtual void findVolatileKeys(const char *volatile_hotkey_name,
366  UT_Array<int> &volatile_keys,
367  UT_Array<int> &keys_modifiers)
368  const;
369  virtual void updateViewports(int id, const char *opname,
370  bool open_only = false) const;
371 
372  //These methods are used in PI_ResourceManagerCommand.C.
373  const PI_OpHandleLinkMap &getOpHandleLinks() const { return myOpHandleLinks; }
374  PI_PITemplate *getOpHandleLinkTemplate(const char *pi_name) const;
375  const PI_SelectorTemplateMap &getSelectors() const { return mySelectors; }
376  PI_SelectorTemplate *getSelectorTemplate(const char *selector_name) const;
377 
378  // Returns a list of all builtin op handles
379  const UT_StringArray &getBuiltinOpHandleNames();
380 
381  // The following method is used by builddialogs
382  const PI_HandleTemplateMap &getHandles() const { return myHandles; }
383 
384  // Tell us if the pi with the given name is an invisible PI by nature.
385  // Optionally return the type of the pi in isfloat (int or float assumed)
386  bool isPIEthereal(const char *piname,
387  bool *isfloat = 0) const;
388 
389  // Because the order of callbacks for OP_UpdateTableSink is
390  // undefined, some callbacks rely on the resource manager's table of states
391  // to be accurate. Since the resource manager's callback can happen
392  // after the other callbacks, they can call these methods to ensure the
393  // resource manager's table is accurate.
394  void ensureStatesExistForAllOperators(const char *net_type_name);
395  virtual void ensureStatesExistForAllOperators(PI_NetworkType net_type);
396 
397  // Map a viewer type token to a PI_ViewerType, or vice-versa.
398  static bool getViewerType(const char *viewer_type_token,
399  PI_ViewerType &type);
400  static void getViewerTypeToken(PI_ViewerType type,
401  UT_String &viewer_type_token);
402 
403  // Map the network name returned by OP_Node::getOpType() to a
404  // PI_NetworkType, or vice-versa.
405  static bool getNetworkType(const char *network_type_name,
406  PI_NetworkType &type);
407  static const UT_StringHolder &getNetworkTypeName(PI_NetworkType type);
408  static OP_OperatorTable *getOpTableFromOperator(const OP_Operator *op);
409 
410  // Choose the first network type from a mask that contains multiple ones.
411  static PI_NetworkType getFirstNetworkType(unsigned int network_mask);
412 
413  static PRM_Template *findParmTemplate(OP_Operator &op,
414  const char *op_Parm_name,
415  int vec_idx, int *parm_idx);
416 
417  // Write out our bindings information to a file.
418  int writeBindingsFile(const char *fname) const;
419 
420  // Load/save/remove the settings for a particular PI and a node that's
421  // linked to it.
422  void loadPISettingsFromTables(PI_OpHandleLink &pi,
423  bool okay_to_use_last_settings) const;
424  void savePISettingsToTables(PI_OpHandleLink &pi);
425  virtual void removePISettingsFromTables(OP_Operator &op_type);
426  void removePISettingsFromTables(const PI_OpHandleLink &pi);
427 
428  // Record settings for a particular PI. This method should only be
429  // called by the omparm command.
430  void recordPISettings(const char *pi_description,
431  const char *pi_type,
432  const OP_Node &op_node,
433  const char *settings);
434 
435  // Objects may add callbacks that are called just before the resource
436  // manager saves its data to the hip file. These callbacks update
437  // the resource manager to make sure the data it saves is current.
438  void addSaveCallback(PI_SaveCallback callback, void *data);
439  void removeSaveCallback(PI_SaveCallback callback,
440  void *data);
441 
442  void registerOpHandleBindings();
443  virtual void removeAllBindings(OP_Operator *op);
444 
445  // Returns the name of the state being created
446  char const* stateToCreate() const;
447 
448  // Set by BM_PythonSupport to give access to the python support
449  // object while the python resource instance is being created.
450  void setPythonResourceSupport(void* res_support);
451  void* getPythonResourceSupport();
452 
453 protected:
454  static void startParmsCache();
455  static void stopParmsCache();
456  static void getParmsCache(UT_ValArray<OP_Node *> *&ops,
458  UT_IntArray *&vec_indices);
459  static void getParmsCacheBehaviour( bool &set_keys,
460  bool &do_scope,
461  bool &append_scope );
462 
463  // Save the name of the state being created.
464  void saveStateToCreate(char const* state);
465 public:
466  static int cacheParms();
467  static void appendToParmsCache(OP_Node *op, PRM_Parm *parm,
468  int vi);
469  static void setParmsCacheBehaviour( bool set_keys, bool do_scope,
470  bool append_scope );
471 
473  { return theHideLockedHandleParts; }
474  static void setHideLockedHandleParts( bool hide )
475  { theHideLockedHandleParts = hide; }
476  static bool getScopeChannelsOnKey()
477  { return theScopeChannelsOnKey; }
478  static void setScopeChannelsOnKey( bool scope )
479  { theScopeChannelsOnKey = scope; }
480  static bool getAddScopedChannels()
481  { return theAddScopedChannels; }
482  static void setAddScopedChannels( bool add )
483  { theAddScopedChannels = add; }
485  { return theOpenChannelEditorOnScope; }
486  static void setOpenChannelEditorOnScope( bool do_open )
487  { theOpenChannelEditorOnScope = do_open; }
488  static void getChannelScopeCommandPrefix( UT_String &str );
489 
490 
491 protected:
492  // Classes:
493 
495  {
496  public:
497  PI_OpPIKey(const char *pi_name_in_setting_table, const char *pi_type,
498  int op_id) :
499  myPINameInSettingTable(pi_name_in_setting_table),
500  myPIType(pi_type),
501  myOpId(op_id) {}
502 
503  bool operator==(const PI_OpPIKey &o) const
504  {
505  // myPIType is not used.
506  return myPINameInSettingTable == o.myPINameInSettingTable &&
507  myOpId == o.myOpId;
508  }
509 
511  {
512  // myPIType is not used.
513  SYS_HashType hash = myPINameInSettingTable.hash();
514  SYShashCombine(hash, myOpId);
515  return hash;
516  }
517 
518  UT_StringHolder piNameInSettingTable() const { return myPINameInSettingTable; }
519  UT_StringHolder piType() const { return myPIType; }
520  int opId() const { return myOpId; }
521 
522  struct Hasher
523  {
524  size_t operator()(const PI_OpPIKey &pk) const { return size_t(pk.hash()); }
525  };
526 
527  private:
528  UT_StringHolder myPINameInSettingTable;
529  UT_StringHolder myPIType;
530  int myOpId;
531  };
532 
534  {
537  };
538 
539  // Methods:
540 
541  void installCommands();
542  void registerOpHandleLinks();
543  void registerCop2HandleLinks();
544  void registerOpHandleConstructors();
545  void registerSelectors();
546  void registerSelectorConstructors();
547 
548  // Functions used by registerOpHandleLinks for loading the OPbindings file.
549  bool isValidPiParmName( const UT_String &pi_name,
550  const UT_String &pi_parm);
551  void loadHandle(CPP_Manager &cppman, OP_Operator *op,
552  pi_OpHandleBinding *binding);
553  void loadSelector(CPP_Manager &cppman,
554  const UT_String &selname,
555  const UT_String &seldescription,
556  pi_OpSelectorBinding *binding);
557  void loadOperator(CPP_Manager &cppman,
558  const UT_String &oppath);
559  void loadOperator(CPP_Manager &cppman,
560  const UT_String &optype,
561  OP_Operator *op,
562  pi_OpHandleBinding *hbinding,
563  pi_OpSelectorBinding *sbinding);
564 
565  virtual void addAutomaticStates(PI_NetworkType net_type);
566  void tableUpdated(OP_OperatorTable *table) override;
567  void tableDeleted(OP_OperatorTable *table) override;
568  void templatesUpdated(OP_Operator *op) override;
569  void operatorDeleted(OP_Operator *op) override;
570  void ensureTableInterestExists(PI_NetworkType net_type,
572 
573  PI_HandleTemplate *getHandleTemplate(const char *handle_name) const;
574 
575  // Save all the PI settings to a stream.
576  static OP_ERROR savePIResourceManagerCallback(std::ostream &os,
577  void *data);
578  OP_ERROR saveSettings(std::ostream &os) const;
579 
580  // Save the non-persistent PI flagged as persistable to a stream
581  OP_ERROR save(std::ostream &os) const;
582 
583  // We need the non-const version of getDefaultPISettings() because we
584  // might need to sort the default settings.
585  const PI_SettingList *getDefaultPISettings(OP_Operator &op_type,
586  const char *type_name,
587  const char *description) const;
588  PI_SettingList *getDefaultPISettings(OP_Operator &op_type,
589  const char *type_name,
590  const char *description);
591 
592  // This method is implemented by the leaf class (i.e. MT_ResourceManager)
593  // and is used for updating the PI Settings (i.e. handle settings)
594  // loaded from the PI setting tables (loadPISettingsFromTables).
595  // MT_ResourceManager uses the latest PI settings registered by a
596  // python state to update the loaded settings.
597 
598  // pi_settings: The PI settings to update. The implementation should
599  // update it directly and return the same pointer.
600  // op: The owner operator.
601  // pi_type: The PI type name.
602  // pi_name: The PI description name.
603  virtual PI_SettingList const * onUpdatePISettings( PI_SettingList const& pi_settings,
604  OP_Operator & op,
605  char const* pi_type,
606  char const* pi_name) const;
607 
608  // Data:
609  using PI_SaveCallbackInfo = std::pair<PI_SaveCallback, void *>;
616 
619 
622 
626 
628  void* myCurrentPythonSupport = nullptr;
629 
630  static bool ourSetKeyOnParms;
631  static bool ourScopeParmChannels;
632  static bool ourAppendToScope;
633  static int ourCacheParms;
637 
640  static bool theAddScopedChannels;
642 };
643 
645 PI_API extern void PIcreateResourceManager(bool verbose=true);
646 PI_API extern bool PIresourceManagerExists();
647 
648 #endif
int operator==(const PI_BindingSelectorInfo &i) const
int operator==(const PI_BindingHandleInfo &i) const
const UT_String & getPrompt() const
UT_StringHolder piNameInSettingTable() const
Unsorted map container.
Definition: UT_Map.h:109
const PI_OpHandleLinkMap & getOpHandleLinks() const
UT_Array< PI_SaveCallbackInfo > mySaveCallbacks
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:632
PI_HandleTemplateMap myHandles
static bool theOpenChannelEditorOnScope
void
Definition: png.h:1083
GLboolean * data
Definition: glcorearb.h:131
const PI_SelectorTemplateMap & getSelectors() const
static UT_ValArray< OP_Node * > ourParmNodes
UT_StringArray myBuiltinOpHandleNames
UT_SymbolMap< pi_OpHandleBinding * > myOpHandleBindings
PI_API void PIcreateResourceManager(bool verbose=true)
static void setScopeChannelsOnKey(bool scope)
PI_OpHandleLinkMap myOpHandleLinks
PI_NetworkType
static bool getAddScopedChannels()
PI_ViewerType
PI_OpPIKey(const char *pi_name_in_setting_table, const char *pi_type, int op_id)
std::size_t SYS_HashType
Define the type for hash values.
Definition: SYS_Hash.h:19
UT_ErrorSeverity
Definition: UT_Error.h:25
const PI_SettingList & getDefaultSettings() const
#define PI_API
Definition: PI_API.h:10
static void setOpenChannelEditorOnScope(bool do_open)
PI_API bool PIresourceManagerExists()
UT_StringHolder piType() const
void(* PI_SaveCallback)(void *data)
PI_SelectorTemplateMap mySelectors
const UT_String & getPIDescription() const
static bool theHideLockedHandleParts
bool operator==(const PI_OpPIKey &o) const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
static bool theScopeChannelsOnKey
UT_SymbolMap< PI_NetworkType > myNetworkTypeTable
static UT_IntArray ourParmVecIndices
static bool ourScopeParmChannels
constexpr std::enable_if< I< type_count_base< T >::value, int >::type tuple_type_size(){return subtype_count< typename std::tuple_element< I, T >::type >::value+tuple_type_size< T, I+1 >);}template< typename T > struct type_count< T, typename std::enable_if< is_tuple_like< T >::value >::type >{static constexpr int value{tuple_type_size< T, 0 >)};};template< typename T > struct subtype_count{static constexpr int value{is_mutable_container< T >::value?expected_max_vector_size:type_count< T >::value};};template< typename T, typename Enable=void > struct type_count_min{static const int value{0};};template< typename T >struct type_count_min< T, typename std::enable_if<!is_mutable_container< T >::value &&!is_tuple_like< T >::value &&!is_wrapper< T >::value &&!is_complex< T >::value &&!std::is_void< T >::value >::type >{static constexpr int value{type_count< T >::value};};template< typename T > struct type_count_min< T, typename std::enable_if< is_complex< T >::value >::type >{static constexpr int value{1};};template< typename T >struct type_count_min< T, typename std::enable_if< is_wrapper< T >::value &&!is_complex< T >::value &&!is_tuple_like< T >::value >::type >{static constexpr int value{subtype_count_min< typename T::value_type >::value};};template< typename T, std::size_t I >constexpr typename std::enable_if< I==type_count_base< T >::value, int >::type tuple_type_size_min(){return 0;}template< typename T, std::size_t I > constexpr typename std::enable_if< I< type_count_base< T >::value, int >::type tuple_type_size_min(){return subtype_count_min< typename std::tuple_element< I, T >::type >::value+tuple_type_size_min< T, I+1 >);}template< typename T > struct type_count_min< T, typename std::enable_if< is_tuple_like< T >::value >::type >{static constexpr int value{tuple_type_size_min< T, 0 >)};};template< typename T > struct subtype_count_min{static constexpr int value{is_mutable_container< T >::value?((type_count< T >::value< expected_max_vector_size)?type_count< T >::value:0):type_count_min< T >::value};};template< typename T, typename Enable=void > struct expected_count{static const int value{0};};template< typename T >struct expected_count< T, typename std::enable_if<!is_mutable_container< T >::value &&!is_wrapper< T >::value &&!std::is_void< T >::value >::type >{static constexpr int value{1};};template< typename T > struct expected_count< T, typename std::enable_if< is_mutable_container< T >::value >::type >{static constexpr int value{expected_max_vector_size};};template< typename T >struct expected_count< T, typename std::enable_if<!is_mutable_container< T >::value &&is_wrapper< T >::value >::type >{static constexpr int value{expected_count< typename T::value_type >::value};};enum class object_category:int{char_value=1, integral_value=2, unsigned_integral=4, enumeration=6, boolean_value=8, floating_point=10, number_constructible=12, double_constructible=14, integer_constructible=16, string_assignable=23, string_constructible=24, other=45, wrapper_value=50, complex_number=60, tuple_value=70, container_value=80,};template< typename T, typename Enable=void > struct classify_object{static constexpr object_category value{object_category::other};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_integral< T >::value &&!std::is_same< T, char >::value &&std::is_signed< T >::value &&!is_bool< T >::value &&!std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::integral_value};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_integral< T >::value &&std::is_unsigned< T >::value &&!std::is_same< T, char >::value &&!is_bool< T >::value >::type >{static constexpr object_category value{object_category::unsigned_integral};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_same< T, char >::value &&!std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::char_value};};template< typename T > struct classify_object< T, typename std::enable_if< is_bool< T >::value >::type >{static constexpr object_category value{object_category::boolean_value};};template< typename T > struct classify_object< T, typename std::enable_if< std::is_floating_point< T >::value >::type >{static constexpr object_category value{object_category::floating_point};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&std::is_assignable< T &, std::string >::value >::type >{static constexpr object_category value{object_category::string_assignable};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&(type_count< T >::value==1)&&std::is_constructible< T, std::string >::value >::type >{static constexpr object_category value{object_category::string_constructible};};template< typename T > struct classify_object< T, typename std::enable_if< std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::enumeration};};template< typename T > struct classify_object< T, typename std::enable_if< is_complex< T >::value >::type >{static constexpr object_category value{object_category::complex_number};};template< typename T > struct uncommon_type{using type=typename std::conditional<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&!std::is_constructible< T, std::string >::value &&!is_complex< T >::value &&!is_mutable_container< T >::value &&!std::is_enum< T >::value, std::true_type, std::false_type >::type;static constexpr bool value=type::value;};template< typename T >struct classify_object< T, typename std::enable_if<(!is_mutable_container< T >::value &&is_wrapper< T >::value &&!is_tuple_like< T >::value &&uncommon_type< T >::value)>::type >{static constexpr object_category value{object_category::wrapper_value};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::number_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&!is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::integer_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::double_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< is_tuple_like< T >::value &&((type_count< T >::value >=2 &&!is_wrapper< T >::value)||(uncommon_type< T >::value &&!is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value)||(uncommon_type< T >::value &&type_count< T >::value >=2))>::type >{static constexpr object_category value{object_category::tuple_value};};template< typename T > struct classify_object< T, typename std::enable_if< is_mutable_container< T >::value >::type >{static constexpr object_category value{object_category::container_value};};template< typename T, enable_if_t< classify_object< T >::value==object_category::char_value, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"CHAR";}template< typename T, enable_if_t< classify_object< T >::value==object_category::integral_value||classify_object< T >::value==object_category::integer_constructible, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"INT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::unsigned_integral, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"UINT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::floating_point||classify_object< T >::value==object_category::number_constructible||classify_object< T >::value==object_category::double_constructible, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"FLOAT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::enumeration, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"ENUM";}template< typename T, enable_if_t< classify_object< T >::value==object_category::boolean_value, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"BOOLEAN";}template< typename T, enable_if_t< classify_object< T >::value==object_category::complex_number, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"COMPLEX";}template< typename T, enable_if_t< classify_object< T >::value >=object_category::string_assignable &&classify_object< T >::value<=object_category::other, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"TEXT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value >=2, detail::enabler >=detail::dummy >std::string type_name();template< typename T, enable_if_t< classify_object< T >::value==object_category::container_value||classify_object< T >::value==object_category::wrapper_value, detail::enabler >=detail::dummy >std::string type_name();template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value==1, detail::enabler >=detail::dummy >inline std::string type_name(){return type_name< typename std::decay< typename std::tuple_element< 0, T >::type >::type >);}template< typename T, std::size_t I >inline typename std::enable_if< I==type_count_base< T >::value, std::string >::type tuple_name(){return std::string{};}template< typename T, std::size_t I >inline typename std::enable_if<(I< type_count_base< T >::value), std::string >::type tuple_name(){auto str=std::string{type_name< typename std::decay< typename std::tuple_element< I, T >::type >::type >)}+ ','+tuple_name< T, I+1 >);if(str.back()== ',') str.pop_back();return str;}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value >=2, detail::enabler > > std::string type_name()
Recursively generate the tuple type name.
Definition: CLI11.h:1729
const UT_String & getOpParm() const
size_t operator()(const PI_OpPIKey &pk) const
static bool getHideLockedHandleParts()
const UT_String & getPrimMask() const
std::pair< PI_SaveCallback, void * > PI_SaveCallbackInfo
OP_OpTypeId
Definition: OP_OpTypeId.h:18
static bool getOpenChannelEditorOnScope()
static void setAddScopedChannels(bool add)
const UT_String & getExtraInfo() const
GLuint const GLchar * name
Definition: glcorearb.h:786
SYS_DECLARE_LEGACY_TR(GU_Detail)
GLenum GLenum GLsizei void * table
Definition: glad.h:5129
static bool getScopeChannelsOnKey()
PI_API PI_ResourceManager * PIgetResourceManager()
static void setHideLockedHandleParts(bool hide)
GA_API const UT_StringHolder parms
static bool theAddScopedChannels
const UT_String & getPIName() const
__hostdev__ constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Definition: NanoVDB.h:976
const PI_HandleTemplateMap & getHandles() const
const PI_BindingParmArray & getBindings() const
const UT_String & getMenu() const
static bool ourSetKeyOnParms
UT_StringHolder myStateBeingCreated
UT_Map< PI_OpPIKey, OpPISettingInfo, PI_OpPIKey::Hasher > myPISettingsForOps
const UT_String & getDescription() const
UT_SymbolMap< pi_OpSelectorBinding * > myOpSelectorBindings
static UT_ValArray< PRM_Parm * > ourParms
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
int operator==(const PI_BindingParmInfo &i) const
static bool ourAppendToScope
const UT_String & getName() const
UT_StringMap< PI_SettingList * > myLastPISettings
state
Definition: core.h:2289
const UT_String & getPIParm() const
Definition: format.h:1821
const UT_String & getOpParm() const