El lunes, 6 de junio de 2016, 15:46:10 (UTC+2), Marcus Ottosson escribió:
>
> > Nope, a class method take the class as first argument and is supposed to 
> return an instance of said class
>
> Just so we don't confuse Rudi, a @classmethod is like a regular method, 
> except that it doesn't have access to its instance.
>

I just read what I wrote before :

*"avoid creating having to create the object" .....*avoid create having to 
create...oh my god, what does that even mean!!

what I meant was that the advantage of classmethod is that you don´t have 
to create the object, meaning that you can call it directly from the class. 
Sorry about that.

Going back to general OOP with an example cesar said, i know it looks I am 
reapting myself but bear with me for one second
 What about a class Limb() that has methods to creates armJoints(self), 
legJoints(self), spines.They have all in common being limbs right?
 Then I have a subclass MakeIkLimb(Limb)  that has methods create 
simpleIk(self), or a reversefootIk(self), etc.... and then another subclass 
called CartoonFeatures(MakeIkLimb)  that will take those existing iks and 
perform more operations like makeStretchyIk(self) etc..

Then way I would use that is:
 · If I am rigging a realistic character, I don´t want any cartoon features 
so I would create the object >> realLimb = MakeIkLimb(); and then doing 
something like realLimb.simpleIk() I would create the ik sistem
 · If I am rigging a cartoon character, I would create the object >> 
cartoonLimb = CartoonFeatures(); cartoonLimb.makeStretchy()

To sum up, I going from generic to specific.If I want realistic I go for 
the class that creates just an ik sistem. If I want cartoon I go for the 
class that requieres the ik from her superclass, and operates one it. I 
mean, I can´t make a stretchyIk if I don´t have an ik
In my previous codes, I had makeStretchyIk as an argument of the makeIk() 
method. But separating them in classes makes it cleaner because if I 
discover a new way of makeStretchyIk, I don´t have to mess with makeIk(), 
so that is safe no matter what.

Is that better? or am I still going over and over again about the same 
thing I didn´t understand before

ps: I just bought on cgcircuit intro to pymel to see If I get a better 
understanding of OOP



-- 
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/42005abc-18d3-4f20-b375-7bf678327d7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to