rtx::RenderSettings
Defined in omni/extras/RtxSettings.h
Structs
rtx::RenderSettings::HashedSettingCString: Statically-sized container for hashed setting strings.
-
class RenderSettings
A class encapsulating render settings.
Public Static Functions
-
static inline bool isPathRenderSettingsRoot(const char *path)
Checks a path to see if it matches the RTX setting root.
- Parameters
path – The path to check
- Returns
trueifpathcompares equal (case sensitive) to kSettingsPath;falseotherwise
-
static inline std::string getAssociatedDefaultsPath(const char *cPath)
Translates the given path to the defaults path.
For instance if
cPathis"/rtx/foo","/rtx-defaults/foo"would be returned.- Parameters
cPath – The path to translate
- Returns
The path key in the defaults tree. See details above.
-
template<typename KeyType, typename ValueType>
static inline void stringToKeyTypeToValueTypeDictionary(const std::string &keyToValueDictStr, std::unordered_map<KeyType, ValueType> &outputDict, const char *debugStr) Translates a string into a key-value mapping.
Only two types of
<KeyType, ValueType>are allowed:<uint32_t, std::vector<uint32_t>>, or<std::string, uint32_t>. A colon (:) is the key/value separator and a semicolon (;) is the map separator. This function first splitskeyToValueDictStrby (;) and then each substring is split by (:). If exactly two values are found by this second split, the value is added tooutputDict. WhenValueTypeis astd::vector, the values are found by splitting the value substring by a comma (,).- Template Parameters
KeyType – The type of the key. See above for details.
ValueType – The type of the value. See above for details.
- Parameters
keyToValueDictStr – A string that is processed according to the details above
outputDict – [out] The
std::unordered_mapthat receives processed key/value pairs. This map is not cleared; any values that exist in it before this function is called remain, but existing keys that are encountered inkeyToValueDictStrwill overwrite existing values (however, ifValueTypeisstd::vectorthe values are appended to existing values).debugStr – (required) a string that will be used in logging if parse errors occur
-
static inline bool hasSettingFlags(carb::settings::ISettings &settings, const char *settingPath)
A helper function to determine if a setting flag path exists.
- Parameters
settings – carb::settings::ISettings as if by carb::getCachedInterface()
settingPath – The path to check for. kFlagsSettingsPath will be prepended to this value
- Returns
trueif the settings flag exists;falseotherwise
-
static inline SettingFlags getSettingFlags(carb::settings::ISettings &settings, const char *settingPath)
A helper function for reading settings flags.
- Parameters
settings – carb::settings::ISettings as if by carb::getCachedInterface()
settingPath – The path to read. kFlagsSettingsPath will be prepended to this value
- Returns
the RTX Settings Flags read as an integer from the given
settingsPath
-
static inline void setSettingFlags(carb::settings::ISettings &settings, const char *settingPath, SettingFlags flags)
A helper function for writing settings flags.
- Parameters
settings – carb::settings::ISettings as if by carb::getCachedInterface()
settingPath – The path to write. kFlagsSettingsPath will be prepended to this value
flags – The flags to write. These values will overwrite any existing flags
-
static inline void removeSettingFlags(carb::settings::ISettings &settings, const char *settingPath)
A helper function for deleting a settings flags key.
- Parameters
settings – carb::settings::ISettings as if by carb::getCachedInterface()
settingPath – The path to delete. kFlagsSettingsPath will be prepended to this value
- Post
The settings path at kFlagsSettingsPath +
settingPathis destroyed.
-
template<typename SettingType>
static inline void setAndBackupDefaultSetting(const char *settingPath, SettingType value, SettingFlags flags = kSettingFlagDefault) Sets the default value for a RTX setting value and backs up the value.
The carb::settings::ISettings API is used to set the default value at
settingPathif the setting key does not exist. Ifflagshas neither kSettingFlagTransient and kSettingFlagResetDisabled set, then the default path is constructed by getAssociatedDefaultsPath(). If the default path is under the/persistentroot, the default path setting is updated withvalue, otherwise the default path setting is updated with the current value read fromsettingPath. Finally, setSettingFlags() is called withsettingPathandflags.- Parameters
settingPath – the setting path to set default for and to back up
value – the default value to set at
settingPathflags – RTX Settings Flags to apply to
settingPath
-
static inline std::string getInternalSettingString(const char *s)
Returns a hashed setting string based on the given setting path.
- Parameters
s – The setting path
- Returns
A hashed setting string based on
s
-
template<typename SettingType>
static inline void setAndBackupPersistentDefaultSetting(const char *settingPath, SettingType value) Sets a setting value to a given default value and back up the previous value.
Warning
The
settingPathpointer value is captured by this function. Its lifetime must be for the rest of the application, or undefined behavior will occur.- Template Parameters
SettingType – the type of the value
- Parameters
settingPath – the setting path to set default for and to back up. NOTE see warning above
value – The default value to assign
-
template<typename SettingArrayType>
static inline void setAndBackupDefaultSettingArray(const char *settingPath, const SettingArrayType *array, size_t arrayLength, SettingFlags flags = kSettingFlagDefault) Sets a setting value to a given array value and backs up the previous value.
- Template Parameters
SettingArrayType – the type of the elements of the array
- Parameters
settingPath – the setting path to set default for and to back up
array – The array of values to assign as the default for
settingPatharrayLength – The number of items in
arrayflags – RTX Settings Flags to apply to
settingPath
-
static inline void resetSettingToDefault(const char *path)
Reads the default value for the given path and restores it.
- Parameters
path – The setting path to restore
-
static inline void resetSectionToDefault(const char *path)
Restores the subtree at the given path from the backed up values.
- Parameters
path – The subtree setting path
-
static inline carb::dictionary::Item *createContext()
Creates a root level dictionary item.
This item is created as via carb::dictionary::IDictionary::createItem() with
<rtx context>as the name.- Returns
a carb::dictionary::Item that is of type carb::dictionary::ItemType::eDictionary
-
static inline void destroyContext(carb::dictionary::Item *ctx)
Helper function to destroy a dictionary item.
This function is a helper function to call carb::dictionary::IDictionary::destroyItem().
- Parameters
ctx – the carb::dictionary::Item to destroy
-
static inline void cloneToContext(carb::dictionary::Item *dstContext, carb::dictionary::Item *srcContext)
Copies a source context to a destination context.
Warning
This function appears to have a bug where
dstContextis used after destroyed ifsrcContextis notnullptr.- Parameters
dstContext – The destination context to overwrite
srcContext – The source context to copy to
dstContext. Maybenullptrto re-initializedstContext.
-
static inline void applyOverridesToContext(carb::dictionary::Item *dstContext, carb::dictionary::Item *overridesContext)
Copies a subtree over the destination subtree.
- Parameters
dstContext – The destination to overwrite
overridesContext – The subtree to write over
dstContext
-
static inline carb::dictionary::IDictionary *getIDictionary()
Dictionary access helper function.
- Returns
carb::dictionary::IDictionary as by carb::getCachedInterface()
-
static inline carb::settings::ISettings *getISettings()
Settings access helper function.
- Returns
carb::settings::ISettings as by carb::getCachedInterface()
-
static inline void hashInternalRenderSettings()
Translates plaintext internal settings to hashed settings and removes the plaintext settings.
This is to ensure that the plaintext internal settings are not inadvertently saved to USD.
-
struct HashedSettingCString
Statically-sized container for hashed setting strings.
We use MD5 hashes which have constant size, so we can compute the worst case hashed setting string size and pass them around on the stack instead of on the heap. In the future this may also help with hashing at build time.
Public Members
-
char data[kHashedSettingCStringMaxLength]
String data.
-
char data[kHashedSettingCStringMaxLength]
-
static inline bool isPathRenderSettingsRoot(const char *path)