Skip to content

Function hierarchies, templates and schemas…

October 30, 2011

Charles

I don’t know if anyones used this idea, but I’ve been looking to a rigging frameworks recently. At a discussion I started on LinkedIn JSON was mentioned as a friendly humanly readable format for building a rigging framework – I concur, its a very simple a clean system of objects e.g:

{
“myObject” : {“a property” : “a value”, “another property” : “another value”}
}

The template

At its heart you simply want to build a skeleton apply a template to it and let it build the rest – you don’t need a visual template or guide, infact the skeleton doesn’t need to know anything about the template or vice versa – all thats needed is inputs to the template.

What is this template? To me it’s essentially a hierarchy of functions, with each function defined in a schema. The hierarchy aspect comes in when a function can pass its results to the input of the next function. The ‘intial’ function in the chain could have inputs that get passed to a gui – and the nice thing with this is that it satisfies users needs at each level. At its simplest a layman builds a skeleton, assigns a template to the whole skeleton or a part of it.

The intermediate  user doesn’t need to understand each function of the template, ( defined by the schema) but is skilled enough to build templates mix functions and pass inputs correctly.

The expert user would have full understanding of the schema that drives the functions and the code of the function itself.

The power of this approach is you have a schema that defines functions that are ordered in a template. You can change the order of the functions, remove functions etc in the template, and allow the template to point to a different schema to completely change the results. Very much how an html document uses css to structure the data.

How would a schema work? Something like this I’d imagine:

{
“schema” :
[
{“id” : “ik_system”, “path” : “path.module.def.function”, “arguments” : [{“name”:”joint”, “type” : “node”},”boolean”, “node”], “returns” : [“float”,”list”, “boolean”]}
]
}

How would a template use this schema? This is the hardest part; i’m guessing something like this:

{
“passedToGui” : [{“id” : “joint”, “type” : “node”}, {“id” : “allowStretch” : “boolean”}],

“functionHierarchy” :
[
{“id” : “buildLeg” , “type” : “ik_system”, “arguments” :[“passedToGui.joint”, “passedToJoint.allowStretch”] },
{“id” : “buildFoot” , “type” : “foot_system” , “arguments” : [“buildLeg[0]” , “passedToGui.allowStretch”, 10]
]
}

With objects/attributes following ‘.’ or ‘[#]’ methodology –  argument passing is still something i’m looking at. But the nice thing with this approach is that is could be used with pretty much any 3d package all your doing is associating functions/defs/methods to a schema and using that schema in a simple template  that users could edit ‘visually’ in the viewport or just by the script itself. Error handling would be to validate the template can work (function results allowed to be passed to other functions) using the schema.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: