Skip to content

Commit 430f695

Browse files
committed
convert to extension
1 parent b1f6ac3 commit 430f695

12 files changed

+44
-140
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ jobs:
66
build:
77
name: "Build"
88
runs-on: ubuntu-latest
9+
container: linuxserver/blender:latest
910
steps:
1011
- uses: actions/checkout@v4
1112
- name: Build add-on
1213
run: |
1314
cp -R addon servo_animation
1415
cp README.md LICENSE servo_animation
15-
zip -r blender_servo_animation_addon servo_animation
16+
blender --command extension build --source-dir addon --output-filepath blender_servo_animation_addon.zip
1617
- name: Archive add-on ZIP
1718
uses: actions/upload-artifact@v4
1819
with:
@@ -40,57 +41,24 @@ jobs:
4041
test:
4142
name: "Test"
4243
needs: build
43-
runs-on: ubuntu-latest
4444
strategy:
4545
fail-fast: false
4646
matrix:
47-
blender:
48-
- {version: "4.2.0", dir: "4.2"}
49-
- {version: "4.3.0", dir: "4.3"}
50-
- {version: "4.3.2", dir: "4.3"}
47+
version:
48+
- "4.2.0"
49+
- "4.3.0"
50+
- "4.3.2"
51+
runs-on: ubuntu-latest
52+
container: linuxserver/blender:${{ matrix.version }}
5153
steps:
5254
- uses: actions/checkout@v4
53-
- name: Set up Python
54-
uses: actions/setup-python@v5
55-
with:
56-
python-version: "3.10"
57-
cache: "pip"
58-
- name: Install dependencies
59-
run: |
60-
sudo apt-get update
61-
sudo apt-get install --no-install-recommends -y unzip wget xz-utils libxi6 libxxf86vm1 libxfixes3 libxrender1 libgl1
62-
- name: Restore Blender cache
63-
id: restore-blender-cache
64-
uses: actions/cache/restore@v4
65-
with:
66-
path: blender-${{ matrix.blender.version }}
67-
key: blender-${{ matrix.blender.version }}
68-
- name: Download Blender
69-
if: steps.restore-blender-cache.outputs.cache-hit != 'true'
70-
run: |
71-
python -m pip install --upgrade pip
72-
pip install blender-downloader
73-
blender-downloader ${{ matrix.blender.version }}
74-
mkdir -p blender-${{ matrix.blender.version }}
75-
tar xf *.tar.xz -C blender-${{ matrix.blender.version }} --strip-components 1
76-
- name: Cache Blender
77-
uses: actions/cache/save@v4
78-
if: steps.restore-blender-cache.outputs.cache-hit != 'true'
79-
with:
80-
path: blender-${{ matrix.blender.version }}
81-
key: blender-${{ matrix.blender.version }}
82-
- name: Create Blender symlink
83-
run: |
84-
sudo ln -s "$(pwd)/blender-${{ matrix.blender.version }}/blender" /usr/bin/blender
8555
- name: Download add-on
8656
uses: actions/download-artifact@v4
8757
with:
8858
name: blender_servo_animation_addon.zip
89-
- name: Install add-on
59+
- name: Install add-on and dependencies
9060
run: |
91-
unzip blender_servo_animation_addon.zip
92-
sudo ln -s "$(pwd)/servo_animation" "$(pwd)/blender-${{ matrix.blender.version }}/${{ matrix.blender.dir }}/scripts/addons/servo_animation"
61+
./tests/prepare.sh
9362
- name: Run tests inside Blender
9463
run: |
95-
./tests/prepare.sh
9664
./tests/test.sh

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ __pycache__
22
.vscode/*
33
!.vscode/settings.json
44
*.blend1
5-
tests/results.txt
5+
tests/results.txt
6+
*.zip

addon/__init__.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,9 @@
88
from .ops.arduino_export import ArduinoExport
99
from .ops.binary_export import BinaryExport
1010
from .ops.stop_live_mode import StopLiveMode
11-
from .ops.install_dependencies import InstallDependencies
1211
from .ops.start_live_mode import StartLiveMode
1312
from .ops.calibrate_servo import CalibrateServo
1413

15-
bl_info = {
16-
"name": "Export Animation as Servo Position Values",
17-
"author": "Tim Hendriks",
18-
"version": (1, 4, 0),
19-
"blender": (2, 90, 0),
20-
"location": "Bone Properties > Servo Settings | File > Import-Export",
21-
"description": "Exports armature animations as servo position values.",
22-
"warning": "",
23-
"doc_url": "https://github.com/timhendriks93/blender-servo-animation#readme",
24-
"support": "COMMUNITY",
25-
"category": "Import-Export",
26-
}
27-
2814

2915
classes = (
3016
BonePropertyGroup,
@@ -36,7 +22,6 @@
3622
BinaryExport,
3723
StopLiveMode,
3824
StartLiveMode,
39-
InstallDependencies,
4025
CalibrateServo
4126
)
4227

addon/blender_manifest.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
schema_version = "1.0.0"
2+
3+
id = "servo_animation"
4+
version = "2.0.0"
5+
name = "Servo Animation"
6+
tagline = "Export your Blender animation to servo position values"
7+
maintainer = "Tim Hendriks <admin@tim-hendriks.com>"
8+
type = "add-on"
9+
10+
website = "https://github.com/timhendriks93/blender-servo-animation"
11+
12+
tags = ["Animation", "Import-Export", "Rigging"]
13+
14+
blender_version_min = "4.2.0"
15+
16+
license = [
17+
"SPDX:GPL-3.0-or-later",
18+
]
19+
20+
wheels = [
21+
"./wheels/pyserial-3.5-py2.py3-none-any.whl",
22+
"./wheels/websocket_client-1.5.1-py3-none-any.whl",
23+
]
24+
25+
files = "Export animation servo position values to disk"

addon/ops/install_dependencies.py

Lines changed: 0 additions & 65 deletions
This file was deleted.

addon/ops/start_live_mode.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from bpy.types import Operator
66
from ..utils.live_mode import LiveMode
7-
from ..ops.install_dependencies import InstallDependencies
87

98

109
class StartLiveMode(Operator):
@@ -32,8 +31,7 @@ def poll(cls, context):
3231
servo_animation = context.window_manager.servo_animation
3332

3433
return (
35-
InstallDependencies.installed()
36-
and not LiveMode.is_connected()
34+
not LiveMode.is_connected()
3735
and (
3836
(
3937
servo_animation.live_mode_method == LiveMode.METHOD_SERIAL

addon/requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

addon/ui/menu_panel.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from ..ops.arduino_export import ArduinoExport
44
from ..ops.binary_export import BinaryExport
55
from ..ops.stop_live_mode import StopLiveMode
6-
from ..ops.install_dependencies import InstallDependencies
76
from ..ops.start_live_mode import StartLiveMode
87
from ..utils.live_mode import LiveMode
98

@@ -22,10 +21,7 @@ def draw(self, context):
2221
col = layout.column()
2322
col.label(text="Live Mode")
2423

25-
if InstallDependencies.installed():
26-
self.draw_live_mode(context, layout, col)
27-
else:
28-
self.draw_live_mode_deps(col)
24+
self.draw_live_mode(context, layout, col)
2925

3026
col = layout.column(align=True)
3127
col.label(text="Export")
@@ -63,8 +59,3 @@ def draw_live_mode(cls, context, layout, col):
6359

6460
col = layout.column()
6561
col.prop(servo_animation, "position_jump_handling")
66-
67-
@classmethod
68-
def draw_live_mode_deps(cls, col):
69-
col.label(text="You are missing dependencies", icon="ERROR")
70-
col.operator(InstallDependencies.bl_idname, text="Install dependencies")
88.5 KB
Binary file not shown.
Binary file not shown.

requirements-dev.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
parameterized
2-
pyserial
3-
websocket-client
42
websockets

tests/prepare.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ def install_dependencies():
2525

2626
subprocess.run([python, "-m", "pip", "install", "-r", req_file], check=True)
2727

28+
def install_addon():
29+
bpy.ops.preferences.addon_install(filepath="blender_servo_animation_addon.zip", overwrite=True)
30+
bpy.ops.preferences.addon_enable(module="servo_animation")
31+
2832
if __name__ == "__main__":
2933
ensure_pip()
34+
install_addon()
3035
install_dependencies()

0 commit comments

Comments
 (0)