Seeking function

Next
 From:  fcwilt
11709.1 
Hi,

I've seen this many times:

moi.geometryDatabase.getSelectedObjects()

but is there the equivalent of this:

moi.geometryDatabase.getVisibleObjects()

Just for fun I tried that but it generated an error.

Thanks.

Frederick
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11709.2 In reply to 11709.1 
Hi Frederick,

re:
> but is there the equivalent of this:
>
> moi.geometryDatabase.getVisibleObjects()

What is your definition of a visible object?

Do you mean objects that don't have obj.hidden == true ?

Or objects that are inside of or intersect with the field of view of a viewport?

Or objects that have some pixels being drawn on screen so not behind another object?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  fcwilt
11709.3 In reply to 11709.2 
Hi,

Just those that are not hidden.

I know I can just iterate over all objects and check the hidden property but I thought, since there was a function that did that for the selected property perhaps there was one for the "visible" property (hidden = false).

I got it working doing the above but it did lead to a question.

When setting the hidden property to FALSE I found that I had to do the same for all sub-objects for the object to be displayed.

The question: when setting the hidden property to TRUE does that automatically set the hidden property for all sub-objects?

Thanks.

Frederick
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11709.4 In reply to 11709.3 
Hi Frederick,

re:
> The question: when setting the hidden property to TRUE does that automatically
> set the hidden property for all sub-objects?

It depends on the object type - on a group setting group.hidden = true will set hidden = true on the immediate children of the group.

On other objects no - on a solid for example setting solid_obj.hidden = true does not set .hidden = true on all of its face and edge sub-objects.

A sub object is effectively hidden if either it or any of its parent objects has hidden == true.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11709.5 In reply to 11709.4 
Also re:

> When setting the hidden property to FALSE I found that I had to do the same
> for all sub-objects for the object to be displayed.

Shouldn't normally be needed to do that unless you've set hidden = true on all the sub objects yourself.

For example, start with a blank scene, draw a box, and hide it (using regular UI).

If you then run this script it should show the box, by only setting .hidden = false on the top level box object only:

var box = moi.geometryDatabase.getObjects().item(0); box.hidden = false;

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  fcwilt
11709.6 In reply to 11709.5 
Hi Michael,

Thanks for all the information about how the hidden property works.

I will re-visit my code and see what I did wrong, to require "un-hiding" all of the sub-objects.

You should setup a "tip jar" for all of us folks that learn so much from you.

Frederick
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All