Thank you for the explanation Justin.
now i understand it.
thanks
Ricardo
On 07/24/2012 03:37 PM, Justin Israel wrote:
Glad it fixed your problem.
Yes I forgot one small correction when I suggested the callback
change. It is still preferable and supported to give the actual
callable function object instead of a string. The reason is that they
dont have to be global scope functions. They will get bound as objects.
What you do need to do is modify your signatures to expect arguments.
Maya will send a value when it runs your callback usually indicating
the state of the UI object. For buttons its always False.
def getFloor(*args):
def freeze(*args):
*args just means "any number of params". Now maya can pass its value
and your functions will receive them. You can simply not do anything
with args.
On Jul 24, 2012, at 3:37 AM, Ricardo Viana <[email protected]
<mailto:[email protected]>> wrote:
Thanks Justin, getting rid of the select, operate, deselect alone
resolved it.
Just a noob question:
what you mean by using the callable object? doesn't the command
accepts only strings? if i remove the "" and the ()
i get an error stating i ve sent an argument but getFloor() takes no
arguments.
thanks
Ricardo Viana
On 07/23/2012 10:04 PM, Justin Israel wrote:
Is it the "rigid()" function that is crashing Maya? I suppose you
could try adding a sleep to see if it at least prevents the crash,
and go from there.
import time
time.sleep(0.1) # 1/10 of a second
That aside, there are some things you can probably do to make it
more efficient. Some of the commands take a list of objects, so that
you don't have to loop over each one and call it individually:
# operate on the whole selection instead of doing a
# for x in y: select, operate, deselect
cmds.connectDynamic(selection, f='gravityField1')
cmds.rigidBody(selecton, active=True,iv=[0.0,-10.0,0])
cmds.rigidBody(floorSel , active=False,passive=True)
Also, you can make your callback connections a bit more tightly
bound by using the callable object:
floorBut=cmds.button(label="Load Floor",c=getFloor)
freezeBut=cmds.button(label="Freeze transforms",c=freeze)
Hope that helps.
On Mon, Jul 23, 2012 at 1:00 PM, Ricardo Viana <[email protected]
<mailto:[email protected]>> wrote:
Hi all. i ve been assigned a task where i need to simulate a
large number of
rigid bodies. i developed a script to aid me in the process but
the thing is
that it works ok with few objects, but when gets to more than
200 objects
it immediately crashes maya. Sorry for my newbieness but is
there a way
i can make the for loop process to slow down so that it slowly
creates rbd
one at a time, maybe that can work. i have the script here
http://pastebin.com/5gDiG9y6 if you
want to have a look.
cheers
Ricardo Viana
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe