Sorry about that, I’ll be more careful next time. Thanks for pointing it out.
في الأربعاء، 7 يناير 2026 في تمام الساعة 10:36:37 ص UTC+2، كتب Marcus Ottosson رسالة نصها: > Just to give you some idea of what some of us are seeing and how > challenging it would be to try and understand you. > > [image: image.png] > > Most people are busy people, any obstacle you can remove between question > and answer, such as not having to visit Google Drive and formatting your > code with syntax highlighting, will yield a quicker answer for you. Win-win. > > On Tue, 6 Jan 2026 at 13:10, Frame <[email protected]> wrote: > >> I’m trying to build a temporary pivot tool, and I made a very simple >> version just to test the core logic. >> >> The idea is: >> I compute the relative matrix and apply it to the selected object. >> >> The problem is that while I’m working on the current frame, everything >> behaves correctly. >> But after I close the tool and scrub or check other frames, the >> character gets completely broken >> >> What could be causing this issue? >> >> I’ve uploaded the code and a screen recording of the problem to Google >> Drive >> >> >> https://drive.google.com/drive/folders/1Bs1oB_2rrRAreBJ0REZZpn2ZW4zbyz0P?usp=sharing >> >> >> Also This is another test. The problem is that the translation is always >> wrong. >> I’m doing the test on frame 7, and I uploaded the scene I’m testing on to >> Drive. >> >> >> import maya.cmds as cmds >> >> import maya.mel >> >> import maya.api.OpenMaya as om >> >> import maya.api.OpenMayaAnim as oma >> >> import math >> >> >> >> def get_dag_path(nodeName): >> >> selection_list = om.MSelectionList().add(nodeName) >> >> return selection_list.getDagPath(0) >> >> >> >> # pivot_name_1 repesent point a >> >> pivot_name_1 = "locator3" >> >> pivot_1 = get_dag_path(pivot_name_1) >> >> pivot_matrix_1 = pivot_1.inclusiveMatrix() >> >> >> >> # pivot_name_2 repesent point b ( after locator3 moved ) >> >> pivot_name_2 = "locator4" >> >> pivot_2 = get_dag_path(pivot_name_2) >> >> pivot_matrix_2 = pivot_2.inclusiveMatrix() >> >> >> >> # obj_name = "Char_Norman_A1_v011:ctrl_Root" >> >> obj_name = "Char_Norman_A1_v011:ctrlIK_Lf_ArmIK" >> >> obj = get_dag_path(obj_name) >> >> obj_matrix = obj.inclusiveMatrix() >> >> >> >> >> >> # parent_name = "Char_Norman_A1_v011:grAll_Ctrl" >> >> parent_name = "Char_Norman_A1_v011:grCon_Lf_ArmIK" >> >> parent = get_dag_path(parent_name) >> >> parent_matrix = parent.inclusiveMatrix() >> >> >> >> relative_matrix = obj_matrix * pivot_matrix_1.inverse() >> >> new_obj_matrix = relative_matrix * pivot_matrix_2 >> >> local_matrix = new_obj_matrix * parent_matrix.inverse() >> >> >> >> transform_matrix = om.MTransformationMatrix(new_obj_matrix) >> >> translation = transform_matrix.translation(om.MSpace.kTransform) >> >> rotation = transform_matrix.rotation(False) >> >> >> >> cmds.xform(obj_name, translation=translation) >> >> cmds.xform(obj_name, >> >> rotation=[ math.degrees(rotation.x), math.degrees(rotation.y), >> math.degrees(rotation.z) ]) >> >> -- >> 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 visit >> https://groups.google.com/d/msgid/python_inside_maya/ec2724c9-1ce8-4295-8ec1-9f567595a2c9n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/python_inside_maya/ec2724c9-1ce8-4295-8ec1-9f567595a2c9n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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 visit https://groups.google.com/d/msgid/python_inside_maya/fc987c09-2ca2-43b2-adb9-b9562dd7a9e2n%40googlegroups.com.
