PDA

View Full Version : Unique with respect to each other


displaced
01-11-2008, 03:34 PM
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

JHN
01-11-2008, 07:40 PM
After you deinstance them, what kind of relation should there be between the objects?

-Johan

PiXeL_MoNKeY
01-11-2008, 09:08 PM
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
01-12-2008, 10:00 PM
Ah I now understand.. what he said *points what Pixel_Monkey

-Johan

displaced
01-13-2008, 04:19 PM
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....

displaced
01-15-2008, 05:42 PM
So the answer to the above is


instancemgr.makeobjectsunique $ #group



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

-- )



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.

PiXeL_MoNKeY
01-15-2008, 06:02 PM
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

displaced
01-16-2008, 08:56 AM
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..

CGTalk Moderation
01-16-2008, 08:56 AM
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.