Maniphest T71533

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

Assigned To
None
Authored By
Aleksandr (viadvena)
Nov 13 2019, 8:37 AM
Tags
  • BF Blender
  • Grease Pencil
Subscribers
Aleksandr (viadvena)
Antonio Vazquez (antoniov)
Philipp Oeser (lichtwerk)
Yianni Papazis (YianniP)

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

Aleksandr (viadvena) created this task.Nov 13 2019, 8:37 AM
Aleksandr (viadvena) added a comment.Nov 13 2019, 9:10 AM


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
Philipp Oeser (lichtwerk) added a project: Grease Pencil.
Philipp Oeser (lichtwerk) added a subscriber: Philipp Oeser (lichtwerk).

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

Philipp Oeser (lichtwerk) added a comment.Nov 13 2019, 10:04 AM

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)

Aleksandr (viadvena) added a comment.Nov 13 2019, 10:12 AM

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.

Aleksandr (viadvena) added a comment.Nov 13 2019, 10:16 AM

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.

Antonio Vazquez (antoniov) added a subscriber: Antonio Vazquez (antoniov).Nov 13 2019, 10:27 AM

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

Antonio Vazquez (antoniov) added a comment.Nov 13 2019, 10:34 AM

@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) added a comment.Nov 13 2019, 10:40 AM
In T71533#810151, @Antonio Vazquez (antoniov) wrote:

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

Antonio Vazquez (antoniov) added a comment.Nov 13 2019, 10:41 AM

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

Antonio Vazquez (antoniov) added a comment.Nov 13 2019, 10:44 AM

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)
Aleksandr (viadvena) added a comment.Nov 13 2019, 10:57 AM
In T71533#810159, @Antonio Vazquez (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.

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

Antonio Vazquez (antoniov) added a comment.Nov 13 2019, 11:14 AM

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

Philipp Oeser (lichtwerk) added a comment.Nov 13 2019, 11:59 AM
In T71533#810175, @Antonio Vazquez (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.
@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...]

Philipp Oeser (lichtwerk) closed this task as a duplicate of T63707: Grease pencil attributes added to regular material.Nov 13 2019, 11:59 AM
Philipp Oeser (lichtwerk) mentioned this in T63707: Grease pencil attributes added to regular material.
Yianni Papazis (YianniP) added a subscriber: Yianni Papazis (YianniP).Dec 15 2019, 5:54 AM
This comment was removed by Yianni Papazis (YianniP).