Re: Envelope Weights Array, out of memory error

2015-10-30 Thread Matt Lind
As noted in many past threads, Python is kind of shoe-horned into Softimage 
and doesn't have the same level of integration as VBScript or Jscript.


The source of the problem is likely related to having to call 
Envelope.GetWeights2() instead of Envelope.Weights.  It may produce the same 
end result, but the path to get there is different likely involving extra 
memory allocation to get the envelope weight data on top of what is handed 
to your calling code.  Under most conditions that is not a problem, but 
yours is a bit extreme.  I would look at trimming the envelope before 
resorting to code modification, but assuming you cannot do so...


A plugin in another language should be fairly trivial such as this:

function GetEnvelopeWeightsData_Execute( oEnvelope, oWeightData )
{
   oWeightData.Data = oEnvelope.Weights.Array.toArray();
}

or

Function GetEnvelopeWeightsData_Execute oEnvelope, oWeightData
   oWeightData.Data = oEnvelope.Weights.Array
end Function


oWeightData would be a pointer to a GridData object and passed into the 
plugin via the siDispatch classification so it is not converted or modified 
in any way by Softimage at invocation of the plugin.  I suggest GridData 
because it has methods to work with rows and columns much like the Envelope 
object, and can easily dump the data back into the envelope via 
oEnvelope.Weights.Array = oWeightData.Data, thus simplifying your code and 
avoiding the need to convert between data types.


Just a suggestion, you can do what you like.


Matt





Date: Fri, 30 Oct 2015 16:12:19 -0400
From: Eric Thivierge <ethivie...@gmail.com>
Subject: Re: Envelope Weights Array, out of memory error
To: "softimage@listproc.autodesk.com"

Steve, yes that was my thought to do that by iterating over each and
building up the numpy array. Usually I can just dump the Weights.Array into
numpy.array() but I can't even get to that point yet because of casting
into a Python tuple or list or whatever. I'll give that a shot.

Matt, I don't need to be jumping through more hoops and crossing the
streams with intermingled JScript / VBScript plug-ins. You may have a
point, maybe one of those languages handles the amount of data better
though.

I have tried splitting the calls separately but that doesn't help either.
:\

Thanks for the tips, will tinker.

Eric T.


Eric Thivierge
http://www.ethivierge.com



Re: Envelope Weights Array, out of memory error

2015-10-30 Thread Steven Caron
Maybe use GetDeformerWeights and accumulate the weights for each deformer
into something like a numpy array, do your work, and the set it back?

On Fri, Oct 30, 2015 at 11:50 AM, Eric Thivierge 
wrote:

> Hello all,
>
> Right off the bat, no I'm not going to use VBScript or JScript.
>
> I'm running into an issue in Python that I'm pretty sure is just a simple
> case of literally out of memory that Python has available but I'm posting
> anyway to see if anyone has ideas.
>
> I have a mesh with ~350k points and 498 skin deformers. When I try to
> access the Weights Array it errors out saying Out of Memory Error in Python.
>
> Code:
> Envelopes(0).GetWeights2().Array
>
> This simply doesn't work. Anyone have any ideas on how to get around this
> in Python or should I look to other tools for this?
>
> I'm guessing I need to get a buddy to write me a C++ command instead.
>
> Thanks in advance.
>
> 
> Eric Thivierge
> http://www.ethivierge.com
>


Re: Envelope Weights Array, out of memory error

2015-10-30 Thread Matt Lind
You'll consider C++ but not something simpler like JScript of VBScript? 
Seems rather odd logic.


Anyway, how you access information is important.  Calling 
Envelopes(0).GetWeights2().Array as a single statement will incur more 
overhead than doing this:


   var oEnvelope = Envelopes(0);
   var oWeights = oEnvelope.GetWeights2();
   var aWeightData = oWeights.Array;

Every time you call a property or method, you prod the system to allocate 
resources to satisfy the request.  There are limits to how much memory you 
can grab at a time, as you've encountered, and by asking for all of it at 
once you're more likely to exhaust it.  By separating statements you split 
the allocation into 3 separate smaller pools, which if taken to the limits, 
allows you to access more memory than with a single transaction and with 
less worry of bumping into the ceiling.


It's more code to write, but it'll work more efficiently in the case you're 
dealing with.  Works particularly well with JScript ;-)



Matt






Date: Fri, 30 Oct 2015 14:50:26 -0400
From: Eric Thivierge <ethivie...@gmail.com>
Subject: Envelope Weights Array, out of memory error
To: "softimage@listproc.autodesk.com"

Hello all,

Right off the bat, no I'm not going to use VBScript or JScript.

I'm running into an issue in Python that I'm pretty sure is just a simple
case of literally out of memory that Python has available but I'm posting
anyway to see if anyone has ideas.

I have a mesh with ~350k points and 498 skin deformers. When I try to
access the Weights Array it errors out saying Out of Memory Error in Python.

Code:
Envelopes(0).GetWeights2().Array

This simply doesn't work. Anyone have any ideas on how to get around this
in Python or should I look to other tools for this?

I'm guessing I need to get a buddy to write me a C++ command instead.

Thanks in advance.


Eric Thivierge
http://www.ethivierge.com



Envelope Weights Array, out of memory error

2015-10-30 Thread Eric Thivierge
Hello all,

Right off the bat, no I'm not going to use VBScript or JScript.

I'm running into an issue in Python that I'm pretty sure is just a simple
case of literally out of memory that Python has available but I'm posting
anyway to see if anyone has ideas.

I have a mesh with ~350k points and 498 skin deformers. When I try to
access the Weights Array it errors out saying Out of Memory Error in Python.

Code:
Envelopes(0).GetWeights2().Array

This simply doesn't work. Anyone have any ideas on how to get around this
in Python or should I look to other tools for this?

I'm guessing I need to get a buddy to write me a C++ command instead.

Thanks in advance.


Eric Thivierge
http://www.ethivierge.com


Re: Envelope Weights Array, out of memory error

2015-10-30 Thread Eric Thivierge
Steve, yes that was my thought to do that by iterating over each and
building up the numpy array. Usually I can just dump the Weights.Array into
numpy.array() but I can't even get to that point yet because of casting
into a Python tuple or list or whatever. I'll give that a shot.

Matt, I don't need to be jumping through more hoops and crossing the
streams with intermingled JScript / VBScript plug-ins. You may have a
point, maybe one of those languages handles the amount of data better
though.

I have tried splitting the calls separately but that doesn't help either.
:\

Thanks for the tips, will tinker.

Eric T.


Eric Thivierge
http://www.ethivierge.com

On Fri, Oct 30, 2015 at 3:18 PM, Matt Lind <speye...@hotmail.com> wrote:

> You'll consider C++ but not something simpler like JScript of VBScript?
> Seems rather odd logic.
>
> Anyway, how you access information is important.  Calling
> Envelopes(0).GetWeights2().Array as a single statement will incur more
> overhead than doing this:
>
>var oEnvelope = Envelopes(0);
>var oWeights = oEnvelope.GetWeights2();
>var aWeightData = oWeights.Array;
>
> Every time you call a property or method, you prod the system to allocate
> resources to satisfy the request.  There are limits to how much memory you
> can grab at a time, as you've encountered, and by asking for all of it at
> once you're more likely to exhaust it.  By separating statements you split
> the allocation into 3 separate smaller pools, which if taken to the limits,
> allows you to access more memory than with a single transaction and with
> less worry of bumping into the ceiling.
>
> It's more code to write, but it'll work more efficiently in the case
> you're dealing with.  Works particularly well with JScript ;-)
>
>
> Matt
>
>
>
>
>
>
> Date: Fri, 30 Oct 2015 14:50:26 -0400
> From: Eric Thivierge <ethivie...@gmail.com>
> Subject: Envelope Weights Array, out of memory error
> To: "softimage@listproc.autodesk.com"
>
>
> Hello all,
>
> Right off the bat, no I'm not going to use VBScript or JScript.
>
> I'm running into an issue in Python that I'm pretty sure is just a simple
> case of literally out of memory that Python has available but I'm posting
> anyway to see if anyone has ideas.
>
> I have a mesh with ~350k points and 498 skin deformers. When I try to
> access the Weights Array it errors out saying Out of Memory Error in
> Python.
>
> Code:
> Envelopes(0).GetWeights2().Array
>
> This simply doesn't work. Anyone have any ideas on how to get around this
> in Python or should I look to other tools for this?
>
> I'm guessing I need to get a buddy to write me a C++ command instead.
>
> Thanks in advance.
>
> 
> Eric Thivierge
> http://www.ethivierge.com
>
>