Re: Self Installed Property: Access to the button that is being clicked?
| Date : Fri, 22 Feb 2008 09:15:13 +0100 |
| To : XSI(at)Softimage.COM |
| From : André Adam <a_adam(at)49games.de> |
| Subject : Re: Self Installed Property: Access to the button that is being clicked? |
|
I've been down that route, and it's nasty. What I did was writing
template functions and calling them as plain text (.toString()) into a
regular _expression_ syntax to replace the name tokens for the final
layout and logic. Something along the lines below: Cheers! -André /*======================================================== Logic ========================================================*/ oPPGLayout.Language = "JScript"; //Templates var sDoGlobalOnChangedAndInitTemplate = "PARAMGLOBAL.ReadOnly = !PARAMDOGLOBAL.Value;"; var sbuttonCopyAnimationOnClickedTemplate = "if(PPGGLOBALCONTROL.Value){if(PPGGLOBALPARAMETER.isAnimated()){CopyAllAnimation2(PPGGLOBALPARAMETER, siFCurveSource);PasteAllAnimation(\"TARGETPARAMETER\");}else{RemoveAnimation(\"TARGETPARAMETER\");Dictionary.GetObject(\"TARGETPARAMETER\").Value = PPGGLOBALPARAMETER.Value;}}else{if(PPGPARAMETER.isAnimated()){CopyAllAnimation2(PPGPARAMETER, siFCurveSource);PasteAllAnimation(\"TARGETPARAMETER\");}else{RemoveAnimation(\"TARGETPARAMETER\");Dictionary.GetObject(\"TARGETPARAMETER\").Value = PPGPARAMETER.Value;}}"; var sbuttonStoreAnimationOnClickedTemplate = "aTargets.push(\"TARGETRELPARAMETER\");if(PPGGLOBALCONTROL.Value){if(PPGGLOBALPARAMETER.isAnimated(siFCurveSource)){aSources.push(PPGGLOBALPARAMETER.Source);}else{aSources.push(PPGGLOBALPARAMETER.Value);}}else{if(PPGPARAMETER.isAnimated(siFCurveSource)){aSources.push(PPGPARAMETER.Source);}else{aSources.push(PPGPARAMETER.Value);}}aActive.push(true);"; //****ppg logic var sOnInitLogic = OnInit.toString(); var sOnInitBody = ""; //MODEL LOOP for(var i=0; i<aAllSortedAndFormatted.length; i++){ var oModel = aAllSortedAndFormatted[i][0]; //****model logic var sbuttonCopyAnimationOnClickedLogic = fName_OnClicked.toString().replace("fName", "buttonCopyAnimation_" + oModel); var sbuttonCopyAnimationOnClickedBody = ""; var sbuttonStoreAnimationOnClickedLogic = fStore_OnClicked.toString().replace("fStore", "buttonStoreAnimation_" + oModel).replace("MODEL", oModel).replace("ACTIONNAME", "paramActionName_" + oModel + ".Value").replace("START", "paramActionIn_" + oModel + ".Value").replace("END", "paramActionOut_" + oModel + ".Value"); var sbuttonStoreAnimationOnClickedBody = ""; //HEXGROUP LOOP var aModelGroups = aAllSortedAndFormatted[i][1]; for(var j=0; j<aModelGroups.length; j++){ var oGroup = aModelGroups[j][0]; var sGroupString = (oGroup*256).toString(16).toUpperCase(); var sParamDoGlobal = "paramDoGlobal_" + oModel + "_" + sGroupString; var sParamGlobal = "paramGlobal_" + oModel + "_" + sGroupString; //****group logic var sDoGlobalOnChangedLogic = fName_OnChanged.toString().replace("fName", sParamDoGlobal); var sDoGlobalOnChangedBody = sDoGlobalOnChangedAndInitTemplate.replace(/PARAMGLOBAL/g, sParamGlobal).replace(/PARAMDOGLOBAL/g, sParamDoGlobal); sOnInitBody = sOnInitBody + sDoGlobalOnChangedAndInitTemplate.replace(/PARAMGLOBAL/g, sParamGlobal).replace(/PARAMDOGLOBAL/g, sParamDoGlobal); //PARAMETER LOOP var aGroupIDs = aModelGroups[j]; for(var k=1; k<aGroupIDs.length; k+=2){ var oParameter = aGroupIDs[k+1]; var sPPGParam = "param" + oParameter.FullName.replace(/\./g, "_").replace("_aa_BoneFlags_paramWeight", ""); //****parameter logic sDoGlobalOnChangedBody = sDoGlobalOnChangedBody + sDoGlobalOnChangedAndInitTemplate.replace(/PARAMGLOBAL/g, sPPGParam).replace(/!PARAMDOGLOBAL/g, sParamDoGlobal); sOnInitBody = sOnInitBody + sDoGlobalOnChangedAndInitTemplate.replace(/PARAMGLOBAL/g, sPPGParam).replace(/!PARAMDOGLOBAL/g, sParamDoGlobal); sbuttonCopyAnimationOnClickedBody = sbuttonCopyAnimationOnClickedBody + sbuttonCopyAnimationOnClickedTemplate.replace(/PPGPARAMETER/g, sPPGParam).replace(/TARGETPARAMETER/g, oParameter.FullName).replace(/PPGGLOBALCONTROL/g, sParamDoGlobal).replace(/PPGGLOBALPARAMETER/g, sParamGlobal); sbuttonStoreAnimationOnClickedBody = sbuttonStoreAnimationOnClickedBody + sbuttonStoreAnimationOnClickedTemplate.replace(/TARGETRELPARAMETER/g, oParameter.FullName.slice(oModel.length+1)).replace(/PPGPARAMETER/g, sPPGParam).replace(/PPGGLOBALCONTROL/g, sParamDoGlobal).replace(/PPGGLOBALPARAMETER/g, sParamGlobal); } sDoGlobalOnChangedLogic = sDoGlobalOnChangedLogic.replace(/fBody;/g, sDoGlobalOnChangedBody); oPPGLayout.Logic = oPPGLayout.Logic + sDoGlobalOnChangedLogic; } sbuttonCopyAnimationOnClickedLogic = sbuttonCopyAnimationOnClickedLogic.replace(/fBody;/g, sbuttonCopyAnimationOnClickedBody); oPPGLayout.Logic = oPPGLayout.Logic + sbuttonCopyAnimationOnClickedLogic; sbuttonStoreAnimationOnClickedLogic = sbuttonStoreAnimationOnClickedLogic.replace(/fBody;/g, sbuttonStoreAnimationOnClickedBody); oPPGLayout.Logic = oPPGLayout.Logic + sbuttonStoreAnimationOnClickedLogic; } sOnInitLogic = sOnInitLogic.replace(/fBody;/g, sOnInitBody); oPPGLayout.Logic = oPPGLayout.Logic + sOnInitLogic; return oProp; } Bradley Gabe wrote: --- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: unsubscribe xsi |
- References:
- Self Installed Property: Access to the button that is being clicked?
- From: "Bradley Gabe" <withanar(at)gmail.com>
- Re: Self Installed Property: Access to the button that is being clicked?
- From: javier <javier.vdp(at)gmail.com>
- Re: Self Installed Property: Access to the button that is being clicked?
- From: "Bradley Gabe" <withanar(at)gmail.com>
- Self Installed Property: Access to the button that is being clicked?
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: RE: Trouble with motionvectors and refraction
- Next by Date: RE: Trouble with motionvectors and refraction
- Previous by Thread: RE: Trouble with motionvectors and refraction
- Next by Thread: RE: Trouble with motionvectors and refraction
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |