Everything related to SDK.
#387949
Hi Brany

Is it possible to fetch the file paths of all the RFMeshes in an MXS using Python?

I've spent a good amount of time this evening trying to find a way to do it but no luck yet. The standard getDependencies() method for finding all the textures used in a scene doesn't list RFMeshes, and so as an alternative I've tried looping through all the objects to see if the RFMesh file path property is hidden anywhere but this didn't get me anywhere either.

Here's a basic version of the script as it stands:
Code: Select all
from pymaxwell import *
mxs_path = "N:\Path\to\scene.mxs"
scene = Cmaxwell(mwcallback)
ok = scene.readMXS(mxs_path)
print ok
print scene.getDependencies() # No mentuon of RFMeshes


# Try looping through objects to get RFMeshes properties
names = scene.getObjectNames()
for obj_name in names:
    print obj_name
    obj = scene.getObject(obj_name)
    print obj.getDependencies()
Thanks for any tips..
#387964
Aha, so the relevant C++ and python methods (isRFRK, getRFRKParameters, setRFRKParameters) are exposed in the Maxwell Render 2.7 SDK, but not in the 3.1 SDK.

Here are the 2.7 docs:
http://www.maxwellrender.com/api/2.7/do ... 2331462f4f
http://www.maxwellrender.com/api/2.7/do ... 54789caef6

Would it be possible to allow access to these methods in Maxwell 3.2? Or failing that is there another workaround to gather RFMeshes from an MXS scene?
#387966
The RFRK methods on Cmaxwell::Cobject are missing because they have been deprecated for a long time, and have now been removed (from maxwell.h, not just pymaxwell). Assuming that you are dealing with files not written using those methods, you have mxs files with MaxwellMesher objects in them (since that was the replacement), so you will need to call CextensionManager.instance().loadAllExtensions() (say, at line 3 in your example code), in order for .mxx files to be loaded and successfully queried by getDependencies.
#387967
Hey JDHill, thanks for your help, it put me on the right track.

Worth noting as well, that if anyone else is doing something similar but NOT using the default pymaxwell.exe interpreter then you may need to import ctypes and specify the location of the mxcommon_64.dll for loadAllExtensions() to work, otherwise you'll see errors like this:
Code: Select all
Error in Loadlibrary.
Error loading library: C:\Program Files\Next Limit\Maxwell 3\extensions\AssetReference.win64.mxx 
 The specified module could not be found.
or
Code: Select all
The program can't start because mxcommon_64.dll is missing from your computer. Try reinstalling the program to fix the problem.
So here's my working code snippet in case anyone finds it helpful:
Code: Select all
from pymaxwell import *

# If you're NOT using the default pymaxwell.exe interpreter you'll need to import ctypes and the mxcommon Dll
import ctypes
hllDll = ctypes.WinDLL("C:\Program Files\Next Limit\Maxwell 3\mxcommon_64.dll")

mgr = CextensionManager.instance()
mgr.loadAllExtensions()

mxs_path = "N:\\Path\\to\\scene.mxs"
scene = Cmaxwell(mwcallback)
ok = scene.readMXS(mxs_path)
print scene.getDependencies()
Next up... testing on OSX :?
#387968
Indeed, plugins always need to make sure mxcommon is loaded too (whether using LoadLibrary on Windows, or dlopen on OSX), since they don't run from the Maxwell directory, like Maxwell/Studio/etc.
#387969
On OSX loadAllExtensions() works as expected when I use the system python, however when I try and use any other version of python I get error like this:
Code: Select all
Extension: /Applications/Maxwell 3/extensions/SubdivisionModifier.osx.mxx incompatible with current SDK version
Extension: /Applications/Maxwell 3/extensions/TiledTexture.osx.mxx incompatible with current SDK version
Extension: /Applications/Maxwell 3/extensions/WireframeTexture.osx.mxx incompatible with current SDK version
Probably worth noting that the I've modified the python path in _pymaxwell.so for other versions of python to get rid of the PyThreadState_Get error http://www.maxwellrender.com/forum/view ... 15#p387637

Any idea what might cause these errors? I'm guessing it's an incorrect link somewhere but not sure where to start really..
New podcast - CG Talks

Hi guys! We've just finished the first season of […]

Thanks, Luis, appreciated. It looks like industria[…]

That looks like a low bpc (bits per channel) norma[…]

Fully working plugin for C4D

When you will be working on it please try to keep […]