Function Publishing System. Which Interface should I inherit from?

Function Publishing System. Which Interface should I inherit from?

martim.grosner
Enthusiast Enthusiast
692 Views
7 Replies
Message 1 of 8

Function Publishing System. Which Interface should I inherit from?

martim.grosner
Enthusiast
Enthusiast

I don't understand which Interface I am supposed to inherit from, in order to use the Function Publishing System. Is it FPInterface, FPMixinInterface, FPInterfaceDesc or even FPStaticInterface?

0 Likes
Accepted solutions (1)
693 Views
7 Replies
Replies (7)
Message 2 of 8

klvnk
Collaborator
Collaborator

 FPInterfaceDesc is exactly the same as FPStaticInterface, it's defined as.....

 

 

 

class FPStaticInterface : public FPInterfaceDesc
{
};

 

 

 

mixin (I think is short for mixed interface) is if you want to share function directly using sdk cpp (using the getinterface system) and or via maxscript using the fp system. The third method is the original getinterface method to share functions with sdk only

 

Message 3 of 8

martim.grosner
Enthusiast
Enthusiast

Mixin as I found out in a comment in ifnpub.h (starting in line 545) stands for "mixed in", because the interface is a sub-class of the plug-in class and thus mixed in with it.

 

What do you mean by sharing the function directly? Or better what is not sharing directly? If I use FPInterface, is it not direct sharing?

0 Likes
Message 4 of 8

istan
Advisor
Advisor

Look also for macro "def_visible_primitive"..

0 Likes
Message 5 of 8

martim.grosner
Enthusiast
Enthusiast

I am more confused now. Looking at the samples and all the examples I've seen so far of Function Publishing, I have not come across that. And looking at the Developer Help page also left me clueless. 

 

Sorry but being new to this, it's all a lot of information.

0 Likes
Message 6 of 8

klvnk
Collaborator
Collaborator

 

What do you mean by sharing the function directly?

 

when using the sdk and you want a plugin to use certain aspects of another plugin you create an interface class which defines the access (something like imyaccess) and then the server plugin is derived from this interface class. Now if the client plugin want to access the server object it calls GetInterface(interface_id) on that object and casting it to an imyaccess type. the client plugin doesn't need to know anything about the server object except what is define in imyaccess it could be sphere or spline as long as it return a valid imyaccess type. Unfortunately this does work with maxscript so if you want imyaccess visible to mxs you use a mixin interface.

 

an example

#define IOUTLINER_INTERFACE_ID			Interface_ID(0x12096f5b, 0x40064092)

class IOutliner : public BaseInterface 
{
public:

	virtual int getNumberOfOutlines() = 0;
	virtual p3vector& getOutline(int outline, TimeValue t = 0) = 0;
	virtual Interface_ID GetID() { return IOUTLINER_INTERFACE_ID; }
};

//********************************************************************************************

inline IOutliner* GetIOutliner(InterfaceServer* iserver)
{
	return static_cast<IOutliner*>(iserver->GetInterface(IOUTLINER_INTERFACE_ID));
}

 

an heres a modifier using a custom planes outline as it's "cutter"

 

outline_example.gif

the plane just inherits from ioutline 

 

 

 

 

0 Likes
Message 7 of 8

martim.grosner
Enthusiast
Enthusiast

I assume you meant "does not work". So if I want some type of function to be called through MAXScript, it HAS to be FPMixinInterface? If this is the case, I thought Function Publishing was meant for this in the first place.

 

Also, I do understand fairly well Interfaces and inheritance. My problem is understanding all of the Function Publishing Interfaces and why there are so many.

 

But with your help I'm close to finding out. 😁

0 Likes
Message 8 of 8

klvnk
Collaborator
Collaborator
Accepted solution

So if I want some type of function to be called through MAXScript, it HAS to be FPMixinInterface? 

 

only if you need it to work with GetInterface() system I described above, otherwise FPInterfaceDesc should do. There is in reality only 2 types of fp interfaces.