Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesh cannot be removed from main database #35

Open
BTOdell opened this issue Jan 26, 2022 · 0 comments
Open

Mesh cannot be removed from main database #35

BTOdell opened this issue Jan 26, 2022 · 0 comments

Comments

@BTOdell
Copy link

BTOdell commented Jan 26, 2022

Python: Traceback (most recent call last):
  File "C:\Users\xxx\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\io_scene_cod\__init__.py", line 610, in execute
    result = export_xmodel.save(self, context,
  File "C:\Users\xxx\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\io_scene_cod\export_xmodel.py", line 394, in save
    result = save_model(self, context, filepath,
  File "C:\Users\xxx\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\io_scene_cod\export_xmodel.py", line 602, in save_model
    mesh.clear()
  File "C:\Users\xxx\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\io_scene_cod\export_xmodel.py", line 205, in clear
    bpy.data.meshes.remove(self.mesh)
RuntimeError: Error: Mesh 'MyMesh' is outside of main database and can not be removed from it

I believe this is due to the new way that a mesh is generated from objects:

depsgraph = context.evaluated_depsgraph_get()
mesh = ob.evaluated_get(depsgraph).to_mesh()

According to the documentation of to_mesh():

Create a Mesh data-block from the current state of the object.
The object owns the data-block. To force free it use to_mesh_clear().
The result is temporary and can not be used by objects from the main database.
BTOdell added a commit to BTOdell/blender-cod that referenced this issue Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant