Object material turns to Grease Pencil materials - Bug #71533

Closed
opened 2019-11-13 08:37:23 +01:00 by Aleksandr · 20 comments

System Information
Operating system: Linux-4.15.0-66-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1050 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 435.21

Blender Version
Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-11-08 22:59, hash: 0a0d735acd
Worked: (optional)

Short description of error
Material of mesh object turns to Grease Pencil material.

Exact steps for others to reproduce the error
I just created object and plug it to use in hair particle system and it's material turns to Grease Pencil material so I can not to change material properly anymore. It happens time to time.
1.png
Bug_Material.blend

**System Information** Operating system: Linux-4.15.0-66-generic-x86_64-with-debian-buster-sid 64 Bits Graphics card: GeForce GTX 1050 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 435.21 **Blender Version** Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-11-08 22:59, hash: `0a0d735acd` Worked: (optional) **Short description of error** Material of mesh object turns to Grease Pencil material. **Exact steps for others to reproduce the error** I just created object and plug it to use in hair particle system and it's material turns to Grease Pencil material so I can not to change material properly anymore. It happens time to time. ![1.png](https://archive.blender.org/developer/F8057211/1.png) [Bug_Material.blend](https://archive.blender.org/developer/F8057199/Bug_Material.blend)
Author

Added subscriber: @viadvena

Added subscriber: @viadvena
Author

2.png
Blender convert mesh to Grease Pencil object. When I exit from material tab, duplicate this object and convert it to mesh - command works, but after this I go to material tab and mesh turns to grease pencil back and produce error when I try to convert it to mesh. I delete material and conversion works and object turns to a mesh but material lost forever.

![2.png](https://archive.blender.org/developer/F8057360/2.png) **Blender convert mesh to Grease Pencil object**. When I exit from material tab, duplicate this object and convert it to mesh - command works, but after this I go to material tab and mesh turns to grease pencil back and produce error when I try to convert it to mesh. I delete material and conversion works and object turns to a mesh but material lost forever.
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Having a hard time reproducing this:

  • could you try to come up with the steps from the default scene to reproduce this?

  • or do you have a file we can open and then do a couple of steps that lead to the problem?

I just created object and plug it to use in hair particle system and it's material turns to Grease Pencil material

cannot reproduce

Having a hard time reproducing this: - could you try to come up with the steps from the default scene to reproduce this? - or do you have a file we can open and then do a couple of steps that lead to the problem? > I just created object and plug it to use in hair particle system and it's material turns to Grease Pencil material cannot reproduce
Member

And yes, I can see the problem in the file from the report (it is just that I cannot reproduce it from scratch or with the steps provided)

And yes, I can see the problem in the file from the report (it is just that I cannot reproduce it from scratch or with the steps provided)
Author

I picked blendfile before with corrupted object. Here I pick actual scene where all started.
test_MatBug.blend
Please look deeply in collections with suffix _S - it's origin meshes for instances in particle systems. As I see all meshes that was instanced turns their mats in gp mats.

I picked blendfile before with corrupted object. Here I pick actual scene where all started. [test_MatBug.blend](https://archive.blender.org/developer/F8057867/test_MatBug.blend) Please look deeply in collections with suffix _S - it's origin meshes for instances in particle systems. As I see all meshes that was instanced turns their mats in gp mats.
Author

Also I can assume that it's happens only with procedural materials without image textures. And used Annotation tool with draw mode above meshes. It's just happens and unfortunately I can not say more. At some moment I just noticed it.

Also I can assume that it's happens only with procedural materials without image textures. And used Annotation tool with draw mode above meshes. It's just happens and unfortunately I can not say more. At some moment I just noticed it.

Added subscriber: @antoniov

Added subscriber: @antoniov

@lichtwerk I'm looking a t the bug too. Try to find where BKE_material_init_gpencil_settings() is called. If we found why this is called, we will catch the bug.

@lichtwerk I'm looking a t the bug too. Try to find where `BKE_material_init_gpencil_settings()` is called. If we found why this is called, we will catch the bug.

@viadvena While we found the solution to the bug, you can recover your material running these lines in console:

bpy.data.materials.remove_gpencil_data(ma)```
@viadvena While we found the solution to the bug, you can recover your material running these lines in console: ```ma = bpy.context.active_object.material_slots- [x].material bpy.data.materials.remove_gpencil_data(ma)```
Author

In #71533#810151, @antoniov wrote:
@viadvena While we found the solution to the bug, you can recover your material running these lines in console:

bpy.data.materials.remove_gpencil_data(ma)```

Thank you! I appreciate this!

> In #71533#810151, @antoniov wrote: > @viadvena While we found the solution to the bug, you can recover your material running these lines in console: > > ```ma = bpy.context.active_object.material_slots- [x].material > bpy.data.materials.remove_gpencil_data(ma)``` Thank you! I appreciate this!

I'm going to create an script to fix your file in one step.

I'm going to create an script to fix your file in one step.

This script fix the file:


for ob in bpy.data.objects:

if ob.type == 'MESH':
for slot in ob.material_slots:
bpy.data.materials.remove_gpencil_data(slot.material)```

This script fix the file: ```import bpy for ob in bpy.data.objects: ``` if ob.type == 'MESH': for slot in ob.material_slots: bpy.data.materials.remove_gpencil_data(slot.material)```
Author

In #71533#810159, @antoniov wrote:
This script fix the file:


for ob in bpy.data.objects:
    if ob.type == 'MESH':
        for slot in ob.material_slots:
            bpy.data.materials.remove_gpencil_data(slot.material)```

Thanks a lot! It works) Could you please to help me with another thing: how can I force recompile shaders? Sometimes materials completely won't to updates. I struggled with this few times and in this situations helps install new build of blender. But may be there is much more esthetic way.
1.png

> In #71533#810159, @antoniov wrote: > This script fix the file: > > ```import bpy > > for ob in bpy.data.objects: > if ob.type == 'MESH': > for slot in ob.material_slots: > bpy.data.materials.remove_gpencil_data(slot.material)``` Thanks a lot! It works) Could you please to help me with another thing: how can I force recompile shaders? Sometimes materials completely won't to updates. I struggled with this few times and in this situations helps install new build of blender. But may be there is much more esthetic way. ![1.png](https://archive.blender.org/developer/F8058216/1.png)
Member

@antoniov: great!

Think we confirm this then? (or do we wnat to merge with #63707?)

@antoniov: great! Think we confirm this then? (or do we wnat to merge with #63707?)

We could merge both, but I'm unable to reproduce it, so no idea how fix it.

We could merge both, but I'm unable to reproduce it, so no idea how fix it.
Member

In #71533#810175, @antoniov wrote:
We could merge both, but I'm unable to reproduce it, so no idea how fix it.

Ah, I was thinking you were squashing the bug already.

While we found the solution to the bug

Anyways, since both issues seems to stem from the same roots [Annotations in play...], will merge these reports.
@viadvena : lets continue discussion in #63707, and please keep us up to date if you have found a way to reproduce [thanx for providing test_MatBug.blend -- but the corruption has already taken place in that file as well, and I am still not able to reproduce... will try more though...]

> In #71533#810175, @antoniov wrote: > We could merge both, but I'm unable to reproduce it, so no idea how fix it. Ah, I was thinking you were squashing the bug already. > While we found the solution to the bug Anyways, since both issues seems to stem from the same roots [Annotations in play...], will merge these reports. @viadvena : lets continue discussion in #63707, and please keep us up to date if you have found a way to reproduce [thanx for providing `test_MatBug.blend` -- but the corruption has already taken place in that file as well, and I am still not able to reproduce... will try more though...]
Member

Closed as duplicate of #63707

Closed as duplicate of #63707

Added subscriber: @Yianni

Added subscriber: @Yianni

This comment was removed by @Yianni

*This comment was removed by @Yianni*
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
4 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#71533
No description provided.