LScript (Layout) to min/max a selected channel which can be applied after any motion plugin or script.
Changes
- Channels - X,Y,Z,H,P,B,SX.SY,SZ
- Minimum value
- Maximum value
Compatible with Newtek LightWave 9.6 and above.
// LScript Item Animation - www.StephenCulley.co.uk // // web address: http://www.stephenculley.co.uk // email address: email@stephenculley.co.uk /* LScript Item Animation - Limit Motion_Limit.ls */ @version 2.2 @warnings @script motion @name *Limit // Title sTitle = "*Limit"; // Version sVersion = "v1.0"; aChannel = @"X","Y","Z","H","P","B","SX","SY","SZ"@; iChannel = 1; nMin = 0.0; nMax = 0.0; create { setdesc(sTitle + " - Channel " + aChannel[iChannel] + " Min " + nMin + " Max " + nMax); } destroy { } process: ma, frame, time { // Variables vPosition = ma.get(POSITION,time); vRotation = ma.get(ROTATION,time); vScaling = ma.get(SCALING,time); // Channel if(iChannel == 1)vPosition.x = clip(nMin,nMax,vPosition.x); if(iChannel == 2)vPosition.y = clip(nMin,nMax,vPosition.y); if(iChannel == 3)vPosition.z = clip(nMin,nMax,vPosition.z); if(iChannel == 4)vRotation.x = clip(nMin,nMax,vRotation.x); if(iChannel == 5)vRotation.y = clip(nMin,nMax,vRotation.y); if(iChannel == 6)vRotation.z = clip(nMin,nMax,vRotation.z); if(iChannel == 7)vScaling.x = clip(nMin,nMax,vScaling.x); if(iChannel == 8)vScaling.y = clip(nMin,nMax,vScaling.y); if(iChannel == 9)vScaling.z = clip(nMin,nMax,vScaling.z); // ma ma.set(POSITION,vPosition); ma.set(ROTATION,vRotation); ma.set(SCALING,vScaling); } // CLIP clip: min,max,n { if(n < min) n = min; if(n > max) n = max; return(n); } load: what,io { if(what == SCENEMODE) // processing an ASCII scene file { iChannel = io.read().asInt(); nMin = io.read().asNum(); nMax = io.read().asNum(); setdesc(sTitle + " - Channel " + aChannel[iChannel] + " Min " + nMin + " Max " + nMax); } } save: what,io { if(what == SCENEMODE) { io.writeln(iChannel); io.writeln(nMin); io.writeln(nMax); } } options { reqbegin(sTitle + " " + sVersion); ctrl_c0 = ctlchoice("Channel",iChannel,@"X","Y","Z","H","P","B","SX","SY","SZ"@); ctrl_c1 = ctlnumber("Min",nMin); ctrl_c2 = ctlnumber("Max",nMax); // Developer ctlsep(); ctrl_dev0 = ctltext("","developer: Stephen Culley","http://www.stephenculley.co.uk"); return if !reqpost(); iChannel = getvalue(ctrl_c0); nMin = getvalue(ctrl_c1); nMax = getvalue(ctrl_c2); setdesc(sTitle + " - Channel " + aChannel[iChannel] + " Min " + nMin + " Max " + nMax); reqend(); }
https://drive.google.com/open?id=1cR_q2GVUAJHumic1-A3eXV16acQnVTWs
No comments:
Post a Comment