Skip to content

VS code extension that provides autocompletion and go to definition for Blender operator strings

Notifications You must be signed in to change notification settings

Mateusz-Grzelinski/blender-operator-complete

Repository files navigation

Status: In early development. Unpublished. Expect bugs.

Autocomplete blender operators for VS Code

In Blender addons, we often use pure strings to call operators from UI. This addon provides autocompletion for those strings.

Autocompletion is triggered if word operator is present in current line, or line above in .py files.

import bpy

class HelloWorldPanel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        self.layout.operator("mesh.primitive_cube_add") # autocompletes this string

bpy.utils.register_class(HelloWorldPanel)

I hope to merge this addon Blender Development, but for now I am learning how to write VS addons with TypeScript.

Installation

The extension is installed like any other extension in Visual Studio Code.

Features

  • settings: set path to Blender executable
  • autocomplete string with blender operators
    • get and cache list of operators from Blender
    • manually refresh list of operators
  • optional: go to definition of operator
    • include files in C:\\Program Files\\Blender Foundation\\Blender 2.93\\2.93\\scripts\\startup\\bl_operators
    • include custom addons
    • include operators implemented in C - go to C source code (if provided) or website
  • optional: use language server instead of executing extenal commands
  • add tests

About

VS code extension that provides autocompletion and go to definition for Blender operator strings

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published