I am trying to convert all the curves in a blendfile to meshes - like this, as explained here:
import bpy
for obj in [ obj for obj in bpy.data.objects ]:
if obj.type == "CURVE":
print(obj, obj.type, obj.parent.type)
print([ o.type for o in getChildren(obj.parent) ])
dg = bpy.context.evaluated_depsgraph_get()
obj = dg.objects.get(obj.name)
me = obj.to_mesh()
print(len(me.vertices))
try:
o = bpy.data.objects.new(obj.name + "Mesh", me)
except Exception as e:
print(e)
However it throws an error:
Error: Can not create object in main database with an evaluated data data-block
I've also tried using:
obj = obj.evaluated_get(dg)
like explained here but this fails too.
What am I doing wrong?
obj
both as the loop variable and as a variable within the loop. Try changing the internal name to something else. $\endgroup$