save_as_mainfile loses mesh datablock when issued in a pre-render event #32734
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#32734
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?
%%%Hi All,
Using Windows XP64 Blender 26.4 RC2 r50890 64bit.
I am working on a way to use the blenderplayer as an alternate render engine.
The blendplayer only reads BLEND file.
The only way to make a BLEND file is with Blender.
The blendplayer will not render an extruded font objects but it will render mesh objects so I wrote a convert script.
Font->Mesh and placed it in the pre_render event.
When a Render is issued via F12 the code converts a Font object to a Mesh object.
A new object is then created as a type mesh with the new mesh datablock, and linked to the scene.
The old Font object is unlinked from the scene.
So I have swapped one object for another in a pre_render event.
At this point my scene is exactly as I want it, my Font object is a mesh object that the blenderplayer will be able to display for screenshot rendering.
I issue a bpy.ops.wm.save_as_mainfile(filepath=render_filename, check_existing=False, copy=True) with render_filename being a valid file name.
The new BLEND file appears on the disk at the location.
But when I open the new BLEND file instead of the expected mesh object I see an Empty. There is a data lost message in the console after the scene loads.
It seems to me that the save_as_main file detected my new object creation, but not the mesh datablock. Because it lost the data it created an Empty.
Kind of weird.
I have setup the above described workflow as a self registering script in the attached BLEND file.
Open the BLEND file and press F12.
Look in the console.
Open the resulting file to see the Empty instead of the mesh.
Also, when you press F12 observe the outliner and you will see that, for a moment, the Font object is converted to a Mesh object icon.%%%
Changed status to: 'Open'
%%%Fix in svn, thanks for the report.%%%
Changed status from 'Open' to: 'Resolved'
Added subscriber: @JonasEschenburg