Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Function Publishing System. Which Interface should I inherit from?

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
martim.grosner
390 Views, 7 Replies

Function Publishing System. Which Interface should I inherit from?

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?

7 REPLIES 7
Message 2 of 8
klvnk
in reply to: martim.grosner

 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
in reply to: klvnk

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?

Message 4 of 8
istan
in reply to: martim.grosner

Look also for macro "def_visible_primitive"..

Message 5 of 8
martim.grosner
in reply to: istan

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.

Message 6 of 8
klvnk
in reply to: martim.grosner

 

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 

 

 

 

 

Message 7 of 8
martim.grosner
in reply to: klvnk

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. 😁

Message 8 of 8
klvnk
in reply to: martim.grosner

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report