RandomizeR

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  07 July 2013
RandomizeR

hey guys this is my new script:




i have problem with understanding for how to use check boxes in maya.

i'm gonna make 3 check boxes for X,Y,Z

if anyone can do this please put an example by python.it works good right now but i like 2 change the method of acting of this script.

you can watch the full size at: https://imageshack.us/a/img546/2608/czh7.jpg
__________________
welcome to the world of imagination
 
  07 July 2013
Here is a simple example :

def TranferAnim(*args)
       testAxis1 = cmds.checkBoxGrp(AxisChoiceT, q=True, v1=True)#Query value from UI 
       testAxis2 = cmds.checkBoxGrp(AxisChoiceT, q=True, v2=True)
       testAxis3 = cmds.checkBoxGrp(AxisChoiceT, q=True, v3=True)
       print(testAxis3 + " " + testAxis2   + " " + testAxis1) 
   
   
   if cmds.window("TransfAnim", exists = True):
       cmds.deleteUI("TransfAnim")
               
   window = cmds.window("TransfAnim")
   cmds.columnLayout()
   
   AxisChoiceT = cmds.checkBoxGrp( numberOfCheckBoxes=3, label='Translate', labelArray3=['tX', 'tY', 'tZ'], v1=1,v2=1,v3=1 )
   ExecuteButton = cmds.button(label='Copy Animation !', c=TranferAnim)
   
   cmds.showWindow( window )


I hope it help
cheers
__________________
DrWeeny
My Blog
My Vimeo
LinkedIn
 
  07 July 2013
thank you. but each of my directions are def, how could i call defs for my each check box?
__________________
welcome to the world of imagination
 
  07 July 2013
import maya.cmds as cm
import sys

myList = cm.ls (sl = True)

class MovingObjects:
    def act(*arg):
    	myList = cm.ls (sl = True)
    	sys.stdout.write('%s\n'%myList)
        for objects in myList:
            cm.move(0,0.01,0 ,r = True)
            
M = MovingObjects()


cm.headsUpMessage('First: "please select objects"', verticalOffset=250)


cm.window(t = 'X-transform' , h = 150 , w = 150 , s = False)
cm.columnLayout( columnAttach=('both', 2), rowSpacing=2, columnWidth=170 )

cm.button(l = 'Act' , c = M.act , w = 150 , h = 50 , bgc = (0,0.7,0.7) )


cm.text( label='Script by : Amin khormaei', align='center' )


cm.showWindow()


this is an example:
i made a mistake i need three radio butttons for X,Y,Z
this act button make a translation in directionY. i need this button to getAttr from radio buttons for direction and do move, and for that randomizer i need this method.

i hope that you get my meaning.

best regards.
__________________
welcome to the world of imagination
 
  07 July 2013
I'm not sure to understand.

You need one command "Move" and define with UI if it go X, Y, Z ? (not three command "moveX", "moveY", "moveZ")

---EDIT---

I'm looking at your code sample and try something.
__________________
DrWeeny
My Blog
My Vimeo
LinkedIn

Last edited by DrWeeny : 07 July 2013 at 09:05 AM.
 
  07 July 2013
Is it something like this :

import maya.cmds as cm
import sys

myList = cm.ls (sl = True)

class MovingObjects:
	
	def __init__(self):
		self.ChosenDir = ["","",""]
		self.UIElements = {}	   
			

	def ClassUI(self, *arg):
		
		def act(*arg):
			myList = cm.ls (sl = True)
			sys.stdout.write('%s\n'%myList)
			for objects in myList:
				for i in self.ChosenDir:
					if i != "":
						myPosition = cm.getAttr(objects + i)
						myPosition += 1
						cm.setAttr(objects + i, myPosition)
		
		def getAxis(*arg):
			
			if cm.checkBoxGrp(self.UIElements["AxisChoice"], q=True, v1=True) == True:
				self.ChosenDir[0] = ".tx"
			else:
				self.ChosenDir[0] = ""
			
			if cm.checkBoxGrp(self.UIElements["AxisChoice"], q=True, v2=True) == True:
				self.ChosenDir[1] = ".ty"
			else:
				self.ChosenDir[1] = ""
				
			if cm.checkBoxGrp(self.UIElements["AxisChoice"], q=True, v3=True) == True:
				self.ChosenDir[2] = ".tz"
			else:
				self.ChosenDir[2] = ""

		
		cm.headsUpMessage('First: "please select objects"', verticalOffset=250)
		
		
		cm.window(t = 'X-transform' , h = 150 , w = 500 , s = False)
		
		cm.columnLayout( columnAttach=('both', 2), rowSpacing=2, columnWidth=500 )
		
		self.UIElements["AxisChoice"] = cm.checkBoxGrp( numberOfCheckBoxes=3, label='Translate', labelArray3=['tX', 'tY', 'tZ'], v1=0,v2=0,v3=0, cc=getAxis)
		
		self.UIElements["ExecuteButton"] = cm.button(l = 'Act' , c = act , w = 150 , h = 50 , bgc = (0,0.7,0.7) )
		
		
		cm.text( label='Script by : Amin khormaei', align='center' )
		
		
		cm.showWindow()
		
M = MovingObjects()
M.ClassUI()
__________________
DrWeeny
My Blog
My Vimeo
LinkedIn
 
  07 July 2013
Originally Posted by DrWeeny: Here is a simple example :

def TranferAnim(*args)
       testAxis1 = cmds.checkBoxGrp(AxisChoiceT, q=True, v1=True)#Query value from UI 
       testAxis2 = cmds.checkBoxGrp(AxisChoiceT, q=True, v2=True)
       testAxis3 = cmds.checkBoxGrp(AxisChoiceT, q=True, v3=True)
       print(testAxis3 + " " + testAxis2   + " " + testAxis1) 
   
   
   if cmds.window("TransfAnim", exists = True):
       cmds.deleteUI("TransfAnim")
               
   window = cmds.window("TransfAnim")
   cmds.columnLayout()
   
   AxisChoiceT = cmds.checkBoxGrp( numberOfCheckBoxes=3, label='Translate', labelArray3=['tX', 'tY', 'tZ'], v1=1,v2=1,v3=1 )
   ExecuteButton = cmds.button(label='Copy Animation !', c=TranferAnim)
   
   cmds.showWindow( window )


I hope it help
cheers


what does this line of code do: print(testAxis3 + " " + testAxis2 + " " + testAxis1)
__________________
welcome to the world of imagination
 
  07 July 2013
It was just a old line of code in order to print values.
I think it was one of my first script so I was checking code =)
__________________
DrWeeny
My Blog
My Vimeo
LinkedIn
 
  07 July 2013
Mr DR could i discuss with you in realtime? , i meant chat
__________________
welcome to the world of imagination
 
  07 July 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 03:53 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.