MaxScript Release 0.32 Source FOR M044+ (11/10/2000)
Copyright (c) 2000 by Borislav Petrov, Bobo's
Rendert**ls.
SHORT DESCRIPTION
MultiWire enhances the Properties
Wiring functionality of Magma with support for
Multiple Connections with a single selection,
Instanced Wire Controllers option,
List Controller support for mixed Wired/Interactive
controls.
Mass-Disconnection of specific Wired Controllers.
Mass-Disconnection of ALL Wired Controllers.
Optional preservation of the current value
and List controllers support on Disconnect.
Support for Object, Modifier and Material
Custom Attributes.
INSTALLATION
MultiWire is a R3-style MacroScript
with a Floating Rollout.
Download and Unzip the distribution
file to your \Scripts directory.
Start Magma M043 or higher, select MAXScript
> Run Script and select the file (Alternatively open Windows Explorer and
drag&drop the file to your Magma Viewports)
Right-click a toolbar, select Customize...,
find Category "Bobo_s Tools" and drag&drop MultiWire to
the toolbar. (Alternatively you can place MultiWire in a
QuadMenu or assign to a Keyboard Shortcut)
Press the button / select the QuadMenu Item
/ press the Shortcut to launch the script.
FEATURES AND USAGE
NEW IN Version 0.32 (11/16/2000)
Fixed another bug crashing the script after
wiring a track with an Integer value using a List Controller - there was
no case handling for Integer values...
NEW IN Version 0.31 (11/15/2000)
Fixed a bug preventing from Wiring (!!!)...
Sorry.
NEW IN Version 0.3 (11/10/2000)
Implemented IsValidNode protection - the script
will check the existence of each node to be wired and will report problems
(read: will not crash :o) when nodes get deleted after being selected as
Master or Slaves.
A deleted Master will cause a Message to appear.
The CONNECTION will be canceled until a new valid Master is being selected.
A deleted Slave will only be reported in the
Listener but will not interrupt CONNECTION / DISCONNECTION operations.
MultiWire
will siply ignore it.
Pressing the [ReSelect...] button for the
Slaves will select only the existing objects and will PURGE all deleted
objects from the current list!
The script seems pretty stable so far. Version
0.3 will be posted to the Discreet Upload Zone for the "Show us your best
stuff" competition.
This explains the version number jump.
NEW IN Version 0.21 (11/4/2000)
In the Version 0.21 update, the name of the
Master object will be displayed on a large button. Pressing this button
will select the Master object in the scene.
The A..Z checkbox will
be checked by default. When checked, the track names will appear in sorted
alphabetical order. In this mode, Custom Attributes (CATs) will appear
on top of the list since prefixed with *.
The Expression edit
text field has been enlarged to display two lines - useful with complex
expressions.
The Slave list also
features a A..Z checkbox for alphabetical sorting.
The Axis Preferences
radiobuttons have been replaced by a drop-down list
The Axis Preferences
now allows multiple combinations of axes for converting Float into Point3
values and back.
The new Invert checkbox
will add a minus sign infront of the value to be used in the expression.
This will save you the editing of the expression when the negative value
is required.
A new addition to Version
0.21 is Custom Attributes (CATs) support. MultiWire will
support all 3 main types of CATs - Object (*Name_OBJCAT), Modifier (*Name_MODCAT)
and Material (*Name_MATCAT) attributes. These attributes are part of the
respective object and can be wired as any other track.
NOTE: The
initial CAT support in the internal version 0.20 used sample code by Frank
DeLise's script. Somewhere between M040 and M042 Custom Attributes got
changed and the code stopped working. The current temp. implementation
in MultiWire 0.21 supports only ONE set of CATs per level. This means that
only the first rollout in Base Object, every Modifier and the Material
will be displayed, the rest will be ignored. This will change when the
problems get fixed in Magma.
Another addition to
Version 0.2 is the support for Color values. Colors will behave like Point3
values, but when converted to angles, the suggested expression will be
multiplied by 360 when assigning to Eulerangles and by 255 when assigning
to Point3 values and Floats. This way you could control the X, Y and Z
axes of rotation with the RGB channels or get the color value in the range
0-255 when using Point3 or Floats.
Because of some bug
in Magma, when wiring a master property to another master, all old slaves
stop updating. MultiWire implements a temp.fix for this problem by trying
to rewire ALL existing wires in the scene after each wiring. For example
if you create a Bone chain and two sliders, wire all bones to the first
slider and then wire the slider to the second slider using Magma's wiring,
moving the second slider will update the first slider but not the bones.
Using MultiWire you can do this without a problem since all bone wires
will be "revived" after the slider to slider wiring.
Since Version 0.1 MAXScript
Wiring stability has been improved significantly. M043 will NOT crash to
desktop when your cat runs over the keyboard and types a wrong expression.
;o) The script itself will not be able to catch the error and a Wiring
dialog error will be issued, but it is really stable compared to M038...
Version 0.1 (9/28/2000)
MultiWire is divided in 4 main
groups: "Wire Master Object" lets you specify the Master Object and the
Property to wire to. "Wire Slave Objects" lets you load the current selection
to be wired to the Master, select the Property to be wired and the Expression
to be used. "Connect" contains the button to start wiring and some options.
"Disconnect" contains the respective button and options.
When started, MultiWire
will load the current scene selection as Slaves to be wired. It will scan
all object's properties and display only the properties common to all objects.
A status line will report the number of selected Slave Objects and the
number of common properties.
To load a different set of objects to be wired,
select them in the scene and press [Load Selection as Slave List]. The
last loaded selection will be remembered and the scene objects must not
remain selected all the time. To see what objects have been selected as
Slaves, press the [ReSelect in Scene] to select the current Slave List
Objects in the scene.
The [CONNECT...] button
will remain disabled until a Master Object has been picked. Use the [>Pick
Master] button to select from the scene or hit H to select by name. Once
selected, the name of the Master will appear in the field to the right
of the button and a list of all available Properties will be displayed.
The [DISCONNECT...] button will be disabled
if no Slave Objects have been selected. It will be enabled if there are
Slave Objects selected during the start of MultiWire or when
you use the [Load Selection...] button for the first time. If you press
the [Load Selection...] button while NO objects are selected, the current
Slave List will NOT be changed.
You can Disconnect (Unwire) properties
of the Slave Objects even if no Master Object has been picked yet.
To Connect (Wire) Properties,
an Expression has to be specified. The Expression describes mathematically
the relation between the selected Property values.
MultiWire
currently allows for unidirectional connections where the Master Object's
Property value is used to control the same Property of multiple Slave Objects.
You can tweak the connections later using the Magma "Wire Properties" Dialog
to get bidirectional connnections where needed. A default Expression will
be suggested by MultiWire taking into account the Value Types
of both Properties to be wired and in some cases the user Preferences regarding
X,Y & Z axes. The default Expression can also be edited or a new one
can be typed in by hand.
WARNING:
Due
to some current MAXScript bugs entering an invalid expression will usually
crash Magma to desktop.
MultiWire has error traps for these cases
enabled already, but they will not prevent the crashes in M038.
When both Properties are of a compatible type
(like Float & Float, Point3 and Point3 etc), the property itself will
be suggested as default Expression. When the Master Property is of Float
type and the Slave is of Point3 type, the Master Property will be suggested
as one of the 3 axes of a Point3 based on the Axis Preference radio buttons
bellow the Expression field. When the Master Property is of Point3 type
and the Slave is of Float type, one axis of the Point3 will be assigned
to the Slave using the same Axis Preference. Quats will be handled as Eulerangles
values.
To Connect Properties,
select the Master Property, the Slave Property, make sure the Expression
has the desired form and press the [CONNECT...] button. You will be prompted
about what operations are going to be performed. Press Yes to wire or No
to cancel. The results of all operations will be reported to the MAXScript
Listener.
The "KEEP Existing Controllers" option is
checked by default. When checked, the Wire Controller will NOT replace
the existing controller, but instead a new List Controller will be automatically
assigned and the Wire Controller will be placed on the list after the old
one. If the track already uses a List Controller, the Wire Controller will
be added to the existing list. In addition, MultiWire will
make sure the old controller will remain Active to allow for interactive
changes independently of the Wire Controller.
NOTE that
this option will also allow you to assign MULTIPLE WIRE CONTROLLERS to
the same Property (which is kind of cool ;o)
As with default Wiring
in Magma, you can Connect Parameters inside the same object as long as
it is not the same Parameter.
MultiWire
will skip the self-connections
and will report them in the Listener.
When "KEEP Existing Controllers" is NOT checked,
all Wire Controllers will replace the existing controllers as the default
Magma Wire Parameter functionality.
The "INSTANCE Controllers"
option is unchecked by default. In this case, each Slave Object will receive
its own unique Wire Controller whose Expression could be edited independently
later. When checked, only one Wire Controller will be generated and assigned
to all Slave Objects. Editing its Expression in ANY of the Instances will
automatically update ALL Parameters of all Objects wired at the same time.
To call the standard Magma Wire Parameters
Dialog to edit the Expressions and see the connections, double-click either
the Master or the Slave Property name in the list box. When double-clicking
the Master Property name, one window will open and display the the Master
Object Tree and Property in the left window. The right window will show
you the World - use the Find icon to jump to any wired Parameters.
If you double-click
the Property name in the Slave Objects List, you will be prompted about
opening a single window for each Object on the Slave List in case there
are more than one Objects in the Slave List. Answer with Yes to open multiple
windows or No to cancel. If there is only a single Object in the list,
the window will open immediately. The multiple windows will let you compare
Expressions and edit all of them at the same time. Use the Find icons left
and right to find the Master and Slave Properties that are connected.
To Disconnect, press the [DISCONNECT...] button.
You will be prompted to confirm the operation.
When the "KEEP Current
Values" option is checked (default), the Wire Controller will be removed,
but its current value will be assigned to the new default controller. In
plain vanilla Magma, the Disconnect would lead to a default value which
is usually zero!
NOTE that
when Disconnecting a Wire Controller from a List controller, you might
want to uncheck this option in order to keep only the ORIGINAL tracks from
before Wiring. If you use both "KEEP Exisitng Controllers" and "KEEP Existing
Values" to connect/disconnect multiple times after another, the Wire value
will accumulate.
If the "KEEP Current Values" is unchecked,
the default Magma disconnection will be performed and a new default controller
will be assigned with default value. If the Wire Controller was part of
a List Controller, it will be deleted completely from the list leaving
only the original controllers there. If only one sub-controller remains
after removing the Wire Controller, the List Controller will be removed
and the single sub-controller will be assigned to the Property. If there
are more than one Wire Controllers in the List Controller, ALL of them
will be removed!
The "Disconnect ALL
Props" option lets you disconnect not only the selected Property, but ANY
property using a Wire Controller inside any Slave Object. This basically
makes all selected Slave Objects completely WIRELESS :o)
MultiWire
will
scan all Slave Objects for Wire Controllers and remove them all. It will
report only the successful disconnections in the Listener.