WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-21-2006, 06:28 PM
Vygreif Vygreif is offline
Member
 
Join Date: Sep 2005
Posts: 21
Pickling Nodes

Hi,
I'm trying to save nodes as pickled objects, and then loading them later. Does Vizard suppord the pickling of those objects fully?

I currently have this problem:
When the user clicks s, I save the object with the following code:
In this example I'm only saving one object.
if key == 's':
male = viz.add('male.cfg')
objects = viz._GlobalNodeList.values()
f = file("test.sv", "w")
temp = objects[0]
pickle.dump(temp,f,1)
f.close()
When he clicks l I load the code
if key == 'l':
f = file("test.sv", "r")
u = pickle.Unpickler(f)
x = u.load()
viz.add(x)
f.close()

However, when I try this I get the following error:
Traceback (most recent call last):
File "fileinputoutput.py", line 38, in mykeyboard
viz.add(x)
File "C:\Program Files\Vizard25\viz.py", line 4877, in add
s = what.split('.')
AttributeError: VizAvatar instance has no attribute 'split'

Thanks,
YG
Reply With Quote
  #2  
Old 02-22-2006, 09:54 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Vizard nodes do not support pickling operations. You will have to manually retrieve the data you want to save and reapply it when you load it. Also, you can't pass Vizard node objects to the add command.
Reply With Quote
  #3  
Old 02-22-2006, 05:41 PM
Vygreif Vygreif is offline
Member
 
Join Date: Sep 2005
Posts: 21
If I do
n = viz.add('ball.wrl')
viz.get(viz.WHAT)
Would return ball.wrl?
Reply With Quote
  #4  
Old 02-23-2006, 10:03 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Are you asking how to get the filename of an object? That functionality does not exist in Vizard.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:17 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC