WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 10-30-2013, 07:24 AM
sleiN13 sleiN13 is offline
Member
 
Join Date: Dec 2008
Posts: 83
Random RuntimeError

I don't know when but probably while removing an Avatar from the world I get a RuntimeError.

Code:
Traceback (most recent call last):
  File "C:\Program Files (x86)\WorldViz\Vizard4\python\viz.py", line 2581, in _RemoveObject
    obj.__class__._OnRemoveObject(obj)
  File "C:\Program Files (x86)\WorldViz\Vizard4\python\viz.py", line 5750, in _OnRemoveObject
    VizBone._RemoveAvatarBones(obj)
  File "C:\Program Files (x86)\WorldViz\Vizard4\python\viz.py", line 5968, in _RemoveAvatarBones
    bones = [ id for id in cls._VizObjectCache.iterkeys() if begin <= id < end ]
RuntimeError: dictionary changed size during iteration
It seems the _VizObjectCache is changed during the remove operation, I'm loading avatars using the "viztask.schedule" and "yield viztask.waitDirector" because loading the avatar and initializing my code around it would take to long causing jutters in the framerate.

Could this be the cause? and how could i solve it?
Reply With Quote
  #2  
Old 10-31-2013, 12:27 AM
JvdBosch JvdBosch is offline
Member
 
Join Date: Sep 2006
Posts: 36
You could try preloading all models. For another project with a lot of avatars, I just preload one and clone() that one when I need a new one. That is instant.

Using the director is tricky...
Reply With Quote
  #3  
Old 10-31-2013, 07:22 AM
sleiN13 sleiN13 is offline
Member
 
Join Date: Dec 2008
Posts: 83
I'm already preloading the avatars, but I still need to initialize the code around the avatar, this involves creating some additional helper object on the avatar together with some other time consuming code. In all it takes between 5 to 7 ms to construct an avatar making loading even 1 avatar per frame noticeable. Using the director method it take 70 ms but the framerate is influenced a lot less. I assumed the async methods of Vizard would work well with Vizard?
Reply With Quote
  #4  
Old 10-31-2013, 08:20 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Most Vizard commands are not thread safe, especially when it comes to adding/removing objects from different threads. The viz.director function mainly exists for backwards compatibility reasons, and is only intended to be used to perform non-Vizard related operations (e.g. file/socket IO).

Having said that, loading models in director threads can work. You just need to be very careful not to add/remove other models while the asynchronous operation is being performed. Additionally, the model should be added to a dummy scene when being loaded asynchronously, to avoid adding the model while the active scene is rendering.

Vizard 5 will have built-in support to load models/avatars asynchronously, and all the threading issues will be handled automatically.
Reply With Quote
  #5  
Old 11-01-2013, 04:00 AM
sleiN13 sleiN13 is offline
Member
 
Join Date: Dec 2008
Posts: 83
When i want to load the model in a different scene how can I set the scene of the object back to viz.MainScene? There doesn't seem to be a setScene function on Node3D objects.
Reply With Quote
  #6  
Old 11-01-2013, 11:46 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The node.setParent command can be used to reparent a node to another scene:
Code:
node.setParent(viz.WORLD, viz.MainScene)
Reply With Quote
  #7  
Old 11-04-2013, 12:45 AM
sleiN13 sleiN13 is offline
Member
 
Join Date: Dec 2008
Posts: 83
When setting the parent do all the children of the node you re-parent also get transferred to the new scene?

And adding children to a node that is in a different scene do they get automatically relinked to that scene?
Reply With Quote
  #8  
Old 11-05-2013, 09:10 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Yes, when you set the parent of the node, all children of that node will be moved to the new scene.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This 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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
random coding Saz Vizard 1 05-27-2010 05:44 PM
random speed and associated coding Saz Vizard 1 05-20-2010 04:03 AM
custom avatar random walk krimble Vizard 2 03-20-2007 03:23 AM
Random head movements VR_enthusiast Vizard 2 07-19-2006 11:59 AM
Random Seeds Vygreif Vizard 1 04-27-2006 09:21 PM


All times are GMT -7. The time now is 12:57 AM.


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