Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
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