Giter Club home page Giter Club logo

Comments (7)

mottosso avatar mottosso commented on July 20, 2024 1

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.

mottosso avatar mottosso commented on July 20, 2024

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.

monkeez avatar monkeez commented on July 20, 2024

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.

mottosso avatar mottosso commented on July 20, 2024

Sounds good to me, authoring animation via Python in Maya is a pain so anything cmdx can would be a plus.

from cmdx.

monkeez avatar monkeez commented on July 20, 2024

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.

mottosso avatar mottosso commented on July 20, 2024

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.

monkeez avatar monkeez commented on July 20, 2024

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​})
# ormynode​[​"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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.