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
Placeholders is a single-unit storage solution for your Frontend.

Placeholder Placeholders is a single-unit file storage solution for your Frontend. Why Placeholder? Generally, when a website/service requests for fil

Tanmoy Sen Gupta 1 Nov 09, 2021
Collection of functions for working with interlaced content in VapourSynth.

vsfieldkit Collection of functions for working with interlaced content in VapourSynth. It does not have any hard dependencies outside of VapourSynth.

Justin Turner Arthur 11 May 27, 2022
Basic infrastructure for writing scripts in Python

Base Script Python is an excellent language that makes writing scripts very straightforward. Over the course of writing many scripts, we realized that

Deep Compute, LLC 9 Jan 07, 2023
This repo is for scripts to run various clients at the merge f2f

merge-f2f This repo is for scripts to run various clients at the merge f2f. Tested with Lighthouse! Tested with Geth! General dependecies sudo apt-get

Parithosh Jayanthi 2 Apr 03, 2022
Import modules and files straight from URLs.

Import Python code from modules straight from the internet.

Nate 2 Jan 15, 2022
A webapp that timestamps key moments in a football clip

A look into what we're building Demo.mp4 Prerequisites Python 3 Node v16+ Steps to run Create a virtual environment. Activate the virtual environment.

Pranav 1 Dec 10, 2021
Holographic Declarative Memory for Python ACT-R

HDM This is the repository for the Holographic Declarative Memory (HDM) module for Python ACT-R. This repository contains: documentation: a paper, con

Carleton Cognitive Modeling Lab 1 Jan 17, 2022
Python Programming Bootcamp

python-bootcamp Python Programming Bootcamp Begin: 27th August 2021 End: 8th September 2021 Registration deadline: 22nd August 2021 Fees: No course or

Rohitash Chandra 11 Oct 19, 2022
This script can be used to get unlimited Gb for WARP.

Warp-Unlimited-GB This script can be used to get unlimited Gb for WARP. How to use Change the value of the 'referrer' to warp id of yours You can down

Anix Sam Saji 1 Feb 14, 2022
SmartGrid - Een poging tot een optimale SmartGrid oplossing, door Dirk Kuiper & Lars Zwaan

SmartGrid - Een poging tot een optimale SmartGrid oplossing, door Dirk Kuiper & Lars Zwaan

1 Jan 12, 2022
Decentralized intelligent voting application.

DiVA Decentralized intelligent voting application. Hack the North 2021. Inspiration Following the previous US election, many voters were fearful that

Ali Shariatmadari 4 Jun 05, 2022
A tool to build reproducible wheels for you Python project or for all of your dependencies

asaman: Amra Saman (আমরা সমান) This is a tool to build reproducible wheels for your Python project or for all of your dependencies. What this means is

Kushal Das 14 Aug 05, 2022
oracle arm registration script.

oracle_arm oracle arm registration script. 乌龟壳刷ARM脚本 本脚本优点 简单,主机配置好oci,然后下载main.tf即可,不用自己获取各种参数。 运行环境配置 本简单脚本使用python3编写,请自行配置好python3环境和requests库。(高版

test1234455 419 Jan 01, 2023
Simple calculator made in python

calculator Uma alculadora simples feita em python CMD, PowerShell, Bash ✔️ Início 💻 apt-get update apt-get upgrade -y apt-get install python git git

Spyware 8 Dec 28, 2021
Cirq is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators

Cirq is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators. Install

quantumlib 3.6k Jan 07, 2023
Hands-on machine learning workshop

emb-ntua-workshop This workshop discusses introductory concepts of machine learning and data mining following a hands-on approach using popular tools

ISSEL Soft Eng Team 12 Oct 30, 2022
Birthday program - A program that lookups a birthday txt file and compares to the current date to check for birthdays

Birthday Program This is a program that lookups a birthday txt file and compares

Daquiver 4 Feb 02, 2022
Meera 2 May 12, 2022
Cairo-integer-types - A library for bitwise integer types (e.g. int64 or uint32) in Cairo, with a test suite

The Cairo bitwise integer library (cairo-bitwise-int v0.1.1) The Cairo smart tes

27 Sep 23, 2022
p5 is a Python package based on the core ideas of Processing.

p5 p5 is a Python library that provides high level drawing functionality to help you quickly create simulations and interactive art using Python. It c

p5py 645 Jan 04, 2023