Website Youtube GitHub

How to use 'transform.matchWorldTransform' directly in the Maya script editor


#1

Hi.
I am trying to match two native maya objects (locator and a joint, no mgear objects) via the mgear.core script, directly in the maya script editor.
Boldly not withheld by my lack of proper scripting skills I smash in the following:

from mgear.synoptic import utils
from mgear.core import transform
import pymel.core as pm

Target = 'hip'
Ctrl = 'hip_ctl'

transform.matchWorldTransform(Target, Ctrl)

Which results in the following error:

Error: AttributeError: file C:\Users\User\Documents\mgear_3.3.1\release\scripts\mgear\core\transform.py line 537: ‘str’ object has no attribute ‘getMatrix’

Is it possible what I am trying to do? How could I write it down so it works?

Thanks


#2

Hi @mackerB

You need to make your target and ctrl pymel objects

from mgear.core import transform
import pymel.core as pm


target = pm.PyNode('hip')
ctrl = pm.PyNode('hip_ctl')

transform.matchWorldTransform(target, ctrl)

#3

Superb, @Jerome! Functional and informative…