Blender addon for executing the operator in response to the received OSC message.

Related tags

MiscellaneousIFJoiner
Overview

I/F Joiner

受信したOSCメッセージに応じてオペレータ(bpy.ops)を実行するアドオンです. OSC通信に対応したコントローラやアプリをインストールしたスマートフォンを使用してBlenderを操作することが可能になります.

同時開発しているAndroidコントローラ化アプリMocopaは当アドオンと併せた使用がおすすめです.

Feature

  • OSCメッセージの受信
  • 受信したOSCメッセージに応じて実行するオペレータの割り当て設定
    • OSCメッセージの引数をオペレータの引数に代入可能
  • 割り当て設定のエクスポートやインポート(JSON形式)
  • Blender 2.8以降に対応
    • Windowsでの使用を推奨します.Macでも動作しますが頻繁にクラッシュするようです.

Install

  1. Releases Pageからzipファイルをダウンロード

  2. Blenderを起動しトップバーから「Edit」→「Preference」を開く

  3. Preferenceウィンドウ左側メニューから「Addon」→ウィンドウ右上「Install」ボタンをクリックしダウンロードしたzipファイルをインストール

  4. 「Community」が選択された状態でInterface: I/F Joinerがアドオンリストに追加されていること確認したら,チェックを入れて有効化する.

How to Use

OSCサーバの起動と停止

アドオンをインストールすると,3DViewのプロパティシェルフに「I/F Joiner」タブが追加されます.

IP AddressにBlenderを起動しているPCのIPアドレス,Port Numberに任意のポート番号を入力し「Start」をクリックしてOSCサーバを起動します.Windowsでは初回起動時にファイアウォールのポップアップが表示されることがあります.その場合は「アクセスを許可する」をクリックしてください.

サーバが起動するとOSCメッセージの受信を開始します.

停止させる際は「Stop」をクリックします

受信したOSCメッセージの確認方法

Windowsの場合

トップバー「Window」→「Toggle System Console」でコマンドプロンプトを開きます. OSCサーバが起動した状態でOSCメッセージを受信するとアドレスパターンと引数がそれぞれ表示されます.

Macの場合

ターミナルからBlenderを起動します.

Blenderがアプリケーションフォルダにインストールされている場合はターミナルに以下を入力してBlenderを起動します.

/Applications/Blender.app/Contents/MacOS/Blender

OSCサーバが起動した状態でOSCメッセージを受信するとアドレスパターンと引数がターミナルにそれぞれ表示されます.

受信したOSCメッセージに対するオペレータの割り当て

  1. I/FJoinerのPreferenceを表示し,Message Mapsの 「Add Message Map」 をクリックして割り当て設定を一つ追加します.

  2. 追加されたボックスの入力欄に機能を割り当てたいメッセージのアドレスパターンを入力します.

  3. 左端の三角形をクリックするとメニューが展開します.「Add」をクリックして実行するオペレータを一つ追加します.

  4. Keymapの設定と同様に,実行するオペレータのIdentifierを入力し指定します. 公式ドキュメントでは各オペレータはbpy.ops.hogehoge()の形で記載されていますが,先頭のbpy.opsと末尾の()を切り取ったhogehogeがIdentifierになります.

    bpy.ops.view3d.toggle_shading(type='WIREFRAME')view3d.toggle_shading

  5. 実行するオペレータの引数を入力します.OSCメッセージに含まれる引数を渡すことが可能です. OSCメッセージに含まれる引数の先頭から順にarg[0], arg[1], arg[2]...でアクセスできます.

    type='HOGEHOGE', value=arg[0]

  6. オペレータを実行する条件を設定します.OSCメッセージに含まれる引数のうち先頭から最大3つまで,何れもFloatの値であり3つの引数全てが最大値・最小値の範囲内にあるとき(min ≦ arg ≦ max)オペレータが実行されます.Event TriggerのMin・Maxに上から引数の順に範囲を入力してください.

Blenderで提供されるオペレータは以下の公式ドキュメントを参照してください.

https://docs.blender.org/api/current/bpy.ops.html

一つのアドレスパターンに対し複数のオペレータを設定することが可能です.実行条件が同一な複数のオペレータを設定した場合は,条件に合致したオペレータがリストの上から順に実行されます.

割り当ての保存と読み込み

Message Mapの割り当てを編集したら,必ず「Save」をクリックしてPreference Fileを保存してください.

また左下ハンバーガーメニューの「Save Preference」でPreference Fileのファイルパスを保存すると,次回起動時は保存したファイルから自動的に設定が読み込まれます.初回起動時は必ず「Save Preference」をクリックしてください.

「Load」からも保存したPreference Fileを読み込めます.バックアップや割り当ての共有に利用できます.

また各Message MapはJSON形式でエクスポート・インポートが可能です.Templateフォルダに割り当てサンプルがあるので「Import Message Map from .json」から読み込んでみてください.

Tips

オペレータの引数に四則計算した値を代入する

オペレータの引数を設定する入力フォーム内で値の四則計算が可能です. OSCメッセージに含まれる引数に対して使うと便利です.

value = arg[0] * 485 + 583

パラメータを変更する

例えばスカルプトブラシの大きさなど,パラメータを変更したい場合はWm Operatorsのbpy.ops.wm.context_set_int()bpy.ops.wm.context.set_float()を使用します.

詳しくは以下の公式ドキュメントを参考にしてください. https://docs.blender.org/api/current/bpy.ops.wm.html

設定例です.

キー入力をシミュレートする

I/F Joinerはキー入力をシミュレートするオペレータを提供します.以下の3つです.

  • ifj.send_key_press(key='keyname')

    • 引数で設定したキーを押します.
  • ifj.send_key_release(key='keyname')

    • 引数で設定したキーを離します.
  • ifj.send_key_press_and_release(key='keyname')

    • 引数で設定したキーを押して離します.

Aキーをシミュレートする設定例です.

オペレータを自作して登録する

Blenderのアドオン保存フォルダ/ifjoiner/custom_operatorsにクラス名がIFJ_から始まるオペレータを書いた.pyファイルを置いておくと自動的に登録されます.

Credits

使用させていただいたライブラリ

参考にさせていただいたアドオン

  • AddRoutes

    OSC通信に加えてMIDI通信も可能なBlenderの各パラメータを操作することができるアドオンです.

参考にさせていただいたサイト

You might also like...
A Blender addon for VSE that auto-adjusts video strip's length, if speed effect is applied.

Blender VSE Speed Adjust Addon When using Video Sequence Editor in Blender, the speed effect strip doesn't auto-adjusts clip length when changing its

Blender addon, import and update mixamo animation

This is a blender addon for import and update mixamo animations.

Blender 2.80+ Timelapse Capture Tool Addon

SimpleTimelapser Blender 2.80+ Timelapse Capture Tool Addon Developed for Blender 3.0.0, tested working on 2.80.0 It's no ZBrush undo history but it's

A Blender addon to enable reloading linked libraries from UI.

library_reload_linked_libraries A Blender addon to enable reloading linked libraries from UI.

Blender addons - A collection of Blender tools I've written for myself over the years.
Blender addons - A collection of Blender tools I've written for myself over the years.

gret A collection of Blender tools I've written for myself over the years. I use these daily so they should be bug-free, mostly. Feel free to take and

Blender-3D-SH-Dma-plugin - Import and export Sonic Heroes Delta Morph animations (.anm) into Blender 3D

io_scene_sonic_heroes_dma This plugin for Blender 3D allows you to import and ex

Blender-miHoYo-Shaders - Shaders for Blender attempting to replicate the shading of games developed by miHoYo
Blender-miHoYo-Shaders - Shaders for Blender attempting to replicate the shading of games developed by miHoYo

Blender-miHoYo-Shaders - Shaders for Blender attempting to replicate the shading of games developed by miHoYo

Using Python to parse through email logs received through several backup systems.

outlook-automated-backup-control Backup monitoring on a mailbox: In this mailbox there will be backup logs. The identification will based on the follo

nbsafety adds a layer of protection to computational notebooks by solving the stale dependency problem when executing cells out-of-order
nbsafety adds a layer of protection to computational notebooks by solving the stale dependency problem when executing cells out-of-order

nbsafety adds a layer of protection to computational notebooks by solving the stale dependency problem when executing cells out-of-order

Releases(v0.01)
Owner
simasimataiyo
simasimataiyo
PBN Obfuscator: A overpowered obfuscator for python, which will help you protect your source code

PBN Obfuscator PBN Obfuscator is a overpowered obfuscator for python, which will

Karim 6 Dec 22, 2022
How to build an Fahrenheit to Celsius Converter in Python

Generally to measure the temperature we make use of one of these two popular units i.e. Fahrenheit & Celsius.

PyLaboratory 0 Feb 07, 2022
Restaurant-finder - Restaurant finder With Python

restaurant-finder APIs /restaurants query-params: a. filter: column based on whi

Kumar saurav 1 Feb 22, 2022
This synchronizes my appearances with my calendar

Josh's Schedule Synchronizer Here's the "problem:" I use a Google Sheets spreadsheet to maintain all my public appearances.

Developer Advocacy 2 Oct 18, 2021
tox-gh is a tox plugin which helps running tox on GitHub Actions with multiple different Python versions on multiple workers in parallel

tox-gh is a tox plugin which helps running tox on GitHub Actions with multiple different Python versions on multiple workers in parallel. This project is inspired by tox-travis.

tox development team 19 Dec 26, 2022
Easy way to build a SaaS application using Python and Dash

EasySaaS This project will be attempt to make a great starting point for your next big business as easy and efficent as possible. This project will cr

xianhu 3 Nov 17, 2022
ToDoListAndroid - To-do list application created using Kivymd

ToDoListAndroid To-do list application created using Kivymd. Version 1.0.0 (1/Jan/2022). Planned to do next: -Add setting (theme selector, etc) -Add f

AghnatHs 1 Jan 01, 2022
A beacon generator using Cobalt Strike and a variety of tools.

Beaconator is an aggressor script for Cobalt Strike used to generate either staged or stageless shellcode and packing the generated shellcode using your tool of choice.

Capt. Meelo 441 Dec 17, 2022
Cloud-native SIEM for intelligent security analytics for your entire enterprise.

Microsoft Sentinel Welcome to the Microsoft Sentinel repository! This repository contains out of the box detections, exploration queries, hunting quer

Microsoft Azure 2.9k Jan 02, 2023
MobaXterm-GenKey

MobaXterm-GenKey 你懂的!! 本地启动 需要安装Python3!!!

malaohu 328 Dec 29, 2022
jmespath.rs Python binding

rjmespath-py jmespath.rs Python binding.

messense 3 Dec 14, 2022
A script to add issues to a project in Github based on label or status.

Add Github Issues to Project (Beta) A python script to move Github issues to a next-gen (beta) Github Project Getting Started These instructions will

Kate Donaldson 3 Jan 16, 2022
En este repositorio pondré archivos graciositos de python que hago de vez en cuando

🐍 Apuntes de python 🐍 ¿Quién soy? 👽 Saludos,mi nombre es Carlos Lara. Pero mi nickname en internet es Hercules Kan. Soy un programador autodidacta

Carlos E. Lara 3 Nov 16, 2021
ARA Records Ansible and makes it easier to understand and troubleshoot.

ARA Records Ansible ARA Records Ansible and makes it easier to understand and troubleshoot. It's another recursive acronym. What it does Simple to ins

Community managed Ansible repositories 1.6k Dec 25, 2022
fast_bss_eval is a fast implementation of the bss_eval metrics for the evaluation of blind source separation.

fast_bss_eval Do you have a zillion BSS audio files to process and it is taking days ? Is your simulation never ending ? Fear no more! fast_bss_eval i

Robin Scheibler 99 Dec 13, 2022
Python programming language Test

Exercise You are tasked with creating a data-processing app that pre-processes and enriches the data coming from crawlers, with the following requirem

Monirul Islam Khan 1 Dec 13, 2021
The calculator on Python.

Calculator Contributors: Delitanast An official website. Information Hello! I am Damir. It`s my first Python project. I think you want see this. I imp

3 Mar 13, 2022
With Christmas and New Year ahead, it is time for some festive coding. Here is a Christmas Card for you all!

Christmas Card With Christmas and New Year ahead, it is time for some festive coding! Here is a Christmas Card for you all! NOTE: I have not made this

CodeMaster7000 1 Dec 25, 2021
A gamey, snakey esoteric programming language

Snak Snak is an esolang based on the classic snake game. Installation You will need python3. To use the visualizer, you will need the curses module. T

David Rutter 3 Oct 10, 2022
Ghost source since the developer of the project quit due to reasons

👻 Ghost Selfbot The official code for Ghost which was recently discontinued and released to the public. Feel free to use any of the code found in thi

xannyy 2 Mar 24, 2022