Jump to content

[WidgetSpriteNode]I can't remove node from world.


photo

Recommended Posts

i try to use WidgetSpriteNode class.

 

i want to draw a node in WidgetSpriteNode.

 

but the node appear at WidgetSpriteNode with worldscene.

 

i wrote this script.

 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// my script

m_lbSpriteNode = new WidgetSpriteNode(gui, 430, 600);

Node node = node_load("mesh.node");

m_lbSpriteNode.setProjection(ortho(-10, 10, 50, -1, 0.1f, 100.0f));

m_lbSpriteNode.setModelview(lookAt(vec3(0,-1,0), vec3(0,1,0), vec3(0,0,1)));

m_lbSpriteNode.setNode(node);

 

// Transparent background viewport

m_lbSpriteNode.setBlendFunc(GUI_BLEND_SRC_ALPHA,GUI_BLEND_ONE_MINUS_SRC_ALPHA);

engine.render.setAmbientColor(vec4(1, 1, 1, 1));

 

// remove

engine.editor.removeNode(node);

or

node_remove(node);

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

but i was failed remove from worldscene.

 

can i remove the node from worldscene for only use in WidgetSpriteNode ?

Link to comment

You shouldn't pass each node into the engine.editor to render it. All existed and enabled nodes are rendered. You can select nodes for WidgetSpriteNode by using viewport mask.

 

thanks, frustum :(

i can change viewportmask. (T -> Camera -> viewportmask, or unigine_editor.cfg -> tools_camera_viewport_mask).

i have more question.

How can i change in script? i can't find any script function.

Link to comment

 

thanks ulf.schroeter, :(

 

i read bitmasking overview, too

i want to change worldscene ViewportMask in script.(T key -> Camera -> Viewportmask)

usually, this function(object.setViewportMask(), WidgetSpriteNode.setViewportMask()) used to hide the node in WidgetSpriteNode.

and if worldscene viewportmask is -1(0xffffffff), this function(object.setViewportMask(), WidgetSpriteNode.setViewportMask()) lose meaning.

Link to comment

Set object viewport mask of all world objects to x00000001 and only for the object(s) you want to render in WidgetSpriteNode set their viewport mask to 0x00000003. You will select only these objects for sprite rendering via setting WidgetSpriteNode viewportmask to 0x00000002.

Link to comment
×
×
  • Create New...