Notifications
Clear all

[Closed] How to modify only a class of objects in a selection?

Hi all,

I was wondering hou can you change some properties only on a class of objects in a selection which contains more classes. For example how to modify only the geometry objects in a selection which has lights in it also. Do I have to save the selection, deselect all others besides geometry, modify it and reselect all at the end or is some simpler way to do it?

Thanks,
Anton

5 Replies

why dont u just check if it is a geometryclass or not

for obj in selection do
(
if superclassof obj == GeometryClass then
(
– change whatever here
)
)

you can also use shortcuts for everything in your scene like:

for i in geometry do
(
)

for h in helpers do
(
)

Cannot really add a loop in that location but I thought of it. I should probably build an array before and reffer to the objects in it…

joconnell: I know about that, bit it does not help because I need to do it only to the geometry in my selection not in the whole scene.

I was thinking of something more like this:
for “lights” in selection
where the “Lights” would be all the lights in that selection… (I know this piece of code doesn’t have any logic…)

Thanks for the quick answer guys!

1 Reply
(@mobeen)
Joined: 11 months ago

Posts: 0

Try this

 allLightsInSelection = (for obj in selection where superclassof obj==Light collect obj)
select allLightsInSelection

Hope this helps
Mobeen

Thanks Mobeen. That’s what I ended up doing.