Creating MWorks plugin

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

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

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

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