The pnts attribute is a multi attribute, that is empty when no tweaks are made on a geometry. So we basically do a removeMultiInstance on every index found for the attribute. Special care needs to be taken if this object is deformed, because the index 0 is connected to a tweak node, via a tweakLocation attribute. So you have to disconnect tweakLocation attribute, do the removeMultiInstance, and reconnect the tweakLocation attribute... Go figure... A little bit convoluted, but it's the cleanest way we found so far.
Nicolas 2015-10-08 9:39 GMT+02:00 Marcus Ottosson <[email protected]>: > No problem guys, but I can't take all the credit. I got suggested this > solution only a few weeks ago by Roy Nieterau. > > On 8 October 2015 at 02:56, Paul Molodowitch <[email protected]> wrote: > >> Awesome, I didn't know about that! In the past I had to do the >> connect-to-a-mesh hack... this is way better. Thanks Marcus! >> >> >> On Wed, Oct 7, 2015 at 1:52 PM Chad Fox <[email protected]> wrote: >> >>> Marcus, you are the man. Thanks for this solution! >>> >>> >>> -Chad >>> >>> On Tue, Oct 6, 2015 at 2:44 AM, Michał Frątczak <[email protected]> >>> wrote: >>> >>>> That seems to do it. Thanks to all. >>>> >>>> On Tuesday, October 6, 2015 at 9:45:34 AM UTC+2, Marcus Ottosson wrote: >>>>> >>>>> Try this. >>>>> >>>>> cmds.polyMoveVertex("pCubeShape1", constructionHistory=False) >>>>> >>>>> - >>>>> http://download.autodesk.com/us/maya/2011help/CommandsPython/polyMoveVertex.html >>>>> >>>>> Alternatively, connect the outMesh to a new mesh, as in my first post. >>>>> And then, disconnect, and connect the outMesh of the new mesh into the >>>>> inMesh of the original. This will give you double transformations. Then >>>>> you >>>>> can simply the vertex values. >>>>> >>>>> On 5 October 2015 at 23:44, Chad Fox <[email protected]> wrote: >>>>> >>>>>> Yeah, worked great with blendshapes. Problem with this merging of >>>>>> meshes is that it creates a new mesh and we lose any custom attrs and >>>>>> connections on the mesh. I've been freezing tweaks by Applying a lattice >>>>>> to >>>>>> the entire model then deleting history. This transfers all pnts to tweak >>>>>> nodes then deletes them. In anycase, I'm still hoping there's a way to >>>>>> freeze the tweaks without this workaround. :P >>>>>> >>>>>> Cheers >>>>>> >>>>>> >>>>>> -Chad >>>>>> >>>>>> On Mon, Oct 5, 2015 at 2:28 PM, Ian Jones <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> Only if it has too (verts with no edges etc) but its almost always >>>>>>> desirable in our experience. Of the mesh is generally clean Maya will >>>>>>> preserve the vertex order with operations like that. We've been doing it >>>>>>> with blendshapes for years. >>>>>>> >>>>>>> On Mon, Oct 5, 2015, 2:25 PM Michał Frątczak <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>>>> There's a risk however of changing vertex order ? >>>>>>>> >>>>>>>> >>>>>>>> On Monday, October 5, 2015 at 11:23:35 PM UTC+2, Ian Jones wrote: >>>>>>>> >>>>>>>>> In the past one of the ways we've sanitized meshes like this is >>>>>>>>> make a cube and combine it with the desired mesh then delete the >>>>>>>>> first 6 >>>>>>>>> faces (from the cube). That tends to force Maya to rebuild/reset >>>>>>>>> everything. >>>>>>>>> >>>>>>>>> Ian >>>>>>>>> >>>>>>>>> On Mon, Oct 5, 2015, 2:17 PM Chad Fox <[email protected]> wrote: >>>>>>>>> >>>>>>>> Thanks for the input, unfortunately the CG talk thread doesn't >>>>>>>>>> give me any new info, in fact I recommend people read that one >>>>>>>>>> carefully as >>>>>>>>>> there's a few people tossing around ideas of .pnts that are not >>>>>>>>>> accurate. >>>>>>>>>> >>>>>>>>>> As the thread points out, you can edit pnts with setAttr, but >>>>>>>>>> setting the pnts to 0, 0, 0 just moves the verts back to their base >>>>>>>>>> location. wish I could just setIdentity on the pnts array hehe. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -Chad >>>>>>>>>> >>>>>>>>> >>>>>>>>>> On Mon, Oct 5, 2015 at 11:26 AM, f.michal <[email protected]> >>>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>>> W dniu 2015-10-01 o 00:28, Chad_Fox pisze: >>>>>>>>>>> >>>>>>>>>>> Hi all >>>>>>>>>>> >>>>>>>>>>> Does anyone know if it's possible to freeze .pnts (tweaks) on a >>>>>>>>>>> mesh using python? I've been struggling with this for a while with >>>>>>>>>>> no >>>>>>>>>>> results. >>>>>>>>>>> >>>>>>>>>>> To be clear. I want to remove/freeze/zero these values on meshes >>>>>>>>>>> that don't have tweak nodes or history. For those who don't know, >>>>>>>>>>> the tweak >>>>>>>>>>> nodes are created when a new history operator is added and all >>>>>>>>>>> tweaks are >>>>>>>>>>> transferred to this node from the .pnts array on the mesh shape. >>>>>>>>>>> Fortunately when there's history I can just delete history and all >>>>>>>>>>> tweaks >>>>>>>>>>> are gone too. >>>>>>>>>>> >>>>>>>>>>> Any input or suggestions to try would be greatly appreciated! >>>>>>>>>>> >>>>>>>>>>> Thanks >>>>>>>>>>> >>>>>>>>>>> Chad >>>>>>>>>>> -- >>>>>>>>>>> You received this message because you are subscribed to the >>>>>>>>>>> Google Groups "Python Programming for Autodesk Maya" group. >>>>>>>>>>> To unsubscribe from this group and stop receiving emails from >>>>>>>>>>> it, send an email to >>>>>>>>>>> [email protected]. >>>>>>>>>>> To view this discussion on the web visit >>>>>>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/4b2aad0c-f8c1-4ef5-9e76-cd6250c45bc7%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>>>>>> https://groups.google.com/d/msgid/python_inside_maya/4b2aad0c-f8c1-4ef5-9e76-cd6250c45bc7%40googlegroups.com >>>>>>>>>>> . >>>>>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Hi Chad ! >>>>>>>>>>> Have you found any solution ? I got struck by this again lately, >>>>>>>>>>> and I even posted to group an hour ago or so ! >>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> You received this message because you are subscribed to the >>>>>>>>>>> Google Groups "Python Programming for Autodesk Maya" group. >>>>>>>>>>> To unsubscribe from this group and stop receiving emails from >>>>>>>>>>> it, send an email to >>>>>>>>>>> [email protected]. >>>>>>>>>>> To view this discussion on the web visit >>>>>>>>>>> https://groups.google.com/d/msgid/python_inside_maya/5612C0F1.9060109%40gmail.com >>>>>>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/5612C0F1.9060109%40gmail.com?utm_medium=email&utm_source=footer> >>>>>>>>>>> . >>>>>>>>>>> >>>>>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> You received this message because you are subscribed to the >>>>>>>>>> Google Groups "Python Programming for Autodesk Maya" group. >>>>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>>>> send an email to [email protected]. >>>>>>>>>> To view this discussion on the web visit >>>>>>>>>> https://groups.google.com/d/msgid/python_inside_maya/CAJ4oLs4dGvvB2ocFO1PxKSzeb8wF1%3Dgr3CQDE2N64wcvRvGWKQ%40mail.gmail.com >>>>>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAJ4oLs4dGvvB2ocFO1PxKSzeb8wF1%3Dgr3CQDE2N64wcvRvGWKQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>>>>>> . >>>>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>>>> >>>>>>>>> -- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "Python Programming for Autodesk Maya" group. >>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>> send an email to [email protected]. >>>>>>>> To view this discussion on the web visit >>>>>>>> https://groups.google.com/d/msgid/python_inside_maya/745a4f68-7691-4c57-9ea1-558eb7ab9cd7%40googlegroups.com >>>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/745a4f68-7691-4c57-9ea1-558eb7ab9cd7%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>>> . >>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "Python Programming for Autodesk Maya" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to [email protected]. >>>>>>> To view this discussion on the web visit >>>>>>> https://groups.google.com/d/msgid/python_inside_maya/CAL6_5Q_NB6OipEkhDOW_98LtxdaCfVCRJ%3DBQyTQw1ojdOL8VAA%40mail.gmail.com >>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAL6_5Q_NB6OipEkhDOW_98LtxdaCfVCRJ%3DBQyTQw1ojdOL8VAA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>>> . >>>>>>> >>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Python Programming for Autodesk Maya" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/python_inside_maya/CAJ4oLs6-mRs7r4bQyixHpXR4NqovORk7UVMEiU2eO%3DdBhCRAtA%40mail.gmail.com >>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAJ4oLs6-mRs7r4bQyixHpXR4NqovORk7UVMEiU2eO%3DdBhCRAtA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> *Marcus Ottosson* >>>>> [email protected] >>>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Python Programming for Autodesk Maya" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/python_inside_maya/a31add83-2c55-4b2b-a193-b028954cd149%40googlegroups.com >>>> <https://groups.google.com/d/msgid/python_inside_maya/a31add83-2c55-4b2b-a193-b028954cd149%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/python_inside_maya/CAJ4oLs4%3D4ZGvep7yUDXr%3DQKX80xfyGVZxncnSY1jZcEyhGNtAw%40mail.gmail.com >>> <https://groups.google.com/d/msgid/python_inside_maya/CAJ4oLs4%3D4ZGvep7yUDXr%3DQKX80xfyGVZxncnSY1jZcEyhGNtAw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/CAAssL7b1zJ6br1UREdAY6z%3DQCtTDCS-hM3XTpU-N32-dszMTSw%40mail.gmail.com >> <https://groups.google.com/d/msgid/python_inside_maya/CAAssL7b1zJ6br1UREdAY6z%3DQCtTDCS-hM3XTpU-N32-dszMTSw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > *Marcus Ottosson* > [email protected] > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCzmvKE6OHhxBm6%3DN7JNOvKtR3ur-onXyUv%2B8kkCJVxdQ%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCzmvKE6OHhxBm6%3DN7JNOvKtR3ur-onXyUv%2B8kkCJVxdQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAD65uqk06mFd1FOMvo%2BZ-F610GOXUf%3DP9S6SX1g7YQka--mrqA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
