This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import the pymel module | |
| from pymel.core import * | |
| #grab our box shape node from maya | |
| myBox = PyNode('pCubeShape1') | |
| #create a "for each loop" to iterate over | |
| #the vertices in the mesh. | |
| for currentVertex in myBox.verts: | |
| #print the position |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import the pymel module | |
| from pymel.core import * | |
| #grab our box node from maya | |
| myBox = PyNode('pCube1') | |
| #lets check the x pos of our box | |
| #using a conditional statement | |
| #conditional syntax is | |
| #if (variable to check) (condition to check) (:) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pymel.core import * | |
| import pymel.core.datatypes as dt | |
| #create a function to find nearest neighbour | |
| #start by getting the particles | |
| particles = PyNode('particleShape1') | |
| #loop through points in the particle system | |
| for p in particles.points: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //The following deforms the mesh using the red channel | |
| //and scales the deformation by 0.2 - this means pure | |
| //red vertices will move normal to the mesh 0.2 units and | |
| //vertices with no red colour will move 0 units (stay put) | |
| x = x+(nx*(r/255))*0.2 | |
| y = y+(ny*(r/255))*0.2 | |
| z = z+(nz*(r/255))*0.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #some different data types in python | |
| #remember, we use variables as a way of making our code make sense to us | |
| #variables point to data in our program | |
| #in python we don't need to specify data types for variables | |
| #python figures this out itself | |
| myFirstName = "Gwyll" | |
| myLastName = "Jahn" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Use colours from one mesh to modify another | |
| from pymel.core import * | |
| #get the objects | |
| geomColoured = PyNode('pCubeShape1') | |
| geomMod = PyNode('pCubeShape2') | |
| #store the colour array | |
| colours = geomColoured.getColors() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Connect camera xpos to xscale of a new cube | |
| from pymel.core import * | |
| cam = general.PyNode('persp') | |
| c = polyCube(name='testCube')[0] | |
| cam.tx >> c.sx # connect | |
| print cam.tx.outputs() #test | |
| #Connect outmesh of one geom to inmesh of another |