Monday, February 10, 2014

Master the Master Function that Masters the Functions

Not too shabby

I managed to group the whole column and duplicate it. A lot of tweaking and, trial and error need to done. Also, I have to create a master function to call out the functions so that it can execute the script. Ahaha, I nearly confused with my script.

Occlusion It 
It looks nice despite a lot of flaws can be found in it. I really satisfied with this work.!

ON THE SIDE NOTE:
HUEHUEHUE

My Final Script As At 10 February:


import maya.cmds as mc
import math

def createFloor():
    myFloor = mc.polyCube( name = 'floor' )
    mc.scale( 5, 1, 10, myFloor[0] )
    mc.move( 0, 0.5, 0, myFloor[0] )
    mc.polyMoveVertex( 'floor.vtx[5]', tx=-1.0 )
    mc.polyMoveVertex( 'floor.vtx[7]', tx=-1.0 )
    mc.polyMoveVertex( 'floor.vtx[4]', tx=1.0 )
    mc.polyMoveVertex( 'floor.vtx[6]', tx=1.0 )
    return myFloor


def multiFloors (exCreateFloor):
    floorList = []
    n = 0
    nA = 0.2
    for each in range(3):
        myDup = mc.duplicate(exCreateFloor)
        print myDup
        mc.move( 0, n+5, 0, myDup[0] )
        n = n+5
        mc.polyMoveFacet( 'floor.f[2]', tz= 1+nA )
        floorList.append( myDup[0] )
    mc.delete('floor') 
    return floorList
   
def createWall():
    myWall = mc.polyCube( name = 'wall')
    mc.move ( 2, 10, -0.25, myWall[0] )
    mc.scale( 0.5, 20, 10.5, myWall[0] )
    mc.rotate( 0, '6deg', 0, r=True )
    mc.polyMoveVertex( 'wall.vtx[4:5]', tz=3.0 )
    return myWall
    
def mainWall():
    mc.polyCube( n = 'base', w = 5.5, h = 5 )
    mc.polyCube( n = 'cut', w = 3, h = 3 )
    mc.move( 0, -1, 0 )
    mc.polySphere( n = 'curve', sx=10, sy=15, r=2)
    mc.polyBoolOp( 'base', 'cut', op = 2, n = 'end1' )
    mc.polyBoolOp( 'end1', 'curve', op = 2, n = 'end2' )
    mc.move ( 0, 2.5, 5 , 'end2')
    return 'end2'
    
def multiwalls (exCreateWall):
    List = []
    myGrp = mc.group(exCreateWall)
    n = 0
    for each in range(3):
        myDup = mc.duplicate(myGrp)
        print myDup
        mc.move( 0, n+5, 0, myDup[0] )
        n = n+5
        List.append(myDup[0])
    return List
        
def FinalWalls():

    exCreateFloor = createFloor()
    multiFloors (exCreateFloor)
    exCreateWall = mainWall()
    multiwalls (exCreateWall)
    createWall()
    
def finalShape():
    FinalWalls()
    mc.group( 'floor1', 'floor2', 'floor3', 'group1', 'group2', 'group3', 'group4', 'wall', n = 'whee')
   
def makePattern (exFinalWalls):
    cubelist = []
    cubelist2 = []   
    nA = 0
    nB = 0
    n=6
    r=0
    h=0
    for each in range(251):
        
        myDup = mc.duplicate(exFinalWalls)
        mc.move( 0+n, 0, 0+nA, myDup[0], absolute=True )
        mc.rotate( 0, r*5,0, myDup[0], pivot=(0 ,0, 0) )
        n= n+4
        r= r+0.8
        nA = nA+0.5
        nB = nB+1.2
        cubelist.append( myDup[0] )
    return cubelist
    
def makePattern2 (exFinalWalls):
    cubelist = []
    cubelist2 = []   
    nA = 0
    nB = 0
    n=6
    r=0
    h=0
    for each in range(255):
        
        myDup = mc.duplicate(exFinalWalls)
        mc.move( 0+n, 0, -0+nA, myDup[0], absolute=True )
        mc.rotate( 0, r*5,0, myDup[0], pivot=(0 ,0, 0) )
        n= n-4
        r= r-0.8
        nA = nA-0.5
        nB = nB-1.2
        cubelist.append( myDup[0] )
    return cubelist

def master():
    finalShape()
    exFinalWalls = 'whee'
    makePattern (exFinalWalls)
    makePattern2 (exFinalWalls)
    mc.delete( 'base', 'cut', 'curve', 'end1', 'whee' )
    
master()





No comments:

Post a Comment