Jump to content

Randomizing Object ID


UuosKovacevic
 Share

Recommended Posts

Hi,

 

I have a problem with randomizing Object ID, because I use to work with groups in 3dsMax.

When I try to randomize Object IDs with ID Tool script it doesn't see group as one object, but also randomize objects inside the group, so in the end I have too many Object IDs in scene and I need to make so much Render Elements for post production.

 

Does anyone know any script that randomize Object IDs and also can see a group as one object in randomization?

 

Thanks,

Link to comment
Share on other sites

This should work for most cases.

 

Select the objects you want to assign random object IDs to and run the script.

 

It will fail if the objects in your groups have children of their own; let me know if this is the case. You can adjust the number at the beginning of the script to set how many random object IDs it uses.

 

numObjectIDs = 10 --change this number to set maximum random object ID

objectScope = selection as array

myGroups = for obj in objectScope where ((superclassof obj ==helpers) and (isGroupHead obj)) collect obj

mySingletons = for obj in objectScope where (((superclassof obj == geometryClass) or (superclassof obj == shape)) and (not isGroupMember obj)) collect obj

for obj in mySingletons do obj.gbufferchannel = (random 1 numObjectIDs)

for obj in myGroups do 
(
groupID = random 1 numObjectIDs
obj.gbufferChannel = groupID
for subObj in obj.children do subObj.gbufferchannel = groupID
)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...