HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_EnvControl.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: UT_EnvControl.h ( UT Library, C++)
7  *
8  * COMMENTS: In Houdini applications, there are many environment variables
9  * which control the behaviour of certain features/capabilities.
10  * This class provides a centralized place to efficiently query
11  * these variables. The reason for the centralization is so that
12  * we can easily get a list of these control variables. As well,
13  * this mechanism provides ways of changing the control settings
14  * from environment variables to disk file to registry entry.
15  * Currently only environment variable control is supported.
16  *
17  *
18  * When adding a new environment variable, please document the variable in
19  * $SHD/ref/env.txt
20  */
21 
22 #ifndef __UT_EnvControl__
23 #define __UT_EnvControl__
24 
25 #include "UT_API.h"
26 #include <SYS/SYS_Types.h>
27 #include "UT_StringArray.h"
28 
30 {
31  // UT library: Public interface
48 
49  // UT: Internal controls
60 
61  // Houdini Environment File Control
64 
65  // FS: Public interface
71 
72  // GA: Public interface
74 
75  // IMG3D: Public interface
77 
78  // IMG: Public interface
99  // IMG: Private interface
106 
107  // MV: Public interface
109 
110  // VEX: Public interface
120 
121  // VEX: Private interface
123 
124  // RE: Public interface
134 
135  // CMD
137 
138  // OP
142 
143  // GEO
147 
148  // GU
150 
151  // RAY
161 
162  // COP
164 
165  // IFD
169 
170  // MAT
172 
173  // UI
188 
189  // FP
191 
192  // OPUI
198 
199  // DM
202 
203  // MATUI
205 
206  // Custom
211 
212  // LM
215 
216  // CHOP
218 
219  // SHOP
222 
223  // VOP
225 
226  // SHLF
229 
230  // Other
235 
236  // Backwards Compatability
245 
257 
259 
260  // hscript
264 
266 
267  // This is for "internal use" only. It turns on features that are not
268  // ready for prime-time.
270 
271  // Maximum number of files to keep in the backup directory
273 
275 
277 
280 
283 
285 
287 
288  // Controls the number of complete FBX scenes to
289  // keep cached in memory after import. Defaults to 1.
291 
294 
296 
299 
301 
302  // OpenCL
305 
309 
311 
312  // Maximum megabytes in write buffer.
314 
316 
320 
323 
326 
328 
330 
332 
334 
337 
339 
341 
342  // Used to force regular LM checks on Steam builds
344 
345  // OptiX
347 
349 };
350 
352 {
353  // UT: Public interface
357 
358  // UT: Internal variables
360 
361  // IMG: Public interface
364 
365  // RE
367 
368  // UI
372 
373  // GR
375 
376  // Custom
378 
379  // ROP: Internal variables
381 
382  // OpenCL: Memory pool size, as percentage of GPU memory.
384 
386 };
387 
389 {
390  // UT: Public interface
406 
407  // UT: Internal variables
410 
411  // external tools
413 
414  // IMG: Public interface
416 
417  // VEX(VMAT)
425 
426  // HOM
428 
429  // OP
430  ENV_HOUDINI_HIP_DEFAULT_NAME, // "untitled.hip"
433 
434  // VOP
436 
437  // GEO
439 
440  // COP
447 
448  // CHOP
450 
451  // IFD
459 
460  // UI
471 
472  // FUI
475 
476  // CHUI
478 
479  // OPUI
483 
484  // VEX(VCC)
486 
487  // Custom
495  ENV_HOUDINI_VIEW_METACAM, //OTLs that lock to view in a special way
496 
497  // Path variables
520 
524 
526 
528 
530 
532 
535 
542 
544 
545  // These are here so we can have them show up in hconfig and provide
546  // help. They should only be used implicitly.
547  ENV_HSITE, // Between HFS and HOME.
548  ENV_JOB, // We should not use JOB!
549 
551 
554 
556 
557  // OPENGL
563 
564  // OPENCL
568 
569  // Orbolt
571 
572  // Anonymous Usage Statistics
574 
576 
578 
580 
582 
584 
585  // Optix
587 
589 };
590 
592 {
593 public:
594  UT_EnvControl();
595  ~UT_EnvControl();
596 
597  static int getInt(UT_IntControl i)
598  { return getControl().myIValues[i]; }
600  { return getControl().myFValues[i]; }
601  static const char *getString(UT_StrControl i)
602  { return getControl().mySValues[i]; }
603 
604  // Look up the appropriate variable name for the token
605  static const char *getIntVar(UT_IntControl i);
606  static const char *getFloatVar(UT_FltControl i);
607  static const char *getStringVar(UT_StrControl i);
608 
609  static void setStringVar(UT_StrControl i, const char *value);
610 
611  // Look up the appropriate old style variable name for the token. This can
612  // be used to check for old environment variables.
613  static const char *getOldIntVar(UT_IntControl i);
614  static const char *getOldFloatVar(UT_FltControl i);
615  static const char *getOldStringVar(UT_StrControl i);
616 
617  /// Indicate that the given variable changed and update our cached values.
618  /// If varname is NULL, then all variables are updated.
619  static void varChanged(const char *varname)
620  { varChanged(varname, nullptr); }
621 
622  /// Update the cached varname value with the given value so that we can
623  /// avoid an extraneous HoudiniGetenv() for the equivalent code snippet:
624  /// @code
625  /// HoudiniSetenv(name, value);
626  /// UT_EnvControl::varChanged(name);
627  /// @endcode
628  /// @return true if name was found and value is non-null, in which case the
629  /// HoudiniSetenv() was called, else false is returned.
630  static bool varChanged(const char *varname, const char *value);
631 
632  /// Like varChanged() except that it can avoid an extraneous
633  /// HoudiniGetenv() for the equivalent code snippet:
634  /// @code
635  /// HoudiniSetenv(name, value);
636  /// UT_EnvControl::varChanged(name);
637  /// @endcode
638  /// @return true if name was found, in which case the HoudiniSetenv() will
639  /// be called, else false is returned.
640  static bool changeVar(const char *name, const char *value);
641 
642  static void changeExistLookupDefault(UT_IntControl i, int new_def);
643 
644  /// Set all additional .env files to be parsed for env variable values.
645  /// It is best to call getAdditionalEnvironmentFiles() first and then
646  /// append to the list because this function will overwrite all the
647  /// additional paths that were previously set.
648  /// You can still use the HOUDINI_NO_ENV_FILE_OVERRIDES to disallow
649  /// overwrites, knowing that these files get applied AFTER the default
650  /// houdini.env file in the user's home directory.
651  /// That said, HOUDINI_NO_ENV_FILE will have no effect on this function.
652  /// If additional files are set, they will be used, regardless of the
653  /// value of HOUDINI_NO_ENV_FILE.
654  static void setAdditionalEnvironmentFiles(
655  const UT_StringArray &files);
656 
657  /// Return the current list of additional environment files.
658  static const UT_StringArray&
659  getAdditionalEnvironmentFiles();
660 
661 private:
662  void doInit(bool init_defaults);
663  void setDefaults();
664  bool loadEnvironmentFile(const char *path,
665  bool allow_overrides);
666  void loadDefaultEnvironmentFile();
667  void loadEnvironmentFiles();
668  void loadEnvironment(bool init_defaults);
669 
670  void updateExistLookup(int i, const char *value = nullptr);
671  void updateIntLookup(int i, const char *value = nullptr);
672  void updateFltLookup(int i, const char *value = nullptr);
673  void updateStrLookup(int i, bool fix_path,
674  const char *value = nullptr);
675 
676  int myIValues[ENV_MAX_INT_CONTROLS];
677  float myFValues[ENV_MAX_FLT_CONTROLS];
678  char *mySValues[ENV_MAX_STR_CONTROLS];
679 
680  static UT_EnvControl &getControl()
681  {
682  if (!theControl)
683  theControl = new UT_EnvControl();
684  return *theControl;
685  }
686  static UT_EnvControl *theControl;
687 
688  static UT_StringArray theAdditionalEnvironmentFiles;
689 };
690 
691 #endif
static void varChanged(const char *varname)
static const char * getString(UT_StrControl i)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
#define UT_API
Definition: UT_API.h:13
png_uint_32 i
Definition: png.h:2877
UT_StrControl
GLuint const GLchar * name
Definition: glcorearb.h:785
static int getInt(UT_IntControl i)
static fpreal getFloat(UT_FltControl i)
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:270
UT_FltControl
UT_IntControl
Definition: UT_EnvControl.h:29