I would apply a custom property to the scene cameras and perform a FindObjects() on the Custom Property.
Matt
From: softimag...@listproc.autodesk.com [mailto:softimag...@listproc.autodesk.com] On Behalf Of Bradley Gabe
Sent: Wednesday, March 28, 2012 7:20 AM
To: soft...@listproc.autodesk.com
Subject: Re: Find Cameras in scene
Just curious. In a scene with thousands of X3DObjects, which code technique is the fastest for selecting only scene cameras and not view cams?

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.1831 / Virus Database: 2090/4557 - Release Date: 10/17/11
Internal Virus Database is out of date.
From: softimag...@listproc.autodesk.com [mailto:softimag...@listproc.autodesk.com] On Behalf Of Martin
Sent: March-29-12 5:03 AM
To: soft...@listproc.autodesk.com
Subject: Re: Find Cameras in scene
FindObjects is the fastest method you have. I think you can't use FindObjects to filter cameras though. Not without adding a Custom Property like Matt said.
Since I usually use old SI versions I haven't test FindObjects2 too much but I guess it is quite fast too.
You could use FindObjects2 and then filter the view ones. I guess that would be faster than FindChildren2 if you have thousands of objects but it's just a guess.
Martin Yara
On Thu, Mar 29, 2012 at 5:51 PM, Peter Agg <pete...@googlemail.com<mailto:pete...@googlemail.com>> wrote:
Just out of interest: Would that be quicker than using the FindChildren2 method on the Scene Root?
On 28 March 2012 21:02, Alok Gandhi <alok....@modusfx.com<mailto:alok....@modusfx.com>> wrote:
Or user data blobs / user key words
[cid:image0...@01CD0D94.8B488900]
On 3/28/2012 2:31 PM, Matt Lind wrote:
I would apply a custom property to the scene cameras and perform a FindObjects() on the Custom Property.
Matt
From: softimag...@listproc.autodesk.com<mailto:softimag...@listproc.autodesk.com> [mailto:softimag...@listproc.autodesk.com] On Behalf Of Bradley Gabe
Sent: Wednesday, March 28, 2012 7:20 AM
To: soft...@listproc.autodesk.com<mailto:soft...@listproc.autodesk.com>
Subject: Re: Find Cameras in scene
Just curious. In a scene with thousands of X3DObjects, which code technique is the fastest for selecting only scene cameras and not view cams?
No virus found in this message.
Checked by AVG - www.avg.com<http://www.avg.com>
You can use FindObjects() to filter cameras directly
The reason FilterObjects() / FilterObjects2() are faster is because they query the scene’s internal database like a SQL query whereas FindChildren() crawls the scene graph (or, at least that’s what I’ve been lead to believe based on past discussions). As long as your target data can be easily identified to stand out from the crowd, FindObjects() will be the faster way to search. The (potential) downside is if you search for cameras using FindObjects(), it will return all the cameras including those outside the scene scope such as the view cameras. To restrict the search, apply metadata (such as a self installing custom property) to the cameras you’re interested in locating and do the query on that metadata. That’ll ensure the returned results are more directly relevant. The other option is to filter the returned results by a 2nd criteria. In the case of scene cameras, the 2nd criteria would be to test if the camera is inside a model. If so, it’s in the scene, otherwise it’s likely a view camera.
This will return all cameras not just those under the scene root:
var oConstants = new Constants();
// Get all cameras in scene
var CLSID_CAMERAS = "{5FC0CCAE-3DC8-11D0-9449-00AA006D3165}";
var oItems = FindObjects( "", CLSID_CAMERAS );
if ( !oItems ) {
LogMessage( "[" + oConstants.PRG + "] No cameras found in scene", siError );
return(1);
}
// Get display setting for first camera (to be applied on all other cameras)
var oCameras = SIFilter( oItems, siCameraFilter, true, siQuickSearch );
if ( !oCameras || oCameras.Count <= 0 ) {
LogMessage( "[" + oConstants.PRG + "] No cameras found", siError );
return(1);
}
…
Matt
From: softimag...@listproc.autodesk.com [mailto:softimag...@listproc.autodesk.com] On Behalf Of Martin
Sent: Thursday, March 29, 2012 2:03 AM
To: soft...@listproc.autodesk.com
Subject: Re: Find Cameras in scene
FindObjects is the fastest method you have. I think you can't use FindObjects to filter cameras though. Not without adding a Custom Property like Matt said.
Since I usually use old SI versions I haven't test FindObjects2 too much but I guess it is quite fast too.
You could use FindObjects2 and then filter the view ones. I guess that would be faster than FindChildren2 if you have thousands of objects but it's just a guess.
Martin Yara
On Thu, Mar 29, 2012 at 5:51 PM, Peter Agg <pete...@googlemail.com> wrote:
Just out of interest: Would that be quicker than using the FindChildren2 method on the Scene Root?
On 28 March 2012 21:02, Alok Gandhi <alok....@modusfx.com> wrote:
Or user data blobs / user key words
