PDA

View Full Version : All objects displayed in viewport


Ratzlaff
06-13-2006, 06:37 PM
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?

Ratzlaff
06-13-2006, 06:52 PM
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.

Bobo
06-13-2006, 07:41 PM
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?


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
06-13-2006, 08:21 PM
Thanks for the response, it is giving me more ideas on how to go about my problem =)

To answer your question,

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



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.

Bobo
06-13-2006, 08:48 PM
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.


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.

Ratzlaff
06-13-2006, 08:59 PM
Nice, that filter by classid is just what I needed. Thanks =)

CGTalk Moderation
06-13-2006, 08:59 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.