[Bf-funboard] Re: Adding Objects (settings)
Willian Padovani Germano
wgermano at superig.com.br
Fri Mar 30 04:57:53 CEST 2007
Around the time Matt Ebb posted his ideas on cgtalk I was thinking about
making "procedural" objects in Blender using Python scripts. That's
probably the next project I'll work on.
More or less like this: a new object with a new data type are added to
Blender. The data contains a few pointers: to a script and to the config
data used by it to create its procedural object, plus a pointer to
another data type (maybe only mesh, maybe also other possibilities),
where the script stores the geometry it creates. The script could
contain functions to: create display data, create render data, define
its config data (we can store them via ID properties) and somehow the
panel with buttons to edit this data.
In practice, you choose from a menu -- just like you choose a cube or
Suzanne or whatever now -- any of the available objects defined by these
scripts. The object is created on the 3d view and a new panel opens in
the edit buttons win, with the options for this object. For an UV sphere
they'd be rings, segments, name, for example. For a cube, a parameter
determining subdivisions in X, Y and Z, maybe also beveled corners,
faces with holes -- anything the script author chose to add.
Whenever a button in its panel is edited, the script is called again to
recreate the geometry. If the script defines both display and render
data, before rendering it is called to create render data. Entering edit
mode is not allowed for these objects, but they can easily be converted
to (or be copied to) mesh objects.
Modifiers would be able to work on these objects, since they would have
actual mesh or whatever data available.
Some advantages, besides being able to recreate the objects easily, are
that it's easier to generate geometry in Python, scripts can access
modules with functions to load supported 3d formats (so even Suzanne and
other non procedural objects can be created from files in some good
format), there are already many scripts that generate interesting
objects, etc. These objects would also require much less space than a
mesh, for example, in .blend files, since they can simply store the
script and config values used. In case people open the file in a Blender
w/o access to the given script, the program simply tells users about the
problem, so they can try to find the given script somewhere online or
ask the original author of the .blend file.
Anyway, just ideas, for now.
More information about the Bf-funboard