pymel question (setting attrs)

Become a member of the CGSociety

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

Thread Tools Search this Thread Display Modes
  05 May 2013
pymel question (setting attrs)

I'm hoping someone can answer this for me...

cacheNode = "body_geo_cacheCache1"

Does not work, but the following does:

cacheNode = "body_geo_cacheCache1"
setAttr(cacheNode + ".hold", 540)

I thought they were supposed to do the same thing?
  05 May 2013
Your cacheNode variable just holds a string at this point so pymel doesn't know what to do with it (apart from string operations).

Try this instead:
cacheNode = pm.PyNode("body_geo_cacheCache1")
  05 May 2013
In your first example you made cacheNode as a string. But a string has no "set" method. What you should have done is make cacheNode an instance of the cacheFile class using the PyNode function.

import pymel.core as pm
cacheNode = pm.PyNode('body_geo_cacheCache1')

  05 May 2013
your trying ot use object methods on a string, you need to get the node object first into a var
  05 May 2013
Aha. Gotcha. Still getting my head around objects (as opposed to nearly everything being a string in mel

Thanks for your help guys.
  05 May 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
Society of Digital Artists

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

All times are GMT. The time now is 08:47 AM.

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