Skip to content

medium-tech/bl-mspec-dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bl-mspec-dev

A Blender addon for MSpec Lingo node-based scripting development.

Overview

This addon provides a custom node tree system for creating and executing Lingo-style scripts within Blender. It features a visual node-based interface that allows users to build computational graphs using various node types including value nodes, operation nodes, and control flow nodes.

Usage

  1. Open Blender and switch to the Node Editor
  2. Change the node tree type to "MSpec Lingo Nodes"
  3. Add nodes using Shift+A or the Add menu
  4. Create test trees using the "Create Test Node Tree" operator
  5. Build your node graphs by connecting nodes together

Development

Activate venv

source .blenv/venv3.11/bin/activate

Run blender app with addon

python -m blenv run

Run blender app tests

python -m blenv run test

Code Style Guidelines

This project follows specific code style preferences to maintain consistency and readability:

Quote Preferences

  • Single quotes (') for string literals
  • Triple double quotes (""") for docstrings only
# Preferred
bl_label = 'My Node'
def my_function():
    """This is a docstring"""
    return 'result'

# Avoid
bl_label = "My Node"
def my_function():
    '''This is a docstring'''
    return "result"

F string quotes

name = 'Brad'
data = {'age': 37}

# for simple f-strings: single quotes
greeting = f'Hello, {name}'

# for complex f-strings: 
#   double quotes to define the f-string, single quotes inside the f-string
msg = f"Brad is {data['age'] years old}"

unused

  • no unused imports
  • no unused variables

Section Headers

Major sections use hash borders:

#
# section name
#

Minor sections use hash suffixes:

# section name #

Descriptive comments are simple:

# example explaining what is going on at this point in the code

Whitespace

  • 2 lines around major section headers and between classes
  • 1 line around minor section headers and between functions
import bpy


#
# value nodes
#


class MyValueNode(Node):
    """Node for handling values"""
    bl_label = 'Value Node'
    
    def init(self, context):
        # Create the output socket
        self.outputs.new('NodeSocketInt', 'value')


class MyOtherValueNode(Node):
    """Node for handling values"""
    bl_label = 'Value Node'
    
    def init(self, context):
        # Create the output socket
        self.outputs.new('NodeSocketInt', 'value')


# helper functions #

def create_default_value():
    # Return a sensible default
    return 42

def create_another_default_value():
    # Return a sensible default
    return 33


#
# registration
#


classes = [
    MyValueNode,
]

About

GUI for developing mspec apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages