Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clone #73

Merged
merged 13 commits into from
Dec 14, 2023
Merged

Clone #73

merged 13 commits into from
Dec 14, 2023

Conversation

mottosso
Copy link
Owner

Support for cloning enum attributes.

parent = createNode("transform")
camera = createNode("camera", parent=parent)

# Make new enum attribute
camera["myEnum"] = Enum(fields=["a", "b", "c"])

# Clone it
clone = camera["myEnum"].clone("cloneEnum")
cam.addAttr(clone)

# Compare it
fields = camera["cloneEnum"].fields()
assert fields == ((0, "a"), (1, "b"), (2, "c"))

- Upgrade NurbsCurve to API 2.0 (Maya 2017+)
- Expose Tm.asScaleMatrix and Tm.asRotateMatrix
- Expose MFn.kMesh
…ated", cmdx.kStepped] = {1: True}

- Support for path-like syntax, e.g. parent | "child" | "grandchild"
- Add Vector.rotate_by PEP8 syntax
- Protect against crash when using MPoint with MObject
- Support BoundingBox.expand with Vector-type
- Expose math.sqrt as cmdx.sqrt
- Expose isScrubbing
- Expose isPlaying
- Support for cmdx.setAttr(undoable=True)
- Support for cmdx.setAttr with Matrix
- Make Maya aware of cmdx version
@mottosso
Copy link
Owner Author

A little overdue, some additions that's been happening over the past month or so.

  • Support for path-like syntax, e.g. parent | "child" | "grandchild"
  • Add Vector.rotate_by PEP8 syntax
  • Protect against crash when using MPoint with MObject
  • Support BoundingBox.expand with Vector-type
  • Expose math.sqrt as cmdx.sqrt
  • Expose isScrubbing
  • Expose isPlaying
  • Support for cmdx.setAttr(undoable=True)
  • Support for cmdx.setAttr with Matrix
  • Make Maya aware of cmdx version

Path-like Syntax

You can now more neatly identify objects in a hierarchy.

# Before
group = cmdx.encode("|some_grp")
hand = cmdx.encode(group.path() + "|hand_ctl")

# After
hand = group | "hand_ctl"

It can be nested too.

finger = group | "hand_ctl" | "finger_ctl"

setAttr

To my great astonishment, Maya's cmds.setAttr depends on the UI settings for units. :O

cmds.setAttr("hand_ctl.translateY", 5)

For a user with Maya set to Centimeters, this would set translateY to 5 centimeters. For any user with any other unit, like Foot, it would instead move it 5 feet. That is terrible behaviour for a script, how can you possibly define the length of something if you don't know the unit? A dog is 100 cm tall, not 100 "any unit" tall.

The cmdx.setAttr on the other hand does what Maya's API does, which is to treat all units consistently.

  • Distance values are in centimeters
  • Angular values are in radians

So the user is free to choose any unit for their UI without breaking their scripts.

- setChannelBox
- currentFrame
- Handle passing tuple to curve()
- Integer attribute type
- Handle multiple vendored cmdx's
@mottosso
Copy link
Owner Author

More additions, should really be merging this hah.

  • setChannelBox
  • currentFrame
  • Handle passing tuple to curve()
  • Integer attribute type
  • Handle multiple vendored cmdx's

@mottosso
Copy link
Owner Author

We've got company. 😃 https://github.com/AnimalLogic/AL_omx

Bringing this up to date with the version bundled with Ragdoll.

@mottosso mottosso merged commit ddf276a into master Dec 14, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant