Eric Thivierge =============== Character TD / RnD Hybride Technologies
Eric Thivierge =============== Character TD / RnD Hybride Technologies
Eric Thivierge =============== Character TD / RnD Hybride Technologies
Maybe you can still get some optimization using numpy, I think. Throw your weights array directly into numpy. It is worth a try at least.
Eric Thivierge =============== Character TD / RnD Hybride Technologies
xsi = Application obj = xsi.Selection(0) envCls = obj.ActivePrimitive.Geometry.Clusters(0) envProp = envCls.Properties(0) # Envelope ICE attrs: # EnvelopeWeights, EnvelopeWeightsPerDeformer, EnvelopeDeformerIndices, NbDeformers data = envProp.GetICEAttributeFromName("EnvelopeWeights").DataArray2D indices = envProp.GetICEAttributeFromName("EnvelopeDeformerIndices").DataArray2D nbdef = envProp.GetICEAttributeFromName("NbDeformers").DataArray[0] print "Deformer count: %s" % nbdef for i,val in enumerate(zip(indices, data)): idx, val = val print "Point #%s indices:(%s) - values:(%s)" % (i,idx,val)
Eric Thivierge =============== Character TD / RnD Hybride Technologies
Have you tried a GridData object? It would abstract the problem away from Python and be flexible enough to pass around between commands written in various languages. I usually use the GridData object because it simplifies coding and has a few methods specifically for working with column data making it easier to manipulate weight values per deformer. You do give up some speed compared to other available methods in the other languages, but in your situation the GridData might perform faster than anything available in Python.
The snippet below runs in Jscript in about 4 seconds on my 5-year old computer. Will probably run faster on yours.
// JScript
function main()
{
var oObject = Selection(0);
var oEnvelope = oObject.Envelopes(0);
// Get weight values from envelope
var oWeightData = XSIFactory.CreateGridData();
oWeightData.Data = oEnvelope.Weights.Array;
// Modify the weight values for the first deformer
var aWeightValues = new Array( oEnvelope.Weights.Count );
oWeightData.SetColumnValues( 0, aWeightValues );
// Update the envelope with modified weight values
oEnvelope.Weights.Array = oWeightData.Data;
It's very dense geo probably no where near the gorgo though. It's just the Softimage default xsi man armored. The body mesh local subdivided and fetching from there.
In my previous posts it's simply the data fetch that is taking 6 seconds. The other processes aren't taking too long regardless. I was surprised because I remember the interaction on the dinos with your tools.
I really seems the slowness is simply accessing envelopeOp.Weights.Array.Indeed, you are right.
Orlando.Pingo, here's a tricky compund, it may work or it may not, but just in case you want to give it a go. Just explode the compound and tweak it. A couple of comments will tell you what's doing what... it's pretty simple compound so you shouldn't have troubles understanding it. It should go between your "follow curve" nodes and your "strand trails" nodes.Hope that helps,
<image.jpeg>
strictly forbidden. <turbulize point position flowing along curve.xsicompound>
Hey Eric,I must confess that I am quite confused by this thread as I can't figure out what this is really about...* performance of the Array property?
You don’t have to convert the VBSafeArray to a Jscript array unless you’re going to modify it in place. You can allocate a Jscript array or use a GridData object to hold the modified values. That’ll save considerable processing time.
Matt
From: softimag...@listproc.autodesk.com [mailto:softimag...@listproc.autodesk.com] On Behalf Of Martin
Sent: Monday, June 03, 2013 10:53 PM
To: soft...@listproc.autodesk.com
Subject: Re: Slow Reading / Writing Envelope.Weights.Array
Just a few tests :
+1 BIG time. I have tried and failed at making this work properly. Even with Mootz emFlock this is not terribly simple to do.
It would be great if flow along curve could work as a force alongside other motion control nodes and allow adjusting degree of effect via slider. It has a slider but I just can't get turbulence working with it without ugly jitter., no matter which way I order the different nodes.
Morten
Thats a good one Peter - it works pretty much like I wanted it :)
A couple of things though - the turbulence seems to accumulate along the curve - I would prefer to have turbulent behaviour around a base position and then send that along a curve - it is nice though to have the curve apply speed and direction though.
Another one is, if I Create Strands from the particles they will flip orientation when moving along the curve and I am not quite sure how to control that.
I have attached the scene if you care to take a look.
Cheers Morten