Skip to content

Conversation

@raphaelm
Copy link

@raphaelm raphaelm commented Mar 7, 2019

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:

  • Mesh colors
  • Joint and visual orientations (unfeasible due to the conversion between euler angles and quaternions)
  • Global locations and orientations of scene objects, since those are not actually properties from lua files but computed values from RBDL

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant