Just for my own understanding, could you explain why python is not an option 
for your problem when you are calling out from it to mel commands?
What specifically requires that you do a mel.eval() from a python environment? 
I must be missing something :-)

If "one liner" keyframe range setting is what you needed, here are some 
interesting python one-liners:

Value is the same: (this is a 'duh' I'm sure, but just starting with it)
cmds.setKeyframe("polySphere2.sa", t=(1,5), v=18)

otherwise...

list comprehension:
_ = [cmds.setKeyframe("polySphere2.sa", t=k, v=v) for k,v in ktv = [(1,18), 
(5,18)]]

mapping:
_ = map(lambda x: cmds.setKeyframe("polySphere2.sa", t=x[0], v=x[1]), ktv = 
[(1,18), (5,18)])


-- justin



On Dec 24, 2011, at 4:49 PM, Sebastian Schoellhammer wrote:

> Hmpf, that is a bummer. 
> So the reason why I don't get an error when I execute in a mel console is 
> that it 'silently fails'?
> 
> Bah and I thought I found a neat shortcut for my custom presets. I'm making 
> something that let's you store animation/expressions  as well and so needs to 
> create/change nodes. Those commands would have been a simple and general 
> solution if it weren't for that problem :/
> 
> merry christmas! :)
> 
> On Fri, Dec 23, 2011 at 9:11 PM, Nicolas Combecave <[email protected]> 
> wrote:
> You seem to want to set your keyframes all in one pass directly on the 
> animCurve, which seem to only be possible during file opening, di-uring io 
> operations.
> http://forums.cgsociety.org/archive/index.php/t-898721.html
> 
> 
> 2011/12/23 Sebastian Schoellhammer <[email protected]>
> No, sadly the only thing I get is "syntax error" and yes in this case 
> mel.eval would be by far the most convenient way.
> 
> 
> 
> On Fri, Dec 23, 2011 at 1:52 PM, Justin Israel <[email protected]> wrote:
> Are you able to post the specific error? Did it give you any more information 
> that what you provided?
> Also, is there any reason you cant do it from python?
> 
> On Dec 22, 2011, at 2:17 PM, Sebastian Schoellhammer wrote:
> 
>> Hello,
>> 
>> I have a weird problem with mel.eval
>> 
>> import maya.mel as mel
>> mel.eval('setAttr -s 2 "polySphere2_subdivisionsAxis.ktv[0:1]" 1 18 5 18;')
>> mel.eval('setAttr "polySphere2_subdivisionsAxis.i" 5;')
>> 
>> The first one is giving me a syntax error, the second works fine.
>> Both work when I copy the exact string into a mel console. 
>> Is there some funky character conversion going on? 
>> 
>> Hum, any hints are greatly appreciated!
>> 
>> Thanks,
>> Seb
>> 
>> 
>> 
>> -- 
>> 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
> 
> 
> 
> -- 
> Sebastian Schoellhammer
> 
> Sr. Technical Artist
> Square Enix LTD
> www.square-enix.com
> 
> 
> 
> -- 
> 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
> 
> 
> 
> -- 
> Sebastian Schoellhammer
> 
> Sr. Technical Artist
> Square Enix LTD
> www.square-enix.com
> 
> 
> -- 
> 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

Reply via email to