Scene.removeNode() Sloooow [SOLVED]

meipemeipe Posts: 101

Hi,

It looks like deleting by script an object with many assets with Scene.removeNode takes forever. It is confusing as it takes one second if you do it manually in DAZ Studio's scene.

For example if I load G8F in the scene, it takes me 11 seconds. If I delete her with a simple script it takes... 25 seconds

The same script is much faster with simple objects.

Any idea of what's going on and if there is a solution?

 

for( i = 0; i < Scene.getNumNodes(); ++i ) {	var n = Scene.getNode(i);      if(n.isRootNode())Scene.removeNode( n )      }

 

Post edited by meipe on

Comments

  • Are you adding the script's action to the undo stack? If not, does adding it to the stack speed execution up?

  • meipemeipe Posts: 101

    I'll try that, thanks for the hint

  • I don't know that it will have an effect, and if it does it's probably only deferring the wait - I believe moving something to the undo stack is faster as it is just moving, not actually freeing up the memory. If there is a speed gain it may stop you from gaining whatever benefit the script is intended to bring (for example lower resource usage or faster shut down).

  • meipemeipe Posts: 101
    edited February 2021

    Fast as lightning speed

    :) :) :)

     

    The full script will be used to selectively remove items in complex scenes.

     

    for( i = 0; i < Scene.getNumNodes(); ++i ) {	var n = Scene.getNode(i);      if(n.isRootNode()){      	beginUndo();      	Scene.removeNode( n )      	acceptUndo (qsTr ("Node removed"));      	}      }

     

    Post edited by meipe on
  • Glad that helped.

Sign In or Register to comment.