Lecture Notes 24/10/22
class Sandwich:
def __init__(swich, filling, rating):
swich.filling = filling
swich.rating = rating
def __str__(swich): #REMEMBER YOUR INDENTATION! PYTHON IS ANAL ABOUT THIS
return f"{swich.filling}({swich.rating})" #THE f IS IMPORTANT, CAN'T JUST USE WHATEVER HERE
def myfunc(swich):
print("Today's lunch is: " + swich.filling)
print("Its rating is: ",swich.rating) #REMEMBER, YOU CAN'T USE + ON A NONE STRING VALUE. GOTTA USE A ,
p1 = Sandwich("Tuna", 4)
p1.rating = 2.4
p1.myfunc()
MAYA CODE v
import maya.cmds
class CubeCreator:
def __init__ (self,Width, Height, Depth):
self.Width = Width
self.Height = Height
self.Depth = Depth
def myCube_Spawn(self,Width,Height,Depth):
cmds.polyCube(w = Width,h = Height,d = Depth)
cube_1 = CubeCreator(10,20,30)
cube_2 = CubeCreator(30,20,10)
cube_3 = CubeCreator(10,10,10)
cube_4 = CubeCreator(20,5,50)
cube_3.myCube_Spawn(cube_3.Width,cube_3.Height,cube_3.Depth)
MAYA (THIS IS THE ANIMATION CODE, BUT IT DOESN'T WORK ATM. FIGURE THIS SHIT OUT)
NEVER MIND, SORTED IT
import maya.cmds
class CubeCreator:
def __init__ (self,Width, Height, Depth):
self.Width = Width
self.Height = Height
self.Depth = Depth
def myCube_Spawn(self,Width,Height,Depth):
cmds.polyCube(w = Width,h = Height,d = Depth)
def Create_Animation(self, Animation_Range):
cube = cmds.polyCube(w = self.Width, h = self.Height,d = self.Depth)
for i in range(Animation_Range):
cmds.currentTime( (i+1)*10, edit=True )
cmds.setKeyframe(cube,v=i, at="translateX")
cube_1 = CubeCreator(10,20,30)
cube_2 = CubeCreator(30,20,10)
cube_3 = CubeCreator(10,10,10)
cube_4 = CubeCreator(20,5,50)
cube_1.Create_Animation(10)
cube_1.myCube_Spawn(cube_2.Width,cube_4.Height,cube_3.Depth)
Programming for Animation
Status | Released |
Category | Other |
Author | Ionasphero |
More posts
- Lecture Notes 28/11/22Dec 15, 2022
- Lecture Notes 28/11/22 Missing CodeDec 15, 2022
- Lecture Notes 07.11.22Dec 15, 2022
- Pre-Quiz Revision NotesDec 15, 2022
- Final Post before SubmissionDec 15, 2022
- Lecture notes 10/10/22Oct 10, 2022
- Lecture notes 03/10/22Oct 10, 2022
Leave a comment
Log in with itch.io to leave a comment.