|
Hi, I have got a problem using the _onChanged() event of PPGs.
When using this code, it is not possible to set values from the _onChanged() method to my PPG if I use the following line:
oPSet.Parameters("oSizeimageWidth").value = oPSet.oSizeimageWidth.value * oPSet.oSizeFactorX.value;
If I use
oPSet.Parameters("oSizeimageWidth").value = 666
everything is fine. Now the strange thing is, that I can log the right part of the equation, which spits out the
correct value:
LogMessage("my oversized imageWidth is: " + oPSet.oSizeimageWidth.value * oPSet.oSizeFactorX.value);
Does anyone have a clue?
Thanks.
Here is the whole code (select a camera and run the script):
// SELECT A CAMERA AND RUN THE SCRIPT
// GET CAMERA
var oSel = Application.Selection;
if (oSel(0).type == "camera")
{
doLayout();
}
else
{
Application.LogMessage("No camera selected!");
}
// PPG LAYOUT function doLayout() {
var $origImageWidth = GetValue("Passes.RenderOptions.ImageWidth");
var $selectedCamName = oSel(0).Name;
var $selectedCam = oSel(0).FullName;
var oCProp = ActiveSceneRoot.AddProperty("CustomProperty",false, "oversizer");
oCProp.AddParameter3('oSelectedCam',siString,$selectedCam);
oCProp.AddParameter3('oSizeFactorX',siFloat,1,1,6.66,true);
oCProp.AddParameter3('oSizeimageWidth',siFloat,$origImageWidth,1,1000,false);
var oLayout = oCProp.PPGLayout;
oLayout.AddItem('oSizeFactorX');
oLayout.AddGroup('Oversized values: ' + $selectedCam);
oLayout.AddSpacer(0,5);
oLayout.AddRow();
oLayout.AddItem('oSizeimageWidth','oSize Width',siControlString);
oLayout.EndRow();
oLayout.EndGroup();
oLayout.Language = 'JScript';
oLayout.Logic = oSizeFactorX_OnChanged.toString();
InspectObj(oCProp,null,null);
}
function oSizeFactorX_OnChanged() {
var oPSet = PPG.Inspected(0);
//this does work:
LogMessage("my oversized imageWidth is: " + oPSet.oSizeimageWidth.value * oPSet.oSizeFactorX.value);
//but when applying to the oPSet, this doesnt work:
oPSet.Parameters("oSizeimageWidth").value = oPSet.oSizeimageWidth.value * oPSet.oSizeFactorX.value;
//applying it to a fixed value works though...:
//oPSet.Parameters("oSizeimageWidth").value = 666; }
|