Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

IM GOING TO FAIL MY DEGREE PLEASE HELP !


  • Please log in to reply

#1
Thomas Club-pr Godfrey

Thomas Club-pr Godfrey

    New Member

  • Member
  • Pip
  • 1 posts
hey id really appreciate someones help.. my python code is not running correctly. and i cant fix the errors. i suck at code so would love someone to help me :)


i have shown the code below

import maya.cmds as cmds

# Question 1
# Function to print all transform nodes

def objList():
myListofStuff = cmds.ls(tr=1)
for i in myListofStuff:
print "Node Name." + i

print"Transform Node Total = ", len(myListofStuff)

# Question 2
# function to toggle visibility of chosen object.

def toggleVisibility(objName):
a = cmds.getAttr(objName+".visibility")
if (a==0):
cmds.setAttr(objName+".visibility",1)
if (a==1):
cmds.setAttr(objName+".visibility",0)

# Question 3
# function to display a window to list all chosen objects also cameras and lights in a scene while giving you the option to toggle the visibility


def window():
a=-1
if cmds.window("Grid", ex=True):
cmds.deleteUI("Grid")

cmds.window("Grid",w=350, h=320,t="My Window")
cmds.rowColumnLayout(numberOfColumns=4, columnWidth=([1,135],[2,80],[3,80],[4,80]) )
cmds.radioCollection()

objectType = cmds.ls(s=True)
objName = cmds.ls(tr=True)

for i in objectType:
a=a+1
cmds.button(l=i,c="cmds.select('"+i+"')")
cmds.text(l=cmds.objectType(i))
cmds.radioButton(l="reveal ",onc="cmds.setAttr('"+i+".v',1)")
cmds.radioButton(l="Hide ",onc="cmds.setAttr('"+i+".v',0)")


cmds.showWindow()

window()
  • 0

Advertisements







Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP