Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: ci

on:
push:
branches:
- main

pull_request:
types:
- opened
- reopened
- synchronize

jobs:
lint_test:
name: Lint & Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7

- name: Install Dependencies
run: uv sync --frozen

- name: Lint
run: uv run --frozen ruff check .

# - name: Test
# TODO everything after pytest might not be needed
# run: uv run --frozen pytest tests --cov=src --cov-branch --cov-fail-under=100

build_release:
name: Build Release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'NO RELEASE')

needs: lint_test

permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Increment Version
uses: automas-dev/reusable-workflows/increment_version@main
id: version

- name: Install Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version

- name: Install UV
uses: astral-sh/setup-uv@v7

- name: Set Version
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
uv version $VERSION
sed -i "s/DEV_BUILD/${VERSION}/g" src/quickbake/blender_manifest.toml

- name: Create Archive
env:
VERSION: ${{ steps.version.outputs.version }}
working-directory: ./src/quickbake
run: |
zip quickbake-${VERSION}.zip *

- name: Create Release
uses: ncipollo/release-action@v1.14.0
with:
artifacts: src/quickbake/quickbake-${{ steps.version.outputs.version }}.zip
makeLatest: true
generateReleaseNotes: true
tag: ${{ steps.version.outputs.version }}
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"ms-python.python",
"charliermarsh.ruff",
"tamasfe.even-better-toml",
"streetsidesoftware.code-spell-checker",
]
}
14 changes: 9 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"python.autoComplete.extraPaths": [
"/usr/share/blender/3.6/scripts/modules"
"python.testing.pytestArgs": [
"tests",
"--cov=src",
"--cov=branch"
],
"python.analysis.extraPaths": [
"/usr/share/blender/3.6/scripts/modules"
]
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

setup:
uv sync

checks: lint test

lint:
uv run ruff check .

format:
uv run ruff check --fix .

test:
uv run pytest

.PHONY: setup install checks lint format test
43 changes: 43 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[project]
name = "quickbake"
version = "0.1.0"
description = "Fast baking for blender"
readme = "README.md"
authors = [{ name = "Thomas Harrison", email = "theharrisoncrafter@gmail.com" }]
requires-python = ">=3.12"
dependencies = []

[build-system]
requires = ["uv_build>=0.9.27,<0.10.0"]
build-backend = "uv_build"

[dependency-groups]
dev = [
"coverage>=7.13.2",
"fake-bpy-module>=20260128",
"pytest>=9.0.2",
"pytest-cov>=7.0.0",
"ruff>=0.14.14",
]

[tool.ruff.lint]
extend-select = ["I"]
ignore = ["F401"]

[tool.ruff.format]
quote-style = "single"

[tool.pytest.ini_options]
pythonpath = ["src"]
addopts = "--cov=src --cov-branch --cov-fail-under=100"

[tool.coverage.run]
branch = false
source = ["src"]

[tool.coverage.paths]
source = ["src"]

[tool.coverage.report]
show_missing = true
fail_under = 100
18 changes: 4 additions & 14 deletions __init__.py → src/quickbake/__init__.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
import bpy

from .properties import QuickBakeToolPropertyGroup
from .op import QuickBake_OT_bake
from .panel import QuickBake_PT_main

bl_info = {
"name": "Quick Bake",
"author": "Thomas Harrison",
"description": "",
"blender": (2, 80, 0),
"version": (0, 0, 1),
"location": "",
"warning": "",
"category": "Render"
}
from .properties import QuickBakeToolPropertyGroup


def register():
bpy.utils.register_class(QuickBake_OT_bake)
bpy.utils.register_class(QuickBake_PT_main)
bpy.utils.register_class(QuickBakeToolPropertyGroup)
bpy.types.Scene.QuickBakeToolPropertyGroup = bpy.props.PointerProperty(
type=QuickBakeToolPropertyGroup)
type=QuickBakeToolPropertyGroup
)


def unregister():
Expand All @@ -31,5 +21,5 @@ def unregister():
del bpy.types.Scene.QuickBakeToolPropertyGroup


if __name__ == "__main__":
if __name__ == '__main__':
register()
4 changes: 2 additions & 2 deletions bake.py → src/quickbake/bake.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Baking helper functions."""

import bpy

import logging

import bpy

_l = logging.getLogger(__name__)


Expand Down
69 changes: 69 additions & 0 deletions src/quickbake/blender_manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
schema_version = "1.0.0"

# Example of manifest file for a Blender extension
# Change the values according to your extension
id = "quickbake"
# the value DEV_BUILD is replaced with the version string by ci
version = "DEV_BUILD"
name = "Quick Bake"
tagline = "Fast baking for blender"
maintainer = "Thomas Harrison <theharrisoncrafter@gmail.com>"
type = "add-on"

# TODO replace with gh pages link
# Optional: link to documentation, support, source files, etc
website = "https://github.com/automas-dev/quickbake/"

# Optional: tag list defined by Blender and server, see:
# https://docs.blender.org/manual/en/dev/advanced/extensions/tags.html
tags = ["3D View", "Bake"]

blender_version_min = "2.28.0"
# # Optional: Blender version that the extension does not support, earlier versions are supported.
# # This can be omitted and defined later on the extensions platform if an issue is found.
# blender_version_max = "5.1.0"

# License conforming to https://spdx.org/licenses/ (use "SPDX: prefix)
# https://docs.blender.org/manual/en/dev/advanced/extensions/licenses.html
license = ["SPDX:GPL-3.0-or-later"]
# # Optional: required by some licenses.
# copyright = [
# "2002-2024 Developer Name",
# "1998 Company Name",
# ]

# # Optional: list of supported platforms. If omitted, the extension will be available in all operating systems.
# platforms = ["windows-x64", "macos-arm64", "linux-x64"]
# # Other supported platforms: "windows-arm64", "macos-x64"

# # Optional: bundle 3rd party Python modules.
# # https://docs.blender.org/manual/en/dev/advanced/extensions/python_wheels.html
# wheels = [
# "./wheels/hexdump-3.3-py3-none-any.whl",
# "./wheels/jsmin-3.0.1-py3-none-any.whl",
# ]

# Optional: add-ons can list which resources they will require:
# * files (for access of any filesystem operations)
# * network (for internet access)
# * clipboard (to read and/or write the system clipboard)
# * camera (to capture photos and videos)
# * microphone (to capture audio)
#
# If using network, remember to also check `bpy.app.online_access`
# https://docs.blender.org/manual/en/dev/advanced/extensions/addons.html#internet-access
#
# For each permission it is important to also specify the reason why it is required.
# Keep this a single short sentence without a period (.) at the end.
# For longer explanations use the documentation or detail page.

[permissions]
files = "Export baked texture images to disk"
clipboard = "Copy and paste bone transforms"

# Optional: advanced build settings.
# https://docs.blender.org/manual/en/dev/advanced/extensions/command_line_arguments.html#command-line-args-extension-build
[build]
# These are the default build excluded patterns.
# You only need to edit them if you want different options.
paths_exclude_pattern = ["__pycache__/", "/.git/", "/*.zip"]
4 changes: 2 additions & 2 deletions material.py → src/quickbake/material.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Material helper functions."""

import logging

import bpy
from bpy_extras.node_shader_utils import PrincipledBSDFWrapper

import logging

_l = logging.getLogger(__name__)


Expand Down
Loading