Start a new topic

mgfilelocatorfunc Python signature?

Original Post by: notsofast Wed Aug 27 19:19:17 2014


I want to use mgSetTextureLocatorFunc() in Python, but I cannot find any definition for the Python version of mgfilelocator func. It needs to return a path string.


Apparently I can't just get the current one and call it in the Python interactive interpreter either.


I'm guessing it is either:


outputFileName locatorFunc(db, inputFileName, userData)


or


(mgbool, outputFileName) locatorFunc(db, inputFileName, userData)

Original Post by: SteveThompson Thu Aug 28 18:10:55 2014


I hope you will continue to make the Python interface more complete. It is very handy.

Thanks to you for highlighting this "hole" in the API. This seems like a useful thing for Scripts to do (work with the locator functions). We will consider adding support for this asap.


Thanks again for your comments and suggestions.

Original Post by: notsofast Thu Aug 28 17:15:43 2014


It was easier to use my own function to find the texture maps, copy them to the new location, and update the texture name, instead of using mgWriteTexture(). And much easier than converting everything to C, but thanks for the suggestion.


I hope you will continue to make the Python interface more complete. It is very handy.

Original Post by: SteveThompson Thu Aug 28 16:30:23 2014


Is there any way to set the search path used by the default locator function?

No there is not. The idea was that the locator function could be swapped in/out by the app so no need to twiddle with search paths. The problem is you can't do this in OpenFlight Script, only the C-language API. Admittedly this is a hole in OpenFlight Script. Can you convert your app to use the C-language API?

Original Post by: notsofast Thu Aug 28 13:54:52 2014


Is there any way to set the search path used by the default locator function?

Original Post by: SteveThompson Wed Aug 27 21:59:56 2014


The documentation is at fault here. You cannot use the locator functions in OpenFlight script currently. Sorry that the documentation does not suggest that. You can only use the locator functions in the C language API.


Again, sorry about that.

Login to post a comment