Creating MWorks plugin

paul.levy's Avatar

paul.levy

17 Aug, 2015 02:09 PM

Hello Chris,

I'm currently a rotation student with the Movshon lab at NYU and have been working with Najib on developing a plug-in for MWorks. We'd like to be able set the monitor's gamma values, run a calibration in case gamma values are not known, and set monitor resolution and refresh rate.

The short story is that I have been unable to figure out how the client (grabbing data from the user via some graphical interface) sends variable updates to the server so that the server can take specific actions for each updated variable.

The more detailed story is that I've looked around the code a fair amount and have run into some issues:

The variables window plug-in works in the same way that we envision for our display plugin. I found in the code (file MWVariablesDataSource.m in plugins-->client-->VariablesWindow) where the "branches" of variables (e.g. system variables, experiment variables) are loaded, where each variable is loaded into the display and where user modification of the variable is handled. I'm not sure how this file, though, interacts with the GUI found in Main.xib of the same project.

Putting aside that approach, I created my own GUI but was unable to establish a link between the GUI and acting on the values in the GUI.

What's the approach that you recommend? Any advice is greatly appreciated!

Thanks,

Paul

  1. Support Staff 1 Posted by Christopher Sta... on 17 Aug, 2015 04:49 PM

    Christopher Stawarz's Avatar

    Hi Paul,

    I'd recommend having a look at Apple's introductory Mac development tutorial, which covers the basics of implementing a graphical UI and associated back end.

    Cheers,
    Chris

  2. 2 Posted by romesh.kumbhani on 17 Aug, 2015 11:53 PM

    romesh.kumbhani's Avatar

    Hi Chris,

    Since I'm partially responsible for Paul's inquiry, I though maybe I'd try to re-explain the issue.

    We'd like to add some additional parameters to the MWorks Server's preference window. We're stuck on knowing where these parameters are saved and how to access them from other routines. After looking through some code, I think they're mostly saved in (and accessed by) the global variable "mainDisplayInfo". We just want to confirm and make sure whatever we edit won't break things in the long run (i.e. in which files we should make our edits so as not to break future builds). Would you be available tomorrow (Tues, Aug 18) at 3 pm for a chat (via phone/skype/etc)? It would be with myself, Najib Majaj and Paul (all of us in Tony Movshon's Lab at NYU). If not, can you suggest a good time?

    - Romesh

  3. Support Staff 3 Posted by Christopher Sta... on 18 Aug, 2015 02:25 PM

    Christopher Stawarz's Avatar

    Hi Romesh,

    MWorks configuration is handled via a handful of system variables. For the purpose Paul described, I think you're correct that #mainScreenInfo is the right variable for storing your settings. Its value is a dictionary, so you can just add new keys for the settings you want to store.

    MWServer's preferences window reads and writes the relevant system variable for each setting. However, the window itself isn't designed to be extended by plugins. If you want a GUI for your settings, then you should create a MWClient plugin. The Eye Calibrator Window is similar to what you'd need, in that it provides a client-side GUI that reads and writes server-side variables. It's also smaller and easier to understand than the variables window.

    Of course, once you've set variables on the server side, the server needs to do something with them. To that end, you'll also need a core plugin. This would probably implement a new IODevice subclass, which could use OpenGLContextManager::getMainDisplayID to get the CGDirectDisplayID for the stimulus display. Once it had that, it could employ the appropriate functions from Quartz Display Services to configure the display.

    Would you be available tomorrow (Tues, Aug 18) at 3 pm for a chat (via phone/skype/etc)?

    Yes, I'm available then, if you think a chat would be helpful.

    Cheers,
    Chris

  4. Christopher Stawarz closed this discussion on 22 Sep, 2015 02:05 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

17 May, 2022 02:12 PM
16 May, 2022 03:12 PM
04 May, 2022 06:02 PM
03 May, 2022 01:30 PM
02 May, 2022 10:47 PM