Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import maya.cmds as cmds
- class BasicLimbRig(object):
- def __init__(self, side, name):
- self.side = side
- self.name = name
- def makeIk(self):
- cmds.ikHandle( n=self.side + "_" + self.name + "_" + "ik" )
- def twistLimb(self):
- """ here some code that will make a twist system based on splineIk """
- def makeFk(self):
- " here come code that creates an Fk "
- class CartoonFeatures(BasicLimbRig):
- """ now I am going to inherit the method makeIk of the superclass and extend it with some
- some code that will make it stretchy """
- def makeIkStretchy(self):
- self.makeIk()
- """ more code that will make it stretchy """
- """ now I will override the method of the superclass. The name of the method is the same, but
- the code inside y completly diferent"""
- def twistLimb():
- """ new code that will make a twist system bases on ribbon """
- #-----------------------------------------------------------------------------------------------#
- # realistic character
- armRig = BasicLimbRig('l','arm')
- armRig.makeIk()
- armRig.twistLimb()
- armRig.makeFk()
- # cartoon character
- cartoonArmRig = CartoonFeatures('l','arm')
- cartoonArmRig.makeIkStretchy()
- cartoonArmRig.twistLimb()
- cartoonArmRig.makeFk() # I am inheriting a method as it is, because the system is the same in
- # cartoon and realistic
- #-----------------------------------------------------------------------------------------------#
- """ here is why I think this is OOP:
- · 1 # I use inheritance of methods, I did method overriding ( that is polymorfisme right?) and I did
- method extension.
- · 2 # I passed to the class methods the instance variables, so I don´t have to declare the arguments
- side and name on each method
- """
Advertisement
Add Comment
Please, Sign In to add comment