Adding Grease Pencil Monkey Object crashes Blender if Link Material is set to Object in User Preferences #56220
Labels
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#56220
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Windows 10, Quadro 4000
Blender Version
Broken: 2.8, Hash
3eab49dd36
Worked: unknown
When you set the Material Link to Object in the User Preferences, and afterwards try to add the Grease Pencil Monkey Object, Blender crashes with an Access Violation.
Exact steps for others to reproduce the error
Load Factory Settings
Go to Edit -> User Preferences -> Editing
Set Link Materials To to Object
Use Shift + A -> Grease Pencil -> Monkey
Adding a Blank Grease Pencil object works, but misbehaves when drawing strokes. They disappear immediately after drawing.
Added subscriber: @RainerTrummer
Added subscriber: @s12a
I can confirm the crash with
e1a6861987
and debug build under:Attaching console output and backtrace.
blender.crash.txt
console_output.txt
Added subscriber: @JoshuaLeung
@JoshuaLeung Could you take a look on this? You know better than me how works this and I'm not sure I understand the internal working of link material to object.
@JoshuaLeung Doing debug I have found the Material ***matar = give_matarar(ob); line returns NULL when is Object mode.
I know there is a copy between ob->mat and ob->data->mat but for some reason when the object is GPENCIL and mode is Object this copy is not working. Do you know where is this code?
Added subscriber: @mont29
@mont29 Could you give me any idea here? I don't know where look. It must be something I forgot, but I don't know what.
@antoniov Just seen from a user perspective, maybe it‘s not even needed to have the option Link To Object available for Grease Pencil objects. It makes a lot of sense for mesh objects, as it allows instances to receive different materials, but for Grease Pencil strokes this might be overkill. What do you think? Should Grease Pencil simply ignore that setting in the User Preferences?
Added subscriber: @brecht
I don't see a good reason to make an exception for grease pencil here, we should just fix the bug.
@antoniov, there is a synchronization between objects and data to ensure their material array size is the same. However the actual pointers to the material are not copied, so the material pointer in the object data material array can (and should) be
NULL
in this case.I suggest to use
give_current_material()
to retrieve the material in the loop where this crashes, so that it automatically gets you the material from the object or its data as needed, instead of usinggive_matarar()
.@brecht Thanks for the info, I going to try to fix it. And agree, why have an exception here?
@brecht Using give_current_material() fix the bug, but I have a new problem now, using BKE_object_material_slot_find_index(ob, ma) always returns 0, but when the material is at data level returns the right index. What I'm doing wrong?
I have checked and the materials are added to objects and the object materials mode is enabled.
Don't worry I have found the solution
Ok, I was just going to say
BKE_object_material_slot_find_index
seems to be only used by grease pencil, it should usegive_current_material()
as well.This issue was referenced by
5c4fd52612
Changed status from 'Open' to: 'Resolved'