Grease pencil blank material slot #62384

Closed
opened 2019-03-09 08:48:21 +01:00 by Hanafi A. Hassan · 25 comments

System Information
Operating system: Windows 10 (64 bit) OS build 17134.591
Graphics card: Graphics Chipset AMD Radeon(TM) R4 Graphics

Blender Version
Broken: Blender 2.80 Beta Windows 64 bit March 09, 01:09:33 - a0f2923fd8

Short description of error
1# Pen settings and material properties tabs disappeared
Blender 2.8 Glitch-1.png
2# An anonymous blank material comes out
Blender 2.8 Glitch-2.png

Exact steps for others to reproduce the error
From 2D animation default file, switch fill tool to draw tool and the pen properties will disappear. It'll only reappear once again when I reopen the .blend file.Anime-8.blend

**System Information** Operating system: Windows 10 (64 bit) OS build 17134.591 Graphics card: Graphics Chipset AMD Radeon(TM) R4 Graphics **Blender Version** Broken: Blender 2.80 Beta Windows 64 bit March 09, 01:09:33 - a0f2923fd821 **Short description of error** **1#** Pen settings and material properties tabs disappeared ![Blender 2.8 Glitch-1.png](https://archive.blender.org/developer/F6788919/Blender_2.8_Glitch-1.png) **2#** An anonymous blank material comes out ![Blender 2.8 Glitch-2.png](https://archive.blender.org/developer/F6788922/Blender_2.8_Glitch-2.png) **Exact steps for others to reproduce the error** From 2D animation default file, switch fill tool to draw tool and the pen properties will disappear. It'll only reappear once again when I reopen the .blend file.[Anime-8.blend](https://archive.blender.org/developer/F6789079/Anime-8.blend)

Added subscriber: @HanafiHikari

Added subscriber: @HanafiHikari

Added subscriber: @ZedDB

Added subscriber: @ZedDB

In the future, please only report one issue per ticket.

In this case the first issue is a duplicate, so no need to report it again: #59445

I can see the second issue in your file, but you do not describe how you got it in the first place.
If I open up the default 2D animation file, that blank material is not there.

How did you managed to get the blank material?

In the future, please only report one issue per ticket. In this case the first issue is a duplicate, so no need to report it again: #59445 I can see the second issue in your file, but you do not describe how you got it in the first place. If I open up the default 2D animation file, that blank material is not there. How did you managed to get the blank material?

@ZedDB I don't know exactly. But I am filling colour to my art and play around with the "Grey" and "Red" materials properties and press "+" button to add another material then weirdly it occurs.

@ZedDB I don't know exactly. But I am filling colour to my art and play around with the "Grey" and "Red" materials properties and press "+" button to add another material then weirdly it occurs.

@HanafiHikari could you provide a step by step guide?

Like this:

  1. Open the default 2D animation file
  2. Draw a stroke
  3. Change the material color
  4. Add a new material with the + button
  5. Notice that a empty material is added
@HanafiHikari could you provide a step by step guide? Like this: 1. Open the default 2D animation file 2. Draw a stroke 3. Change the material color 4. Add a new material with the `+` button 5. Notice that a empty material is added

@ZedDB No. It just appear randomly.

@ZedDB No. It just appear randomly.

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Please check ba4d07cc5c to see if it fixed the material issue.

Please check ba4d07cc5c to see if it fixed the material issue.

Added subscriber: @capnm

Added subscriber: @capnm

Please check ba4d07cc5c to see if it fixed the material issue.

Fixed the "hidden" problem for me, but it (not sure if it was caused by your commit) behaves weird:
Step by step repro:

  • File -> Load Factory Settings
  • File -> New -> 2D Animation
  • with the already selected 'Black' material click at the 'Add a new material' button, 'Black.001' appears in-place of 'Black'
    image.png
    image.png
  • draw a line
  • by hovering the pointer over the material panel the old material 'Black' magically appears
    in a new slot at the bottom of the slot list:
    image.png
> Please check ba4d07cc5c to see if it fixed the material issue. Fixed the "hidden" problem for me, but it (not sure if it was caused by your commit) behaves weird: Step by step repro: * File -> Load Factory Settings * File -> New -> 2D Animation * with the already selected 'Black' material click at the 'Add a new material' button, 'Black.001' appears in-place of 'Black' ![image.png](https://archive.blender.org/developer/F6791501/image.png) ![image.png](https://archive.blender.org/developer/F6791566/image.png) * draw a line * by hovering the pointer over the material panel **the old material 'Black' magically appears** in a new slot at the bottom of the slot list: ![image.png](https://archive.blender.org/developer/F6791067/image.png)

Added subscriber: @antoniov

Added subscriber: @antoniov

No, it's not magic.... I guess the current brush has assigned the "old" material, so when you draw a new stroke with this brush, the system check if the material is assigned to the objet, and add it if necessary.

Verify what material are you using in the current brush and verify also if the material is pinned to the brush.

No, it's not magic.... I guess the current brush has assigned the "old" material, so when you draw a new stroke with this brush, the system check if the material is assigned to the objet, and add it if necessary. Verify what material are you using in the current brush and verify also if the material is pinned to the brush.

Verify what material are you using in the current brush and verify also if the material is pinned to the brush.

It feels magic ;-)
I wrote the minimal example repro with a start from the factory settings, so you can verify everything yourself.
I believe the material setting is currently weird/broken. See e.g. at the 12 in the screenshot …

> Verify what material are you using in the current brush and verify also if the material is pinned to the brush. It feels magic ;-) I wrote the minimal example repro with a start from the factory settings, so you can verify everything yourself. I believe the material setting is currently weird/broken. See e.g. at the 12 in the screenshot …

Added subscriber: @matc

Added subscriber: @matc

The 'Add a new material' button in theory is a 'Replace with duplicate' button.

The 12 is likely caused by loading the .blend file. I can reproduce this with Grease Pencil -> Blank.

Here is one possible solution. Keeping the 'magic' in sync with the properties panel (immediately, instead of after the next stroke):

diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index d1bed15872d..c622d850e07 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -530,6 +530,13 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
 		Material *new_ma = NULL;
 		BKE_id_copy_ex(bmain, &ma->id, (ID **)&new_ma, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_ACTIONS);
 		ma = new_ma;
+
+		if (ob != NULL && ob->type == OB_GPENCIL) {
+			assign_material(CTX_data_main(C), ob, new_ma, *give_totcolp(ob) + 1, 0);
+
+			WM_event_add_notifier(C, NC_MATERIAL | NA_ADDED, new_ma);
+			return OPERATOR_FINISHED;
+		}
 	}
 	else {
 		const char *name = DATA_("Material");

Another solution is to replicate the behviour of other objects.

diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index d1bed15872d..03a54e1c40b 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -60,6 +60,7 @@
 - include "BKE_texture.h"
 - include "BKE_workspace.h"
 #include "BKE_world.h"
+#include "BKE_brush.h"
 
 - include "DEG_depsgraph.h"
 - include "DEG_depsgraph_build.h"
@@ -530,6 +531,10 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
 		Material *new_ma = NULL;
 		BKE_id_copy_ex(bmain, &ma->id, (ID **)&new_ma, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_ACTIONS);
 		ma = new_ma;
+
+		if (ob != NULL && ob->type == OB_GPENCIL) {
+			BKE_brush_update_material(bmain, new_ma, NULL);
+		}
 	}
 	else {
 		const char *name = DATA_("Material");

I don't really know which one is the intended behaviour.

The 'Add a new material' button in theory is a 'Replace with duplicate' button. The 12 is likely caused by loading the .blend file. I can reproduce this with Grease Pencil -> Blank. Here is one possible solution. Keeping the 'magic' in sync with the properties panel (immediately, instead of after the next stroke): ``` diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index d1bed15872d..c622d850e07 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -530,6 +530,13 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) Material *new_ma = NULL; BKE_id_copy_ex(bmain, &ma->id, (ID **)&new_ma, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_ACTIONS); ma = new_ma; + + if (ob != NULL && ob->type == OB_GPENCIL) { + assign_material(CTX_data_main(C), ob, new_ma, *give_totcolp(ob) + 1, 0); + + WM_event_add_notifier(C, NC_MATERIAL | NA_ADDED, new_ma); + return OPERATOR_FINISHED; + } } else { const char *name = DATA_("Material"); ``` Another solution is to replicate the behviour of other objects. ``` diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index d1bed15872d..03a54e1c40b 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -60,6 +60,7 @@ - include "BKE_texture.h" - include "BKE_workspace.h" #include "BKE_world.h" +#include "BKE_brush.h" - include "DEG_depsgraph.h" - include "DEG_depsgraph_build.h" @@ -530,6 +531,10 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) Material *new_ma = NULL; BKE_id_copy_ex(bmain, &ma->id, (ID **)&new_ma, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_ACTIONS); ma = new_ma; + + if (ob != NULL && ob->type == OB_GPENCIL) { + BKE_brush_update_material(bmain, new_ma, NULL); + } } else { const char *name = DATA_("Material"); ``` I don't really know which one is the intended behaviour.

Edit:
Now I think the new material copy should be placed in a new slot. Without the material brush pin also set as current?

Is the pin option intentionally not present in the active tool settings?
Brush switching via the active tool settings is also not synchronized properly with the top bar. The brush name in top bar changes only after drawing in the viewport.

If you don't look at or hide the top bar (me), the GP materials panel is currently misleading, sorry for my confusion.

Edit: Now I think the new material copy should be placed in a new slot. Without the material brush pin also set as current? Is the pin option intentionally not present in the active tool settings? Brush switching via the active tool settings is also not synchronized properly with the top bar. The brush name in top bar changes only after drawing in the viewport. If you don't look at or hide the top bar (me), the GP materials panel is currently misleading, sorry for my confusion.

Thanks @matc for your code. I have committed one of your solutions (credits to you). The good one is update the brush using BKE_brush_update.

I have seen there are still some problems with the user number for the autocreated materials. I will take a look on that too.

Thanks @matc for your code. I have committed one of your solutions (credits to you). The good one is update the brush using BKE_brush_update. I have seen there are still some problems with the user number for the autocreated materials. I will take a look on that too.
Antonio Vazquez was assigned by Bastien Montagne 2019-03-12 11:27:25 +01:00

Added subscriber: @mendio

Added subscriber: @mendio

@mendio Can you verify the template design? it looks there are enough screen space in the example above.

@mendio Can you verify the template design? it looks there are enough screen space in the example above.

Removed subscriber: @matc

Removed subscriber: @matc
Brecht Van Lommel changed title from 2D workspace Bugs to Grease pencil blank material slot 2019-06-17 12:37:03 +02:00

In #62384#638303, @antoniov wrote:
@mendio Can you verify the template design? it looks there are enough screen space in the example above.

The screenshots I see in this task are frome the old 2D animation template @antoniov , what do you want me to check?

> In #62384#638303, @antoniov wrote: > @mendio Can you verify the template design? it looks there are enough screen space in the example above. The screenshots I see in this task are frome the old 2D animation template @antoniov , what do you want me to check?

Added subscriber: @brecht

Added subscriber: @brecht

I don't think there's anything to do regarding bug #1 and the template anymore.

I just renamed the report to try to make it clear this is only about #2 now, some issue with empty material slots.

I don't think there's anything to do regarding bug #1 and the template anymore. I just renamed the report to try to make it clear this is only about #2 now, some issue with empty material slots.

This issue was referenced by b46c21364a

This issue was referenced by b46c21364ada2c1559524e57a136a031c937ce0a

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' 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
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
9 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#62384
No description provided.