0
\$\begingroup\$
  1. How to get local offset of a control with Python in UE RigEditor? I’ve found a function to get global offset unreal.RigHierarchy.get_global_control_offset_transform but I don’t see a function to get local offset.

  2. What means initial=True/False in function unreal.RigHierarchy.set_control_offset_transform() Well, yes it looks like self-explanatory, but what is an initial value in that case? The behavior is different when switch between True/False. But I cannot figured it out.

  3. Have a look please at the script below. The main idea is to move local(initial/current) transformations to local offset and all local(initial/current) become 0. I cannot realize why my script sets right transformations, the print prints them right too, but it appears different/wrong in editor and 3d viewport? What could be missed here?

new_controls = ['control_name_1, control_name_2',...]
for new_ctrl in new_controls:
    print('/////////////////////////////////')
    new_ctrl_loc_transform = rig.hierarchy.get_local_transform(unreal.RigElementKey(type=unreal.RigElementType.CONTROL, name=new_ctrl), initial=True) // Get initial local transforms
    print(new_ctrl_loc_transform)
    rig.hierarchy.set_local_transform(unreal.RigElementKey(type=unreal.RigElementType.CONTROL, name=new_ctrl), unreal.Transform(unreal.Vector(0,0,0), unreal.Rotator(0,0,0), unreal.Vector(1,1,1)), initial=True) // Reset initial local transforms to 0
    print(rig.hierarchy.get_local_transform(unreal.RigElementKey(type=unreal.RigElementType.CONTROL, name=new_ctrl), initial=True))
    rig.recompile_vm() //Recompile
    print(rig.hierarchy.get_local_transform(unreal.RigElementKey(type=unreal.RigElementType.CONTROL, name=new_ctrl), initial=True))
    print(new_ctrl_loc_transform)
    rig.hierarchy.set_control_offset_transform(unreal.RigElementKey(type=unreal.RigElementType.CONTROL, name=new_ctrl), new_ctrl_loc_transform, initial=True) // Set previously got initial local transformations to local offset
    print(rig.hierarchy.get_local_transform(unreal.RigElementKey(type=unreal.RigElementType.CONTROL, name=new_ctrl), initial=True))
    rig.hierarchy.set_local_transform(unreal.RigElementKey(type=unreal.RigElementType.CONTROL, name=new_ctrl), unreal.Transform(unreal.Vector(0,0,0), unreal.Rotator(0,0,0), unreal.Vector(1,1,1)), initial=True) //Reset initial local trans. one more time(just in case)
    print(rig.hierarchy.get_local_transform(unreal.RigElementKey(type=unreal.RigElementType.CONTROL, name=new_ctrl), initial=True))
    rig.recompile_vm() // Recompile
    print(rig.hierarchy.get_local_transform(unreal.RigElementKey(type=unreal.RigElementType.CONTROL, name=new_ctrl), initial=True))
\$\endgroup\$
2
  • \$\begingroup\$ "sets right transformations, the print prints them right too, but it appears different/wrong in editor and 3d viewport" - it would help if you edited to explain &/or show how it's wrong. Or post a minimal reproducible example. You've been on SO for a goodly while - the expectations here are similar. \$\endgroup\$
    – Pikalek
    Mar 11 at 20:04
  • \$\begingroup\$ @Pikalek The peace of code I've posted is pretty much explanatory I believe. I think this question is really sepicific to Unreal Engine and how offset is implemented there. Yes, the concept with moving pivot poits is same. But i don't think a person who has never worked with UE Rigging, would be able to help. But if you insist, I can add some screenshots with transfomation numbers from UE... \$\endgroup\$
    – Dron4K
    Mar 11 at 20:15

0

You must log in to answer this question.

Browse other questions tagged .