Notifications
Clear all

[Closed] All objects displayed in viewport

I want to make a group of all objects that I can see in the viewport so that when I merge in a file, I know which objects are new and which ones were already existing. $objects has those and a lot more, and I’ve run into problems with putting non-viewport objects in a group with other stuff.

Another way of asking the question is: How does the Select Objects dialog (the ‘h’ key) populate its list?

5 Replies
2 Replies
(@bobo)
Joined: 11 months ago

Posts: 0

To answer your question,

allVisible = for o in objects where not o.isHiddenInVpt collect o

This will respect all sorts of visibility controls incl. hidden nodes, hidden layers and hide frozen checkbox.

This of course is not the right way to go when merging objects, because merged objects could be hidden, and non-merged objects could be hidden, too. How would you know what got REALLY merged?

The best way to go would be to snapshot all existing objects into an array


theOldObjects = objects as array

then perform the merging and then see which objects are not in the old array

theNewOnes = for o in objects where findItem theOldObjects o == 0 collect o

After this, you could deal with what is visible and what not…

(@ratzlaff)
Joined: 10 months ago

Posts: 0

Thanks for the response, it is giving me more ideas on how to go about my problem =)

This still collects the (what I consider) non-visible objects that are created when you place a particle flow operator in your scene. The select object dialog does not place them there (like $‘birth 01’)

I guess the right term isnt ‘visible objects’ for the particle flow operators, as your reply certainly answers my question as phrased.
I want to script the actions as follows:
press the ‘h’ key
click the ‘all’ button in the ‘list types’ group
click the ‘all’ button under the object list
click select
group that selection

since the listener doesnt display these actions, I assume there could be some nice function that does it, but I havent yet entered in the magic search phrase into the help file yet to find it (damn you Unwrap_UVW!!!)

I’m now looking into filtering the visible objects from the .isHiddenInVpt command by their interface implementations, since those appear to be specific to just the particle flow objects.

hm they all appear to be in categorized lists
$geometry
$shapes
$lights
$cameras
$helpers
$spacewarps
$systems

however what I specifically do not want to group together are the particle flow operators and events.

Particle Flow Helpers are a special case. MAXScript has no concept for their invisibility. (I think Oleg used some rather hacky way to implement them). But technically speaking, Particle Flow operators merged into the scene ARE newly merged objects. I would still do what I suggested and then filter out any Particle Flow operators that might have been collected.

Select By Name has its own quirks and own filters and there is nothing in MAXScript that behaves exactly like that. For MAXScript, all objects are there at any time. Their visibility in viewports can be controlled in many ways, and the flag that hides Pflow operators internally does not seem to be one of the supported ones.

The workaround would be to use the fact that Oleg gave a common second ClassID element to all PFlow Operators and all PFlow System Objects like Events, Engine etc.

So you could filter the objects that are NOT PFlow elements (excl. PF_Source itself which is Geometry that you probably want)

NotPFlow = for o in objects where o.classid[2] != 515064320 and o.classid[2] != 515064576 collect o

Hope this helps.

Nice, that filter by classid is just what I needed. Thanks =)