|
@@ -0,0 +1,102 @@
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ This templates shows what you can do in this is module script
|
|
|
+ All the code outside functions will be executed each time this script is loaded, meaning at file load, when hitting the "reload" button or when saving this file
|
|
|
+*/
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+var myFloatParam = script.addFloatParameter("My Float Param","Description of my float param",.1,0,1);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+var myTrigger = script.addTrigger("My Trigger", "Trigger description");
|
|
|
+var myBoolParam = script.addBoolParameter("My Bool Param","Description of my bool param",false);
|
|
|
+var myFloatParam = script.addFloatParameter("My Float Param","Description of my float param",.1,0,1);
|
|
|
+var myIntParam = script.addIntParameter("My Int Param","Description of my int param",2,0,10);
|
|
|
+var myStringParam = script.addStringParameter("My String Param","Description of my string param", "cool");
|
|
|
+var myColorParam = script.addColorParameter("My Color Param","Description of my color param",0xff0000ff);
|
|
|
+var myP2DParam = script.addPoint2DParameter("My P2D Param","Description of my p2d param");
|
|
|
+var myP3DParam = script.addPoint3DParameter("My P3D Param","Description of my p3d param");
|
|
|
+var myTargetParam = script.addTargetParameter("My Target Param","Description of my target param");
|
|
|
+var myEnumParam = script.addEnumParameter("My Enum Param","Description of my enum param",
|
|
|
+ "Option 1", 1,
|
|
|
+ "Option 2", 5,
|
|
|
+ "Option 3", "banana"
|
|
|
+ );
|
|
|
+*/
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ The init() function will allow you to init everything you want after the script has been checked and loaded
|
|
|
+ WARNING it also means that if you change values of your parameters by hand and set their values inside the init() function, they will be reset to this value each time the script is reloaded !
|
|
|
+*/
|
|
|
+function init()
|
|
|
+{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+ This function will be called each time a parameter of your script has changed
|
|
|
+*/
|
|
|
+function scriptParameterChanged(param)
|
|
|
+{
|
|
|
+
|
|
|
+ script.log("Parameter changed : "+param.name);
|
|
|
+ if(param.is(myTrigger)) script.log("Trigger !");
|
|
|
+ else if(param.is(myEnumParam)) script.log("Key = "+param.getKey()+", data = "+param.get());
|
|
|
+ else script.log("Value is "+param.get());
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+ This function, if you declare it, will launch a timer at 50hz, calling this method on each tick
|
|
|
+*/
|
|
|
+
|
|
|
+function update(deltaTime)
|
|
|
+{
|
|
|
+ script.log("Update : "+util.getTime()+", delta = "+deltaTime);
|
|
|
+}
|
|
|
+*/
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+If this script is in a mapping, then this will be called whenever the value from the mapping is updated
|
|
|
+*/
|
|
|
+function setValue(value)
|
|
|
+{
|
|
|
+ script.log("Set value "+value);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+This will be called either when the consequence is triggered if it is in an Action, or just after setValue() if it is in a Mapping
|
|
|
+*/
|
|
|
+function trigger()
|
|
|
+{
|
|
|
+
|
|
|
+ var sequence = root.sequences.keys;
|
|
|
+ var layer = sequence.layers.camZoom;
|
|
|
+ var time = sequence.currentTime.get() ;
|
|
|
+
|
|
|
+ myFloatParam.set(layer.automation.getValueAtPosition(time+10.));
|
|
|
+ var currentKey = layer.automation.getKeyAtPosition(time);
|
|
|
+ var nextKey = layer.automation.getItemAfter(currentKey);
|
|
|
+ if(nextKey!=undefined){
|
|
|
+
|
|
|
+ var duration = nextKey.position.get() - time;
|
|
|
+ var value = nextKey.value.get();
|
|
|
+ root.customVariables.camAutomation.variables.value.value.set(value);
|
|
|
+ root.customVariables.camAutomation.variables.time.time.set(duration);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|