Converting Light Copies to Instances

Hi,

I was looking for a script and founded this one on THE AREA is working fine for converting objects from copies to instances, BUT not for lights…in the selection window they arent show, i guess i should change in the following code the GeometrClass for something like LightClass, but isnt working so not so easy :slight_smile:

fn flt obj = isKindOf obj GeometryClass

src = selectByName title:"Select source" filter:flt single:true

dst = selectByName title:"Select copies" filter:flt

for i in dst do instanceReplace i src

Some ideas??

Mmmm no one??? :frowning:

ditch the “filter:flt” from the two middle lines and it’ll no longer use the filter that only allows geometry.

As another way, If your master light in your scene is called light_001 for example you can use:


-- leave the dollar sign in here and change the name of the object to whatever object you want everything to switch to

masterObj= $light_001

for i = 1 to selection.count do
(
	selection[i].baseobject = masterObj.baseobject
)

ditch the “filter:flt” from the two middle lines and it’ll no longer use the filter that only allows geometry.

As another way, If your master light in your scene is called light_001 for example you can use:


-- leave the dollar sign in here and change the name of the object to whatever object you want everything to switch to

masterObj= $light_001

for i = 1 to selection.count do
(
	selection[i].baseobject = masterObj.baseobject
)

Thank you very very much joconell, both methods are working fine!!

Glad to help!

Hi guys,
just found this…is there a way to just make the master object which ever is selected first or something like that so that I don’t have to change the name of the master object everytime. Usually when I want to make lights instanced they are the same anyway but just not instanced so I don’t care which one is master.
Thx


for i = 2 to selection.count do ( selection[i].baseobject = selection[1].baseobject )