ORB-HD / puppeteer

A motion capture mapping tool to to convert marker movement to skeletal animations
Other
2 stars 2 forks source link

Add support for parametrized lua files #1

Open raphaelm opened 5 years ago

raphaelm commented 5 years ago

This PR adds support for parametrization in most variables read from or written to model lua files. Input lua files may include variables wrapped in a dummy function called Variable that is overridden by puppeteer at load time. puppeteer will then show Lua expressions in the property browser that can be edited and previewed in real time. Invalid lua expressions are marked red and are not saved. When exporting, a valid Lua file is created that preserves the parameters.

This approach is fully backwards-compatible with existing files and with RBDL, since when evaluated by a different program, the Variable() wrapper function just does nothing and the lua file evaluates just fine.

This is supported for nearly all model fields. The following properties in the property browser may not contain expressions:

Sample input file:

HeiMan = require 'HeiMan.HeiMan'

if Variable == nil then function Variable(name, value) return value end end
height = Variable('height', 1.82)
weight = Variable('weight', 74)

heiman = HeiMan (weight, height)
model = heiman:create_model()

return model