I want to write a script that combines all geometry in one collection into a single (separate) object. With all modifiers applied. I got most of it working but since I’m using geometry nodes to set UV coordinates in some of them, I need to convert the UVMap attribute beforehand for the joining to work properly.
Now the problem is everytime I call
bpy.ops.geometry.attribute_convert(mode='UV_MAP')
It says invalid context (or something like that)
I tried overriding object, active_object, selected_object and selected_editable_objects with the object(s) I that had the operator applied
First I thought it was because I was using evaluated meshes (which seem to play by their own rules, but even mesh_from_object (or whatever it’s called) didn’t help it
bpy.opsare for interactive use through the UI and should be avoided in scripts because they depend on context. Using them through scripts may yield unexpected results at best, or fail entirely at worst. Manipulate data directly frombpy.datainstead. – Duarte Farrajota Ramos Jul 18 '22 at 08:59new_obj = obj.copy()rather thanbpy.ops.object.duplicate(). – Jakemoyo Jul 18 '22 at 15:44