// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // Procedure Name: // MASHbakeToParticles // // Description; // Force nParticles to exist at MASH point locations. This is scripted, and slow. // global proc MASHbakeToParticles() { string $sel[] = `ls -sl`; if (size($sel) > 0) { string $id = `nodeType $sel[0]`; if ($id == "MASH_Waiter") { vector $positions[] = `getAttr ($sel[0]+".positions")`; string $pcmd = "nParticle "; for ($item in $positions) $pcmd += ("-p " + $item + " "); string $particleShape[] = `eval($pcmd)`; string $dynCommand = "vector $positions[] = `getAttr "+$sel[0]+".positions`;\n\nint $id = particleId;\nvector $current = $positions[$id];\nposition = << ($current.x), ($current.y), ($current.z) >>;"; dynExpression -s $dynCommand -rbd $particleShape[1]; } else { MASHinViewMessage((getPluginResource("MASH", "kPleaseSelectAWaiter")), "Warning"); } } else { MASHinViewMessage((getPluginResource("MASH", "kPleaseSelectAWaiter")), "Warning"); } }