HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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
47 
48  // 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 
322 
325 
328 
330 
332 
334 
336 
338 
340 };
341 
343 {
344  // UT: Public interface
348 
349  // UT: Internal variables
351 
352  // IMG: Public interface
355 
356  // RE
358 
359  // UI
363 
364  // GR
366 
367  // Custom
369 
370  // ROP: Internal variables
372 
373  // OpenCL: Memory pool size, as percentage of GPU memory.
375 
377 };
378 
380 {
381  // UT: Public interface
397 
398  // UT: Internal variables
401 
402  // external tools
404 
405  // PY
409 
410  // IMG: Public interface
412 
413  // VEX(VMAT)
421 
422  // HOM
424 
425  // OP
426  ENV_HOUDINI_HIP_DEFAULT_NAME, // "untitled.hip"
429 
430  // VOP
432 
433  // GEO
435 
436  // COP
443 
444  // CHOP
446 
447  // IFD
455 
456  // UI
467 
468  // FUI
471 
472  // CHUI
474 
475  // OPUI
479 
480  // VEX(VCC)
482 
483  // Custom
491  ENV_HOUDINI_VIEW_METACAM, //OTLs that lock to view in a special way
492 
493  // Path variables
514 
518 
520 
522 
524 
526 
529 
536 
538 
539  // These are here so we can have them show up in hconfig and provide
540  // help. They should only be used implicitly.
541  ENV_HSITE, // Between HFS and HOME.
542  ENV_JOB, // We should not use JOB!
543 
545 
548 
550 
551  // OPENGL
557 
558  // OPENCL
562 
563  // Orbolt
565 
566  // Anonymous Usage Statistics
568 
570 
572 
574 
576 };
577 
579 {
580 public:
581  UT_EnvControl();
582  ~UT_EnvControl();
583 
584  static int getInt(UT_IntControl i)
585  { return getControl().myIValues[i]; }
587  { return getControl().myFValues[i]; }
588  static const char *getString(UT_StrControl i)
589  { return getControl().mySValues[i]; }
590 
591  // Look up the appropriate variable name for the token
592  static const char *getIntVar(UT_IntControl i);
593  static const char *getFloatVar(UT_FltControl i);
594  static const char *getStringVar(UT_StrControl i);
595 
596  static void setStringVar(UT_StrControl i, const char *value);
597 
598  // Look up the appropriate old style variable name for the token. This can
599  // be used to check for old environment variables.
600  static const char *getOldIntVar(UT_IntControl i);
601  static const char *getOldFloatVar(UT_FltControl i);
602  static const char *getOldStringVar(UT_StrControl i);
603 
604  /// Indicate that the given variable changed and update our cached values.
605  /// If varname is NULL, then all variables are updated.
606  static void varChanged(const char *varname)
607  { varChanged(varname, nullptr); }
608 
609  /// Update the cached varname value with the given value so that we can
610  /// avoid an extraneous HoudiniGetenv() for the equivalent code snippet:
611  /// @code
612  /// HoudiniSetenv(name, value);
613  /// UT_EnvControl::varChanged(name);
614  /// @endcode
615  /// @return true if name was found and value is non-null, in which case the
616  /// HoudiniSetenv() was called, else false is returned.
617  static bool varChanged(const char *varname, const char *value);
618 
619  /// Like varChanged() except that it can avoid an extraneous
620  /// HoudiniGetenv() for the equivalent code snippet:
621  /// @code
622  /// HoudiniSetenv(name, value);
623  /// UT_EnvControl::varChanged(name);
624  /// @endcode
625  /// @return true if name was found, in which case the HoudiniSetenv() will
626  /// be called, else false is returned.
627  static bool changeVar(const char *name, const char *value);
628 
629  static void changeExistLookupDefault(UT_IntControl i, int new_def);
630 
631  /// Set all additional .env files to be parsed for env variable values.
632  /// It is best to call getAdditionalEnvironmentFiles() first and then
633  /// append to the list because this function will overwrite all the
634  /// additional paths that were previously set.
635  /// You can still use the HOUDINI_NO_ENV_FILE_OVERRIDES to disallow
636  /// overwrites, knowing that these files get applied AFTER the default
637  /// houdini.env file in the user's home directory.
638  /// That said, HOUDINI_NO_ENV_FILE will have no effect on this function.
639  /// If additional files are set, they will be used, regardless of the
640  /// value of HOUDINI_NO_ENV_FILE.
641  static void setAdditionalEnvironmentFiles(
642  const UT_StringArray &files);
643 
644  /// Return the current list of additional environment files.
645  static const UT_StringArray&
646  getAdditionalEnvironmentFiles();
647 
648 private:
649  void doInit(bool init_defaults);
650  void setDefaults();
651  bool loadEnvironmentFile(const char *path,
652  bool allow_overrides);
653  void loadDefaultEnvironmentFile();
654  void loadEnvironmentFiles();
655  void loadEnvironment(bool init_defaults);
656 
657  void updateExistLookup(int i, const char *value = nullptr);
658  void updateIntLookup(int i, const char *value = nullptr);
659  void updateFltLookup(int i, const char *value = nullptr);
660  void updateStrLookup(int i, bool fix_path,
661  const char *value = nullptr);
662 
663  int myIValues[ENV_MAX_INT_CONTROLS];
664  float myFValues[ENV_MAX_FLT_CONTROLS];
665  char *mySValues[ENV_MAX_STR_CONTROLS];
666 
667  static UT_EnvControl &getControl()
668  {
669  if (!theControl)
670  theControl = new UT_EnvControl();
671  return *theControl;
672  }
673  static UT_EnvControl *theControl;
674 
675  static UT_StringArray theAdditionalEnvironmentFiles;
676 };
677 
678 #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:12
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:269
UT_FltControl
UT_IntControl
Definition: UT_EnvControl.h:29