Emma Content Development FAQ
From Emma
What is the Emma CDK?
A. Emma's Content Development Kit (CDK) supports content artists using declarative markup and creative tools to produce new user experiences. This CDK includes tools, documentation and examples which facilitate production of content to be performed in Emma.
What is the difference between Emma's CDK and Emma's SDK?
A. The CDK is for artists, animators, declarative content authors, etc. Emma's SDK is for C++ programmers who want to develop new Emma modules (.dlls, .libs, etc), or to extend or modify Emma source code.
How do I enable the OpenGL renderer
A. Create a text file named 'app.lua' which contains:
resource.environment.renderer = "OPENGL";
and put it in the same directory as your content ( or your content's main file if your content�has many directories )
How do I enable the OpenGL renderer for all content ?
A. Create a text file named 'local.lua' which contains:
resource.environment.renderer = "OPENGL";
and put it in the same directory as�emma.exe or emmamfcapp.exe.
How can I take a screenshot of Emma ?
A. When the rendering window has focus, hit 'i'. This will save a screenshot of the window to the same directory as the content such as "Emma0626105_121919943.jpg".
The logging console disappeared,� how can I bring it back ?
A. Hit 'c' when the rendering window has focus.
What does Emma's declarative markup format look like?
A. The .ema file format provides an uncluttered declarative scene markup format, which describes a set of multimedia Objects (known as Nodes) and establishes the relationships between those Nodes. Each Node presents its interface as a set of Fields; these Fields are used to set and alter the properties which control the Node's behavior. This unifying Node/Field architecture gives Emma the flexibility for extension into a wide range of composable media, interactivity, and behavioral domains. The current set of predefined Nodes and Fields is documented in the Emma Content Development Guide, at
http://www.emma3d.org/cdk/
What about using XML for Emma's declarative markup?
A. The .ema file format provides a much simpler, human readable syntax for describing Emma's objects. However, .ema will be directly translatable into its companion XML syntax, .xma, and back again, to afford content production and generation efforts with the programmable power of XML. .xma translation is slated for development as part of Emma's content authoring framework.
I have an .ema file, how can I convert it to .lua?
A. The command line "emma.exe -c foo.ema > foo.lua" translates the .ema file input into a .lua script, and outputs it into a .lua file
I have a .lua file, how can I convert it to .ema?
A. Lua is a powerful scripting language with many capabilities which go beyond the central markup conventions of the .ema format. As such, there is no general conversion tool guarenteed to convert arbitrary .lua into .ema. However, as Emma's content authoring framework is built out, it will be capable of running a .lua file, and saving the scene structure generated by that input as .ema markup. Note again that this scene capture may not preserve arbitrary .lua constructs from the input, but it is guarenteed to save all scene Objects written around Emma's core scene conventions as reproducable .ema files.
How do field events work?
A. Whenever you make an assignment to a field that is contained in an Emma node, it has the ability to generate an event. An event is simply a Lua function that gets called whenever the field value is set. These functions have access to the same global variables as any Lua function in Emma. Additionally, it has access to a self variable, which is the node containing the field that fired, and to the TOP variable, which is set to the PROTO instance containing that node.
What is the markup to put events on a field?
A. The Emma language supports routing syntax and function syntax for adding events to fields. It looks like this:
field SFFloat myval DO { print("myval is set to ",self.myval) }
TO OTHERNODE.otherval
Timer { fraction DO { print("fraction is set to ",self.fraction) }
The first two lines set events on a field being declared as a top-level node of a PROTO. The last line adds an event to the field of a node. Note that you can have more than one event on a field. The function associated with each is called in the order in which it appears in the markup.
How does routing work?
A. Emma routing allows a convenient shorthand for defining simple connections between fields. In the same way you can use the DO syntax to place a function on a field, you can use the keywords TO and FROM to specify a a destination (in the case of TO) or source (in the case of FROM) for an event. You can also use a separate ROUTE statement, where you specify both the source and destination of the event. Routing in Emma is handled using Lua function calls. These 3 statements:
fraction TO OTHERNODE.fraction
DEF T Group { translation FROM INTERP.value }
ROUTE MOUSE.pos TO CONTROL.pos
each create a small Lua function that looks like this:
fraction.addEvent(function(self) TOP.OTHERNODE.fraction = self.fraction end) TOP.INTERP.value.addEvent(function(self) TOP.T.translation = TOP.INTERP.value end) TOP.MOUSE.pos.addEvent(function(self) TOP.CONTROL.pos end)
So all the same rules apply to routes as to DO scripts.
How do I add and remove events from a field?
A. Events are added to a field with the addEvent function, like this:
local i = T.fraction.addEvent(function(self) print("fraction is ",self.fraction) end)
addEvent returns an index number which can be used to later remove that event like this:
T.fraction.removeEvent(i)
