ProxyPreset:
Filter:
JITLibExtensions/Classes (extension) | Libraries > JITLib

ProxyPreset
ExtensionExtension

store and morph between settings of JITLib Proxies.

Description

ProxyPreset is the base class for a number of Preset classes for JITLib proxies: It can handle proxies that keep their settings in environments, such as TaskProxies and PatternProxies, and proxies that use nodeMaps, like NodeProxy.

Settings are lists of key - value pairs, like [[key1, val1], [key2, val2], ... [keyN, valN]]. One can switch between these settings, or - if the parameter values in the list are single numbers, one can interpolate and morph between them.

Its subclasses using named proxies are: TdefPreset for Tdef, PdefPreset for Pdef, and NdefPreset for Ndef. Finally, there are also gui classes for all of them: ProxyPresetGui, TdefPresetGui, PdefPresetGui, and NdefPresetGui.

Class Methods

.new

make a new anonymous ProxyPreset

Arguments:

proxy

a TaskProxy or PatternProxy

namesToStore

which paramNames to store in presets. if none given, inferred from the current proxy settings.

settings

provide preset settings for the proxy

specs

provide preset specs for the proxy, mainly for randomizing and morphing. if none given here, and object has a halo of specs, those in halo will be used.

morphFuncs

special functions to provide for morphing between non-numerical settings. not used yet.

Instance Methods

instance variables

.proxy

the proxy for which preset contains settings

.namesToStore

the param names for which values will be stored in the settings

.settings

settings stored for the proxy

.currSet

the name of the current setting

.targSet

the name of the target setting used in morphing

.specs

a dict for specs to use for numerical parameter interpolation. by default this is synced with the proxy's Halo specs.

.morphVal

the current morph/blend value.

.morphTask

a taskproxy that can crossfade between different settings.

.morphFuncs

special functions to provide for morphing between non-numerical settings. not used yet.

Methods - settings

instance methods

.useHalo

use the proxy's Halo for syncing specs and namesToStore.

.checkSpecsMissing

check if there are specs for all namesToStore. if not, posts an invitation to add the missing ones, or a

.specsDialog

open a dialog window to add specs.

.addSet

add a setting by name. if no values are given, take current setting of proxy.

.removeSet

remove a setting by name

.addSettings

add a list of named settings

.removeSettings

remove a list of settings by their names

.postSettings

post current settings as compilestring.

.getSetNames

get the names of all currently stored settings.

.setCurr

set the current setting by name within stored settings.

.setTarg

set the target setting by name within stored settings.

.getSet

get a stored setting by name.

.setProxy

set the proxy's current settings to the setting given by name.

.getFromProxy

get the proxy's current settings as [[key1, val1], ... [keyN, valN]]

.currFromProxy

get the proxy's current settings and store them as \curr.

.stepCurr

.stepTarg

step the current and target setting by increment.

Methods - randomizing settings

Note that randomizing settings only fully works for numerical settings!

.randSet

create a rand setting, based on an existing one

Arguments:

rand

how muct to randomize (0.0 to 1.0)

startSet

which set to randomize - if nil, uses currSet

except

which keys not to randomize

seed

a seed number for the random generator

.setRand

same as randSet, but sets proxy to the random setting.

.someRand

like randSet, but ratio sets how many of the params will be randomized.

Methods - morphing and crossfading

Note that morphing and crossfading only fully works for numerical settings!

.blend

blend between two sets given by name. the mapped flag sets whether to blend between mapped or unmapped values; the result is again unmapped.

.morph

morph between two settings with a given blend factor.

Arguments:

blend

the blend factor

name1

the name of setting 1

name2

the name of setting 2

mapped

a flag whether to interpolate between mapped values of the params.

.xfadeTo

crossfade to a target setting in the given duration.

.blendSets

the lower-level way to do a straight blend between two sets.

.mapSet

.unmapSet

utilities to convert single settings between mapped and unmapped values. used when blending in mapped mode.

Methods - storage

.storeToDisk

get and whether to store settings to disk automatically. default = true.

.storePath

the path where to store and read settings to and from disk.

.loadSettings

load settings from disk at given path.

.writeSettings

write settings to disk. By default, they go next to the source code file where the Preset was created, and by default, a backup of the previous stored settings is made.

.setPath

set storage name

.presetPath

path where to store presets. currently, this is next to the source code file where the Preset was created.

.storeDialog

open a dialog window for entering a storage name. Intended for use with ProxyPresetGui.

.deleteDialog

open a dialog window for deleting existing settings by name(s). Intended for use with ProxyPresetGui.

Examples