well, that's kind of a tricky question. creating the missing nodes
would be very difficult because we would have to essentially recreate
a maya ascii/binary scene loader: pickle all attribute values and
connections and attempt to recreate them if missing. IMHO this would
be too complex and error prone to be worth the time investment. our
other option, ignoring the missing nodes, is not very attractive
either because it breaks the promise of unpickling: you might
unpickle 10,000 nodes and end up with nothing. a warning for missing
nodes/attrs might be a good compromise, but unfortunately, there is no
argument that you can pass to pickle to tell it to ignore errors, so
this behavior would have to be hard-wired into pymel, meaning that
those who desire an error to signal that something has gone wrong
won't get one. what do you think should be the default behavior?
-chad
On Oct 27, 2009, at 1:36 AM, Sune wrote:
>
> Hi there,
>
> I have a small "issue" with pymel and pickle. If I pickle out say a
> list that contains some pymel objects, once I try to unpickle that
> file, Maya chokes if the pickled pymel nodes are not in the scene. Any
> suggestions?
>
> Here is an example:
>
> from pymel import *
> import pickle
>
> x = (ls('LeftUpLeg')[0], ls('LeftHandThumb3')[0])
> dataFile = 'c:/generic.jnt'
>
> # Dump the List out as a pickled file
> file = open(dataFile, 'w')
> pickle.dump(x, file)
> file.close()
>
> # Read in the jointDateList from the pickled file
> file = open(dataFile, 'r')
> x = pickle.load(file)
> file.close()
> >
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---