On Mon, 6 Jun 2016 5:18 AM Rudi Hammad <[email protected]> wrote:
>
> but a very obvious use case could be a modular rigging system, where you
> define components (limb, fkchains, some sort of curve based component and
> so on) and then put everything together by instantiating those components
> and assigning different states (the position of the arm is not the same as
> the leg, but both are instances of the Limb class, same with what they are
> connected to and stuff like that.... all that state belongs to the objects,
> but its features are shared between both arms and legs on a biped rig).
>
> But that is exactly how I was working on my modular rigging tool. Here is
> the link if you want to check it: https://vimeo.com/168109200
> I have a superclass that has numerical methods, that I inherit to use in
> another class that has methods related to joints...So that is why I am
> getting confues now, I think I am not explaining my self.
>
I get what you are saying. You have classes that collect functions with
similar applications I to "themes". And then you create new themes by
subclasses them into new collections of methods with similar application.
What I hear (and saw from your code examplea) that may be missing is the
idea of state. You pass in a couple options through your unit for some
methods to use. It is possible that those methods could be functions that
take arguments. The reason being, if none of of those methods set and new
data in your instance as state, then the internal state never changes. Thus
you end up with those saved options as just plain functions arguments.
Cheap example of what I mean :
class Pants(object):
def __init__():
# initial state
self._nFoo = 0
def foo(self):
# foo'd your pants
self._nFoo += 1
def fooTimes(self):
# how many times did you foo your pants?
return self._nFoo
So you can see here here that your class starts with some initial state in
the init. It may or may not accept arguments to make additional options to
the state. Them you call different methods that perform work and modify the
state of the instance. Now you can have multiple instances of your class
with different states, depending on how they are used.
You can also see see that an instance variable is not just something you
pass in to init. It is any member that is any member that gets store on the
instance at any time.
Justin
Anyway, thanks for the tips guys
>
> cheers
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/64ce1dd3-99ee-410a-a960-4ea230aa7586%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/64ce1dd3-99ee-410a-a960-4ea230aa7586%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2zGAMp1eV3-X-wWAyqV-aZD_k-GuqxHLAwRQkKqZExUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.