|
Application Programming Interface and Script Language
form·Z 4.5 introduces the ability to add external functionality
to form·Z through programming
extensions, which can be plugins or scripts. A plugin is written in the
C or C++ computer language and is compiled into a shared library (Macintosh)
or a dynamic link library (Windows). These libraries are referred to as
the plugin files and they are identified by the .fzp file extension. A script
is written in the form·Z script language (FSL), which is a simplified
version of C. Scripts are compiled into binary files identified by the .fsb
file extension.
A script is, in essence, a simplified version of a plugin. It is intended
for a novice programmer who may get started with adding extensions to form·Z without having to set up a complete C or C++ based development environment.
The language used for scripts (FSL) follows the C language very closely.
It offers the same basic data types and statements and, like a plugin, a
script can call the majority of the form·Z supplied functions
that access operations of the program. Once a script has been written and
tried, it is generally fairly straightforward to convert the C-like FSL
code of the script to real C or C++ code for use in a plugin.
There are nine types of extensions: attributes, file translators, object
types, renderers, commands, palettes, RenderZone shaders, tools, and utilities.
All of these are available for plugin development. The latter five are also
available for scripts.
An attribute defines a characteristic that can be assigned to objects and/or
faces of objects. Attribute plugins complement the standard attributes,
such as surface styles, layers, shadow casting or visibility and behave
consistent with the form·Z attributes.
A file translator is used to exchange data and images with form·Z.
Plugin file translators complement the form·Z translators and
appear in the Export Data, Export Image, and Import Format menus.
An object type is the definition of a controlled object. Object type extensions
behave consistent with the form·Z controlled objects. The parameters
of the control object can be accessed through the Edit button in the Query
dialog as with any form·Z controlled object. Object type plugins
are often complemented by one or more tool extensions that create or manipulate
the controlled object.
A renderer creates an image of the modeling scene on the screen. Plugin
renderers are shown in the Display menu, below the standard form·Z renderers. form·Z supports interactive renderers, static vector
or polygonal renderers, and static pixel renderers.
A command in form·Z is an action that is invoked from a menu
item, icon in the command palette or a key shortcut. Command extensions
are extensions that complement the form·Z commands and behave
consistent with the form·Z commands. Commands are very flexible
as virtually any form·Z API function can be called during the
execution of the task.
A palette is a floating window that contains an interface for a feature
or set of related features. The interface is composed of a variety of interface
elements (buttons, radio buttons, check boxes, lists etc.) provided by the form·Z interface manager (FUIM). Palette extensions are extensions
that complement the form·Z palettes and behave consistent with
the form·Z palettes.
A Renderzone shader is an extension which describes the rendering characteristics
of a single pixel in a rendering. There are six types of shaders: color,
bump, reflection, transparency, background, and depth effect. Extension
shaders complement the form·Z shaders and appear in the coresponding
locations in the Surface Style and RenderZone Options dialogs.
Tools are extensions that complement the form·Z tool set and
behave consistent with the form·Z tools. They appear in the form·Z interface, in the icon tool palettes, just like a form·Z tool. Tools can either be operators or modifiers. An operator creates or
edits the form·Z project data (objects, lights, etc.) through
graphic manipulation in the form·Z Project window. A modifier
is a tool that controls a setting that affects a group of operators. Tools
are very flexible and can do a variety of things. Object creation, editing,
and derivation operations are common uses of tools.
Utility extensions are designed to execute a task, which is either less
frequently used or an item in the form·Z interface is not desired.
Utility extensions are best used on tasks that are linear in nature (like
batch processing).
The form·Z 4.5 package contains a number of ready to run examples
for scripts and plugins, some of which are illustrated here. These are expected
to prove valuable as learning resources. We highly recommend that new extension
developers start by running some of the given examples and that they actually
write their first scripts and/or plugins by simply editing and revising
some of our examples.
| |
A sample of new tools and plugins avaliable in form·Z 4.5. From
Top to bottom: Script Editor, Draft Sweep, Star, Frame, Gear, Replace,
Unclone, Model Doctor, Unclone, and Triangle.
To
review some of these and other new features in v4.5 click here.
The Scrible plugin offers the option to produce "wavy" images
that imitate pencil drawings, two variations of which are shown above. Shown
above are three customized shaders that have also been added by plugins.
|
|
|