Yup... the only thing I would add is that you need to allocate space for
whatever you're going to be storing - the default constructor allocates NO
space (not even enough for a single int).

The easiest way to allocate space here would be to use the createFromInt
method:

u=om.MScriptUtil()
u.createFromInt(0) # Can be any value, just want to make sure space is
allocated

You can use the createFromInt / createFromDouble methods to allocate enough
space for up to 4 values; if you need more, I suggest using the
(undocumented) createFromList method.

I love MScriptUtil - it lives at the lovely intersection of confusing
implementation, poor documentation, and high expectation of crashes when
used incorrectly...

- Paul

On Tue, May 11, 2010 at 12:37 AM, Viktoras <[email protected]> wrote:

> On 2010.05.11 06:48, Brandon Harris wrote:
>
>>         u = openMaya.MScriptUtil().asIntPtr()
>>         v = openMaya.MScriptUtil().asIntPtr()
>>         compItr.getIndex(u,v)
>>         compList.append([(pathName + ".cv[%s][%s]")%
>> (openMaya.MScriptUtil().getInt(u),openMaya.MScriptUtil().getInt(v))])
>>
>>
> this was never intended to be a correct usage of MScriptUtil, you should
> not save instances of "asPtr" return values.
> instead, you save instance of MScriptUtil, e.g.
>
> u=om.MScriptUtil()
>
> then pass asPtr value to functions
>
> compItr.getIndex(u.asIntPtr(),v.asIntPtr())
>
> then retreive the value with
>
> om.MScriptUtil.getInt(u.asIntPtr())
>
> --
> Viktoras
> www.neglostyti.com
>
>
> --
> http://groups.google.com/group/python_inside_maya
>

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to