From 9a1a0edc99bd4a95ca33266c86d8c75ae5582e05 Mon Sep 17 00:00:00 2001 From: Guillaume Babin <36015647+guibab@users.noreply.github.com> Date: Tue, 13 Feb 2024 08:35:55 -0800 Subject: [PATCH] freeze rotation when duplicating shape and reapplying shape (#5) Co-authored-by: Guillaume Babin --- scripts/blurdeform/blurdeform.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/blurdeform/blurdeform.py b/scripts/blurdeform/blurdeform.py index 89eb068..6b9bc92 100644 --- a/scripts/blurdeform/blurdeform.py +++ b/scripts/blurdeform/blurdeform.py @@ -631,6 +631,11 @@ def addNewFrame(self): self.refresh(selectTime=True, selTime=cmds.currentTime(q=True)) def doAddNewFrame(self, blurNode, currentGeom, targetMesh): + prt ,= cmds.listRelatives(targetMesh, parent=True, path=True) + cmds.parent(targetMesh, currentGeom) + cmds.makeIdentity(targetMesh, apply=True, translate=False, rotate=True, scale=False, normal=0, preserveNormals=True) + cmds.parent(targetMesh, prt) + poseName = cmds.getAttr(self.currentPose + ".poseName") listDeformationsFrame = self.getListDeformationFrames() @@ -1227,6 +1232,7 @@ def enterEditMode(self): nameSpaceSplit = geo.split(":") dupName = "EDIT_" + nameSpaceSplit[-1] dup = cmds.duplicate(geo, name=dupName)[0] + cmds.makeIdentity(dup, apply=True, translate=False, rotate=True, scale=False, normal=0, preserveNormals=True) cmds.addAttr(dup, longName="blurSculptNode", dataType="string") cmds.setAttr(dup + ".blurSculptNode", edit=True, keyable=True) cmds.setAttr(dup + ".blurSculptNode", self.currentBlurNode, type="string")