Skip to content

Commit 86a3659

Browse files
committed
Merge branch 'feature/extension_conversion' into develop
2 parents fd05519 + 04a2af8 commit 86a3659

28 files changed

+217
-323
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 44 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+
./scripts/build.sh
1617
- name: Archive add-on ZIP
1718
uses: actions/upload-artifact@v4
1819
with:
@@ -28,7 +29,6 @@ jobs:
2829
uses: actions/setup-python@v5
2930
with:
3031
python-version: "3.10"
31-
cache: "pip"
3232
- name: Install dependencies
3333
run: |
3434
python -m pip install --upgrade pip
@@ -40,58 +40,27 @@ jobs:
4040
test:
4141
name: "Test"
4242
needs: build
43-
runs-on: ubuntu-latest
4443
strategy:
4544
fail-fast: false
4645
matrix:
47-
blender:
48-
- {version: "2.90.0", dir: "2.90"}
49-
- {version: "3.1.0", dir: "3.1"}
50-
- {version: "3.5.0", dir: "3.5"}
51-
- {version: "4.0.0", dir: "4.0"}
46+
version:
47+
- "4.2.0"
48+
- "4.3.0"
49+
- "4.3.2"
50+
runs-on: ubuntu-latest
51+
container: linuxserver/blender:${{ matrix.version }}
5252
steps:
5353
- uses: actions/checkout@v4
54-
- name: Set up Python
55-
uses: actions/setup-python@v5
56-
with:
57-
python-version: "3.10"
58-
cache: "pip"
59-
- name: Install dependencies
60-
run: |
61-
sudo apt-get update
62-
sudo apt-get install --no-install-recommends -y unzip wget xz-utils libxi6 libxxf86vm1 libxfixes3 libxrender1 libgl1
63-
- name: Restore Blender cache
64-
id: restore-blender-cache
65-
uses: actions/cache/restore@v4
66-
with:
67-
path: blender-${{ matrix.blender.version }}
68-
key: blender-${{ matrix.blender.version }}
69-
- name: Download Blender
70-
if: steps.restore-blender-cache.outputs.cache-hit != 'true'
71-
run: |
72-
python -m pip install --upgrade pip
73-
pip install blender-downloader
74-
blender-downloader ${{ matrix.blender.version }}
75-
mkdir -p blender-${{ matrix.blender.version }}
76-
tar xf *.tar.xz -C blender-${{ matrix.blender.version }} --strip-components 1
77-
- name: Cache Blender
78-
uses: actions/cache/save@v4
79-
if: steps.restore-blender-cache.outputs.cache-hit != 'true'
80-
with:
81-
path: blender-${{ matrix.blender.version }}
82-
key: blender-${{ matrix.blender.version }}
83-
- name: Create Blender symlink
84-
run: |
85-
sudo ln -s "$(pwd)/blender-${{ matrix.blender.version }}/blender" /usr/bin/blender
8654
- name: Download add-on
8755
uses: actions/download-artifact@v4
8856
with:
8957
name: blender_servo_animation_addon.zip
9058
- name: Install add-on
9159
run: |
92-
unzip blender_servo_animation_addon.zip
93-
sudo ln -s "$(pwd)/servo_animation" "$(pwd)/blender-${{ matrix.blender.version }}/${{ matrix.blender.dir }}/scripts/addons/servo_animation"
60+
./scripts/install.sh
61+
- name: Install test dependencies inside Blender
62+
run: |
63+
./scripts/prepare.sh
9464
- name: Run tests inside Blender
9565
run: |
96-
./tests/prepare.sh
97-
./tests/test.sh
66+
./scripts/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

README.md

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,9 @@ Also check out the [Blender Servo Animation Arduino Library](https://github.com/
1818

1919
## Installation
2020

21-
> Note: this Add-on is compatible with Blender version **2.90 or higher**.
21+
> Note: the latest version of this Add-on is compatible with Blender **4.2 or higher**.
2222
23-
1. Download the [latest version of the Add-on](https://github.com/timhendriks93/blender-servo-animation/releases/latest/download/blender_servo_animation_addon.zip) as a ZIP archive.
24-
2. Open Blender and go to `File > Preferences > Add-ons`.
25-
3. Click the `Install...` button, select the previously downloaded ZIP and click `Install Add-on`.
26-
4. Enable the Add-on by checking the checkbox in the Add-ons list.
27-
28-
More information and screenshots can be found in the official [Blender Manual](https://docs.blender.org/manual/en/latest/editors/preferences/addons.html#add-ons).
23+
The Add-on can be installed as a regular [Blender Extension](https://docs.blender.org/manual/en/latest/editors/preferences/extensions.html).
2924

3025
## Providing Servo Settings
3126

@@ -73,16 +68,19 @@ Once all servo settings are provided and your animation is ready, you can calcul
7368

7469
Make sure to select the armature containing the bones/servos you want to export and choose the desired format in the `File > Export` menu:
7570

76-
![Servo Settings panel](images/export_menu.png)
71+
![Export Menu Top](images/export_menu.png)
72+
73+
Alternatively, you can also trigger the export via the timeline menu which is shown in the live mode section below:
7774

78-
Alternatively, you can also trigger the export via the timeline menu which is shown in the live mode section below.
75+
![Export Menu Timeline](images/timeline_menu.png)
7976

8077
### Export Formats
8178

82-
There are two different formats to choose from:
79+
There are 3 different formats to choose from:
8380

8481
1. `Animation Servo Positions (.h)`: An Arduino/C/C++ style header file which can be easily included in an Arduino project.
8582
2. `Animation Servo Positions (.json)`: A simple (non-formatted) JSON file which can be used in a more generic way.
83+
3. `Animation Servo Positions (.bin)`: A binary file which can be used to store the animation data on an SD card.
8684

8785
### Using the Exported Data
8886

@@ -99,21 +97,13 @@ To make the animation process even more intuitive, you can enable the `Live mode
9997

10098
This will allow you to control your servos in real-time from within Blender.
10199

102-
### Installing dependencies
103-
104-
After enabling the add-on, you can find the `Servo Positions` popover menu in the header of the timeline. Before using the live mode feature of this add-on, you might have to install some Python dependencies first by pressing the `Install dependencies` button. This will automatically install the required `pip` packages and requires an active internet connection. This process can might take a few seconds depending on the speed of your internet connection.
105-
106-
![Install dependencies button](images/live_mode_dependencies.png)
107-
108-
Afterwards you can prepare and control the connection to be used for the `Live mode` via this menu. For additional convenience, you will also find buttons to export the servo positions here.
109-
110100
### Setup a connection
111101

112102
To use the `Live Mode`, you will need to prepare a receiver which will interpret the received commands and use them to control the servo motors accordingly.
113103

114104
In most cases, the receiver can be considered an Arduino compatible micro controller. As a first step, a connection method should be selected via the `Method` dropdown menu.
115105

116-
![Timeline menu](images/timeline_menu.gif)
106+
![Livemode Timeline menu](images/timeline_menu.png)
117107

118108
> Note: starting the `Live Mode` will immediately send the position values for all servos based on the current frame. Make sure that this will not break anything, as the servos will try to move to their new position as fast as possible.
119109

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: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# pylint: disable=import-outside-toplevel
2-
31
import bpy
2+
import serial
3+
import websocket
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
@@ -67,8 +65,6 @@ def execute(self, context):
6765
return {'CANCELLED'}
6866

6967
def open_serial(self, _context):
70-
import serial
71-
7268
try:
7369
serial_connection = serial.Serial(self.serial_port, self.serial_baud)
7470
except (serial.SerialException, ValueError):
@@ -93,8 +89,6 @@ def open_serial(self, _context):
9389
return {'FINISHED'}
9490

9591
def open_socket(self, _context):
96-
import websocket
97-
9892
socket_url = f"ws://{self.socket_host}:{self.socket_port}{self.socket_path}"
9993
socket_connection = websocket.WebSocket()
10094
socket_connection.settimeout(1)

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")

addon/utils/live_mode.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
# pylint: disable=import-outside-toplevel, broad-exception-caught
1+
# pylint: disable=broad-exception-caught
22

33
import time
44
import math
55
import bpy
6+
import serial
7+
import websocket
8+
9+
from serial.tools import list_ports
610

711
from ..utils.servo_settings import get_active_pose_bones
812
from ..utils.converter import calculate_position
@@ -26,9 +30,6 @@ def set_connection(cls, connection):
2630

2731
@classmethod
2832
def is_connected(cls):
29-
import serial
30-
import websocket
31-
3233
method = bpy.context.window_manager.servo_animation.live_mode_method
3334

3435
if method == LiveMode.METHOD_SERIAL:
@@ -63,8 +64,6 @@ def disable_handler(cls):
6364

6465
@classmethod
6566
def get_serial_ports(cls):
66-
from serial.tools import list_ports
67-
6867
ports = []
6968

7069
for port in list_ports.comports():
88.5 KB
Binary file not shown.
Binary file not shown.

examples/IK/ik.blend

32.2 KB
Binary file not shown.

examples/Scenes/scenes.blend

32.5 KB
Binary file not shown.

examples/Simple/simple.bin

0 Bytes
Binary file not shown.

examples/Simple/simple.blend

30.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)