JacquesLucke / blender_vscode

Visual Studio Code extension for Blender development.
MIT License
570 stars 75 forks source link

Delete is skipped #68

Closed CarstenHoyer closed 1 year ago

CarstenHoyer commented 4 years ago

This simple script works from Blender (selects everything, deletes everything, inserts a camera), but fails from VS code - in the sense that it does select everything, and it also inserts a camera, but it doesn't perform the delete operation.


import bpy

bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(use_global=False)
bpy.ops.object.camera_add(enter_editmode=False, align='VIEW', location=(55,55,60), rotation=(0,0,0))
CarstenHoyer commented 4 years ago

Here is a workaround:


bpy.ops.object.select_all(action='SELECT')
for obj in bpy.context.selected_objects:
    if obj.type == 'MESH':
      bpy.data.meshes.remove(obj.data)
    bpy.data.objects.remove(obj)    
CGArtPython commented 1 year ago

I am closing this issue. This was resolved with this commit https://github.com/JacquesLucke/blender_vscode/commit/621e275d9000e571f4b4d10cbde7abdd1cf15e0a