Changes
- Added Group Undo (v1.1)
- Fixed mistype of polygons() (Thanks to LightWave Plugin Database for reminder)
Compatible with Newtek LightWave 9.6 and above.
// LScript Modeler - www.StephenCulley.co.uk // // web address: http://www.stephenculley.co.uk // email address: email@stephenculley.co.uk /* LScript Modeler - Poke Modeler_Poke.ls */ @version 2.2 @warnings @script modeler @name *Poke // Title sTitle = "*Poke"; // Version sVersion = "v1.1"; main { // Selection - Polygon (DIRECT) selmode(DIRECT); iPolyCount = polycount(); if(iPolyCount[1] < 1) error("No polygons selected."); undogroupbegin(); // Undo editbegin(); if(iPolyCount[1] >= 1) { foreach(aPolygon,polygons) { aPoints = polyinfo(aPolygon); rempoly(aPolygon); vAverage = <0.0,0.0,0.0>; for(iPointCount = 2; iPointCount <= sizeof(aPoints); iPointCount++) { vAverage += pointinfo(aPoints[iPointCount]); } // Resize by points vAverage *= 1 / (sizeof(aPoints) - 1); // Make new point iAverage = addpoint(vAverage); // Returns ID // Add polygons for(iPointCount = 2; iPointCount <= sizeof(aPoints) - 1; iPointCount++) { aNewPolygon[1] = aPoints[iPointCount]; aNewPolygon[2] = aPoints[iPointCount + 1]; aNewPolygon[3] = iAverage; addpolygon(aNewPolygon); } aNewPolygon[1] = aPoints[sizeof(aPoints)]; aNewPolygon[2] = aPoints[2]; aNewPolygon[3] = iAverage; addpolygon(aNewPolygon); } } editend(); undogroupend(); // Undo info(iPolyCount[1]," poly(s) poked."); }
All scripts available at my Google Drive at
https://drive.google.com/open?id=1cR_q2GVUAJHumic1-A3eXV16acQnVTWs
hi, isn't Make Pole the same though?
ReplyDeleteIt is. Its here more as example code.
DeleteThanks for the sourcecode! Very helpful.
ReplyDeleteThanks for the code
ReplyDelete