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
Calc.py - A powerful Python REPL calculator

Calc - A powerful Python REPL calculator This is a calculator with a complex sou

Alejandro 8 Oct 22, 2022
A Notifier Program that Notifies you to relax your eyes Every 15 Minutes👀

Every 15 Minutes is an application that is used to Notify you to Relax your eyes Every 15 Minutes, This is fully made with Python and also with the us

FSP Gang s' YT 2 Nov 11, 2021
CountBoard 是一个基于Tkinter简单的,开源的桌面日程倒计时应用。

CountBoard 是一个基于Tkinter简单的,开源的桌面日程倒计时应用。 基本功能 置顶功能 是否使窗体一直保持在最上面。 简洁模式 简洁模式使窗体更加简洁。 此模式下不可调整大小,请提前在普通模式下调整大小。 设置功能 修改主窗体背景颜色,修改计时模式。 透明设置 调整窗体的透明度。 修改

gaoyongxian 130 Dec 01, 2022
Usando Multi Player Perceptron e Regressão Logistica para classificação de SPAM

Relatório dos procedimentos executados e resultados obtidos. Objetivos Treinar um modelo para classificação de SPAM usando o dataset train_data. Class

André Mediote 1 Feb 02, 2022
HogwartsRegister - A Hogwarts Register With Python

A Hogwarts Register Installation download code git clone https://github.com/haor

0 Feb 12, 2022
A maubot plugin to invite users to Matrix rooms according to LDAP groups

LDAP Inviter Bot This is a maubot plugin that invites users to Matrix rooms according to their membership in LDAP groups.

David Mehren 14 Dec 09, 2022
HatAsm - a HatSploit native powerful assembler and disassembler that provides support for all common architectures

HatAsm - a HatSploit native powerful assembler and disassembler that provides support for all common architectures.

EntySec 8 Nov 09, 2022
API moment - LussovAPI

LussovAPI TL;DR: py API container, pip install -r requirements.txt, example, main configuration Long version: Install Dependancies Download file requi

William Pedersen 1 Nov 30, 2021
Small exercises to get you used to reading and writing Python code!

Pythonlings Welcome to Pythonlings, an automated Python tutorial program (inspired by Rustlings and Haskellings). WIP This program is still working in

鹤翔万里 5 Sep 23, 2022
Just another sentiment wrapper.

sentimany Just a simple sentiment tool. It just grabs a set of pre-made sentiment models that you can quickly use to attach sentiment scores to text.

vincent d warmerdam 15 Dec 27, 2022
Ingestinator is my personal VFX pipeline tool for ingesting folders containing frame sequences that have been pulled and downloaded to a local folder

Ingestinator Ingestinator is my personal VFX pipeline tool for ingesting folders containing frame sequences that have been pulled and downloaded to a

Henry Wilkinson 2 Nov 18, 2022
A performant state estimator for power system

A state estimator for power system. Turbocharged with sparse matrix support, JIT, SIMD and improved ordering.

9 Dec 12, 2022
Dashboard to view a stock's basic information, RSI, Bollinger bands, EMA, SMA, sentiment analysis via Python

Your One And Only Trading Bot No seriously, we mean it! Contributors Jihad Al-Hussain John Gaffney Shanel Kuchera Kazuki Takehashi Patrick Thornquist

5 May 21, 2022
Herramienta para pentesting web.

iTell 🕴 ¡Tool con herramientas para pentesting web! Metodos ❣ DDoS Attacks Recon Active Recon (Vulns) Extras (Bypass CF, FTP && SSH Bruter) Respons

1 Jul 28, 2022
An OrpheusDL Tidal module

OrpheusDL - Tidal A Tidal module for the OrpheusDL modular archival music program Report Bug · Request Feature Table of content About OrpheusDL - Tida

Daniel 54 Dec 29, 2022
Tugas kelompok Struktur Data

Binary-Tree Tugas kelompok Struktur Data Silahkan jika ingin mengubah tipe data pada operasi binary tree *Boleh juga semua program kelompok bisa disat

Usmar manalu 2 Nov 28, 2022
Helper to organize your windows on your desktop.

The script of positionsing windows on the screen. How does it work? Select your window to move/res

Andrii D. 1 Jul 09, 2021
Design-by-contract in Python3 with informative violation messages and inheritance

icontract icontract provides design-by-contract to Python3 with informative violation messages and inheritance. It also gives a base for a flourishing

275 Jan 02, 2023
Leveraging pythonic forces to defeat different coding challenges 🐍

Pyforces Leveraging pythonic forces to defeat different coding challenges! Table of Contents Pyforces Tests Pyforces Pyforces is a study repo with a c

Igor Grillo Peternella 8 Dec 14, 2022
BMI-Calculator: Program to Calculate Body Mass Index (BMI)

The Body Mass Index (BMI) or Quetelet index is a value derived from the mass (weight) and height of an individual, male or female.

PyLaboratory 0 Feb 07, 2022