Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Open Reality / extending the API and custom objects
  RSS 2.0 ATOM  

extending the API and custom objects
Rate this thread
 
61941
 
Permlink of this thread  
avatar
  • Ollie_D
  • Posted: 14 November 2011 12:59 PM
  • Total Posts: 26
  • Joined: 23 August 2006 03:55 AM

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



Replies: 0
avatar
  • Neill3d
  • Posted: 15 November 2011 08:24 AM

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.



freelance mocap studio AnimArt - http://mocap.com.ua/en/

Replies: 1
/img/forum/dark/default_avatar.png

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

Author: Ollie_D

Replied: 15 November 2011 10:10 AM  
avatar
  • Ollie_D
  • Posted: 21 November 2011 03:38 PM

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.ArgumentErrorPython argument types in
    SampleExporter
.findModelsByAttribute(strFBComponentList)
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.ArgumentErrorPython argument types in
    pyfbsdk
.FBFindObjectsByName(FBComponentListstr)
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}boolbool)

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

FBSDK_DLL void FBFindObjectsByName( const charpNamePatternFBComponentListpListbool pIncludeNamespace truebool pModelsOnly false );
void findModelsByAttribute(const charpPropNameFBComponentListpList)

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?



Replies: 0