Jump to content

[SOLVED] select node in editor and needReload()


photo

Recommended Posts

Posted
hi : i would like to select some node in the editor
here is the code and it works
foreach(Node node;nodes){
nodesSelect(node,0);
}
engine.editor.needReload();

if i remove the needReload() it will not work. I don't really understand why.

the problem for needReload() is that it will stop editor to update.

any idea?

 

Posted

Hi there!

 

First of all, engine.editor.needReload won't stop editor updates as it'll just set internal flag. If you look at update function in core/editor/editor.cpp file you can notice that inside it's constantly checking for that flag.

 

You could also use nodesUpdate(1) call instead so you won't reload all editor systems.

Posted

hi Bob:

   I's actually not sure  how to select nodes in the editor properly. could you send me a sample script?

thanks

Posted

Hello there, Yang!

 

This should be something like this:

Node new_selection[0]; // fill this array with the nodes you want to select

nodesReload();

forloop(int i = 0; new_selection.size()) {
	nodesSelectNew(new_selection[i],1);
}

×
×
  • Create New...