Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3508 Members - Latest Member: NevilleKemp

26. May 2012, 04:03:12 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)[SOLVED] Retrieving nodes
Pages: [1]
Print
Author Topic: [SOLVED] Retrieving nodes  (Read 306 times)
ChrisE
Becoming dependent
**
Offline Offline

Posts: 104


View Profile
« on: 02. December 2010, 10:42:34 pm »

So, suppose that I've gotten a populated scene graph, and need to fetch a node back. I've got the original TransformGroup or Shape3D that I added to my root Branch Graph, but I would like to know how to remove that from the scene graph.

I was going to do this in a ScheduledOperation, of course, but beyond that is there a searching or removal method that I can use? Or do I have to use the findAll methods with a name?

In general, in fact, should I be trying to give unique names to all my nodes?

-Chris
« Last Edit: 07. December 2010, 05:42:50 pm by ChrisE » Logged
ChrisE
Becoming dependent
**
Offline Offline

Posts: 104


View Profile
« Reply #1 on: 02. December 2010, 11:42:22 pm »

Oh, and another question: The scene-graph is read-only threadsafe, right? Or is it completely not threadsafe?

EDIT: And should I call node.detach(), or BranchGroup.removeChild(node)?
« Last Edit: 03. December 2010, 12:14:31 am by ChrisE » Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #2 on: 03. December 2010, 12:29:44 am »

You'll either have to use one of the find methods to find your node or store a reference to the node somewhere to directly reference it. You should do the latter, if you can.

It's up to you, whether to give your nodes unique names.

The scenegraph is read-only thread safe except for the transformation matrices (and some other "meta" data, which are recalculated by the rendering thread, if they need to be.

node.detach() is nothing by an alias for removeChild() on the parent group.

Marvin
Logged
ChrisE
Becoming dependent
**
Offline Offline

Posts: 104


View Profile
« Reply #3 on: 03. December 2010, 12:31:14 am »

So, I can just pass the node I have a reference to into a scheduled operation to have it call its own detach method from within the correct thread context (just making sure)?
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #4 on: 03. December 2010, 10:33:00 am »

yes
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic