constant crashes when assigning evaluated mesh to obj after recent depsgraph changes #64735
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#64735
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
Operating system: Linux-4.13.10-041310-generic-x86_64-with-debian-stretch-sid 64 Bits
Graphics card: GeForce GTX 1050/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 390.67
Blender Version
Broken: version: 2.80 (sub 68), branch: master, commit date: 2019-05-16 18:01, hash:
d726d7e462
Short description of error
I'm trying to apply modifiers of an object, but am getting crashes constantly, when assigning the evaluated mesh to the object's data block.
Exact steps for others to reproduce the error
video demo
Added subscriber: @MACHIN3
Added subscriber: @rlguy
I am also experiencing this issue and am able to reproduce both crashes using the .blend file (Window 10 Home).
Using
active.data = bpy.data.meshes.new_from_object(active_eval)
as mentioend here , seems to work.
Added subscribers: @Sergey, @brecht
@Sergey, we should have a warning similar to #64731 here I think, when assigning an ID to an ID with
LIB_TAG_NO_MAIN
not matching.Changed status from 'Open' to: 'Archived'
As the updated documentation of to_mesh() states: the object is the owner of the result of
to_mesh()
. It is short-living, and can not be referenced by other objects from your file (it can be referenced by a temporary object though).The proper way of achieving your goal is to put mesh to the main database in the following way:
bpy.data.meshes.new_from_object(active_eval)
. Note, that this will also ensure all other pointers in the mesh are valid form within main database (for example, mesh will not reference materials from dependency graph).The entire script becomes this:
I've made this more explicit in the RNA documentation and Python examples in
5186cfbea4
.Would be cool to automatically detect unsupported pointers assignment, but that is a bit tricky. Mainly because a lot of scripts are relying on the possibility to temporarily modify objects in weird and wonderful ways. Maybe @brecht can think of some way improving error reporting for such cases without being too intrusive for the existing scripts?
This exact report i wouldn't consider a bug. Just script code requires a bit tweaking, and after that it is guaranteed to be non-crashing (before the dependency graph changes this script wouldn't immediately, but will create a wrong and corrupted .blend file, due to materials and animation pointing to the IDs from the dependency graph).
Thanks for the report, closing!
Unfortunately, we can not do this easily. There are scripts which are creating temporary objects with mesh pointing to a result of evaluated
to_mesh()
. This is all fine if the object is removed afterwards.If the assignment is based on
LIB_TAG_NO_MAIN
then we would need some way to create out-of-main objects as well.If scripts need to do that, I think they should be using
bpy.data.meshes.new_from_object()
instead?That isn't strictly speaking the same due to material, animation, shape keys pointers. Not sure how much problematic it is in the reality though.
Note: started the patch which is aimed to help preventing unsupported configurations: D4884.
@Sergey Thanks, you've been very helpful. How would you apply mods now, while keeping the materials assigned as they are by mods like bevel for instance. See apply_mods_keep_materials.blend
Is the only solution to first use to_mesh() to check the material indices for each face, and then reapply them accordingly on the mesh created from new_from_object()? Is this what the Apply button in the mod panel does?
@MACHIN3, thanks for the file, saved some time verifying the fix. Committed at
848967c21d
.P.S. Maybe next time open a new report. Much easier to keep a history of changes and references to reports.
Awesome, wasn't sure if it's a bug or intended behavior. And while at it. It also doesn't/didn't preserve
use_auto_smooth
and I assumeauto_smooth_angle
Autosmooth should also be preserved now. Is it still broken for you?
I'm still on the old build. I assume not, if this is the fix:
mesh_in_bmain->smoothresh = mesh->smoothresh;