Jump to content
Sign in to follow this  
jordibares

Object merge question

Recommended Posts

jordibares    66

I am experiencing a behaviour when using object merge that is driving me mad… ok, here it goes… hopefully will be clear

 

I have a car, 1 body and 4 wheels. All 5 elements are separate objects and I apply the materials at OBJ level too by drag&drop.

 

But then I want to "collect" those objects so I can manipulate them as one when I object merge the OBJ the material is lost… it only works if I put a material node at SOP level which is not what I want. I am viewport century and the whole point of drag&drop at OBJ level seems to be lost.

 

My question is… am I missing something or is this by design not possible? I already have a few workarounds but I just would like to know if this is possible.

 

thanks in advance.

Share this post


Link to post
Share on other sites
Netvudu    111

to be more precise, no materials assigned at OBJ level travel through the Object Merge, and actually it makes sense. (I´m pretty sure you already know the following, but just in case) When you apply a material at OBJ level, you´re not actually applying any attributes to the geometry until it reaches the shader, which is where it´s reading that OBJ material info. Hence, there´s´no shop_material_path attribute applied yet and it reads whatever new material you apply at OBJ level. As you mentioned, if you apply the SOP Material and then merge that somewhere else, it does read it, because the shop_material_path is there already. I think it is designed this way, because that allows you to object merge some geometry, but choose a new material from OBJ level. But yes, from a drag&drop workflow POV, it´s not ideal. Just to put it from a different perspective. What if you wanted to keep on using drag&drop, but wanted a copy of your objects with different materials? Then, any other method would force you to use the SOP material again.

Edited by Netvudu

Share this post


Link to post
Share on other sites
jordibares    66

Thanks Javier, I was not aware of the details (thanks for developing) but this is from the user experience point of view a bug… anyway, I guess a possible solution would be to always add a sop material reading the object material? I will try this on monday and see how it behaves as for me the drag and drop functionality is critical to scale teams up.

 

 

:-)

 

 

to be more precise, no materials assigned at OBJ level travel through the Object Merge, and actually it makes sense. (I´m pretty sure you already know the following, but just in case) When you apply a material at OBJ level, you´re not actually applying any attributes to the geometry until it reaches the shader, which is where it´s reading that OBJ material info. Hence, there´s´no shop_material_path attribute applied yet and it reads whatever new material you apply at OBJ level. As you mentioned, if you apply the SOP Material and then merge that somewhere else, it does read it, because the shop_material_path is there already. I think it is designed this way, because that allows you to object merge some geometry, but choose a new material from OBJ level. But yes, from a drag&drop workflow POV, it´s not ideal. Just to put it from a different perspective. What if you wanted to keep on using drag&drop, but wanted a copy of your objects with different materials? Then, any other method would force you to use the SOP material again.

Share this post


Link to post
Share on other sites
Netvudu    111

Sure. Python to the rescue!

 

You could reference the object material from a Material SOP added to the Object Merge

 

 

EDIT: I found a spare hour this weekend (of course it must be the weekend, otherwise there´s virtually no spare time) and created what you need.

The attached shelf tool allows you to select from the viewer whichever object/s you need, and automagically brings them to a new node currently called "nuevo" (*ahem*you should change that :huh: ). It names each Object merge with the proper object´s name, and adds a material SOP (also with proper name) that references to the OBJ level material parameter, so if you change the original the new one follows.

I had to choose the Object_merge transform mode for you, but it should be trivial changing that to what you need for a specific occasion.

 

Finally, I didn´t crash-test it a lot. I just made sure that it works for objects at different levels and also it complains if you don´t select anything. Some more error-testing checks should be made prior to considering it production-ready. For instance, you could add checks to see if you decided to go the Material SOP route instead of using the OBJ-level material parameter for the original objects.

 

The silly code is commented just in case you want to change anything.

 

Hope it helps "realising" (huh-huh :P ) your pipeline.

 

ObjectMergePlus.zip

Edited by Netvudu

Share this post


Link to post
Share on other sites
cowboy71    3

Hey Netvudu,

Thank you so much for the script, works great.  After running it and pushing it through a sim,  I used an unpack to bring the textures back in the viewport but having same issue when rendered the geo is white. 

 

edit ( just had to dump the textures in the correct directory with the FBX.)

Thanks again, that script rocks!

Edited by cowboy71

Share this post


Link to post
Share on other sites
Netvudu    111

You´re welcome! Happy it helped anybody.

BTW, I still feel dizzy when I remember the number of margaritas  I had in a mexican restaurant over there, in cool Santa Monica 

Share this post


Link to post
Share on other sites
hatrick    15

could anyone take a look at this tool pls. it does not seem to work with the latest 16 builds. 

many thx

Share this post


Link to post
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
Sign in to follow this  

×