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

fix hang when adding nested compound attributes #38

Merged
merged 3 commits into from
Nov 30, 2020

Conversation

benblo
Copy link

@benblo benblo commented Nov 4, 2020

fixes #5

cmdx.py Outdated
@@ -5258,6 +5258,7 @@ class Compound(_AbstractAttribute):
Multi = None

def __init__(self, name, children=None, **kwargs):
self.Fn = om.MFnCompoundAttribute() # see https:/mottosso/cmdx/issues/5#issuecomment-717330454
Copy link
Owner

@mottosso mottosso Nov 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make the class Fn = None? One of these aren't necessary.

Also try and stick to 80 lines with if possible, which it can be here if we put the comment on the line above.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, removed.

Actually I was wondering if we should keep declaring Fn as currently (static for each attribute type), but always instantiate something like self.Fn = cls.Fn() directly in _AbstractAttribute.__init__(), but I'm not 100% sure this is strictly necessary outside for non-Compound attributes.
Also I'm not sure how to actually get to the type-specific Fn from _AbstractAttribute 😄

@mottosso
Copy link
Owner

Could we add just one test to this, to make sure it works on all Maya's, and that it won't break again in the future?

@benblo
Copy link
Author

benblo commented Nov 30, 2020

I could, though last time I used tests wasn't very fun ;)
I don't really have time to spend on this right now, I tend to work in bursts so next time I can focus on cmdx, I'll do it right, setup the docker thing you mentioned etc and finish this.

Btw, I recently created wrappers for some APIs (eg playbackOptions), that are exposed as commands although to me they are much better suited as a class with properties (all it does is expose get/set accessors).
Much of my pains with Maya come from not having proper autocompletion for cmds, not having proper typing information, and spending way too much time reading the docs to figure out the keyword combinations, so I've now taken the habit of whenever I need a new API, first wrapping it into something I find more sensible (I feel like most of it could be automated).
I don't know if this is of any interest to you? maybe in a different module, since I feel this is not necessarily the focus of cmdx.

@mottosso
Copy link
Owner

I could, though last time I used tests wasn't very fun ;)

Haha, I understand exactly. xD I've added a test just now.

I don't know if this is of any interest to you? maybe in a different module, since I feel this is not necessarily the focus of cmdx.

Not for cmdx, that's more in the territory of PyMEL I think; i.e. all-encompassing mess. What's keeping you from using that?

@mottosso mottosso merged commit dc854be into mottosso:master Nov 30, 2020
@benblo benblo deleted the Ben/fix-nested-compounds branch February 16, 2021 09:25
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.

Compound of Compounds
2 participants