Passing FPInterfaces as Parameters and Results

FPInterfaces themselves can now be passed directly as parameters and results via the new type, TYPE_INTERFACE. These turn up in MAXScript as instances of a new value class, FPInterface, with all the interface's methods accessible as properties.

In cases where you have an class publishing a single mixin interface, it is possible to pass instances directly as TYPE_INTERFACE and let the FPInterface* type-cast implied by TYPE_INTERFACE extract the mixin interface. This is a useful simple alternative to the IObject scheme for publishing a mixin interface on non-Animatables, since you don't actually need to implement the IObject protocol in these cases. If the Foo example above had a single mixin, it would publish it in a similar way to the following:

class IFoo : public  FPMixinInterface
{
   virtualvoid Frabulate(Point3 p)=0;
   //...
};

class Foo : public OtherBaseClass, publicIFoo
{
   // Foo methods
   ...
   // IFoo methods
   voidFrabulate(Point3 p) { ... }
   //...
};

The same Foo*-returning GetFoo() method in the previous example would then be declared using TYPE_INTERFACE in the FUNCTION_MAP as:

FN_1(my_getFoo, TYPE_INTERFACE, GetFoo, TYPE_INODE);

and in the descriptor constructor as:

my_getFoo, _T("getFoo"), 0, TYPE_INTERFACE, 0, 1,
     _T("object"), 0, TYPE_INODE,

In this case, calling getFoo() in MAXScript would return an FPInterface value that exposes the IFoo methods directly as properties.

f = getFoo $
f.frabulate [10,0,0] --call the Foo1 frabulate method

Note again this scheme won't work for class publishing multiple multiple mixins since implied FPInterface* cast becomes ambiguous - you must use the IObject mechanism in this case.