Object material turns to Grease Pencil materials - Bug #71533

Closed
opened 3 years ago by viadvena · 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)
Poster

Added subscriber: @viadvena

Added subscriber: @viadvena
Poster

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.
Collaborator

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Collaborator

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
Collaborator

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)
Poster

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.
Poster

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.
Collaborator

Added subscriber: @antoniov

Added subscriber: @antoniov
Collaborator

@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.
Collaborator

@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)```
Poster

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!
Collaborator

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.
Collaborator

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)```
Poster

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)
Collaborator

@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?)
Collaborator

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.
Collaborator

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...]
Collaborator

Closed as duplicate of #63707

Closed as duplicate of #63707
lichtwerk closed this issue 3 years ago
Yianni commented 3 years ago

Added subscriber: @Yianni

Added subscriber: @Yianni
Yianni commented 3 years ago

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/Collada
Interest/Compositing
Interest/Core
Interest/Cycles
Interest/Dependency Graph
Interest/Development Management
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/Modeling
Interest/Modifiers
Interest/Motion Tracking
Interest/Nodes & Physics
Interest/Overrides
Interest/Performance
Interest/Performance
Interest/Physics
Interest/Pipeline, Assets & I/O
Interest/Platforms, Builds, Tests & Devices
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
legacy module/Animation & Rigging
legacy module/Core
legacy module/Development Management
legacy module/Eevee & Viewport
legacy module/Grease Pencil
legacy module/Modeling
legacy module/Nodes & Physics
legacy module/Pipeline, Assets & IO
legacy module/Platforms, Builds, Tests & Devices
legacy module/Python API
legacy module/Rendering & Cycles
legacy module/Sculpt, Paint & Texture
legacy module/Triaging
legacy module/User Interface
legacy module/VFX & Video
legacy project/1.0.0-beta.2
legacy project/Asset Browser (Archived)
legacy project/BF Blender: 2.8
legacy project/BF Blender: After Release
legacy project/BF Blender: Next
legacy project/BF Blender: Regressions
legacy project/BF Blender: Unconfirmed
legacy project/Blender 2.70
legacy project/Code Quest
legacy project/Datablocks and Libraries
legacy project/Eevee
legacy project/Game Animation
legacy project/Game Audio
legacy project/Game Data Conversion
legacy project/Game Engine
legacy project/Game Logic
legacy project/Game Physics
legacy project/Game Python
legacy project/Game Rendering
legacy project/Game UI
legacy project/GPU / Viewport
legacy project/GSoC
legacy project/Infrastructure: Websites
legacy project/LibOverrides - Usability and UX
legacy project/Milestone 1: Basic, Local Asset Browser
legacy project/Nodes
legacy project/OpenGL Error
legacy project/Papercut
legacy project/Pose Library Basics
legacy project/Retrospective
legacy project/Tracker Curfew
legacy project/Wintab High Frequency
Meta/Good First Issue
Meta/Papercut
migration/requires-manual-verification
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 & Devices
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 Information 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

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#71533
Loading…
There is no content yet.