Table of contents
module flair_style_presets
API module exposing functions related to shader style presets within Flair. The shader style presets are directly applied onto the flairGlobals node, changing engine settings and post-processing shaders. This module is directly used by the Style Presets UI.
Presets are individually stored as .json
files and contain attributes of objects and their values.
Examples:
Instance the style presets library and load a style
1
2
3
4
5
6
7
8
import flair_style_presets
style_preset_lib = flair_style_presets.StylePresetLibrary()
style_preset_lib.find() # not needed to manually find starting Flair 1.1.3+
# load a style with all options enabled
options = { "worldScale": False, "quality": True, "canvases": True, "attributes": True }
style_preset_lib.load("wc_ingres", options)
function set_style_attrs
1
set_style_attrs(globals_data, options=None)
Set the style attributes in the globals node according to options.
Options are:
- worldScale - set world scale attribute
- quality - set quality attributes i.e., TAA, TAA samples, render scale
- canvases - set all attributes with canvas in their name
- attributes - set all remaining attributes
You can get the shader style attributes with the get_maya_attrs()
function from the import/export API. You could use the respective set_maya_attrs()
function too, but you won’t be able to set options and will also set global attributes like _sequenceDir
and _sequenceName
that might not be desired.
Args:
globals_data
(dict): Dictionary of style data within the flairGlobals nodeoptions
(dict): Dictionary of options to set (default:{ "worldScale": True, "quality": True, "canvases": True, "attributes": True }
)
class StylePresetLibrary
Preset library class to save and load style presets within Flair.
This class inherits from the Python dict object, extending its functionality.
Example:
Load library and print available presets
1
2
3
4
5
6
7
# load preset library
style_preset_lib = flair_style_presets.StylePresetLibrary()
style_preset_lib.find() # not needed to manually find starting Flair 1.1.3+
# print available presets
preset_names = style_preset_lib.keys()
print(preset_names)
method StylePresetLibrary.find
1
find()
Finds all available style presets and populates the library class.
method StylePresetLibrary.load
1
load(name, options)
Load the shader style preset with the specified options onto the flairGlobals node.
Options are:
- worldScale - sets world scale attribute
- quality - sets quality attributes i.e., TAA, TAA samples, render scale
- canvases - sets all attributes with canvas in their name
- attributes - sets all remaining attributes
Options are a requirement for this method and can be defined as follows:
options = { "worldScale": False, "quality": True, "canvases": True, "attributes": True }
Args:
name
(unicode): name of style presetoptions
(dict): options to load the shader style with
method StylePresetLibrary.save
1
save(name, obj)
Save the shader style attributes of the flairGlobals node into a preset with the specified name
Args:
name
(unicode): name of the style presetobj
(list, unicode): name of the globals node to create preset from e.g.,"flairGlobals"