Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework MeshObject material manipulation #1082

Open
AndreyYashkin opened this issue Apr 1, 2024 · 2 comments · May be fixed by #1083
Open

Rework MeshObject material manipulation #1082

AndreyYashkin opened this issue Apr 1, 2024 · 2 comments · May be fixed by #1083
Labels
enhancement New feature or request

Comments

@AndreyYashkin
Copy link
Contributor

Describe your feature request

#1013 introduced a duplicate linked option, but there are no applications for it yet. Current implementation of material manipulation methods sets and gets them for object data. This leads to shared materials between original objects and linked duplicates. In Blender two objects can have shared data, but different materials by switching the material slots links from "DATA" to "OBJECT".

Describe a possible solution

The methods for setting and getting the object's materials shall be able to manipulate with the both object's and object's data material slots.

@AndreyYashkin AndreyYashkin added the enhancement New feature or request label Apr 1, 2024
AndreyYashkin added a commit to AndreyYashkin/BlenderProc that referenced this issue Apr 1, 2024
AndreyYashkin added a commit to AndreyYashkin/BlenderProc that referenced this issue Apr 1, 2024
AndreyYashkin added a commit to AndreyYashkin/BlenderProc that referenced this issue Apr 1, 2024
@AndreyYashkin AndreyYashkin linked a pull request Apr 1, 2024 that will close this issue
AndreyYashkin added a commit to AndreyYashkin/BlenderProc that referenced this issue Apr 1, 2024
@cornerfarmer
Copy link
Member

Hey @AndreyYashkin,

thanks a lot for the issue and the PR! I currently dont fully understand the use-case of the new functionality. However, at the same time, the new feature adds quite a bit of complexity to the material setter/getter and my fear is that this might lead to non-intuitive behavior.

I do understand that you would like to change the material of objects with linked data.
So what speaks against the following workflow:

-> Every time a user sets a material via obj.set_material() the respective material slot gets set to OBJECT

This makes sure that the material is always set only for the specific object instance.
If the user wants to set a material across multiple objects, the user needs to call obj.set_material() inside a for obj in objs loop. But I dont think that is much of a problem.

What do you think about this solution? In my eyes this would be beneficial as it reduces the complexity quite a bit.

@AndreyYashkin
Copy link
Contributor Author

AndreyYashkin commented Apr 12, 2024

Sorry for the late response.

  1. From my perspective warping Blender functionality does not lead to any non-intuitive behavior. In contrast, you may try the same operations inside Blender without coding and get the same result. In my PR I added only additional functionality to get actual visible material which is not obvious to get using code in one case, while inside Blender you can see it with your eyes.
  2. Every time a user sets a material via obj.set_material() the respective material slot gets set to OBJECT

Well, I think that it can work too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants