Skip to content
weSkelDOCUMENTATION
Documentation/Scripting/First script

Write your own tools

First script

Create two transforms, connect their scale and clean up the demonstration.

PythonTransformPlugs

This walkthrough creates two Maya transforms, connects their scale, then removes the two demonstration nodes.

In a test scene, open a Python tab in the Script Editor and run the entire block. A unique suffix identifies the nodes created by this example.

from uuid import uuid4
from weSkel.src.core.node.dag.transform.lib import Transform
prefix = "weskelSdk_" + uuid4().hex[:10]
driver = Transform(prefix + "_driver")
follower = Transform(prefix + "_follower")
driver.create()
follower.create()
driver.scale = (2.0, 3.0, 4.0)
driver.plugs["scale"].connect_to(follower.plugs["scale"])
assert follower.plugs["scale"].src == driver.plugs["scale"]
assert tuple(follower.scale) == (2.0, 3.0, 4.0)
print(driver.name, "->", follower.name)
print("Follower scale:", tuple(follower.scale))

Expected result: two transforms appear in the Outliner. The Script Editor prints their names and Follower scale: (2.0, 3.0, 4.0). The follower receives its scale from the driver.

Line or expression What it does
Transform(name) Prepares a wrapper for the given name.
node.create() Creates the missing transform. This method returns None: keep the wrapper variable.
driver.scale = (...) Changes scale through a wrapper property.
node.plugs["scale"] Accesses the Maya scale plug.
connect_to(...) Connects the source plug to the destination plug.
destination.src Lets you check the actual connected source.

Scale is unitless, so this first example does not depend on the scene’s angle or distance settings.

In the same Python tab, after the first block, run:

for node in (follower, driver):
node.delete(snapshot=False)
assert not node.exists
print("SDK example nodes removed")

Expected result: the two example nodes are deleted and SDK example nodes removed is printed.

Situation Action
No module named 'weSkel' Review the configuration in Getting started.
driver or follower is undefined The first block did not finish; inspect the original error.
An assertion fails Keep the full error and the Maya and weSkel versions. Inspect the two nodes in the test scene.
Another weSkel copy was loaded Correct the paths and restart Maya before trying again.

To understand property names and expected values, continue with Wrappers & specs.