Notifications
Clear all

[Closed] Unique with respect to each other

Hello,

Im trying to seperate a selection on instances by making them unique but still maintaining the releationship to each other

I’ve been looking at

instancemgr.makeobjectsunique

but cant find any refrence to keeping the links between them

has anyone had any experience of this

Cheers
Colin

7 Replies
 JHN

After you deinstance them, what kind of relation should there be between the objects?

-Johan

Why not just make the first item in the selection array unique and then make the other items instances of the now unique item? Or something like that?

-Eric

 JHN

Ah I now understand… what he said *[i]points what Pixel_Monkey

[/i]-Johan

Thanks for your replies…sorry the question was quite confusing i only realized once i re-read it on sunday morning…

so yes i understand your replies and it seems a logical approach but just to confirm…

normally if you have say 20 items that are all instances of each other and you select 10 of these items and make them unique you will get a pop up box asking if you would like to make them unique with reference to each other if you select yes they all become indiviually unique if you select no the 10 item become instances of each other but unique to the original remaining 10 items…

Now i want to reproduce the second option with maxscript…

now with the command makeobjectsunique there is a #group option but im not sure what it does ???

do you think the only methos is what pixel monkey suggests or is there a built in maxscript method? that i cant find…

So the answer to the above is

 
[size=2][color=magenta]instancemgr.makeobjectsunique $ #group
 
[/color][/size]

I’ve now moved on to an additional problem.

If i have a instanced set of 20 planes with a randomized set of 5 materials on them.
So i should end up with roughly 4 planes with one material on times 5.

now i want to select all the planes with one type of material on and then make them unique with the above method.

Now i have come up with the below


for i = 1 to currentmateriallibrary.count do

-- ( 



-- cmat = currentmateriallibrary[i]

-- select (for o in geometry where o.material == cmat collect o)



-- instancemgr.makeobjectsunique $ #group

-- print i

[size=2][color=magenta]-- )
 
[/color][/size]

but it doesnt work completely. i’ll end up with a set of 3 items with a fouth one seperate.

i’ve gone through the code line by line in the listener and it seems to work i just cant get my head around it.

Unless you have added all the materials from your scene the currently opened Material Library your method will have problems. If you want to work with materials in your scene use sceneMaterials, which is an array of materials and maps applied in the scene, and not currentMaterialLibrary, only materials and maps in the current material library.

-Eric

I’m working specifically with materials from the currently opened library so thats not really the issue.

Im automating the process of randomly applying materials from a library which you can select from a dropdown list and then seperating the geomerty based upon what material was applied.

But as mentioned in the above post im getting strange results. if one material was applied to four objects, i’ll end up with the three of them being instances and one being completely seperate or a varriation on that.

I have a hunch that when the above script collects geometry and then makeobjectsunique, i think later on its selecting geometry that has already been done and then making it unique again. but i cant work out why and i cant seem to simulate it…