JScript CustomP question


#1

Hi everybody,

 I am on a personnal scripting project and I have a little "problem".
 My script create a Null and  a CustomP with a button inside.
 This button call a function when we click on it.

 But, I would like my function to remember the name of the null who is his parent.
It works when I don't add ".toString()" but I need this string transformation to recall the function every time I click the button...

My temporary solution is to first select the null and then the function recodnize it as the null, but if it can be done without selection it would be much better.

Is anyone have any idea please???

Thanks for your help :slight_smile:

//I create my null object.
     oNull = GetPrim("Null", "My_Null_Object", null, null);
     
     //I add my CustomP.
     oControler_CustomP = ActiveSceneRoot.AddProperty("CustomProperty",false,"Control") ;
     
     //I create a Layout with a Tab inside.
     oPPG = oControler_CustomP.PPGLayout ;
     oPPG.AddTab("Control")
     
     //I create my scripted button in the tab.
     oBtn1 = oControler_CustomP.AddParameter3( "MyScriptedButton", siBool, true ) ;
     oItem1 = oPPG.AddButton(oBtn1.name) ;
     
     //I send the CustomP under my null object hierarchy.
     CopyPaste(oControler_CustomP, null, oNull, 1);
     
    //Logic
     oPPG.Language = "JScript";
     oPPG.Logic = MyScriptedButton_OnClicked(oNull).toString() //Because of the "toString()" XSI doesn't accept my "(oNull)".
     
    //Here is my script
     function MyScriptedButton_OnClicked(oNull)
     {
     	logMessage("The name of my null is: "+oNull)
     }
     

#2

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.