[Maya-Python Club:1123] Manipulator bug

2008-09-23 Thread barnabas79
Here's some oddness - try executing the following set of commands: === def delayedError(): import maya.OpenMaya as api import maya.cmds as cmds dagMod = api.MDagModifier() manip = dagMod.createNode("textButtonManip") dagMod.doIt() mfnDag =

[Maya-Python Club:1142] Make a message attribute without a warning

2008-09-30 Thread barnabas79
Hey all - I was wondering if there was a way to add a dynamic message attribute without receiving a warning - ie, if I do: import maya.cmds as cmds cmds.addAttr(longName="msgAttr", attributeType="message") ... I receive: // Warning: file: C:/3D/Maya2008/scripts/AETemplates/ AEreplaceCompound.me

[Maya-Python Club:1143] Re: Make a message attribute without a warning

2008-09-30 Thread barnabas79
me=attr, attributeType="message", *args, **kwargs) ... will avoid the warning. But it seems like such a potentially messy solution, I think I'd rather just change my script to not use compound attributes (they're not as useful as I'd hoped, anyway), and hope the

[Maya-Python Club:1145] maya/2008/scripts not added to sys.path correctly (in Windows)

2008-10-01 Thread barnabas79
Out of curiosity, anyone know if the bug of .../maya/2008/scripts not being added to the sys.path correctly is fixed in 2009? For whatever reason, folks often have trouble with directions like "don't add it to .../maya/2008/scripts, add it to .../maya/scripts instead"... (If you have no idea wha

[Maya-Python Club:1182] doctest in maya gui

2008-10-08 Thread barnabas79
Hey - I was wondering if anyone has gotten doctest to work successfully from inside the script editor of a full-gui running maya. That is, doctest works fine if maya is started from within python via maya.standalone.initialize(), but if I run a doctest from the script editor, it never sees ANY ou

[Maya-Python Club:1194] Workaround for node deletion callback

2008-10-10 Thread barnabas79
Hey all - I just ran into this fun error: swig/python detected a memory leak of type 'MCallbackId *', no destructor found. After a quick search, I see that it was mentioned back in January by Farsheed, and a few others since then, so I assume it's a known bug... so I won't go into the details.

[Maya-Python Club:1218] scriptJob crash with parent and runOnce

2008-10-17 Thread barnabas79
Just a FYI for anyone else out there - creating a scriptJob with the runOnce flag and the parent flag set to a piece of ui, whose script deletes that same piece of ui, will cause a crash. If you're unconditionally deleting the ui whenever the scriptJob is triggered, the easy workaround is simply

[Maya-Python Club:1220] Re: doctest in maya gui

2008-10-17 Thread barnabas79
Update - ok, so went to implement chad's solution, and was a bit surprised to find that it didn't work. Turns out what's going on here is the differing ways standard python interpreters and maya's interpreter handle echoing of output. After some digging, I found that this behavior is controlled

[Maya-Python Club:1230] addNodeDirtyPlugCallback bug in 2008 - fixed in 2009

2008-10-22 Thread barnabas79
For the curious: it would seem there's a bug with api.MNodeMessage.addNodeDirtyPlugCallback in python in maya 2008 - thankfully, it appears to have been fixed in 2009! Huzzah! Anyway, this code seems to fail with maya 2008, and succeeds in 2009... - Paul http://pastebin.com/f4332cc67 # test

[Maya-Python Club:1794] Re: MDGContext in python and another question

2009-02-23 Thread barnabas79
Example usage of MDGContext: import maya.OpenMaya as om atTime10 = om.MDGContext(om.MTime(10)) import maya.OpenMaya as om atTime10 = om.MDGContext(om.MTime(10)) selList = om.MSelectionList() selList.add("pCube1.translateX") plug = om.MPlug() selList.getPlug(0, plug) print "Value now: ", plug.asD

[Maya-Python] Undocumented API methods

2009-03-19 Thread barnabas79
Hi all - so, I ran across an undocumented method of MFnMesh, getUvShellsIds, which is used in /docs/Maya2009/en_US/API/flip_u_v_cmd_8cpp-example.html Might anyone know if undocumented function such as this are undocumented for a reason - ie, they might be changed soon, they're untested, etc

[Maya-Python] Dynamic attributes marked as NOT storable are saved

2009-03-20 Thread barnabas79
Just made a bug report to autodesk, but since that's not viewable to the general public, posting here too: Dynamic attributes created with addAttr that have the storable flag set to false are still written out to the file - see: http://pastebin.com/f3b83af36 import maya.cmds as cmds # Create a

[Maya-Python] Detect when changes are caused by an undo

2009-03-21 Thread barnabas79
Hi all - so, I'm wondering if there's a way to detect when changes to an attribute are caused by an undo / redo. Ie, I have a script that that, whenever a certain attribute is changed, automatically makes some other changes to the scene as well. In other words, the flow looks like: state1 --(att

[Maya-Python] redo past an undone autoKeyframe

2009-03-23 Thread barnabas79
Hey folks - was wondering if anyone else out there can confirm something for me: it looks like having autoKeyframe on messes up the undo queue. Specifically, I can't seem to redo past something that would set an autoKeyframe. To reproduce: 1. Make a cube (or any object, really) 2. Set a keyfram

[Maya-Python] Re: Dynamic attributes marked as NOT storable are saved

2009-03-23 Thread barnabas79
that non-storable attribute, the altered value IS saved (as a reference edit). - Paul On Mar 21, 6:07 am, Dean Edmonds wrote: > On Fri, Mar 20, 2009 at 17:23, barnabas79 wrote: > > > Dynamic attributes created with addAttr that have the storable flag > > set to false are st

[Maya-Python] Re: Dynamic attributes marked as NOT storable are saved

2009-03-23 Thread barnabas79
efault cmds.setAttr(refNode + '.notStorable', 3) # Save our referencing scene, reopen it, and check cmds.file( rename='storableTest_referencing.ma' ) cmds.file( force=True, save=True, type='mayaAscii') cmds.file( 'storableTest_referencing.ma', o=True ) print &q

[Maya-Python] ctypes in Maya

2009-04-05 Thread barnabas79
Hi all - so, I can't use ctypes within maya. If I try, I get this: import ctypes # Error: No module named _ctypes # Traceback (most recent call last): # File "", line 1, in # File "...\Autodesk\Maya2009\bin\python25.zip\ctypes\__init__.py", line 10, in # # ImportError: No module named _cty

[Maya-Python] Re: ctypes in Maya

2009-04-05 Thread barnabas79
Ok, after doing some poking around, looks like the problem is on python's end: on my regular windows x64 python install, I can't import ctypes, whereas on my 32-bit python, I can. So, I guess there's not just no ctypes in windows 64-bit maya... - Paul On Apr 5, 9:21 am, barnabas

[Maya-Python] Mystery components

2009-04-09 Thread barnabas79
Howdy pythoners... So, I guess this isn't exactly python-specific, but I was wondering if someone on here could help me: Basically, I'm trying to create instances of the various component types for testing with pymel, but can't find out how to create the following (or what they are, really): 'k

[Maya-Python] component plugs

2009-04-11 Thread barnabas79
Hi - does anyone know how to find out the what the available 'component' plugs are on a given node? Ie: pCube1.vtx[3] '.vtx' is not an attribute, but instead, a way to reference / access the mesh vertex components. listAttr will not return 'vtx', nor will MFnComponent.attribute(x) Anybody know

[Maya-Python] setting one of the shape attributes using setAttr

2009-05-13 Thread barnabas79
Hey - I was wondering if anyone here has tried to set a 'nurbsCurve' attribute using setAttr (or, really, any of the shape attribute types - I assume the syntax will be similar between them). Ie, the docs have this example for mel: createNode nurbsCurve -n "myNurbsCurveShape"; setAttr myNurbsCur

[Maya-Python] crash when selecting edges of a newly made subd

2009-06-03 Thread barnabas79
Just a FYI: # Note - the following commands must be executed all at once in order to cause a # crash. If you execute each command one at a time, no crash will occur. import maya.cmds as cmds polyCube = cmds.polyCube()[0] subd = cmds.polyToSubdiv(polyCube)[0] select(subd + '.sme[*][*]') --~--~--

[Maya-Python] Making an empty kSurfaceFaceComponent MObject

2009-06-06 Thread barnabas79
Hey - I was wondering if anyone here knew of a way to make an EMPTY kSurfaceFaceComponent MObject? Normally, I would use MFnDoubleInexedComponent.create - but there seems to be a bug - it's not compatible with kSurfaceFaceComponent: import maya.OpenMaya as api dubComp = api.MFnDoubleIndexedComp

python_inside_maya@googlegroups.com

2009-06-08 Thread barnabas79
Hey there - anyone know how to make a MUint64 & in python for maya? Basically, I want to do: api.MFnSubdNames.fromSelectionIndices(myInt64, 256, 0) ...but have no idea how to make 'myInt64'. The old standby MScriptUtil doesn't have support for MInt64... - Paul --~--~-~--~~

[Maya-Python] CGCON

2009-07-03 Thread barnabas79
Out of curiosity, anyone here attending CGCON in LA? http://www.cgcon.net/ - Paul --~--~-~--~~~---~--~~ http://groups.google.com/group/python_inside_maya -~--~~~~--~~--~--~---

[Maya-Python] Re: sys.argv[0] not returning correct value in Maya

2009-09-24 Thread barnabas79
Check out a post here: http://groups.google.com/group/python_inside_maya/browse_thread/thread/5ada870a705dfecf/fdf976179cf2a0c9?lnk=gst&q=__file__#fdf976179cf2a0c9 ...for different ways to find out where a module lives. - Paul On Sep 24, 5:48 pm, seth.gibs...@gmail.com wrote: > Could __path__

[Maya-Python] MDagPathArray iterator doesn't terminate

2009-10-01 Thread barnabas79
The subject says it all... import maya.OpenMaya as om sel = om.MSelectionList() sel.append('persp') sel.add('persp') dag = om.MDagPath() comp = om.MObject() sel.getDagPath(0, dag, comp) dagArray = om.MDagPathArray() dagArray.append(dag) dagArray.append(dag) numElements = 0 for dag in dagArray: