Here is zee old one:
Code:
macroScript LeafConvert category:"John O'Connell Tools" /* This script is provded as is and is in no way to be considered a bug free utility. Any loss of time or information as a result of using this script is not the responsibility of John O'Connell so use it at your own risk! To be done: 1. Add random scaling and rotation offsets 2. Add in the option to use more than one type of leaf 3. Add the ability to convert multiple objects and have automatic conversion of objects into editable poly 4. Add in stability and more error checking The latest version of this should always be available in the stuff section of http://www.joconnell.com so check back often */ ( rollout LeafConvert "AEC Leaf convertor" ( fn polyFilter obj = superclassof obj == GeometryClass Spinner replaceID "Replace Mat ID" type:#integer range:[-1000,1000,5] pickbutton LeafObject "Pick leaf Object" width:200 align:#right filter:polyfilter button MakeLeaves "Make Leaves" width:200 align:#right on LeafObject picked obj do ( leafobject.text = LeafObject.object.name ) on makeleaves pressed do ( the_sel = selection as array copy_obj = leafobject.object mat_id = replaceID.value for o = 1 to the_sel.count do ( try(convertToPoly the_sel[o])catch() face_count = getnumfaces the_sel[o] print face_count face_array = #() -- Get faces with the specified mat id for i = 1 to face_count do ( if (polyop.getfaceMatId the_sel[o] i == mat_id) then ( append face_array i ) ) copy_obj_mesh = editable_mesh() copy_obj_mesh.name = (the_sel[o].name + "_leaves") copy_obj_mesh.pos = the_sel[o].pos disableSceneRedraw() -- Begin progress bar progressStart "Making leaves" escapeEnable = false itemnum = face_count curitem = 0 for f = 1 to face_array.count do ( curitem += 1 the_pos = polyop.getfacecenter the_sel[o] (face_array[f]) the_dir = polyop.getfacenormal the_sel[o] (face_array[f]) the_dist_obj = copy copy_obj the_dist_obj.pos = the_pos the_dist_obj.dir = the_dir attach copy_obj_mesh the_dist_obj -- Update progress bar total_progress = ((curitem as float)/(itemnum as float))*100 gc() progressUpdate total_progress ) progressEnd() enableSceneRedraw() completeRedraw() ) ) ) createdialog LeafConvert width:360 )
Comment