MAXScript access to tyDiffusion’s features is available through global functions. These functions give users full control over tyDiffusion’s generators and UI.
tyDiffusion_UI(): opens the tyDiffusion UI.
tyDiffusion_generateImage(): generates an image using tyDiffusion’s current settings. Equivalent to pressing “generate image” button in tyDiffusion UI.
tyDiffusion_generateAnimation(): generates an animation using tyDiffusion’s current settings. Equivalent to pressing “generate animation” button in tyDiffusion UI.
tyDiffusion_generatePreprocessor {name}: generates the result of the specified ControlNet preprocessor. Equivalent to pressing a preprocessor’s “☆” button in the tyDiffusion UI. Example:
tyDiffusion_generatePreprocessor "depth"
The names of all tyDiffusion settings can be found in the tyDiffusionSettings.xml file, in the tyDiffusion root folder (default location: C:\ProgramData\tyFlow\tyDiffusion\tyDiffusionSettings.xml). The settings in that file are stored in standard XML format. For example, if you wanted to find the name of the setting that contains the weight value of the Depth ControlNet, you would see the following entry under the <controlNetSettings> category: <controlNetDepthWeight type=“double” value=“1.000000” />. From that entry you can see the name of the setting is “controlNetDepthWeight”, and since it is a double type, its value can be retrieved using the tyDiffusion_getFloat function (MAXScript uses floats instead of doubles, but the two can be interchanged in this case).
tyDiffusion_getInteger {settingName}: returns the value of the specified integer setting.
tyDiffusion_setInteger {settingName} {value}: assigns the specified integer value to the specified integer setting.
tyDiffusion_getFloat {settingName}: returns the value of the specified float setting.
tyDiffusion_setFloat {settingName} {value}: assigns the specified float value to the specified float setting.
tyDiffusion_getString {settingName}: returns the value of the specified string setting.
tyDiffusion_setString {settingName} {value}: assigns the specified string value to the specified string setting.
tyDiffusion_holdSettings(): saves all tyDiffusion settings for restoration at a later time.
tyDiffusion_restoreSettings(): restores all tyDiffusion settings that were previously held.
By calling tyDiffusion_holdSettings() before making changes to various individual settings, you can quickly revert all those changes at a later time by calling tyDiffusion_restoreSettings() without having to revert each change individually.
tyDiffusion_saveImage {viewIndex} {filename}: saves the last image generated by tyDiffusion in the specified viewport to the specified PNG file.
tyDiffusion_loadPreset {filename} {[optional] includeMatchingSettings} {[optional] excludeMatchingSettings}: loads a specified tyDiffusion XML preset file. If the optional “includeMatchingSettings” argument is assigned, only settings matching the specified string will be loaded. If the optional “excludeMatchingSettings” argument is assigned, settings matching the specified string will not be loaded. Example:
tyDiffusion_loadPreset @"myPresetFilename.xml"
tyDiffusion_loadPreset @"myPresetFilename.xml" includeMatchingSettings:"controlNet" --only loads ControlNet settings
tyDiffusion_loadPreset @"myPresetFilename.xml" excludeMatchingSettings:"controlNet" --loads all settings except ControlNet settings
tyDiffusion_loadPreset @"myPresetFilename.xml" includeMatchingSettings:"controlNet" excludeMatchingSettings:"weight" --only loads ControlNet settings that don't include the string "weight".