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

Tweaks #44

Merged
merged 5 commits into from
Nov 30, 2020
Merged

Tweaks #44

merged 5 commits into from
Nov 30, 2020

Conversation

mottosso
Copy link
Owner

A few handy updates I find myself needing.

  • cmdx.exists to quickly query existence
  • cmdx.DagModifier improvied debugging
  • cmdx.connect convenience function

if cmdx.exists(someNode):
  say_hello()

if someNode.childCount() > 1:
  print("This joint has multiple children, yo")

This one is useful for debugging.

with cmdx.DagModifier() as mod:
   tm = mod.create_node("transform")
   mod.doIt()
   mod.connect(tm["translateX"], tm["message"])

Before

# I had issues with `create_node` and `connect`

After

# I had issues with `connect`

Since we've already successfully done the prior with an explicit call to doIt. This helps when there's tons of things being done, but most of which have already been doIt.

And finally.

cmdx.connect(a["plug1"], b["plug1"])

As a convenience function for..

with cmdx.DagModifier() as mod:
  mod.connect(a["plug1"], b["plug2"])

To help with readability when most of the commands don't need/use a modifier, but just this one connect does.

@mottosso mottosso added the enhancement New feature or request label Nov 27, 2020
@mottosso mottosso merged commit 43a8391 into master Nov 30, 2020
@mottosso mottosso deleted the tweaks branch January 22, 2022 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant