Multi/sub Object

Multi/sub Object

Anonymous
Not applicable
637 Views
1 Reply
Message 1 of 2

Multi/sub Object

Anonymous
Not applicable

Hello

I want to assign a Multi/sub Object material to an object by script
I have a Multi/sub Object material named ‘Industrial’ and I want to put it on the object ‘Buildings’

Thanks

0 Likes
Accepted solutions (1)
638 Views
1 Reply
Reply (1)
Message 2 of 2

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

@Anonymous wrote:

I want to assign a Multi/sub Object material to an object by script
I have a Multi/sub Object material named ‘Industrial’ and I want to put it on the object ‘Buildings’

 


it's a simple task if the situation is simple. but the problems might be...

# you can have multiple objects named "Buildings"

# you can not have an object named  "Buildings"

# the same is about material(s)

# were is the ‘Industrial’ material?

 

well... let's do it anyway for a 'simple' situation:

1. you have or not have 'Buildings' objects but ready to assign the material to all of them

2. you have or not have 'Industrial' material. If you have many, the first one will be used 

3. the material is in Material Editor list. If the material doesn't exists in the list the undefined material will be applied

 

so we can do it:

(getnodebyname "Buildings" all:on).material = meditmaterials["Industrial"]

if the material is already in the scene, we can change the expression to:

(getnodebyname "Buildings" all:on).material = scenematerials["Industrial"]

 

but if we want to do everything correctly and safely, first we need to check all the problems that I mentioned above

 

0 Likes