MotionBuilder Forum
Welcome to Autodesk’s MotionBuilder Forums. Share your knowledge, ask questions, and explore popular MotionBuilder topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

extending the API and custom objects

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
333 Views, 3 Replies

extending the API and custom objects

I have a couple of questions regarding plugin development. I have been scripting in mobu for some time and am pretty comfortable with the API. I have just recently started looking into plugin development. I am also new to C++ so I can appreciate it is going to be a reasonably steep learning curve.

I have been going through the samples that are provided and have managed to build them as well create my own variations here and there. The things that I want to do however are not covered in the samples so I thought I would pose the questions here.


Extending the API
Is it possible to extend the API in such as way to provide additional commands to the python interface? The example I am thinking of is a command for finding objects with the particular attribute. Now of course this is possible in python but it is slow, particularly with large scenes. I am hoping that I can write the command in C++ and then call it from python when required. Something similar to FBFindObjectsByName, perhaps FBFindObjectsByAttribute.

Custom objects
Is it possible to create a custom object type? Something that distinguishes them from all other objects in the scene. There is an example that creates a custom object but is still an FBModel as far of the system is concerned. I would like to make a custom model type, like FBHandle, FBNote etc. I would like to have an FBMyCustomModel for example.

Thanks in advance for any info you can provide.

Cheers,
Ollie
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

Hi Ollie,

> Extending the API
There is a way to extending the API for Python, almost using newer versions of OR SDK. You can find an example of doing this in OR samples

> Custom objects
There is a possibility to create only custom models from FBModel and custom user models from the special FBUserObject type.
Message 3 of 4
Anonymous
in reply to: Anonymous

Hi Neill,

Thanks for your reply. I have been through the samples several times and can not find anything regarding extending the API for python. Dont suppose you know where the example is?

Cheers,
Ollie
Message 4 of 4
Anonymous
in reply to: Anonymous

OK so thanks to this thread I was able to get things going with boost. It took a fair bit of fiddling around but do now have the inaugural "hello world" function working.

My next question is about passing data to and from python and C++. Starting with my example of findModelsByAttribute. I am trying to send a component list to the C++ function from python, similar to the FBFindObjectsByName. The error I am getting is "did not match C++ signature" error.

full error is

    SampleExporter.findModelsByAttribute("test", lList) 
Boost.Python.ArgumentError: Python argument types in
SampleExporter.findModelsByAttribute(str, FBComponentList)
did not match C++ signature:
findModelsByAttribute(char const * __ptr64, class ORSDK2011::FBArrayTemplate<class ORSDK2011::FBComponent * __ptr64> {lvalue})


If I induce a similar error on FBFindObjectsByName (by mixing the inputs for example) I get

    FBFindObjectsByName(lList, "Cube")
Boost.Python.ArgumentError: Python argument types in
pyfbsdk.FBFindObjectsByName(FBComponentList, str)
did not match C++ signature:
FBFindObjectsByName(char const * __ptr64, class PYFBSDK::FBComponentList_Wrapper {lvalue})
FBFindObjectsByName(char const * __ptr64, class PYFBSDK::FBComponentList_Wrapper {lvalue}, bool)
FBFindObjectsByName(char const * __ptr64, class PYFBSDK::FBComponentList_Wrapper {lvalue}, bool, bool)



Looking at the documentation on FBFindObjectsByName the parameters into the function look the same as my findModelsByAttribute.

FBSDK_DLL void FBFindObjectsByName( const char* pNamePattern, FBComponentList& pList, bool pIncludeNamespace = true, bool pModelsOnly = false );



void findModelsByAttribute(const char* pPropName, FBComponentList& pList) 


So my questiuon is why is my function looking for FBArrayTemplate and FBFindObjectsByName is looking for FBComponentList_Wrapper when they are both the looking for a FBComponentList in the function?

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

Post to forums  

Autodesk Design & Make Report