Giter VIP home page Giter VIP logo

armadillu / ofxremoteui Goto Github PK

View Code? Open in Web Editor NEW
136.0 16.0 23.0 8.27 MB

OpenFrameworks addon serves any number of variables (bool, float, int, enum, string, ofColor) on the network, so that you can modify from outside the OF app. Includes a native OSX Client. OSC based.

Home Page: http://uri.cat/

License: Other

Objective-C 11.50% C 7.20% C++ 68.89% Shell 0.16% Objective-C++ 11.95% Makefile 0.16% Rich Text Format 0.15%
openframeworks controller parameters osc midi native tweak

ofxremoteui's Introduction

ofxRemoteUI

Build Status Build status

OpenFrameworks addon that allows you to serve c++ variables/parameters (bool, float, int, enum, string, ofColor) on the network, so that you can modify them remotely. It uses server client architecture, where your app is the server. It communicates both ways; you can modify your project's variables from the client, but you can also pull your app's variable values from the client; this way you can track values that evolve programatically. It runs on OSC.

You can save and then load "presets", which allow you to quickly change values for a lot of your parameters quickly. You can also make "group presets" to change only the values of a subset of your parameters.

Compile against OF master branch. If you are trying to use this against an older version (0.9.8 or lower) you should use the commit tagged with "OF_0.9.8". It requires ofxPoco in OF versions >0.9.8

Watch a quick Intro Video.

Clients
In order of appearance in the screenshot above, Mac OS X native Client, Built In Client (inside your OpenFrameworks app), Web Client (served from your OpenFrameworks app), iOS Client (not quite flushed out).


Features

  • Edit & Track variables remotely through UDP/OSC (bool, int, float, string, Enum, ofColor).
  • Allows to save/load your variable states across app launches.
  • MIDI and Joystick controller bindings. Bind any parameter to any MIDI controller knob/slider/note or HID Joystick. (OSX Client)
  • Parameter values are saved in your app's data folder, in xml format.
  • Allows creation/deletion of Presets, variable states that you can switch from and to quickly.
  • Presets can be created globally (saving all parameter values at once), or for a subset of params (param group).
  • Easily create Parameter Groups, and access them through keyboard shortcuts (OSX Client).
  • Parameter Groups are automatically colorized to easily identify them.
  • Realtime Filter your params by name to find things quickly (OSX Client).
  • Automatic discovery of servers in the network; easily control multiple apps from one Client interface.
  • Press "tab" on your OF app to see/edit your params from within your OF app. Allows you to do quick client-less edits; and also load and save Global and Group Presets.
  • Event notifications in both OSX client (through growl) and on your OF app.
  • You can always restore your parameters to the "previous launch" state, or to the default values.
  • Log remotely - ofxRemoteUIServer allows you to log messages to you client with RUI_LOG(); which accepts printf-like formatted writing.
  • ofxRemoteUI can be used outside OF in any C++ project, and in Processing thx to @kritzikratzi
  • Easy to use C++ Macros hide complexity away, very easy to plug into any existing project.
  • Support for native ofParameters of compatible types (int, float, bool, string ofColor, ofVec). Allows you to edit native OF ofParameter types from RemoteUI. See "example-ofParameter". *outdated!
  • Control parameters from any web browser through its web gui.

Dependencies

  • ofxXmlSettings
  • ofxOsc
  • ofxPoco in OperFrameworks version > 0.9.8

Available Clients

  • Native OSX client, feature complete (this should be your first choice)
  • Built in client (inside the OF app) for basic edits, saving, resetting, and global and group preset loading and saving.
  • WebClient based on dat.GUI. Connect to OpenFrameworks through websockets (thx to @jackosx).
  • Native iOS client (WIP - OSC is not very reliable over WIFI and only basic features implemented - deprecated).

Compatibility

Works in OpenFrameworks, but also in plain C++ projects. @kitschpatrol is actively working on a Cinder Block that works on top of a fork here. He's added some awesome feature like getter/setter support for your params, and maybe one day we'll be able to merge back.

There's also a feature limited version of the server for Processing, made by @kritzikratzi! See here.

Motivations

I know there's tons of very good UI's already, but one thing that bothers me about most of them is how by using them, your are affecting your framerates quite a lot. That's the main reason that made me build ofxRemoteUI. Being quite comfy in OSX development, I chose to make a full-featured native OSX client; although clients for other platforms could be developed as well, using the underlying ofxRemoteUIClient class.

Details

It's OSC based, and it includes a native OSX Client. The Native OSX Client allows param colorization for better clarity, and live param filtering. It also supports the grouping of params into categories, for easy access. There's automatic keyboard shortcuts to do so.

It can also be set to store the current values when quitting the app (or whenever its convenient), so that you can carry on where you left off last time you used it. It does so by saving a file called "ofxRemoteUISettings.xml" in your data folder. It uses ofxXmlSettings to store everything.

You can also create and delete presets, which are parameter states for your app. Presets are stored with your OF app, inside an "ofxRemoteUIPresets" folder, in your data folder. This makes it easy to check in your presets with your source code. Whenever you like the current config, you can make a preset to keep it around. You can also delete presets.

ofxRemoteUI uses Macros + the singleton pattern to make it very easy to share any variable you decide to edit remotely, from any class of your project.

The OSX client also allows to copy all the current params as plain text. You can also paste them back after editing them! Thx to @kritzikratzi for this idea!

To use it outside of OpenFrameworks, you can see how the example-noOF is setup.


How To Use

the most basic setup only requires a few calls.

float x;
int y;
ofColor color;

void setup(){

	RUI_SETUP(); //start server

	//Expose x and y vars to the server, providing a valid slider range
	RUI_SHARE_PARAM(x, 0, ofGetWidth());
	RUI_SHARE_PARAM(y, 0, ofGetHeight());

	//share the color param
	RUI_SHARE_COLOR_PARAM(color);

	//load values from XML, as they were last saved (if they were)
	RUI_LOAD_FROM_XML();
}

Then, use any of the client options to view and edit your shared parameters. Look into the server example to see more features. It is fairly documented.

Controller Bindings

The ofxRemoteUI OSX client allows to bind any midi control / joystick axis / button to any of your params. Make sure your device is connected before you launch the app. To bind a device to a parameter, do the following:

  1. Click on a param name on the main Window. It will start blinking.
  2. Rotate/Slide/Press your external device control (joystick, gamepad button, midi slider, knob, etc).
  3. Done! You can now control that param from your external controller

You can Save/Load/Edit/Clear your midi bindings from the "MIDI Bindings" window.

MIDI Sliders/Knobs/etc can be bound to floats, ints, enums, bools and colors. For ints, floats and enums, the mapping is obvious; for bools, the lower half of a slider/knob sets the param to false, the upper half to true. For colors, the slider shifts the hue of the color parameter.

Bools can also be bound to "piano keys"; params being set to true for as long as a key is held down.

Bindings are saved when the app is quit. You can also save any particular device binding configuration into a ".midiBind" file. You can also double-click any .midiBind file form the finder to load your previously saved bindings. There is a "bindings" window that allows you to delete particular bindings. You can see what parameters are currently bound by choosing "File->Blink Bound Midi Controls".

Web-based Interface

The web client allows you to control the parameters of your OpenFrameworks app from a web browser. It does so by connecting your web browser to your OF app through websockets; it uses ofxPoco to handle the connection.

ofxRemoteUIServer creates a minimal webserver that hosts a single-file HTML + JS + CSS gzipped package that your browser will interpret. You don't need to provide additional files.

You can quickly load up the web GUI interface by getting into the built-in client (press 'tab' from the OF app), and from there press 'c' (for client). This will launch a web browser and load the web gui for you.

The web interface is developed in a separate repository ofxRemoteUI-Web. The whole interface is packaged in the RUIWebBinary.cpp file, so if you want to modify / tweak the interface, go to the ofxRemoteUI-Web repo and create a new build of that file and drop it into the ofxRemoteUI src folder (replacing the old one).

The web client has completely been developed by @jackosx, with some quality-of-life tweaks by @armadillu.

Note that this interface is not very tested. Don't use several clients at the same time, only one will be alloewd to connect. Web client connection/disconnection doesnt seem very realiable at the moment, but should be ok for a quick edit. You can completely disable the web interface by defining the preprocessor macro "NO_RUI_WEB_INTERFACE" in your project.

Random Notes

"Restore to initial XML Values" sets alls params to whatever values they had at server app launch.
"Restore to Default Values" sets alls params to whatever values the shared variable had before sharing it with RUI_SHARE_PARAM().

Enums must be consecutive so that each enum item is +1 the previous one for them to work. This is usually the default c++ behavior if you don't set specific values when defining your enums. Break this rule and you will get crashes.

When loading a preset, it might be that the preset doesn't specify values for all your current params (because it was created when that param didn't exist). If so, the params whose values haven't been modified by the preset will show a small warning sign for a few seconds, so that you are aware.

Automatic discovery relies on each server advertising itself (its hostname, app name and port) on port 25748 over OSC.

There is a setting in the OSX client that allows for it to automatically connect to a server app when it launches in the local network, or only on your local computer. Look into the OSX Client preferences window.

RUI_SETUP() assigns a random port the first time the app is launched, and it uses that same port on successive launches. You can also manually specify a port by supplying it RUI_SETUP(10000);

ofxRemoteUIServer listens for the keyDown event, and if "tab" is pressed, it displays a built-in client with some basic features. You can interact with the built-in client using arrow keys, return, and some other keystrokes depending on the context. Read the on-screen help at the bottom.

The built-in UI can be set to draw in any scale (useful for retina screens) by using:

RUI_GET_INSTANCE()->setBuiltInUiScale(scale);

You can set the built-in UI to be drawn using ofxFontStash by adding it to your project, and defining USE_OFX_FONTSTASH in your project's PreProcessor Macros. This allows you to use any font to draw the built-in client ui by calling, instead of the default OF bitmap font.

RUI_GET_INSTANCE()->drawUiWithFontStash("myFont.ttf");

The same thing applies to ofxFontStash2.

XML FILE FORMAT

Commits before the Git Tag "LastCommitWithXMLv1" use the original file format for XML files. Commits after that tag, will automatically save in the new format (v2), but will also parse files with the old format. You can also save files in the old format by pressing "E" (for export) from the built in client, either globally or on a per-group basis.

The new file format is proper XML with a root node, it's more human readable, it keeps params listed in the same order they are added in so its easier to read changes on versioning systems, and it has comments showing the group they belong to.

g

LICENSE and ATTRIBUTIONS

ofxRemoteUI is made available under the MIT license.

The OSX Client uses the vvMidi frameworks to handle MIDI devices more easily. VVMidi uses a LGPL license.

The OSX Client's HID capabilities come mostly from @jotapeh.

ofxRemoteUI bundles ofxXmlSettings and ofxOSC from OpenFrameworks to allow non-OF C++ projects to use ofxRemoteUI.

ofxremoteui's People

Contributors

armadillu avatar bryant1410 avatar galsasson avatar m1keall1son avatar markkorput avatar neilmendoza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ofxremoteui's Issues

Issue for deploying on device - iOS 9.2.1 iPhone 6S

Hi @armadillu

I always get a exception says "osc::MalformedBundleException: packet too short for bundle element" when I'm running app on real device.

If I'm using simulator (iOS 9.2) is totally fine but I'm deploying and running app on my iPhone, I always have this issue, any thought?

Thanks!

Collaboration ?

Hello !

I am a developer of the ossia library which has sensibly the same goals than ofxRemoteUI : https://github.com/OSSIA/API ; it also has some in-progress openframeworks, Qt, java, C, unity3D, and python bindings but the core is pure cross-platform C++.

It is used in the i-score sequencer to provide communication with other software.

I woud like to know if you would be interested in collaborating so that i-score would be able to control and automate applications built with ofxRemoteUI in a time line ? The only thing to do would be to write a class in the ossia library that talks the OSC protocol of ofxRemoteUI, but I don't really know where to get started, if the protocol is fixed, etc.

Can't Compile iOS client

Hey! Do you have a pre-built version of the iOS client? (Through the App Store perhaps? Or TestFlight?) I can't build it, getting the following linker error:

Undefined symbols for architecture x86_64:
  "UriDecode(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      ofxRemoteUI::setValuesFromString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in ofxRemoteUI.o
  "UriEncode(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      ofxRemoteUI::getValuesAsString() in ofxRem

Can't edit string on screen

I'm using on screen edit feature (tab) to edit string value on OF's (0.8.4) window.

However, even I choose the right item and press 'left/right arrow key', I can not get any edit box or something to edit. (only see an animation on top of '+ PRESET SELECTION'
I can edit this string value by iOS client though.

My code is straight forward like this,

RUI_NEW_GROUP("UPDATE VEGETABLE % HERE");   //make a new group (optional)
RUI_SHARE_PARAM(currentAppleAmount, ofColor(255,0,0,64));   

Any hints?

cannot run client

Hi,

I am currently writing a program, which uses the Remote UI you wrote.
The problem is that i cannot run the osxclient included.
Is there any way you can send it to me, or give me more info about how to run it?

Thanks a lot

Jan

Properties with getter/setters

What is the best way to use ofxRemoteUI for properties with getters/setters?

For example, I have an object that doesn't just draw at a scale every frame, but needs some initialization after a particular scale is set.

So in stead of having

object.scale = 1.0;
OFX_REMOTEUI_SHARE_PARAM(object.scale, 0, 2);

I need some way to actually call

object.setScale(value)

when the parameter changes.

Is there a convenient method of doing this using ofxRemoteUI?

ofxRemoteUIClientOSX font is hard to read when system-wide dark mode is enabled

Hi!
On recent MacOS, if the system-wide dark mode is enabled, the fonts changes colour to white making it really hard to read with the colour palette being used in the app.

image

In the meantime, if someone's experiencing this issue too, here's a simple command to disable the dark mode for just the OSX Client:

defaults write cat.uri.ofxRemoteUIClientOSX NSRequiresAquaSystemAppearance -bool Yes

ofxremoteuiclient crashing and hanging on startup

Until the latest set of changes to ofxRemoteUIClient, I was seeing it crash immediately on startup (even when there was no network, and no local ofxRemoteUIServers).

Now I'm seeing "missed 1 test packet", and lots of hanging. It definitely cannot connect to my ofxRemoteUIServer instances.

There's also some weirdness in ofxRemoteUIClient::setup: it looks like you're checking the value of port before you set it to port_? Have I pulled some code-in-progress?

error compiling to iOS 0.10 .1

/of_v0.10.1_ios_release/addons/ofxRemoteUI/noOFLibs/ofStolenUtils.cpp:13:7: Redefinition of 'ofToFloat'
of_v0.10.1_ios_release/addons/ofxRemoteUI/noOFLibs/ofStolenUtils.cpp:5:5: Redefinition of 'ofToInt'

any chance to solve this?

[Bug] Preset deletion doesn't work

I've noticed that deleting a preset doesn't work. I've tested with the code on master and the OSX client. I'm pretty sure this is a server issue because the client gets a response back from the server after sending a deletion packet but the preset XML file is never deleted.

No parameter recall from xml (parameter "found in XML but not defined in source code!")

Hi,

No matter what, I can't get parameters to get back to their state. I'm compiling again ofx 0.10.0 on macos 10.12.6.

The preset values get stored correctly in the .rui file (i can see it in a text editor), but when I launch the app again, for each parameter i get something like (i activated verbose output) :

[verbose] ofxRemoteUI: Param '0.3.number' found in XML but not defined in source code! Keeping it arround to save back to XML

And the parameter in the running application is back at its default value.

I tried compiling the "example-ofParameter", and it's exactly the same issue. Am I missing something or is this a bug ? Can you reproduce it using the original "example-ofParameter" example ?

Demo client can't connect to server

I just successfully compiled the example OF client and server. They both run fine, but the client can't seem to connect (after running the server first). They should run and connect out of the box right, nothing else I need to change?
I'm on Linux, but I don't see how that should matter..

[notice ] ofxRemoteUIClient listening at port 10001 ... 
[notice ] ofxRemoteUIClient connecting to 127.0.0.1
[notice ] ofxRemoteUIClient: connect()
[notice ] ofxRemoteUIClient: missed one TEST Packet... (4 left)
[notice ] ofxRemoteUIClient: missed one TEST Packet... (3 left)
[notice ] ofxRemoteUIClient: missed one TEST Packet... (2 left)
[notice ] ofxRemoteUIClient: missed one TEST Packet... (1 left)
[notice ] ofxRemoteUIClient: missed one TEST Packet... (0 left)
[warning] ofxRemoteUIClient: disconnecting bc server connection timed out!
[notice ] ofxRemoteUIClient: disconnect()

Enhancement: Decreasing ranges

Often it's useful to have ranges that decrease, with the highest value on the left and the lowest on the right, currently this isn't possible with the OS X client.

My use case: controlling a pixelation shader where a high value (lots of pixels) has low visual effect, but a low value (few pixels) has a high visual effect.

server not visible with drawNotifications = false

When drawNotifications = false (either through OFX_REMOTEUI_SERVER_SET_DRAWS_NOTIF or hardcoding the src) the server is no longer visible to the ofxRemoteUIClientOSX

Using latest master branch and oF 0.8.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.