mbncp wrote
As I make often changes to my setup I would love to create object by coding, but a create object by itself isn't really useful, at least it would be nice to attach an on expression script and some variables. Are those functions available ?
If you're using an environment like Max then that environment can be used to supply the dynamic settings you need in real time, at the expense of some cpu.
I have not tested adding variables or scripts, but I assume Axel is right, so I suppose we're out of luck here.
Fortunately the whole physics thing and all of the behariour attributes of Lemur are available for dynamic scripting. The functions Attributes and Attributes2 wil show the attributes that I know of that can gotten or set for each object type.
Attributes:
Code: Select all
decl arg = OSC_ARGS[0];
if (arg == 'Breakpoint')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'coordinates', 'editable', 'free', 'grid', 'grid_steps', 'label', 'nbr', 'physic', 'zoom',
'edit', 'attraction', 'friction', 'speed', 'rest', 'holdX', 'holdY',
'x',ý'y'});
else if (arg == 'Dummy')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color', 'transparent',
'label', 'tabbar'});
else if (arg == 'CustomButton')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'behavior', 'capture', 'label_off', 'label_on', 'outline',
'Mode', 'mode',
'x'});
else if (arg == 'Fader')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'capture', 'cursor', 'grid', 'grid_steps', 'label', 'value',
'physic', 'precision', 'zoom',
'attraction', 'friction', 'speed',
'x', 'y'});
else if (arg == 'Knob')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'cursor', 'grid', 'grid_steps', 'label', 'value', 'physic', 'precision',
'type', 'unit', 'mode',
'attraction', 'friction', 'speed',
'x'});
else if (arg == 'Leds')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'colors', 'row', 'column', 'multicolor', 'label',
'transparent'});
else if (arg == 'Menu')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'items', 'scale', 'transparent',
'selection'});
else if (arg == 'Monitor')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'label', 'precision', 'transparent', 'unit', 'value'});
else if (arg == 'MultiBall')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'ball_enable', 'capture', 'colors', 'grid', 'grid_steps', 'ephemere',
'label', 'multicolor', 'multilabel', 'nbr', 'physic',
'polyphony', 'pressure', 'zoom',
'attraction', 'friction', 'speed', 'attack', 'decay', 'sustain', 'release', 'hold', 'holdX', 'holdY',
'x', 'y', 'z'});
else if (arg == 'MultiSlider')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'bipolar', 'gradient', 'grid', 'grid_steps', 'horizontal',
'label', 'multicolor', 'nbr', 'physic',
'tension', 'friction', 'height',
'x'});
else Attributes2(OSC_ARGS);
Attributes2
Code: Select all
decl arg = OSC_ARGS[0];
if (arg == 'Pads')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'capture', 'colors', 'column', 'label', 'labels',
'attack', 'decay', 'sustain', 'release', 'hold',
'row', 'multicolor', 'multilabel',
'x'});
else if (arg == 'Range')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'capture', 'grid', 'grid_steps', 'horizontal',
'label', 'physic',
'tension', 'friction', 'min_height', 'max_height', 'drag',
'x'});
else if (arg == 'RingArea')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'capture', 'label',
'attraction', 'friction', 'speed', 'attractor_x', 'attractor_y',
'x', 'y'});
else if (arg == 'SignalScope')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'label', 'mode','transparent',
'x', 'y', 'timebase'});
else if (arg == 'SurfaceLCD')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'diplay', 'target','transparent'});
else if (arg == 'Switches')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'capture', 'colors', 'row', 'column', 'label', 'labels',
'multicolor', 'multilabel', 'paint', 'radio',
'x'});
else if (arg == 'Text')
oscout(0, '/Attributes', {arg, 'name', 'rect', 'color',
'content', 'transparent'});
else oscout(0, '/Attributes', {arg, '<not an object type>'});
My function Value to get / set a value is in early alpha. It should always return the current value of an attribute and it should set the attribute if a value is optionally supplied. At the moment this function looks at this:
Code: Select all
decl obj = findobject(OSC_ARGS[0]);
decl attr = OSC_ARGS[1];
decl val;
if (attr == 'rect')
val = getobjectrect(obj);
else
val = getattribute(obj, attr);
if (val != 0)
oscout(0, '/Value', {OSC_ARGS[0], attr, val});
else
oscout(0, '/Value', {OSC_ARGS[0], attr, getexpression(obj, OSC_ARGS[1])});
if (sizeof(OSC_ARGS) > 2)
{
oscout(0, 'Value set', OSC_ARGS[2]);
setexpression(obj, attr, OSC_ARGS[2]);
}
Cheers,
Willem aka Xanadu