Page MenuHome

Object material turns to Grease Pencil materials - Bug
Closed, DuplicatePublic

Description

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: rB0a0d735acd6e
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.


Event Timeline


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.

Philipp Oeser (lichtwerk) lowered the priority of this task from 90 to 30.Nov 13 2019, 10:03 AM

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

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)

I picked blendfile before with corrupted object. Here I pick actual scene where all started.


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.

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.

@Philipp Oeser (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.

@Aleksandr (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[0].material
bpy.data.materials.remove_gpencil_data(ma)

@Aleksandr (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[0].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.

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)

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.

Philipp Oeser (lichtwerk) raised the priority of this task from 30 to 50.Nov 13 2019, 11:10 AM

@Antonio Vazquez (antoniov): great!

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

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.

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.
@Aleksandr (viadvena) : lets continue discussion in T63707, 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...]