I've written a basic Fluid parser as part of a render engine export script. The relevant file is viewable here: http://cvs.savannah.gnu.org/viewvc/ecume/exporters/luxmaya/luxPlugin/Lux/LuxExportModules/Volume.py?revision=1.1&view=markup
On Sat, Sep 27, 2008 at 10:25 PM, Dean Edmonds <[EMAIL PROTECTED]>wrote: > > On Fri, Sep 26, 2008 at 7:59 AM, Horvátth Szabolcs > <[EMAIL PROTECTED]> wrote: > > > > I'm writing a command to query and modify fluid voxel data and having > > some difficulties understanding a python data type. > > MFnFluid.density is supposed to return a pointer to a float array but > > the Python API returns a 'PySwigObject' > > that I don't know how to handle. How do I iterate through its values? Or > > am I doing something completely wrong? > > Python does not have pointer types. Elementary types are passed by > value and objects are passed by reference. > > To get around this, the Maya API provides the MScriptUtil class which > can be used to generate a pointer or reference to an elementary type, > or to extract a value from a pointer to an elementary type. > > In your case you can use > maya.OpenMaya.MScriptUtil.getFloatArrayItem(densityValues, i) to > retrieve the i'th value from the array. > > -- > -deane > > > > --~--~---------~--~----~------------~-------~--~----~ Yours, Maya-Python Club Team. -~----------~----~----~----~------~----~------~--~---
