Comments (7)
Also a good idea, nice one. :)
How about we start with .animate
, which would also get called whenever a dict
is passed straight to a plug? Similar to how .write
is called whenever you pass a regular value. Then we can take both of those for a spin and get a feel for it.
from cmdx.
No immediate thoughts, other than wanting to enable passing a dictionary instead of the Maya-esque times
and values
arguments.
mycurve.addKeys({
1: 0,
5: 1.24,
12: 0
})
Oh, and the current method keys
doesn't sound like the verb it is meant to be used as. Should probably be addKeys
. Maybe it would also be nice with some kind of direct animation of a plug.
# psuedo
mynode["tx"] << cmdx.AnimCurve({1: 0.0, 10: 5.0, 20: 0.0})
What did you have in mind?
from cmdx.
Yeah, the keys
method did confuse me at first so I'm all for making it addKeys
.
One thing I wanted to try was supporting undo/redo via the oma.MAnimCurveChange class.
Then also adding some of the other useful functions and properties found in MFnAnimCurve.
from cmdx.
Sounds good to me, authoring animation via Python in Maya is a pain so anything cmdx can would be a plus.
from cmdx.
Thinking on your example of
# psuedo
mynode["tx"] << cmdx.AnimCurve({1: 0.0, 10: 5.0, 20: 0.0})
I'm not sure this would work as AnimCurve
wouldn't know what type to create (TL, TA, TU, etc.). Unless I'm not thinking of something?
Maybe when you set an attribute that's a dict it could create and connect an AnimCurve
:
# psuedo
mynode["tx"] = {1: 0.0, 10: 5.0, 20: 0.0}
Unless that would be considered too "magical", any thoughts?
from cmdx.
I'm not sure this would work as AnimCurve wouldn't know what type to create (TL, TA, TU, etc.). Unless I'm not thinking of something?
We could solve that I think by looking at the attribute type, like if it's a linear or angular attribute, and pick a curve type to match.
Maybe when you set an attribute that's a dict it could create and connect an AnimCurve:
That's not a bad idea! Looks like when you set a single value, except you're setting multiple. And maybe if you set a list..
mynode["tx"] = [0.0, 5.0, 0.0]
It would resort to using the index - i.e. 0, 1, 2 - as the time. Except oh, no. That wouldn't play nice with setting array values, like ["t"]
. But dictionaries are unused, so there's room for that.
An alternative I thought of, to make it a little less magical and readable to the non-cmdx'er would be..
mynode["tx"].animate({1: 0.0, 10: 5.0, 20: 0.0})
from cmdx.
With the animate
method lists could also be supported for setting by index:
mynode["tx"].animate([0.0, 5.0, 0.0])
I suppose if we really wanted to support list and dict animation via assignment we could do something like this:
mynode["tx"] = cmdx.Keys({1: 0.0, 10: 5.0, 20: 0.0})
# or
mynode["tx"] = cmdx.Keys([0.0, 5.0, 0.0])
Keys could accept other options like interpolation:
mynode["tx"] = cmdx.Keys({1: 0.0, 10: 5.0, 20: 0.0}, interpolation=cmdx.Linear)
Just an idea, I'm happy to start off the the animate method though.
from cmdx.
Related Issues (20)
- cmdx.listRelatives always returns None HOT 18
- Plugs not taking and returning UI units HOT 4
- DagNode.addChild crashes in certain circumstances HOT 6
- Modifiers and data types HOT 2
- design proposition for components HOT 10
- attributes' default value not saved in scene HOT 3
- Support for proxy attributes
- DGModifier.disconnect and Undo
- Attribute reuse and undo
- Multiple versions simultaneously
- How to debug Maya crashes? HOT 9
- Deploy on CI HOT 1
- Direct passing of cmdx.Node to vanilla cmds HOT 3
- Support keyframing of pairBlended attributes
- MObjectHandle hashCode... HOT 3
- Two users, one machine
- Thoughts on code formatter such as Black? HOT 5
- Set a nodes transform HOT 7
- Auto offset group
- Add type annotations HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cmdx.