Re: [scripting] Adding an FCurve to a Linked Parameter via OM?

Date : Sun, 02 Dec 2007 00:31:20 +0100
To : XSI(at)Softimage.COM
From : Julien Stiegler <julien.stiegler(at)free.fr>
Subject : Re: [scripting] Adding an FCurve to a Linked Parameter via OM?
You should use Playcontrol.Rate for horizontal scale like this
var PlaybackRate =    GetValue("PlayControl.Rate", null);
anFCurve.AddKey(xValue*PlaybackRate, yValue);

for example :

applyInbetweensProperty("cylinder", 2);

function applyInbetweensProperty(inParentName, nValues)
{
var inParent = Dictionary.GetObject(inParentName);
var pset = inParent.AddCustomProperty("DisplayInfo_DrivenKeys");
var master = pset.AddParameter2( "master", siFloat, 1.0, 0.0, nValues, 0.0, nValues, siClassifUnknown, siAnimatable);
for(var i=0; i<nValues; i++)
{
var drivenVar = pset.AddParameter2( "driven"+i, siFloat, 1.0, 0.0, 100.0, 0.0, 100.0, siClassifUnknown, siAnimatable);
SetInbetweenKey(drivenVar.FullName, master.FullName, Array(0+i,1+i,2+i), Array(0,1,0))
}
}


function SetInbetweenKey(drivenParam, drivingParam, xValues, yValues)
{
var PlaybackRate = GetValue("PlayControl.Rate", null);
SetExpr(drivenParam, "l_fcv( "+drivingParam+" )", null);
var L_FCurve=Dictionary.GetObject(drivenParam+".Expression.l_fcv").Source;
L_FCurve.RemoveKeys();
for(var i=0; i<xValues.length && i<yValues.length; i++)
{
L_FCurve.AddKey(xValues[i]*PlaybackRate, yValues[i]);
}
}



Julian Johnson wrote:

Is it possible to add a linked parameter FCurve via the OM? Here's what I'm doing:

import win32com.client

def disp(ob):
  return win32com.client.Dispatch(ob)

oRoot = Application.ActiveSceneRoot
oSphere = oRoot.AddGeometry( "sphere", "MeshSurface" )
oParam = oSphere.Parameters('posx')
oExpr = disp(oParam.AddExpression('l_fcv(cube.kine.local.posx)'))
oFCurve = oExpr.Parameters('l_fcv').AddFCurve(20,)
oFCurve.AddKey(0,0)
oFCurve.AddKey(10,20)

But the resultant FCurve has no 'understanding' of the horizontal scale it should be using. If you create the curve via commands it seems to work fine. I've tried various different FCurve types but maybe this just isn't possible in the OM?

Julian
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi




--- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.