DavidBrainard / RenderToolbox3

Matlab toolbox for managing graphics rendering for psychophysics
MIT License
11 stars 4 forks source link

Recipe API #42

Closed benjamin-heasly closed 10 years ago

benjamin-heasly commented 10 years ago

It would be useful to have a layer of utility functions for working with RenderToolbox3 recipes. This Recipe API would sit on top of existing utilities, facilitating their use and making it easier to treat a rendering recipe as a coherent whole, rather than a collection of files.

Please see the wiki page Recipe API Design for a detailed description of the proposed Recipe API.

benjamin-heasly commented 10 years ago

It could be useful if the RecipeAPI included a notion of a "configuration script" which set RenderToolbox3 preferences prior to rendering, similar to the current template utility: https://github.com/DavidBrainard/RenderToolbox3/blob/master/Utilities/RenderToolbox3ConfigurationTemplate.m

A recipe's configuration script would be executed before any other operations. It would facilitate recipe-specific configuration and prevent configuration from "leaking" between recipes. It could also attempt to determine configuration or locate resources dynamically, in cases when a recipe needs to run on differing systems.

benjamin-heasly commented 10 years ago

Starting work on this in RecipeAPI branch: https://github.com/DavidBrainard/RenderToolbox3/tree/RecipeAPI

benjamin-heasly commented 10 years ago

It might be good to allow plain-old scripts to access the "current" recipe. This would allow custom config, executive, and analysis scripts to access and modify the recipe, without having to conform to a specific function API (i.e. they would not have to be functions that accept and return a recipe struct). This would facilitate mixing the RecipeAPI with existing scripts.

The RecipeAPI could store the current recipe in a global or persistent variable or Matlab preference. It could mediate access to the current recipe with a function that accepts a recipe, updates the current recipe, and returns the current recipe. For example, custom scripts could use recipe = CurrentRecipe(recipe)

Whenever a RecipeAPI function needs to invoke a custom script, it could set the current recipe, then invoke the script, then retrieve the current recipe for its return value.

benjamin-heasly commented 10 years ago

The Recipe API is implemented, tested, and documented as of b8a4df3efe5188b54413560574a4af6359ddb06c