Home

Awesome

Plugget Qt Blender addon

A Blender add-on that adds plugget qt to the menu: Window/Plugget Qt Manager, and offers an easy installer for plugget in Blender

image<br> Dark ui is auto applied in Blender due to the qt stylesheet

Use

Installation

Blender install script (recommended)

# ===================== install plugget =================================
from pip._vendor import requests
import zipfile
import os
import io
import shutil
import tempfile
import bpy
from pathlib import Path
import sys

def download_github_repo(repo_url, extract_to):
    # Construct the URL to the zip file
    if repo_url.endswith('/'):
        repo_url = repo_url[:-1]
    zip_url = f"{repo_url}/archive/refs/heads/main.zip"

    # Send a request to the URL
    response = requests.get(zip_url)
    if response.status_code == 200:
        print(f"Successfully downloaded {zip_url}")
    else:
        print(f"Failed to download {zip_url}")
        return

    with tempfile.TemporaryDirectory() as temp_dir:
        # Extract the content of the zip file to the temporary directory
        with zipfile.ZipFile(io.BytesIO(response.content)) as zip_file:
            zip_file.extractall(path=temp_dir)
            print(f"Repository extracted to temporary directory {temp_dir}")

        extracted_folder_name = os.path.join(temp_dir, "plugget-main")
        plugget_folder_path = os.path.join(extracted_folder_name, "plugget")

        # Move 'plugget' directory to the final destination
        final_destination_path = os.path.join(extract_to, "plugget")
        if os.path.exists(final_destination_path):
            shutil.rmtree(final_destination_path)  # Remove if exists
        else:
            # create parent folder if it doesn't exist
            Path(final_destination_path).parent.mkdir(parents=True, exist_ok=True)
            
        shutil.move(plugget_folder_path, extract_to)
        print(f"Moved 'plugget' to {final_destination_path}")
        
        # add to path, since some apps dont do this by default
        sys.path.append(extract_to)

default_target_path = str(Path(str(bpy.utils.script_path_user())) / "modules")
repo_url = "https://github.com/plugget/plugget"
try:
    import plugget
except ImportError:
    download_github_repo(repo_url, default_target_path)

# ===================== install dependencies =================================
import plugget._utils  
plugget._utils.install_plugget_dependencies(app="blender")

# ===================== install plugget addon =================================
plugget.install("bqt")
plugget.install("plugget-qt-addon")

Blender install file (recommended)

You can also run the script yourself instead:

<details> <summary><h3>Other installation methods</h3></summary>

Plugget install

If you already have plugget installed, you can plugget-install this addon by name plugget-qt-addon

import plugget
plugget.install("plugget-qt-addon")

Manual install

local editable install

Great for development.

  1. Install the add-on without dependencies to addon folder
  1. Install the plugget-qt pip dependency to the modules folder
  1. start blender, and on every startup you need to add the modules path to site packages.
import site, os
blender_scripts_path = os.path.join(os.path.expanduser("~"), "AppData", "Roaming", "Blender Foundation", "Blender", "3.2", "scripts", "addons")  # Windows OS example
site.addsitedir(blender_scripts_path)
</details>

requirements

custom menu

The add-on launches plugget_qt like this:

import plugget_qt
plugget_qt.show()

If you already have an add-on or script, to manage your menu and tools, you can skip this add-on and launch the widget with above code. (I recommend the menu manager unimenu)

support