Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11992 Posts in 1588 Topics- by 3508 Members - Latest Member: PienueDut

26. May 2012, 11:16:10 am
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Best way to highlight a selection
Pages: [1]
Print
Author Topic: Best way to highlight a selection  (Read 459 times)
ford.304
Enjoying the stay
*
Offline Offline

Posts: 30


View Profile Email
« on: 28. April 2009, 05:51:08 pm »

I'd like to show when someone selects an object in my 3d view by turning the model they have selected a different color, possibly including making it transparent. I already have a way to determine which model I have selected from which geometry was returned by the picking test.

As far as I can tell, the best way to do this is to create a class that implements TraversalCallback that will change all of the Appearance instances in the Shape3D nodes. I also need to keep track of what nodes I changed Appearance on and what their appearance was, so that I can change it back.

Is this the easiest way to do this, or is there some existing method for overriding color settings for an entire subtree temporarily?

Thanks.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 28. April 2009, 07:12:59 pm »

Most of the shapes will have the same Appearance. They possibly even use a single Appeance instance. You should determine the distinct set of Appearance from the Model and deal with them only.

Marvin
Logged
hawkwind
Getting respectable
***
Offline Offline

Posts: 363



View Profile Email
« Reply #2 on: 28. April 2009, 09:20:07 pm »

I set the emmissive color green when I mouse over an object of interest
Logged
ford.304
Enjoying the stay
*
Offline Offline

Posts: 30


View Profile Email
« Reply #3 on: 30. April 2009, 02:42:15 pm »

Is there a shortcut to determining the appearances used by a Model, or is the best way to go through all individual Shape3D nodes?
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #4 on: 30. April 2009, 06:12:03 pm »

Is there a shortcut to determining the appearances used by a Model, or is the best way to go through all individual Shape3D nodes?

No. There is no shortcut for the Appearances. But there is a shortcut for the Shape3Ds. You can do it the following way:

Code:
HashSet<Appearance> apps = new HashSet<Appearance>();
for ( Shape3D shp : model.getShapes() )
{
    apps.add( shp.getAppearance() );
}

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic