You can access hair point data in the same way as you do point data on a
poly mesh.
var aPoints =
oObj.Activeprimitive.Geometry.Points.PositionArray.toArray();
for ( var i=0; i<aPoints.length; i+=3 ) {
}
The number of strands is the count of points divided by 14. It's the only
way to get the strand count.
The root point of a hair strand doesn't exist in the hair point data, you
have to retrieve it from the emitting geometry by looping through face nodes
in a unique way:-
Istrand = 0;
For each face
for each node on face
if ( ! (point is visited) )
iStrand ++
Kind of thing. I usually push the point position onto an array so I can
index it directly.
> -----Original Message-----
> From: owner-xsi(at)Softimage.COM
> [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Greg Smith
> Sent: 24-May-2006 23:30
> To: XSI_MailingList
> Subject: [scripting] hair geometry
>
> Okay so I cracked my knuckles, and started to get into the
> nuts and bolts of the hair geometry primitive and so far I am
> a little frustrated. Maybe its because I am still a little
> wet behind the ears when tinkering with the internals of xsi,
> I don't know.
>
> So down to the nitty gritty. Using python, I am trying to get
> access at components of hair geometry object. one of the
> things I am having an issue with is finding a direct method
> in finding the total amount of guide hairs live on the hair
> object. Thus far I haven't found a direct method. The only
> thing I have come up with so far is dividing the total number
> of points found in the hair object by the total amount of
> points found in a guid hair. This gives me the appropriate
> number, but I would prefer something a little more elegent.
>
> Is there any way to grab the 2d array index of a point using
> the object model?
> when I select a point on one of the guide hairs, I get this
> line in the history log.
>
> Application.SelectGeometryComponents("Hair.pnt[(27,3)]")
>
> However I don't want to use a string argument, I'd much
> rather use an object method, however when I try, I can't
> figure out how to access a point component in that method. I
> can gain access of a point by index number from the
> pointcollection using the code below.
>
> xsi = Application
> hr = xsi.ActiveSceneRoot.FindChild('Hair')
> ohair = hr.ActivePrimitive.Geometry
> oPnts = ohair.Points
>
> I tried appending .SubComponent to oPnts and work from there,
> but I can't figure out where I am supposed to proceed.
>
> any Ideas?
>
> Thanks,
>
> Greg
>
>
>
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following
> text in body:
> unsubscribe xsi
>
>
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi