!!! LINUX PEOPLE
PLEASE READ !!!
In order to use my makefiles you will need to have
2 scripts, mayacc and mayald somewhere in your path. These simply set
the correct include and library directories for maya plugins and then
call gcc. If you need to re-compile the plugins for a different version
of maya, change the maya directory path variable within the scripts and
that *should* be all you need to do. I have no idea if the plug-ins work
on Apple Mac's, I would assume it would not take you long to port over.....
mayacc & mayald
|
Software Shaders
All nodes involved in rendering (shading nodes)
work in a similar fashion. The general gist is to create a node that takes
a number of input attributes and then outputs a colour, transparency value
etc. The Maya API help lists a number of specific input and output attributes
that can be used to retrieve surface information, camera and lighting
info etc.
In addition we can also classify the node with a specific
text string. This will organise the node type into the most relevant panel
in the create dialogs for the multi-lister. |
|
|
|
Shader Node
A simple colour blending utility node.
This is probably the simplest shader node ever.... |
|
|
Basic Software Shader
1
An example of the simplest possible software
shader going. It simply creates an input colour, and output colour and
basically passes the input to the output. ie, this is a constant colour
shader. |
|
|
Basic Software Shader 2
The software shader extends things a little
bit by adding in some basic diffuse lighting. |
|
|
Basic Software Shader 3
This extends the previous example by adding
in ambient colour and bump mapping attributes. |
|
|
Basic Software Shader 4
This shader example extends the previous one by adding
in specular lighting calculations. |
|
|
Basic Software Shader 5
This shader adds in some ray-traced reflection
support into the material. This example is very similar to the devkit
phong example.... |
|
|
|
|
|
HW
Shader Nodes |
HW Shaders under linux seem to be pretty broken as far
as I can tell. The problem I'm having is that I am unable to access
any external shared objects from a plugin. For example, using fmod within
a plugin to add 3D sound seems to be impossible because it will never
load fmod.so.
The problem with HW shaders under linux is that I can't
get access to any opengl extensions from within my plugins. I take heart
from the fact that NVidia don't offer the CGFX plugin under linux, so
i assume that i'm not the only one having this problem.
The shader's here all work under linux because they
only use openGL 1.1. If anyone knows the reason why this doesn't work
and has a solution, i'd be very interested to hear!!!
|
|
|
|
|
|
HW Shader 1 A
very simple example of an openGL hardware shader. |
|
|
HW Shader 2 This
extends the previous example by adding in an attribute editor template
for the shader |
|
|
HW Shader 3 This
example add's an MPxDragAndBropBehavior derived class into the foray to
handle drag and drop connections made in the hypergraph and hypershade.
|
|
|
HW Shader 4 This
uses MImage to access the texture data. You'd probably want to use MTexture
rather than this method.... |
|
|
|
Locator Nodes |
|
|
|
|
|
Locator Node 1 An
example of a fairly pointless and dull locator node. |
|
|
Locator Node 2
An example of a locator node with a few custom attributes. |
|
|
Locator Node 3
This locator node also contains an attribute
editor template to define the layout of the controls in the attribute
editor |
|
|
37 New Locator Nodes
A selection of 37 random locator nodes.
I was bored ok?!?.... |
|
|
|
Contexts |
Ahhh, a small
context crisis under Win32 i'm afraid. Err, under linux the overlay works
rather nicely indeed. You can only get a mild grey colour, but still;
it works. Under Win32 it seems as though overlays are not supported, and
the result is the gastly mess you see in the images below. In the API
lasso tool example, a manual call to swap the buffers is made. In my opinion,
the API example is a bit dodgy, there is a fixed version on highend 3D,
but i've not tried it out to see if it works. This version runs really
nicely on linux.... (i usually find it's the other way around) |
|
|
|
|
|
Context 1 This
example impliments a very simple rectangular selection tool using MPxContext
and MPxContextCommand. To use the plugin once loaded, type the following
into the script editor
$context = `RectangleSelectToolContext` ;
setToolTo $context; |
|
|
Context 2 This
example impliments a circular selection tool.
$context = `CircleSelectContext` ;
setToolTo $context; |
|
|
Context 3 This
example extends the basic Circular context to add in User interfaces registered
with MFnPlugin::registerUI |
|
|
Context 4 This
is basically a slightly altered version of the lasso tool that comes with
the Maya API devkit. |
|
|
|
Messages and Callbacks |
|
|
|
|
|
MConditionMessage
Simply provides a callback to notify the
plugin when Maya starts or stops animation playback. |
|
|
MEventMessage1
Adds a simple idle callback to a plugin
which simply prints a text string every time maya becomes idle. |
|
|
MEventMessage2
Adds a simple idle callback to a plugin which simply moves
a line from the bottom of the overlay to the top. |
|
|
MEventMessage3
Uses user data associated with an event
message to 'thunk' an idle callback to a member function of a class. This
allows maya to specifically call a member function of a class upon a specifiied
event. |
|
|
MEventMessage4
Uses an event message to poll joypads
via Direct Input (Win32) or the joystick lib (linux). The status of the
joypad is then forced onto the overlay each time the idle is called. |
|
|
MEventMessage5
Uses an event message to poll joypads
via Direct Input (Win32) or the joystick lib (linux). The joypad controls
a small dot drawn on the overlay. A bit silly, but you could use this
as the basis of 'overlay pong' or something similar.... |
|
|
MModelMessage
A simple example of MModelMessage that
creates callbacks to identify when the selection list changes or an object
gets duplicated. |
|
|
MSceneMessage
This callback example has callbacks to
recieve notification of when a file is imported, exported, opened or saved. |
|
|
|
MComputation |
|
|
|
|
|
MComputation1
This plugin demonstrates the MComputation
class in the simplest possible way.... |
|
|
MComputation2
This plugin writes out a file for frames
1 to 1000. Each file contains the vertex positions of all meshes in the
scene at that frame. MComputation is there to stop this long winded action
by pressing escape.... |
|
|
|
Exporters and Importers |
|
|
|
|
|
Light Import/Export
Exports an imports Lights only. This is
just a very simple example that shows a fully working importer and as
well as exporter. The plugin uses the MPxFileTranslator |
|
|
Basic Mesh Exporter
+ Viewer
A simple exporter and viewer for polygonal
data. This example is on a par with the obj exporter included with maya,
it should provide a simple basis from which to start an exporter. |
|
|
Intermediate Exporter + Viewer
This exporter adds support for materials,
textures and lights. MImage is used to output the texture data in a seperate
binary file. |
|
|
Advanced Exporter
+ Viewer
This adds support for Nurbs curves and
surfaces as well as skinning, bone hierachies and animation data. There
are a few things about this code i would personally do differently now,
however i can't see myself updating it at the moment due to lack of time
:( You might find a couple of things that you'd want to change, but it's
more or less there.... |
|
|
MD2 Exporter + Viewers
A simple exporter and set of loaders for the Quake2 MD2
file format. |
|
|
|
Node Examples |
|
|
|
|
|
Simple Node 1
This is an example of the simplest possible
MPxNode derived plugin. The node simply has an input time attribute, and
a single output floating point value. The output is simply set to the
sine of the input |
|
|
Simple Node 2 This
is an example extends the prvious example by providing a simple mel command
to create the node, and by adding an additional scalar attribute. |
|
|
Simple Node 3 This
is an example extends the prvious example by providing an Attribute Editor
template (AE Template). This additional mel script is what defines the
user interface for this node type. |
|
|
Simple Node 4 This
doesn't actually add anything. I think somethings gone wrong in one of
the lectures..... |
|
|
Ramp Attribute
This example shows how to add a Ramp attribute to a node
and how to get the Attribute Editor to display the nice little graph.
|
|
|
|
Mel Command Examples |
|
|
|
|
|
Function 1
A really basic template for an MSimple
based maya plugin. It uses MFnPointLight to create a red point light within
the scene. |
|
|
Function 2 This
example loops through all meshes within a scene and adds a pointlight
to each vertex of each mesh within the scene. |
|
|
Function 3 This
example uses MImage to return a colour value of a pixel to mel. This demonstrates
how MSyntax can be used to make parsing mel argument easier. |
|
|
Function 4 Function
2 but derived from MPxCommand instead of using MSimple. |
|
|
Function 5 Adds
to the previous example by adding a selected flag. |
|
|
Function 6 Use
MSyntax to simplify the argument parsing. |
|
|
Function 7 Use
MSyntax to simplify the process of working with selected objects. |
|
|
|