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
Python Projects is an Open Source to enhance your python skills

Welcome! 👋🏽 Python Project is Open Source to enhance your python skills. You're free to contribute. 🤓 You just need to give us your scripts written

Tristán 6 Nov 28, 2022
Todos os exercícios do Curso de Python, do canal Curso em Vídeo, resolvidos em Python, Javascript, Java, C++, C# e mais...

Exercícios - CeV Oferecido por Linguagens utilizadas atualmente O que vai encontrar aqui? 👀 Esse repositório é dedicado a armazenar todos os enunciad

Coding in Community 43 Nov 10, 2022
A redesign of our previous Python World Cup, aiming to simulate the 2022 World Cup all the way from the qualifiers

A redesign of our previous Python World Cup, aiming to simulate the 2022 World Cup all the way from the qualifiers. This new version is designed to be more compact and more efficient and will reflect

Sam Counsell 1 Jan 07, 2022
berisi kodingan kodingan python umum yang kubuat.

python-codevault berisi kodingan kodingan python umum yang kubuat. untuk memudahkan transisi dan menjadi refrensi tutorial. daily challange for myself

Agung Zon Blade 1 Dec 19, 2021
FileTransfer - to exchange files from phone to laptop

A small website I locally host on my network to exchange files from my phone and other devices to my laptop.

Ronak Badhe 4 Feb 15, 2022
Get a link to the web version of a git-tracked file or directory

githyperlink Get a link to the web version of a git-tracked file or directory. Applies to GitHub and GitLab remotes (and maybe others but those are no

Tomas Fiers 2 Nov 08, 2022
Tiling manager which runs on top of EWMH window managers.

PyTyle is an extremely versatile and extensible tiling manager that is meant to be used on top of EWMH window managers. Its feature set was modeled af

55 Jul 29, 2021
CDM Device Checker for python

CDM Device Checker for python

zackmark29 79 Dec 14, 2022
A free website that keeps the people informed about housing and evictions.

Eviction Tracker Currently helping verify detainer warrant data for middle Tennessee - via Middle TN DSA - Red Door Collective Features Presents data

Red Door Collective 7 Dec 14, 2022
Python library for ODE integration via Taylor's method and LLVM

heyoka.py Modern Taylor's method via just-in-time compilation Explore the docs » Report bug · Request feature · Discuss The heyókȟa [...] is a kind of

Francesco Biscani 45 Dec 21, 2022
Hello, Welcome to this repo. don't forget to read guidelines in readme.md

Hacktoberfest_2021 If you looking for your first contribution, we are here to help. Just create a simple program using any language you like in our fo

Wafa Rifqi Anafin 117 Dec 14, 2022
LeetComp - Background tasks powering the static content at LeetComp

LeetComp Analysing compensations mentioned on the Leetcode forums (https://kuuts

Kumar Utsav 125 Dec 21, 2022
Материалы для курса VK Углубленный Python, весна 2022

VK Углубленный Python, весна 2022 Материалы для курса VK Углубленный Python, весна 2022 Лекции и материалы (слайды, домашки, код с занятий) Введение,

10 Nov 02, 2022
Tool for running a high throughput data ingestion/transformation workload with MongoDB

Mongo Mangler The mongo-mangler tool is a lightweight Python utility, which you can run from a low-powered machine to execute a high throughput data i

Paul Done 9 Jan 02, 2023
Python implementation of an automatic parallel parking system in a virtual environment, including path planning, path tracking, and parallel parking

Automatic Parallel Parking: Path Planning, Path Tracking & Control This repository contains a python implementation of an automatic parallel parking s

134 Jan 09, 2023
Web app to find your chance of winning at Texas Hold 'Em

poker_mc Web app to find your chance of winning at Texas Hold 'Em A working version of this project is deployed at poker-mc.ue.r.appspot.com. It's run

Aadith Vittala 7 Sep 15, 2021
Install Firefox from Mozilla.org easily, complete with .desktop file creation.

firefox-installer Install Firefox from Mozilla.org easily, complete with .desktop file creation. Dependencies Python 3 Python LXML Debian/Ubuntu: sudo

rany 7 Nov 04, 2022
reproduces experiments from

Installation To enable importing of modules, from the parent directory execute: pip install -e . To install requirements: python -m pip install requir

Meta Research 15 Aug 11, 2022
The best way to learn Python is by practicing examples. The repository contains examples of basic concepts of Python. You are advised to take the references from these examples and try them on your own.

90_Python_Exercises_and_Challenges The best way to learn Python is by practicing examples. This repository contains the examples on basic and advance

Milaan Parmar / Милан пармар / _米兰 帕尔马 205 Jan 06, 2023
The Python agent for Apache SkyWalking

SkyWalking Python Agent SkyWalking-Python: The Python Agent for Apache SkyWalking, which provides the native tracing abilities for Python project. Sky

The Apache Software Foundation 149 Dec 12, 2022