LScript (Layout) to animate models expanding in to existence. It is best used upon non subdivided and unwelded polygons.
Compatible with Newtek LightWave 9.6 and above.
// LScript Displacement Map - www.StephenCulley.co.uk // // web address: http://www.stephenculley.co.uk // email address: email@stephenculley.co.uk /* LScript Displacement Map - Expand Displace_Expand.ls */ @version 2.2 @warnings @script displace @name *Expand // Title sTitle = "*Expand"; // Version sVersion = "v1.0"; // Item Item; // Variable iCount = 0; iPoint = 0; iPointCount = 0; vPosition = <0.0,0.0,0.0>; // Requester bRequesterUpdate = false; // Update iRequesterFrame = -1; // Frame // Envelope envAmount; // Amount // Control ctrl_c0; create: obj { setdesc(sTitle); // Item Item = obj; // Envelope envAmount = Envelope("Amount (" + sTitle + ")",CHAN_NUMBER,sTitle); // Amount envAmount.persist(false); envAmount.createKey(0,0.0); // Info info("*Expand - Use with unwelded polygons without subdivions."); } destroy { } newtime: id, frame, time { if(reqisopen() && iRequesterFrame != frame) { bRequesterUpdate = true; // Update setvalue(ctrl_c0,envAmount.value(Scene().currenttime)); // Amount iRequesterFrame = frame; // Frame bRequesterUpdate = false; // Update } // Subpatch Level SubPatchLevel(0,0); // Variable nAmount = clip(0.0,1.0,envAmount.value(time)); iPointCount = Item.pointCount(); nPoint = nAmount * iPointCount; nFrac = frac(nPoint); iPoint = nPoint - nFrac; vPosition = linear1D(Item.position(Item.points[max(1,iPoint)]),Item.position(Item.points[min(iPointCount,iPoint + 1)]),nFrac); iCount = 0; // Count } flags { // WORLD LOCAL return(LOCAL); } process: da { iCount++; // Count if(iCount <= iPoint) { } else { // da da.source[1] = vPosition.x; da.source[2] = vPosition.y; da.source[3] = vPosition.z; } } // CLIP clip: min,max,n { if(n < min) n = min; if(n > max) n = max; return(n); } // INTERPOLATION linear1D: n1,n2,i // i = interpolation point (0-1) { return(n1 * (1 - i) + n2 * i); } load: what,io { if(what == SCENEMODE) // processing an ASCII scene file { if(io.read().asStr() == sTitle + " " + sVersion) { // Envelope envAmount.load(); // Amount } } } save: what,io { if(what == SCENEMODE) { // Header io.writeln(sTitle + " " + sVersion); // Envelope envAmount.save(); // Amount } } options { if(reqisopen()) { reqend(); return; } reqbegin(sTitle + " " + sVersion); ctrl_c0 = ctlpercent("Amount",envAmount.value(Scene().currenttime)); // Amount ctrl_c1e = ctlbutton("E",20,"button_c1e"); // Button // Developer ctlsep(); ctrl_dev0 = ctltext("","developer: Stephen Culley","http://www.stephenculley.co.uk"); // Refresh ctlrefresh(ctrl_c0,"refresh_c0"); // Amount reqopen(); } button_c1e // Amount { envAmount.edit(); } refresh_c0:value // Amount { if(bRequesterUpdate) return; // Requester Update setvalue(ctrl_c0,clip(0.0,1.0,value)); iKey = envAmount.keyExists(Scene().currenttime); if(iKey == nil) {envAmount.createKey(Scene().currenttime,clip(0.0,1.0,value));} else {envAmount.setKeyValue(iKey,clip(0.0,1.0,value));} }
https://drive.google.com/open?id=1cR_q2GVUAJHumic1-A3eXV16acQnVTWs
No comments:
Post a Comment