"Copy Materials to Selected" only works when materials are defined on the mesh #54544

Closed
opened 2018-04-08 09:31:26 +02:00 by takeshi funahashi · 15 comments

System Information
Operating system and graphics card

Blender Version
Broken: 2.79, 2.82 alpha @ 5dc1183580

Short description of error
Copy Materials to Selected misses a copy of the materials that are linked to the object.

Exact steps for others to reproduce the error

1 open new FIle (no material in data block)
2 add cube, select cube, change name as cube1 add a "new material"
3 change material link as "object", and "un-link" the material which assgined for mesh data
( select material which linked for mesh data, in outliner, then remove link)
4 set diffuse color blue, change material name as "mat_blue"
5 add new cube, select added one, then name as "cube2"
6 select "cube2", with shift select "cube", (active object = cube1 (blue material) selected cube = cube2 (no material)
7 from material drop down menu, "copy material to others"
8 it not add material slot of cube2..

If I make material slot for cube2 and assgin new material for the slot, and "copy materials to others"
it remove material link from cube2 materia_slot. so I need manually assgin "mat_blue" for cube2 from material drop down menu.

Sorry if it is intended, but I epxect "copy material to others" work about material whch link "object" as same as link "data"

T54544_edit.blend

**System Information** Operating system and graphics card **Blender Version** Broken: 2.79, 2.82 alpha @ 5dc1183580e932870064b44246e8fb750a8d806e **Short description of error** Copy Materials to Selected misses a copy of the materials that are linked to the object. **Exact steps for others to reproduce the error** 1 open new FIle (no material in data block) 2 add cube, select cube, change name as cube1 add a "new material" 3 change material link as "object", and "un-link" the material which assgined for mesh data ( select material which linked for mesh data, in outliner, then remove link) 4 set diffuse color blue, change material name as "mat_blue" 5 add new cube, select added one, then name as "cube2" 6 select "cube2", with shift select "cube", (active object = cube1 (blue material) selected cube = cube2 (no material) 7 from material drop down menu, "copy material to others" 8 it not add material slot of cube2.. If I make material slot for cube2 and assgin new material for the slot, and "copy materials to others" it remove material link from cube2 materia_slot. so I need manually assgin "mat_blue" for cube2 from material drop down menu. Sorry if it is intended, but I epxect "copy material to others" work about material whch link "object" as same as link "data" [T54544_edit.blend](https://archive.blender.org/developer/F2648513/T54544_edit.blend)

Added subscriber: @TakeshiFunahashi

Added subscriber: @TakeshiFunahashi
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Sorry, I might be misunderstanding, but I cannot reproduce...
Could you try this file (this has steps 1-6 of your report) and then do "copy material to others"?

#54544.blend

If that works, then could you please post a simple .blend that has these steps in and still fails?

Marking as incomplete for now...

Sorry, I might be misunderstanding, but I cannot reproduce... Could you try this file (this has steps 1-6 of your report) and then do "copy material to others"? [#54544.blend](https://archive.blender.org/developer/F2640329/T54544.blend) If that works, then could you please post a simple .blend that has these steps in and still fails? Marking as incomplete for now...
takeshi funahashi self-assigned this 2018-04-10 02:42:24 +02:00

Thanks to check this report. andyour blend file actually worked, but it was different how set-up material, in outliner.
your attached blend file, "mat_blue" link material for "object" but at same time "mat blue" still keep link with "data" of cube1

this is my download blend.
duplicatelink.JPG

But I report when I remove link material for "data". only link with "object"
(just change link type to object, I feel blender keep material link of "data". but I clean up it. sorry I miss discribe it)

please test with this blend, it only remove link of mat_blue with "data" but keep link with "object" which you offered blned file.
after remove link for "data", cube1 can not transfer material any more.
(but material link with object, then the cube1 can show mat_blue)

T54544_edit.blend

Thanks to check this report. andyour blend file actually worked, but it was different how set-up material, in outliner. your attached blend file, "mat_blue" link material for "object" but at same time "mat blue" still keep link with "data" of cube1 this is my download blend. ![duplicatelink.JPG](https://archive.blender.org/developer/F2648562/duplicatelink.JPG) But I report when I remove link material for "data". only link with "object" (just change link type to object, I feel blender keep material link of "data". but I clean up it. sorry I miss discribe it) please test with this blend, it only remove link of mat_blue with "data" but keep link with "object" which you offered blned file. after remove link for "data", cube1 can not transfer material any more. (but material link with object, then the cube1 can show mat_blue) [T54544_edit.blend](https://archive.blender.org/developer/F2648189/T54544_edit.blend)
takeshi funahashi was unassigned by Philipp Oeser 2018-04-10 11:07:30 +02:00
Campbell Barton was assigned by Philipp Oeser 2018-04-10 11:07:30 +02:00
Member

Added subscriber: @ideasman42

Added subscriber: @ideasman42
Member

Sorry, didnt notice the Material was still linked with data.

So yes, the Copy Material to Others operator only works with materials on object data (checked relevant code)

An alternative to using above operator is using the Make Links > Materials operator.
Afaics this operator has a couple of advantages:

  • will work with materialslots linked to objects (not objectdata)
  • will respect this user preference

#54544.png

couple of issues/notes with 'Copy Material to Others':

  • actually copies all materials (should be plural -- tooltip already says so)
  • wont work with materialslots linked to objects (not objectdata)
  • code history implies this was added as a (workaround?) in 2.5 in October 2009 when Make Links wasnt available, but then Make Links actually came back in November 2009

I might be missing something here, but it seems to me that (given the fact those two ops do very similar things - and one of them actually seems 'superior') we could replace Copy Material to Others with Make Links > Materials?

I'd be happy to do the patch, but kindly asking @ideasman42 for his opinion/advice here...

Sorry, didnt notice the Material was still linked with data. So yes, the `Copy Material to Others` operator only works with materials on object **data** (checked relevant code) An alternative to using above operator is using the `Make Links > Materials` operator. Afaics this operator has a couple of advantages: - will work with materialslots linked to objects (not objectdata) - will respect this user preference ![#54544.png](https://archive.blender.org/developer/F2651924/T54544.png) couple of issues/notes with 'Copy Material to Others': - actually copies all materials (should be plural -- tooltip already says so) - wont work with materialslots linked to objects (not objectdata) - code history implies this was added as a (workaround?) in 2.5 in October 2009 when `Make Links` wasnt available, but then `Make Links` actually came back in November 2009 I might be missing something here, but it seems to me that (given the fact those two ops do very similar things - and one of them actually seems 'superior') we could replace `Copy Material to Others` with `Make Links > Materials`? I'd be happy to do the patch, but kindly asking @ideasman42 for his opinion/advice here...
Campbell Barton was unassigned by takeshi funahashi 2018-04-10 14:21:50 +02:00
takeshi funahashi self-assigned this 2018-04-10 14:21:50 +02:00

Thanks advices. I could understand, Link material have many advantage, and plan to use it more.
but I may need to test it, to confrim it can be substitute of my current plan.

Because I hope to make "skin set exchanger" or "full mat exchange tool" , which can save current "all slot materials" of complex mesh as one "skin set" in another blend.file (skin_sets.blend) .
Skin_sets.blend need to store many material sets with each mesh (I plan to use duplicated link mesh) which named as each skin sets.

Then I hoped to use material which " link with object." because, "link duplicated mesh" can keep individual "skin sets". it may make blend file size small.

when I overwrite skin of current working mesh, I planed to append mesh(named as " skinset1" etc) , and copy and paste all materials. then I remove donner mesh from working scene. I planed to auto-mate these process as python add-on just for my purpose.

So if Link material work for my plan, I may need not use "copy and paste material", but as you said, actually these 2 tool seems a little different. Then I need to test it more. I think, (I am not beteran user), I may better not judge to remove old tool. if it still need for each user purpose )
and thanks test my report, and teach me about "link material" . I try it.

And,,, I really hope, if blender offer add-on, which I dsicribed above.. I know, I can easy keep material, and make material lbirary, there are already add-on for these purpose. but blender have not offered, tool or add on, which can save all material slots materials, as skin-set, and re apply it . so if you feel it seems useful, hope
you request it with clear words.
(I requested it in right-clcik select, but I could not get good response,,,)

Thanks advices. I could understand, Link material have many advantage, and plan to use it more. but I may need to test it, to confrim it can be substitute of my current plan. Because I hope to make "skin set exchanger" or "full mat exchange tool" , which can save current "all slot materials" of complex mesh as one "skin set" in another blend.file (skin_sets.blend) . Skin_sets.blend need to store many material sets with each mesh (I plan to use duplicated link mesh) which named as each skin sets. Then I hoped to use material which " link with object." because, "link duplicated mesh" can keep individual "skin sets". it may make blend file size small. when I overwrite skin of current working mesh, I planed to append mesh(named as " skinset1" etc) , and copy and paste all materials. then I remove donner mesh from working scene. I planed to auto-mate these process as python add-on just for my purpose. So if Link material work for my plan, I may need not use "copy and paste material", but as you said, actually these 2 tool seems a little different. Then I need to test it more. I think, (I am not beteran user), I may better not judge to remove old tool. if it still need for each user purpose ) and thanks test my report, and teach me about "link material" . I try it. And,,, I really hope, if blender offer add-on, which I dsicribed above.. I know, I can easy keep material, and make material lbirary, there are already add-on for these purpose. but blender have not offered, tool or add on, which can save all material slots materials, as skin-set, and re apply it . so if you feel it seems useful, hope you request it with clear words. (I requested it in right-clcik select, but I could not get good response,,,)
takeshi funahashi was unassigned by Philipp Oeser 2018-04-11 14:30:33 +02:00
Campbell Barton was assigned by Philipp Oeser 2018-04-11 14:30:33 +02:00
Member

please dont claim the task youself, this will most likely prevent others from looking at it

please dont claim the task youself, this will most likely prevent others from looking at it

Hi I need to re-consider this report.(and hope it confirmed) Because I understand, "Make links >material" can use to see same material (from source). and about some case it work what I expect, but there is clear difference, Between "Copy Material to Others" and "Make links (materilal)

Copy material to others can keep "material name". That means, when you make mesh with many material slot, and hope to exchange all mat at once,
"Copy material to others" can exchange materilal with keep "current material name" assgined for each material-slot.

Lets think I make complex "machine" witch have 10 material slot. And you plan to keep many material variation of the machine (keep same material-slot). And hope to exchange material-sets when you need.

  1. I save duplicated machine meshes in material.blend file. Machine1_mat1, Machine2_mat2, Machine3_mat3,,, etc.
    Each "Machine_mat" are duplicated meshes of "Machine" So they use same mesh-data, and have same "material-slot",
    but I can set different materials for each material slot. It only work when we set material link as "object"

  2. I hope to change machine material to Machine3_mat3.

 then I append Machine_mat3 to current scene, and  I Copy material from Machine_mat3 to Machine. Without change Material name.  But it not work (which I reported here)

3 If I use "Make Links > Materials" for "Machine" and "Machine_mat3" (which is appended from material.blend),
Machine show same materials as Machine_mat3, but it overwrite "all materials name" of Machine as same as Machine_mat3.

It is really annoying when you manage complex mesh materials assgined for material-slots.
blender do not offer way to "set name for material slots", then to keep clear, which faces are assgined for each parts material , we need to use material name.

Copy and paste Material can remove this problem. I can keep all material name , but can change material which what I hope.

Hi I need to re-consider this report.(and hope it confirmed) Because I understand, "Make links >material" can use to see same material (from source). and about some case it work what I expect, but there is clear difference, Between "Copy Material to Others" and "Make links (materilal) Copy material to others can keep "material name". That means, when you make mesh with many material slot, and hope to exchange all mat at once, "Copy material to others" can exchange materilal with keep "current material name" assgined for each material-slot. Lets think I make complex "machine" witch have 10 material slot. And you plan to keep many material variation of the machine (keep same material-slot). And hope to exchange material-sets when you need. 1. I save duplicated machine meshes in material.blend file. Machine1_mat1, Machine2_mat2, Machine3_mat3,,, etc. Each "Machine_mat" are duplicated meshes of "Machine" So they use same mesh-data, and have same "material-slot", but I can set different materials for each material slot. It only work when we set material link as "object" 2. I hope to change machine material to Machine3_mat3. ``` then I append Machine_mat3 to current scene, and I Copy material from Machine_mat3 to Machine. Without change Material name. But it not work (which I reported here) ``` 3 If I use "Make Links > Materials" for "Machine" and "Machine_mat3" (which is appended from material.blend), Machine show same materials as Machine_mat3, but it overwrite "all materials name" of Machine as same as Machine_mat3. It is really annoying when you manage complex mesh materials assgined for material-slots. blender do not offer way to "set name for material slots", then to keep clear, which faces are assgined for each parts material , we need to use material name. Copy and paste Material can remove this problem. I can keep all material name , but can change material which what I hope.
Campbell Barton was unassigned by Dalai Felinto 2019-12-23 16:36:16 +01:00

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

Looking at the code (assign_material() and material_slot_copy_exec()) the "Copy Material to Selected" operator should work for both object & data materials.

Looking at the code (`assign_material()` and `material_slot_copy_exec()`) the "Copy Material to Selected" operator should work for both object & data materials.
Sybren A. Stüvel changed title from "copy materials to others" not paste current active obj material, when material link as "object" to "Copy Materials to Selected" only works when materials are defined on the mesh 2020-02-04 14:36:45 +01:00

This issue was referenced by 9c1da81a4c

This issue was referenced by 9c1da81a4c173437c1e556afde7b32eef4b0a47d

Added subscriber: @mont29

Added subscriber: @mont29
Bastien Montagne self-assigned this 2020-07-28 18:28:06 +02:00

Will fix, having 100% proper fullproof solution is likely impossible given the weird mixed object/obdata relations with materials, but should usually give expected results...

Will fix, having 100% proper fullproof solution is likely impossible given the weird mixed object/obdata relations with materials, but should usually give expected results...

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#54544
No description provided.