Some code to illustrate:
http://pastebin.com/m14dfb5ea
import maya.cmds as cmds
# Create a scene we will save
cmds.file(f=1, new=1)
node = cmds.createNode("transform", name='testNode')
# Add a NON-STORABLE attribute, and set it to a non-default
cmds.addAttr(node, longName='notStorable', storable=False,
defaultValue=0)
cmds.setAttr(node + '.notStorable', 3)
# Save our scene
cmds.file( rename='storableTest_referenced.ma' )
cmds.file( force=True, save=True, type='mayaAscii')
# Now, make a new scene
cmds.file(f=1, new=1)
# Reference in our old scene
cmds.file( 'storableTest_referenced.ma', r=True )
# Check that the non-storable attribute was, in fact, not stored
refNode = cmds.ls("*testNode")[0]
print "Stored Value:", cmds.getAttr(refNode + '.notStorable')
# Set it to a non-default
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 "Stored Value:", cmds.getAttr(refNode + '.notStorable')
On Mar 23, 12:36 pm, barnabas79 <[email protected]> wrote:
> Heh... ah, I see. My mistake...
>
> However, I originally started looking into this because I had a
> problem with a referenced file - and it seems that there may still be
> a bug there.
>
> Ie, if you make a non-storable attribute in a file, save it, then
> reference in that file in another scene, and alter that non-storable
> attribute, the altered value IS saved (as a reference edit).
>
> - Paul
>
> On Mar 21, 6:07 am, Dean Edmonds <[email protected]> wrote:
>
> > On Fri, Mar 20, 2009 at 17:23, barnabas79 <[email protected]> wrote:
>
> > > 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
> > [...]
> > > # Now, re-open that scene we just saved
> > > cmds.file('storableTest.ma', force=True, open=True)
>
> > > # Check that the non-storable attribute was, in fact, not stored
> > > print "Stored:", cmds.attributeQuery('notStorable', node = node,
> > > exists=1)
>
> > You misunderstand the meaning of 'non-storable'. It means that the
> > *value* of the attribute will not be stored in the file. The attribute
> > itself will always be stored unless you remove it from the node.
>
> > --
> > -deane
>
>
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---