Bond Molecule

Add a bonding molecule that can group other molecules together to form a compound behavior that can be turned on and off all at once.

Summary
Bond Molecule
Preference Dialog
CommentsTo combine molecules into compound, in edit mode, simply drag their icons and drop onto a bonding molecule’s icon.
Properties
typestring, ( r )
pref.namestring, ( r )
pref.enableWhenstring, ( r, w )
pref.disableWhenstring, ( r, w )
descriptionstring, ( r )
Functions
attach
detach
delete
rename
clone
serialize
getMolecules
$m

Preference Dialog

Comments

To combine molecules into compound, in edit mode, simply drag their icons and drop onto a bonding molecule’s icon.  Clicking on the bonding molecule shows/hides its child molecules allowing you access to their individual properties.

In this example, a camera, environment, and manualobject molecules form the first compound.  A css and script molecules form the second.  The text and script molecules are stand-alone molecules.

A compound is transportable by a single drag’n drop of its bonding molecule.  It can be cloned, serialized, and de-serialized as one single entity, even though it is comprised of many different molecules.

Properties

type

string, ( r )

Type of this molecule, bond.

pref.name

string, ( r )

The scriptable name for this molecule.  This name can be set using rename function dynamically.

pref.enableWhen

string, ( r, w )

Specifies the event that activates this compound.  Default is load.

pref.disableWhen

string, ( r, w )

Specifies the event that deactivates this compound.  (All child molecules are deactivated.)  Default is none.

description

string, ( r )

A brief description of what this compound does.

Functions

attach

attach(droplet);

Attach this compound to the given droplet.

Parameters

droplet(object) a droplet.

Returns

N/A

detach

detach();

Remove this compound from its droplet.

Parameters

N/A

Returns

N/A

delete

delete();

Delete this compound.

Parameters

N/A

Returns

N/A

rename

rename(name);

Rename this bonding molecule.

Parameters

name(string) a new name.

Returns

N/A

clone

clone();

Create a clone of this compound.  All child molecules are cloned.

Parameters

N/A

Returns

(object) a molecule.

serialize

serialize();

Serialize this compound into its JSON representation, including all its child molecules.

Parameters

N/A

Returns

(string) JSON representation of a compound.

getMolecules

getMolecules(type);

Returns the molecules of given type within this compound.

Parameters

type(string) a space-delimited molecule types.

Returns

(array) an array of molecules.

$m

$m(type);

Short hand version of getMolecules.

Parameters

type(string) a space-delimited molecule types.

Returns

(array) an array of molecules.

Close