RE: Find Cameras in scene

39 views
Skip to first unread message

Matt Lind

unread,
Mar 28, 2012, 2:31:04 PM3/28/12
to soft...@listproc.autodesk.com

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?

Alok Gandhi

unread,
Mar 28, 2012, 4:02:58 PM3/28/12
to soft...@listproc.autodesk.com
Or user data blobs / user key words

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.

Peter Agg

unread,
Mar 29, 2012, 4:51:28 AM3/29/12
to soft...@listproc.autodesk.com
Just out of interest: Would that be quicker than using the FindChildren2 method on the Scene Root?
Alok_Signature_email_.gif

Martin

unread,
Mar 29, 2012, 5:02:51 AM3/29/12
to soft...@listproc.autodesk.com
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
Alok_Signature_email_.gif

Peter Agg

unread,
Mar 29, 2012, 5:12:26 AM3/29/12
to soft...@listproc.autodesk.com
I guess I'm just wondering whether it's quicker when you take into account having to add the custom property/datablob to all the cameras. Though, now I've said that - wouldn't you need to get all the scene cameras first so you can set the custom property on them to designate them as being a scene camera...?

(presuming you don't have a standard camera model or somesuch, anyway)
Alok_Signature_email_.gif

Stephen Blair

unread,
Mar 29, 2012, 10:13:12 AM3/29/12
to soft...@listproc.autodesk.com
FindObjects2 appears to be fastest, even with filtering.
http://wp.me/powV4-1Jp

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>

image001.gif

Matt Lind

unread,
Mar 29, 2012, 2:55:31 PM3/29/12
to soft...@listproc.autodesk.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


cid:image001.gif@01CD0D98.86916CC0

Reply all
Reply to author
Forward
0 new messages