import maya.OpenMaya as om
light = om.MFnVolumeLight()
light.create()
light.setLightShape(3)
myRamp = om.MRampAttribute(light.penumbraRamp())
myRamp.getNumEntries()
#Def to get some values from MScriptUtil
def getFltPtrs():
f1_ptr = 0.5
f2_util = om.MScriptUtil()
f2_util.createFromDouble(0.5)
f2_ptr = f2_util.asFloatPtr()
return [(f1_ptr),(f2_ptr)]
fPtrs = getFltPtrs()
myRamp.getValueAtPosition(fPtrs[0], fPtrs[1])
The reason is the first value is just a float not a reference. You can
tell that the value is not a reference in the documentation because it
has no & character next to it. As you can see from the Maya API docs
below:
void MRampAttribute::getValueAtPosition (float position,
float & value,
MStatus * ReturnStatus = NULL,
MDGContext & context = MDGContext::fsNormal
)
Hope that helps,
Ryan
www.rtrowbridge.com/blog
Character TD
Naughtydog
On Jul 6, 12:42 am, Rosenio <[email protected]> wrote:
> Now I've used the MScriptUtil functions but return the same problem...
> (I change the op to om)[:D]
>
> import maya.OpenMaya as om
>
> ligth = om.MFnVolumeLight()
> ligth.create()
> ligth.setLightShape(3)
> myRamp = om.MRampAttribute(ligth.penumbraRamp())
> myRamp.getNumEntries() #It works fine
>
> #Def to get some values from MScriptUtil
> def getFltPtrs():
> f1_util = om.MScriptUtil()
> f1_util.createFromDouble(0.5)
> f1_ptr = f1_util.asFloatPtr()
>
> f2_util = om.MScriptUtil()
> f2_util.createFromDouble(0.5)
> f2_ptr = f2_util.asFloatPtr()
> return [(f1_ptr),(f2_ptr)]
>
> fPtrs = getFltPtrs()
>
> myRamp.getValueAtPosition(fPtrs[0], fPtrs[1]) #Doesn't work
> # Error: TypeError: in method 'MRampAttribute_getValueAtPosition',
> argument 2 of type 'float' #
>
> Enyone of you guys now whats hapening?
> I wonder if someone can help me...
--
http://groups.google.com/group/python_inside_maya