HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_Director.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: OP Library (C++)
7  *
8  * COMMENTS:
9  * The OP_Director class is a collection (network) of managers.
10  * The Managers register themselves with an active OP_Director
11  * when they are created. The active OP_Director is obtained
12  * via the global function (yuch) OPgetDirector().
13  *
14  */
15 
16 #ifndef __OP_Director_h__
17 #define __OP_Director_h__
18 
19 #include "OP_API.h"
20 #include "OP_CommandManager.h"
21 #include "OP_Network.h"
22 #include "OP_Node.h"
23 #include "OP_OTLManager.h"
24 #include "OP_OperatorTable.h"
25 #include "OP_ConnectorId.h"
26 #include <CH/CH_Manager.h>
27 #include <UT/UT_ColorTable.h>
28 #include <UT/UT_IntArray.h>
29 #include <UT/UT_NonCopyable.h>
30 #include <UT/UT_Thread.h>
32 #include <UT/UT_Tuple.h>
33 #include <UT/UT_ValArray.h>
34 #include <SYS/SYS_Types.h>
35 #include <iosfwd>
36 
37 #define OP_POSTLOAD_SCRIPT "456.cmd"
38 
39 class UT_WorkArgs;
40 class UT_WorkBuffer;
41 class UT_Args;
42 class OP_SaveCallback;
43 class OP_Input;
44 class OP_ExprFunc;
45 class op_ShopClerkInfo;
46 class OP_BundleList;
47 class OP_StyleManager;
48 class OP_Take;
49 class OP_FileResolver;
50 class OP_GlobContext;
52 class PRM_ScriptPage;
53 class UT_Obfuscator;
54 class OP_EventScriptPathCache;
55 
57  void *data, void *cbdata);
59 
61 {
62  Y_UP,
63  Z_UP
64 };
65 
67 {
68 public:
69  enum EventType
70  {
80  };
81  typedef void (*EventCallback)(EventType type, void *);
82  typedef OP_ERROR (*SaveCallback)(std::ostream &, void *);
83 
84 public:
86  ~OP_Director() override;
87 
88  OP_OpTypeId getOpTypeID() const override
89  { return DIR_OPTYPE_ID; }
90  const char *getOpType() const override
91  { return DIR_OPTYPE_NAME; }
92  OP_DataType getCookedDataType() const override
93  { return OP_NO_DATA; }
94  void *getCookedData(OP_Context &) override
95  { return 0; }
96  void deleteCookedData() override
97  { }
99  std::ostream &, OP_Context &, int = 0) override
100  { return 1; }
101  bool loadCookedData(UT_IStream &, const char * = 0) override
102  { return true; }
103  int saveCookedData(const char *, OP_Context &) override
104  { return 1; }
105  OP_OpTypeId getChildTypeID() const override
106  { return MGR_OPTYPE_ID; }
107  const char *getChildType() const override
108  { return MGR_OPTYPE_NAME; }
109 
110  OP_Network *getManager(const char *name) const;
111  CH_Manager *getChannelManager() { return &myCommandManager; }
112  OP_CommandManager *getCommandManager() { return &myCommandManager; }
113  fpreal32 getVersion() const { return myVersion; }
114 
115  // NB: clearNetwork() will always reload the channel manager options!
116  // However, the user is responsible as to when we save them
117  bool loadChannelManagerOptions();
118  bool saveChannelManagerOptions();
119 
120  virtual void enable(int state);
121 
122  OP_ERROR saveNetwork(std::ostream &os,
123  const OP_SaveFlags &options);
124  bool loadNetwork(UT_IStream &is, int merge=0,
125  const char *mergePattern=0,
126  int overwrite=0);
127  void initializeManagerWireStyles();
128  virtual void clearNetwork( int clear_aliases );
129 
130  // This will go through the entire hip file and cook all the CHOPs
131  // that have their export flags set and cook them with CookOverride
132  // turned on.
133  virtual void opUpdateAllExports();
134 
136  { myOldCHOPOverrideFlag = true; }
138  { return myOldCHOPOverrideFlag; }
140  { myOldCHOPOverrideFlag = false; }
141 
142  /// Create an evaluation context scope with a new node
143  class CwdScope;
144 
146  { return getCwd(SYSgetSTID()); }
147  void getCwd(UT_String &str)
148  { getCwd(SYSgetSTID(), str); }
149 
150  OP_Node *getCwd(int thread);
151  void getCwd(int thread, UT_String &str);
152  void setCwd(int thread, const OP_Node *node,
153  int eval_collection=-1);
154 
155  // pushCwd() pushes the current cwd onto a stack that can later be restored
156  // using popCwd(). The optional new_cwd parameter sets the cwd to it at
157  // the same time.
158  void pushCwd(int thread, const OP_Node *new_cwd = NULL);
159  void popCwd(int thread);
160 
161  int getCwdStackSize(int thread) const
162  {
163  return myCwdContext.getValueForThread(thread)
164  .myCwdStack.size();
165  }
166 
167  void setEditNetworkUI(OP_Network *net);
168 
169  bool getPickedNodes(OP_NodeList &picked_nodes,
170  bool include_hidden=false,
171  bool append_to_list=false) const;
172  bool getPickedItems(OP_NetworkBoxItemList &picked_items,
173  bool include_hidden=false) const;
174  bool getPickedInputs(
175  UT_Array<OP_Input *> &picked_inputs) const;
176  OP_Node *getLastPickedNode(OP_Node *parent = NULL) const;
177  const OP_ItemIdList &getPickedItemIds() const;
178 
179  void clearPickedItems();
180 
181  // Pick the given item, clearing all other picked items first. This is here
182  // so that we can prevent an extra undo if the current state already
183  // matches what we want.
184  void makeOnlyPickedCurrent(OP_NetworkBoxItem &item);
185 
186  // These next 3 methods should only be called from OP_Node::setPicked()
187  // The myPickedItems array can't contain duplicates and maintains the
188  // invariant that:
189  // - node.getPicked() is TRUE iff it is in the list.
190  // - node.getPicked() is FALSE implies that it is NOT in the list.
191  void addPickedNode(const OP_Node &node, bool edit);
192  void removePickedNode(const OP_Node &node, bool edit);
193  void makePickedNodeLast(const OP_Node &node, bool edit);
194 
195  // These methods should only be called from the various
196  // setPicked() functions in OP_NetworkBoxItem subclasses. The
197  // myPickedXXXIds arrays can't contain duplicates and maintain the
198  // invariant that:
199  // - item.getPicked() is TRUE iff it is in the list.
200  // - item.getPicked() is FALSE implies that it is NOT in the list.
201  void addPickedItem(const OP_NetworkBoxItem &item);
202  void removePickedItem(const OP_NetworkBoxItem &item);
203  void itemBeingDeleted(const OP_NetworkBoxItem &item);
204 
205  // These methods should only be called from OP_Input::setPicked(). The
206  // myPickedXXXIds arrays can't contain duplicates and maintain the
207  // invariant that:
208  // - input.getPicked() is TRUE iff it is in the list.
209  // - input.getPicked() is FALSE implies that it is NOT in the list.
210  void addPickedInput(const OP_Input &input);
211  void removePickedInput(const OP_Input &input);
212 
213  // Control time.
214  void setTime(fpreal time);
215  fpreal getTime() const;
216  void setFPS(fpreal fps);
217  void setNFrames(fpreal nframes);
218  void setTimeRange(fpreal tstart, fpreal tend);
219 
220  /// The save callback is called when saving .hip files. It is called with
221  /// a stream reference to the .hip file so that the callback can insert
222  /// hscript commands into the .hip file's .application section. When a
223  /// .hip file is loaded, all the commands in the .application section are
224  /// executed.
225  // @{
226  void setSaveCallback(SaveCallback cb, void *cb_data);
227  void removeSaveCallback(SaveCallback cb, void *cb_data);
228 
229  /// Callbacks for certain global OP_Director events, such as new scene
230  /// and load scene.
231  void addEventCallback(EventType type, EventCallback cb,
232  void *data);
233  void removeEventCallback(EventType type, EventCallback cb,
234  void *data);
235  // @}
236 
237  void setUserDisplayOptionSaveCallback(
238  OP_ERROR (*cb)(std::ostream &, void *),
239  void *callbackData);
240  void setSceneFileVisualizersSaveCallback(
241  OP_ERROR (*cb)(std::ostream &, void *),
242  void *callbackData);
243  void addBadLoadData(char *str, int len);
244 
245  int isLoading() const { return (myInLoadCount > 0); }
246  virtual void beginLoading();
247  virtual void endLoading();
248  bool getIsLoadingHip() const
249  { return myIsLoadingHip; }
250  bool getIsQuitting() const
251  { return myIsQuitting; }
253  { myIsDoingExplicitSave = value; }
255  { return myIsDoingExplicitSave; }
256  bool getIsAnyNodeCooking() const;
257 
258  bool getIsMantra() const
259  { return myIsMantra; }
260  void setIsMantra(bool v)
261  { myIsMantra = v; }
262 
263  void destroyFileResolver();
264 
265  void beginTakeSwitch();
266  void endTakeSwitch();
267  bool isSwitchingTake() const
268  { return mySwitchingTake; }
269 
270  int renameNode(OP_Node *, const char *,
271  OP_RenameAction) override;
272 
273  // These methods are only called by the network load/save
274  void saveChannelGroups(std::ostream &os, int binary);
275  bool loadChannelGroups(UT_IStream &is, const char *path);
276  void saveTimeGroups(std::ostream &os, int binary);
277  bool loadTimeGroups(UT_IStream &is, const char *path);
278  void saveScriptedOpLibrary(std::ostream &os);
279  bool loadScriptedOpLibrary(UT_IStream &is, int modtime);
280  bool loadScriptedOpDefs(UT_IStream &is);
281  void saveInternalOpLibraries(std::ostream &os);
282  bool loadInternalOpLibraries(UT_IStream &is);
283  void saveLibraryPreferences(std::ostream &os);
284  bool loadLibraryPreferences(UT_IStream &is);
285  bool loadHOMSessionModuleSource(UT_IStream &is);
286  void saveUnselectedFilePatterns(std::ostream &os);
287  bool loadUnselectedFilePatterns(UT_IStream &is);
288 
289  void saveOTLBackupInformation(std::ostream &os);
290 
291  OP_ExprFunc *getExprFunctions();
292  void saveExprFunctions(std::ostream &os);
293  bool loadExprFunctions(UT_IStream &is, const char *path);
294 
295  OP_BundleList *getBundles() { return myBundles; }
296 
297  // These track the current update mode: Should an OP recook?
298  int cookEnabled() const
299  { return myCookEnabled; }
300  void setCookEnabled(int state)
301  { myCookEnabled = state; }
302 
303  // These track the simulation update mode: Should simulations cook?
304  int simulationEnabled() const
305  { return mySimulationEnabled; }
306  void setSimulationEnabled(int state)
307  { mySimulationEnabled = state; }
308 
309  // These control whether those simulations reset by output drivers should
310  // reset based on the global or playback playbar range.
312  { return mySkipPlaybarBasedSimulationReset > 0; }
314  { mySkipPlaybarBasedSimulationReset += inc; }
315 
316  // These methods are used by SHOPs to keep track of visible clerks.
317  bool addShopClerk(const char *type);
318  int getNShopClerks() const
319  { return myShopInfo.entries(); }
320  const char *getShopClerkName(int clerk) const;
321  int getShopClerkVisibility(int clerk) const;
322  void setShopClerkVisibility(int clerk, int onoff);
323  bool isCompiledLibrary (OP_OTLLibrary *lib);
324 
325  // This function does nothing at this level, but it is meant to be
326  // overridden to create new OP_OperatorInfos for the given table based
327  // on the existance of VOP networks.
329  const char * /* indexPath */,
330  OP_OTLDefinitionArray & /* defs */)
331  { }
333  const char * /* definitionOp */,
334  OP_Operator * /* op */)
335  { return 0; }
337  OP_Node * /* definitionOp */,
338  UT_String & /* definition */)
339  { }
340  virtual void updateExportedParms(
341  OP_Node * /* definitionOp */)
342  { }
343  // Save the spare parameters section for the specified node. We have
344  // to do this through a virtual function that is actually implemented
345  // in the MOT library because it requires the PI_EditScriptedParms
346  // class.
348  bool,
349  std::ostream &) const
350  { return UT_ERROR_NONE; }
351  // Load the spare parms section for a node. Although it doesn't require
352  // the PI library, this function is also implemented in the MOT library
353  // just to keep the save and load code paths in a similar location.
355  UT_IStream &,
356  UT_String &) const
357  { return true; }
358  // Adds a single spare parm to the specified node. This function exists
359  // for backward compatibility with spare parms from H8. This function is
360  // implemented in the MOT library where we have access to the PI classes
361  // for editing parms (PI_EditScriptedParms).
362  virtual bool addNodeSpareParm(OP_Parameters * /*node*/,
363  PRM_Template * /*parmtemplate*/) const
364  { return false; }
365  // Removes a single spare parm to the specified node. This function exists
366  // for backward compatibility with spare parms from H8. This function is
367  // implemented in the MOT library where we have access to the PI classes
368  // for editing parms (PI_EditScriptedParms).
369  virtual bool removeNodeSpareParm(OP_Parameters * /*node*/,
370  const char * /*parmname*/,
371  UT_StringArray * /*errs*/ = NULL,
372  UT_StringArray * /*warn*/ = NULL
373  ) const
374  { return false; }
375  // Updates the spare parms of a node to match the supplied
376  // PI_EditScriptedParms. This class isn't defined until the PI
377  // library, so this function is actually implemented in MOT_Director.
380  UT_String &) const
381  { }
382  // Save a series of hscript commands to a stream to replicate the
383  // spare parameters of the specified node.
385  std::ostream &,
386  const char *,
387  bool) const
388  { }
389  // Delete spare parameter/base parameter mixing layout. This puts the
390  // spare parameters on their own page.
392  { }
393  // Delete all spare parameters on a node.
395  { }
396 
398  { return 0; }
399 
400  // Functions for saving and loading compiled VEX and RSL code for nodes
401  // with VOP_CodeGenerators in a compiled hip file.
402  virtual void saveNodeCompiledCode(OP_Node *, std::ostream &,
403  bool is_source_code = false)
404  { }
406  bool is_source_code = false)
407  { return true; }
408  virtual void saveNodeCompiledDs(OP_Node *, std::ostream &)
409  { }
411  { return true; }
412 
413  OP_Take *getTakeManager() { return myTakeManager; }
414  OP_StyleManager *getStyleManager() { return myStyleManager; }
415  UT_ColorTable &getGroupColorTable() { return myGroupColorTable; }
416 
417  // deprecated method: interest gets cleared out before every cook
418  void addExtraInput(OP_Node *op,
419  OP_InterestType type) override;
420 
421  // A utility function to glob (pattern expand) all arguments on a command
422  // line.
423  static int globAllArguments(OP_Node *node, UT_Args &args,
424  UT_WorkBuffer &workbuf,
425  UT_WorkArgs &argv,
426  OP_ItemTypeMask item_type,
428  int startitem = 1);
429 
430  // This function is similar to the one above, except it takes a string
431  // pattern (which may contain spaces) and returns an array of matching
432  // nodes and/or netboxes.
433  static void globAllArgumentsAsArray(OP_Node &relative_to_node,
434  const char *pattern,
435  OP_ItemTypeMask item_type,
436  OP_GlobContext &glob_context,
438 
439  // These functions are the instantiations of the virtual functions
440  // from our OP_OTLManagerSink base class.
441  void definitionsAdded(int libindex,
442  UT_IntArray &defindex) override;
443  void definitionsRemoved(int libindex,
444  UT_IntArray &defindex,
445  OP_OTLLibrary *&preserve) override;
446 
447  // Given a path of the form "tablename/opname", return the table and
448  // operator indicated by the path. The relativetonode parm is used when
449  // the path is actualy a node path, and we want the table and operator
450  // of the node specified by the path. If it is a relative path, the
451  // relativetonode is the starting point. If it is null, the current
452  // working node is used, or the director.
453  void getTableAndOperator(const char *path,
455  OP_Operator *&op,
456  const OP_Node *relativetonode = 0);
458  { return myOTLManager; }
460  { return myOTLManager; }
461 
462  // This function should be called right before exiting. It will go
463  // through all OP_Operators with active nodes and run the POSTLASTDELETE
464  // event script (though it doesn't actually delete the nodes).
465  void runDeleteScriptsOnQuit();
466 
467  // Add or remove callback functions that get executed whenever we call
468  // OP_Node::opChanged.
469  void addGlobalOpChangedCallback(
470  OP_GlobalOpChangedCallback cb, void *cbdata);
471  void removeGlobalOpChangedCallback(
472  OP_GlobalOpChangedCallback cb, void *cbdata);
473  // This function is called any time OP_Node::opChanged is called. It sends
474  // the change information along to any global op change callback functions
475  // that have been registered by addGlobalOpChangeCallback.
476  void globalOpChanged(OP_Node *node,
477  OP_EventType reason,
478  void *data);
479 
480  // This function creates a backup of the specified file, if the option
481  // to save backup files is turned on. The actual file name and file type
482  // are irrelevent. It returns true if the backup was successful (or was
483  // not required).
484  static bool createBackupFile(const char *filename,
485  bool domove= false);
486  // This function will rename the current file "filename" to the next
487  // filename in the sequence to free up "filename" so that it can be
488  // saved over. If successful, it will store the new filename in
489  // "newfilename". Otherwise, "newfilename" will be an empty string.
490  static void autoIncrementRename(const char *filename,
491  UT_String &newfilename,
492  UT_String &errorstring,
493  bool movefile,
494  bool autosave);
495 
496  void runScript(CMD_Manager *cman, const char *filename);
497  UT_Tuple<bool, int> runPython(CMD_Manager *cman, const char *filename);
498  UT_Tuple<bool, int> runPython(CMD_Manager *cman, int argc,
499  char *argv[]);
500  UT_Tuple<bool, int> runDefaultStartupScripts(CMD_Manager *cman,
501  const char *startup_script,
502  const char *postload_script);
503 
504  // Get the global (i.e. non-operator specific) script path cache.
505  OP_EventScriptPathCache *getGlobalEventScriptPathCache()
506  { return myGlobalEventScriptPathCache; }
507 
508  // Clear all cached paths to global event scripts.
509  void clearGlobalEventScriptPathCache();
510 
511  // Query all cached global event script paths.
512  void getCachedGlobalEventScriptPaths(
513  UT_StringArray &events,
515  bool only_nonempty) const;
516 
517  // Because of code complexity issues, this method must be used to destruct
518  // an OP_Director.
519  static void destroyDirector(OP_Director *opdir);
520 
521  bool getSaveSceneAsText() const;
522  void setSaveSceneAsText(bool onOff);
523  bool getNewFileSaveSceneAsText() const;
524  void setNewFileSaveSceneAsText(bool onOff);
525 
526  /// Run callbacks for before saving a scene,
527  /// 'autosave' indicates if the save was triggered by the autosave timer.
528  void notifyBeforeSceneSave(
529  const UT_StringHolder &filename,
530  bool autosave);
531  /// Run callbacks for before saving a scene,
532  /// 'autosave' indicates if the save was triggered by the autosave timer.
533  /// 'did_succeed' indicates if the save was successful.
534  void notifyAfterSceneSave(
535  const UT_StringHolder &filename,
536  bool autosave,
537  bool did_succeed);
538 
540 
542  { return myOrientationMode; }
544  { myOrientationMode = axis; }
545 
546  static UT_Obfuscator *getObfuscator();
547 
548 protected:
550  { return UT_ERROR_NONE; }
551  OP_ERROR bypassMe(OP_Context &, int &) override
552  { return UT_ERROR_NONE; }
553  const char *getFileExtension(int binary) const override
554  { return binary ? ".bhip" : ".hip"; }
555  void clearUnsupportedCommands() const;
556 
557  // This function is called when we update our OTL for an operator. It
558  // does nothing at this level, but in MOT it will clear out the PI
559  // settings that have been saved for the specified operator type.
560  virtual void clearHandleSettings(OP_Operator *) { }
561 
562  // We don't allow spare parms on the director, so just ignore this call.
564  UT_String &errors) override
565  {
566  errors += "Spare parameters are not alowed on ";
567  errors += "the root node.";
568  return false;
569  }
570 
571  /// Runs the user-defined post load script when loading
572  /// a new network into Houdini.
573  void runPostLoadScript();
574 
575 private:
576  // Disallow copying of OP_Director, these methods are not implemented
577  // on purpose
578  OP_Director(const OP_Director &copy);
580 
581  void installCommands();
582  void installMoreCommands();
583  void installCHCommands();
584  void installOTLCommands();
585  void installOpRampResolver();
586 
587  void savePreCommands(std::ostream &os);
588  void savePostCommands(std::ostream &os);
589 
590  void notifyEventCallbacks(EventType type);
591 
592  /// Helper function to update to a new operator definition. May delete
593  /// the old operator and return a different one.
594  void updateNewDefinition(
595  OP_Operator *&op,
596  OP_OTLLibrary *newlib,
597  int newdefindex);
598 
599  /// Helper function for runDefaultStartupScripts().
600  /// Pass back the full path of the first startup script file
601  /// found in the Houdini path.
602  static void getFirstFoundStartupScriptFile(
603  UT_StringHolder &script_path,
604  const char *script_file_name);
605 
606  /// Helper function for runDefaultStartupScripts().
607  /// Passes back the full path of the first finding of inputpath
608  /// in the script search directories. The file name of outputpath
609  /// may end in any of the acceptable script file extensions
610  /// (i.e. .py or .cmd).
611  static void getFirstFoundScriptFile(
612  UT_StringHolder &outputpath,
613  const char *inputpath);
614 
615  static void sceneSaveEvent(EventType event, UT_Args &args);
616 
617 private:
618  char *myBadLoadData;
619  int myBadLoadDataLen;
620  OP_CommandManager myCommandManager;
621  fpreal32 myVersion;
622  int myInLoadCount;
623 
624  struct CwdContext
625  {
626  CwdContext() : myCwdId(-1)
627  {
628  }
629  int myCwdId;
630  UT_IntArray myCwdStack;
631  UT_IntArray myEvalCollectionStack;
632  };
634 
635  OP_ItemIdList myPickedItems;
637 
638  OP_SaveCallback *myCallbacks;
639  OP_SaveCallback *myUserDisplayOptionCallback;
640  OP_SaveCallback *mySceneFileVisualizersCallback;
641  OP_BundleList *myBundles;
642  OP_Take *myTakeManager;
643  OP_StyleManager *myStyleManager;
644  OP_FileResolver *myFileResolver;
645  UT_ColorTable myGroupColorTable;
646 
647  int myCookEnabled;
648  int mySimulationEnabled;
649  int mySkipPlaybarBasedSimulationReset;
651 
652  OP_OTLManager myOTLManager;
653  OP_OperatorTableList myTablesToReload;
654  UT_StringSet *myDummyDefinitionActivations;
655 
656  OP_GlobalOpChangedCallbacks myGlobalOpChangedCallbacks;
657  UT_ValArray<void *> myGlobalOpChangedCallbackData;
658 
659  struct EventCallbackInfo
660  {
661  EventCallback cb;
662  void *data;
663  friend bool operator==(const EventCallbackInfo &lhs, const EventCallbackInfo &rhs)
664  {
665  return (lhs.cb == rhs.cb) && (lhs.data == rhs.data);
666  }
667  };
668 
669  // EventCallbackInfoList will emulate an ordered set
670  //
671  // This is important since we want to ensure that:
672  // 1 - callbacks are executed in the order that they're registered
673  // 2 - only a single unique callback+data pair can be registered
674  //
675  // These are "enforced" in 1-notifyEventCallbacks and 2-addEventCallback
676  //
677  typedef UT_Array<EventCallbackInfo> EventCallbackInfoList;
678  EventCallbackInfoList myEventCallbacks[NUM_NETWORK_EVENT_TYPES];
679 
680  // Cache of global (i.e. non-operator specific) event script paths.
681  OP_EventScriptPathCache *myGlobalEventScriptPathCache;
682 
683  // This flag tracks whether any OPs that got loaded had the old
684  // style override flag. If so, we know we will have to do a complete
685  // update.
686  bool myOldCHOPOverrideFlag;
687  // This flag tracs whether or not we are inside a call to loadNetwork.
688  // This is different from the isLoading flag, which gets set during any
689  // network load.
690  bool myIsLoadingHip;
691  bool mySwitchingTake;
692  // This value is temporarily set to true when the user explicitly asks
693  // for a hip file save either by executing an mwrite, or choosing Save
694  // or Save As from the File menu.
695  bool myIsDoingExplicitSave;
696  // This flag is set to true while Houdini is exiting.
697  bool myIsQuitting;
698 
699  // This flag is set when the OP director is created for mantra. There are
700  // some OP features which are expensive (i.e. importing the hou python
701  // module). This option disables those features.
702  bool myIsMantra;
703 
704  bool mySaveSceneAsText;
705  bool myNewFileSaveSceneAsText;
706 
707  OrientationMode myOrientationMode;
708 
709  static UT_Obfuscator *theObfuscator;
710 };
711 
714 
715 /// Create an evaluation context scope with a new node
716 class OP_API OP_Director::CwdScope : UT_NonCopyable
717 {
718 public:
719  CwdScope(int thread, const OP_Node &new_cwd);
720  ~CwdScope();
721 private:
722  int myThread;
723  CH_EvalContext::Scope myEvalScope;
724  int myOldCwdId;
725 };
726 
727 #endif
virtual bool addNodeSpareParm(OP_Parameters *, PRM_Template *) const
Definition: OP_Director.h:362
bool loadNetwork(UT_IStream &is, int merge=0, const char *pattern=NULL, int overwrite=0, const OP_FixNameParms *fix_name_parms=NULL, UT_StringArray *src_names=NULL, UT_StringArray *dest_names=NULL)
void * getCookedData(OP_Context &) override
Definition: OP_Director.h:94
UT_ErrorSeverity OP_ERROR
Definition: OP_Error.h:6
UT_ValArray< OP_GlobalOpChangedCallback > OP_GlobalOpChangedCallbacks
Definition: OP_Director.h:58
GLenum GLenum GLenum input
Definition: glew.h:13879
GLuint GLsizei const void GLenum preserve
Definition: glew.h:8474
GT_API const UT_StringHolder filename
GLuint const GLchar * name
Definition: glew.h:1814
OP_StyleManager * getStyleManager()
Definition: OP_Director.h:414
void setIsDoingExplicitSave(bool value)
Definition: OP_Director.h:252
OP_API OP_Director * OPsetDirector(OP_Director *boss)
const Args & args
Definition: printf.h:628
GT_API const UT_StringHolder time
UT_ColorTable & getGroupColorTable()
Definition: OP_Director.h:415
bool isSwitchingTake() const
Definition: OP_Director.h:267
bool getIsMantra() const
Definition: OP_Director.h:258
void setOldCHOPOverrideFlag()
Definition: OP_Director.h:135
bool getOldCHOPOverrideFlag()
Definition: OP_Director.h:137
GLenum GLsizei GLenum GLenum const void * table
Definition: glew.h:4940
virtual void findInternalScriptOperators(const char *, OP_OTLDefinitionArray &)
Definition: OP_Director.h:328
virtual bool loadNodeSpareParms(OP_Parameters *, UT_IStream &, UT_String &) const
Definition: OP_Director.h:354
int saveCookedData(const char *, OP_Context &) override
Definition: OP_Director.h:103
UT_ErrorSeverity
Definition: UT_Error.h:25
virtual void definitionsRemoved(int, UT_IntArray &, OP_OTLLibrary *&)
std::tuple< Types...> UT_Tuple
Definition: UT_Tuple.h:53
OP_EventScriptPathCache * getGlobalEventScriptPathCache()
Definition: OP_Director.h:505
OP_BundleList * getBundles()
Definition: OP_Director.h:295
const GLdouble * v
Definition: glew.h:1391
bool changeSpareParms(UT_IStream &, UT_String &errors) override
Definition: OP_Director.h:563
virtual int renameNode(OP_Node *node, const char *name, OP_RenameAction action=OP_RENAME_NORMAL)
virtual void clearHandleSettings(OP_Operator *)
Definition: OP_Director.h:560
virtual void deleteAllNodeSpareParms(OP_Parameters *) const
Definition: OP_Director.h:394
OrientationMode getOrientationMode() const
Definition: OP_Director.h:541
void setOrientationMode(OrientationMode axis)
Definition: OP_Director.h:543
float fpreal32
Definition: SYS_Types.h:200
int saveCookedData(std::ostream &, OP_Context &, int=0) override
Definition: OP_Director.h:98
static void saveOTLBackupInformation(std::ostream &os, const OP_OperatorList &fallbackops, const OP_OperatorList &dummyops)
CH_Manager * getChannelManager()
Definition: OP_Director.h:111
OP_OTLManager & getOTLManager()
Definition: OP_Director.h:457
const char * getOpType() const override
Definition: OP_Director.h:90
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
virtual void updateExportedParms(OP_Node *)
Definition: OP_Director.h:340
OP_OpTypeId getOpTypeID() const override
Definition: OP_Director.h:88
friend class OP_Director
Definition: OP_Network.h:1060
virtual bool loadNodeCompiledDs(OP_Node *, UT_IStream &)
Definition: OP_Director.h:410
OP_DataType getCookedDataType() const override
Definition: OP_Director.h:92
virtual bool loadNodeCompiledCode(OP_Node *, UT_IStream &, bool is_source_code=false)
Definition: OP_Director.h:405
OP_InterestType
Definition: OP_DataTypes.h:44
int getCwdStackSize(int thread) const
Definition: OP_Director.h:161
OP_ERROR cookMe(OP_Context &) override
Definition: OP_Director.h:549
int cookEnabled() const
Definition: OP_Director.h:298
bool getIsDoingExplicitSave() const
Definition: OP_Director.h:254
void bumpSkipPlaybarBasedSimulationReset(int inc)
Definition: OP_Director.h:313
void clearOldCHOPOverrideFlag()
Definition: OP_Director.h:139
bool getIsQuitting() const
Definition: OP_Director.h:250
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
int getNShopClerks() const
Definition: OP_Director.h:318
const GLuint GLenum const void * binary
Definition: glew.h:3502
int isLoading() const
Definition: OP_Director.h:245
bool getIsLoadingHip() const
Definition: OP_Director.h:248
void
Definition: png.h:1083
void getPickedItems(OP_ItemTypeMask item_type_mask, OP_NetworkBoxItemList &picked, bool include_hidden=false, bool recurse_picked_netboxes=false) const
#define MGR_OPTYPE_NAME
Definition: OP_Node.h:309
bool loadCookedData(UT_IStream &, const char *=0) override
Definition: OP_Director.h:101
void deleteCookedData() override
Definition: OP_Director.h:96
const char * getChildType() const override
Definition: OP_Director.h:107
OP_Node * getCwd()
Definition: OP_Director.h:145
OP_OpTypeId
Definition: OP_OpTypeId.h:18
*Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
virtual OP_ERROR saveNodeSpareParms(OP_Parameters *, bool, std::ostream &) const
Definition: OP_Director.h:347
virtual bool removeNodeSpareParm(OP_Parameters *, const char *, UT_StringArray *=NULL, UT_StringArray *=NULL) const
Definition: OP_Director.h:369
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
virtual OP_Node * linkInternalScriptOperator(const char *, OP_Operator *)
Definition: OP_Director.h:332
GT_API const UT_StringHolder version
const OP_OTLManager & getOTLManager() const
Definition: OP_Director.h:459
GLsizei const GLchar *const * path
Definition: glew.h:6461
virtual void getInternalScriptDefinition(OP_Node *, UT_String &)
Definition: OP_Director.h:336
virtual void deleteNodeSpareParmLayout(OP_Parameters *) const
Definition: OP_Director.h:391
void setIsMantra(bool v)
Definition: OP_Director.h:260
unsigned int OP_ItemTypeMask
Definition: OP_ItemId.h:43
fpreal32 getVersion() const
Definition: OP_Director.h:113
cl_event event
Definition: glew.h:3695
Create an evaluation context scope with a new node.
Definition: OP_Director.h:66
SYS_API int SYSgetSTID()
virtual void addExtraInput(OP_Node *op, OP_InterestType type)
OP_Take * getTakeManager()
Definition: OP_Director.h:413
const char * getFileExtension(int binary) const override
Definition: OP_Director.h:553
fpreal64 fpreal
Definition: SYS_Types.h:277
virtual void saveNodeSpareParmCommands(OP_Parameters *, std::ostream &, const char *, bool) const
Definition: OP_Director.h:384
OP_API OP_Director * OPgetDirector()
#define OP_API
Definition: OP_API.h:10
OIIO_API bool copy(string_view from, string_view to, std::string &err)
virtual void saveNodeCompiledDs(OP_Node *, std::ostream &)
Definition: OP_Director.h:408
OP_EventType
Definition: OP_Value.h:22
Scope(int thread)
OP_DataType
Definition: OP_DataTypes.h:28
OP_CommandManager * getCommandManager()
Definition: OP_Director.h:112
void getCwd(UT_String &str)
Definition: OP_Director.h:147
GLuint64EXT * result
Definition: glew.h:14007
virtual PRM_ScriptPage * allocateSpareScriptPage(OP_Operator *)
Definition: OP_Director.h:397
OP_OrientationMode
Definition: OP_Director.h:60
void setCookEnabled(int state)
Definition: OP_Director.h:300
virtual void definitionsAdded(int, UT_IntArray &)
GLubyte * pattern
Definition: glew.h:5711
virtual void saveNodeCompiledCode(OP_Node *, std::ostream &, bool is_source_code=false)
Definition: OP_Director.h:402
virtual void changeNodeSpareParms(OP_Parameters *, PI_EditScriptedParms &, UT_String &) const
Definition: OP_Director.h:378
int simulationEnabled() const
Definition: OP_Director.h:304
OP_ERROR bypassMe(OP_Context &, int &) override
Definition: OP_Director.h:551
Cooks node data and makes it available through the reader.
GLsizei const GLfloat * value
Definition: glew.h:1849
OP_OpTypeId getChildTypeID() const override
Definition: OP_Director.h:105
OP_RenameAction
Definition: OP_Network.h:68
GLboolean enable
Definition: glew.h:2745
void setSimulationEnabled(int state)
Definition: OP_Director.h:306
void(* OP_GlobalOpChangedCallback)(OP_Node *node, OP_EventType reason, void *data, void *cbdata)
Definition: OP_Director.h:56
#define DIR_OPTYPE_NAME
Definition: OP_Node.h:310
UT_NonCopyable & operator=(const UT_NonCopyable &)=delete
type
Definition: core.h:528
GLenum GLsizei len
Definition: glew.h:7752
GLenum const void * paths
Definition: glew.h:13589
bool skipPlaybarBasedSimulationReset() const
Definition: OP_Director.h:311