Closed hsouders closed 3 years ago
@hsouders This looks great!! So much work you've put into this \m/.
A few thoughts/findings with some initial testing:
Export keyframes only
and when I try to change sample unit to s
:# Error:
# Traceback (most recent call last):
# File "/Applications/Autodesk/maya2020/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/pymel/internal/factories.py", line 830, in callback
# res = origCallback(*newargs)
# File "/Applications/Autodesk/maya2020/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/pymel/internal/factories.py", line 807, in __call__
# return self.func(*self.args + args, **kwargsFinal)
# File "/Users/evanatherton/Library/Preferences/Autodesk/maya/modules/mimic/scripts/mimic_config.py", line 387, in set
# prefs = cls.get_prefs_dict(pref_level)
# File "/Users/evanatherton/Library/Preferences/Autodesk/maya/modules/mimic/scripts/mimic_config.py", line 374, in get_prefs_dict
# assert not 'Invalid pref_level passed'
# AssertionError #
Setup > General > Axis Limits
, using the Get Axis Limits
button on Acceleration or Jerk throws an error:# Traceback (most recent call last):
# File "/Applications/Autodesk/maya2020/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/pymel/internal/factories.py", line 830, in callback
# res = origCallback(*newargs)
# File "/Users/evanatherton/Library/Preferences/Autodesk/maya/modules/mimic/scripts/mimic_utils.py", line 1061, in write_limits_to_ui
# write_deriv_limits_to_ui('Jerk')
# File "/Users/evanatherton/Library/Preferences/Autodesk/maya/modules/mimic/scripts/mimic_utils.py", line 1098, in write_deriv_limits_to_ui
# axis_deriv_limits = _get_limits(robot, limit_type)
# File "/Users/evanatherton/Library/Preferences/Autodesk/maya/modules/mimic/scripts/mimic_utils.py", line 1317, in _get_limits
# add_limits_to_robot(robot, limit_type)
# File "/Users/evanatherton/Library/Preferences/Autodesk/maya/modules/mimic/scripts/mimic_utils.py", line 2807, in add_limits_to_robot
# nominal_limit = mimic_config.Pref.get('NOMINAL_JERK_LIMIT')
# AttributeError: 'module' object has no attribute 'Pref' #
collapsable=True
flag in the frameLayout.mimic/prefs
. We could store user prefs there and maybe move mimic_config.py there as well. But I don't feel too strongly about that though so totally up to you if you prefer it the way it is.DEBUG = True
. Then anywhere they want a debug print statement they'd use if DEBUG: print *
so you could easily turn all debugging off and on by changing that first variable assignment. I personally like deleting them once debugging is done, but I do like that trick for things worth keeping around.Thanks again man, this is awesome!
One more thought regarding how the file level prefs interact with the global prefs: it’d also be nice if there was a way to “push” the current prefs state of the Mimic UI over to the Preferences UI to then save as the global user prefs without having to set all the options again in the Prefs UI
Thanks for catching those bugs! I'll look into them.
Other things:
Good point about the Prefs window being long. I'm on a large display and forget about this sometimes. I can make the frames collapsible. Do you think it's also worth putting the Postproc options in their own tab?
I'll look into moving files outside of /scripts, I don't think there will be a problem if the json file is located there, but I'm not sure if Maya will execute a python file outside of /scripts. I'll investigate.
If we're planning to keep print statements around, I think it probably makes more sense to use python's logging module instead. Logging gives you some more flexibility and it's easy to pipe messages to a file if needed. I think I'll probably end up doing that unless you have any concerns?
I can't complain about you doing the cross platform testing. Phew! Should I leave the Mimic logo as the header to the Preferences window? I could see people getting confused and not realizing which window they're looking at? It looks weird if it's empty, but 🤷
Restoring defaults to a Maya file: I think this is a good idea. There are three possible implementations of this:
Additionally, loading user preferences from the current file could be useful. I suppose there could be an "Advanced" tab in the Preferences window that would give you this option (and the options above + a bit more), but things start to get a little confusing:
Maybe the best move is to leave the "Save Preferences" button where it is, and move all these other options to the "Advanced" tab?
- Good point about the Prefs window being long. I'm on a large display and forget about this sometimes. I can make the frames collapsible. Do you think it's also worth putting the Postproc options in their own tab?
I'm a big fan of tabs (as you can probably tell haha). So I'm definitely in favor of moving the postproc settings into their own tab.
- I'll look into moving files outside of /scripts, I don't think there will be a problem if the json file is located there, but I'm not sure if Maya will execute a python file outside of /scripts. I'll investigate.
That's a good point, that might be a messy way of doing it. It'd probably be more clear to at least keep the .py file in /scripts. Feels silly then to make an entirely new directory to hold a single .json, so we can just keep it as-is for now and see if it bothers us in the future.
- If we're planning to keep print statements around, I think it probably makes more sense to use python's logging module instead. Logging gives you some more flexibility and it's easy to pipe messages to a file if needed. I think I'll probably end up doing that unless you have any concerns?
No concerns here :) I haven't used the logging module before, but definitely seems like the right tool
- I can't complain about you doing the cross platform testing. Phew! Should I leave the Mimic logo as the header to the Preferences window? I could see people getting confused and not realizing which window they're looking at? It looks weird if it's empty, but 🤷
You can just leave it as is and I'll give the "branding" some more thought on my end. I might do it like I did the mFIZ window or something to keep a consistent style for the "add-ons"
Restoring defaults to a Maya file: I think this is a good idea. There are three possible implementations of this:
- Delete all preferences in the file. (You'll definitely want to do this before you distribute a new model that you rigged).
- Set all preferences in the file to match Mimic defaults.
- Set all preferences in the file to match the User defaults.
Additionally, loading user preferences from the current file could be useful. I suppose there could be an "Advanced" tab in the Preferences window that would give you this option (and the options above + a bit more), but things start to get a little confusing:
- Save User Preferences (to json)
- Load User Preferences (from arbitrary json)
- Reset User Preferences to Mimic Defaults
- Load User Preferences from Current File
- Delete All Preferences in Current File
- Set File Preferences to Mimic Defaults
- Set File Preferences to User Defaults
- Maybe the best move is to leave the "Save Preferences" button where it is, and move all these other options to the "Advanced" tab?
Yeah I can see it getting confusing for users to pick up the difference between "user", "file", and "default" preferences without a tutorial video or something (which isn't a huge deal). We could make a little "Help" button that launches a dialog with a 1-sentence description of each and/or use the hover tool tips for each of those options. I think, for now at least, leaving "Save Preferences" where it is and moving the rest to an "Advanced" tab sounds like the best solution
Ok!
Well, I got pretty busy for a while, but I had some time to clean this up and add those features. Here are the highlights:
Notes on the "Advanced" tab:
Things that I'd still like to fix/implement, but I don't think they're going to make it in this PR:
I would definitely appreciate some QA help, as I'm sure I missed something. I added a TODO so you should be able to find that header image pretty easily. (Search "TODO(evanatherton)") Let me know!
Epic work @hsouders! I've only managed to find 1 bug (sample rate is saving as a string value instead of a float). I'm merging now, will fix that bug, the header, and the <2020 shelves from there. Thanks again man!
Ha, There's always one, isn't there.....
@evanatherton
There's still some code cleanup and a couple bugs that I haven't had time to investigate, so don't accept the pull request! I wanted you to take a look at functionality and let me know what you think before I start locking things down.
How it should work: There are three levels of preferences:
Couple things to note:
Lastly, "it works on my machine" but I've been playing with a lot of Maya variables, so it's possible I've created a situation where is works on my local machine but not elsewhere. Let me know if you run into any issues or we need to change functionality.