well at this moment, I'm not apply several weights to several joints,
I'm only apply 1 weight to 1 specific joint, also, I suppose the main
issue I'm bumping into is when I take a joint, remove it from the
skincluster and then add it back in. That is when the indexing gets
lost. There probably won't be a huge inflow of this kind of error, but
I would prefer to understand why it's doing that so I can avoid it
happening if possible. thanks!

Brandon L. Harris

On Dec 16, 7:58 pm, <[email protected]> wrote:
> When I used the setWeights methods I used and
>
> OpenMaya.MIntArray () for the index
>
> OpenMaya.MDoubleArray() for the values
>
>
>
> Check out the thread:
>
> http://groups.google.com/group/python_inside_maya/browse_thread/thread/d0df3e63bd2b1934/02902bc0a6d89e05
>
>
>
> Not sure whats the deal with indexes higher then the joint count. Have you 
> been recycling the same skinCluster for your testing? I imagine that could 
> produce sporadic indexes.
>
>
>
> -brian
>
> www.meljunky.com
>
>
>
> -------- Original Message --------
> Subject: [Maya-Python] Re: Adding Influence Object
> From: Brandon Harris <[email protected]>
> Date: Wed, December 16, 2009 8:01 pm
> To: python_inside_maya <[email protected]>
> let me run this by you and see if this is my problem. Getting the
> index of a joint in a skincluster
> joint = "joint1"
> jointDag = openMaya.MDagPath()
> jointName = openMaya.MSelectionList()
> jointName.add(joint)
> jointName.getDagPath(0, jointDag)
> jointIndex = (skinCluster.indexForInfluenceObject(jointDag))
> If I'm not mistaken, this should give me the index value for the joint
> that I can then pipe into the setWeights() like so
> weight=.45
> skinCluster.setWeights(objectPath, compItr.currentItem(), jointIndex,
> weight, True, throwAwayWeights)
> It seems that the index gets mixed up somehow because sometimes I get
> a value of 6 when there's only 2 or 3 joints in the scene, or as I'm
> setting values, it will apply a value that I specified for joint1 onto
> joint2 or joint3.
> Also, when I add a joint to the skinCluster, it gives it a higher
> index than the number of joints in the scene.
> Any help would be awesome!
> Brandon L. Harris
> On Dec 16, 5:13 pm, <[email protected]> wrote:
> > Floating point representations are inherently imprecise for many numbers. 
> > Which caused you values to go beyond 1.0 or set below 1.0. The way I 
> > approached it was to get the sum of the weights for the given component and 
> > used it to normalize the weights.
> >
> >
> >
> > finalVertWeight = vertWeight / totalWeightForThatVertOfAllJoints
> >
> >
> >
> >
> >
> > Dividing the weights by the totalWeights will normalize the weights to 1.0 
> > rathen then something like 1.000006 or 0.999995..its more like 
> > 1.0000000000000000477 now. Normalization should fix that
> >
> >
> >
> >
> >
> > -brian
> >
> >www.meljunky.com
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -------- Original Message --------
> > Subject: [Maya-Python] Re: Adding Influence Object
> > From: Brandon Harris <[email protected]>
> > Date: Wed, December 16, 2009 5:56 pm
> > To: python_inside_maya <[email protected]>
> > MelJunky, Was hoping that you would respond.
> > Are you normalizing your weights when using the setWeight()? When I
> > turn Normalization to False it works fine, but then my weights aren't
> > normalized and I don't want weights over a value of 1.
> > Brandon L. Harris
> > On Dec 16, 3:27 pm, <[email protected]> wrote:
> > > I used MFnSkinCluster not that long ago and I retrieved the fullPathName 
> > > of two different skinClusters and stored them in a list.
> > >
> > >
> > >
> > > Then, I had to compare the list to see if I need to add any influence 
> > > objects:
> > >
> > > list( set( first.influenceObjectsStr ).difference( 
> > > second.influenceObjectsStr) )
> > >
> > >
> > >
> > > If, the results wasn't None then I executed the MEL command to add them 
> > > as an influence using "OpenMaya.MDGModifier()", with the two methods 
> > > commandToExecute and doIt.
> > >
> > >
> > >
> > > So, I recommend to go with your first instinct and use MEL. Don't 
> > > remember where but someone mentioned that MEL is easier to add influences 
> > > then trying to use the API.
> > >
> > >
> > >
> > >
> > >
> > > As for the setWeights() issue...I had no problem changing the weight from 
> > > zero. Are you using the dataBlock for help setting the weights by chance 
> > > to retrieve values for setting the final weights?
> > >
> > >
> > >
> > > Try printing out the values from the OpenMaya.MDoubleArray() that you are 
> > > using to set the values are correct. Could also double check arguments 
> > > for the setWeights is correct... I had a problem before with setWeights 
> > > and I tracked it down to a previous issue.
> > >
> > >
> > >
> > > -brian
> > >
> > >www.meljunky.com
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > -------- Original Message --------
> > > Subject: [Maya-Python] Re: Adding Influence Object
> > > From: Brandon Harris <[email protected]>
> > > Date: Wed, December 16, 2009 4:00 pm
> > > To: python_inside_maya <[email protected]>
> > > And this has actually raised another issue. If a joints influence is
> > > entirely at 0 on a skinCluster and I use the setWeights() it won't set
> > > the weights. It just leaves the joint influence at 0. This a known
> > > issue?
> > > On Dec 16, 10:34 am, Brandon Harris <[email protected]> wrote:
> > > > Alright, so I have a system where you can grab components on multiple
> > > > meshes and apply weights to specified joints. Everything works fine
> > > > unless you run into a joint that doesn't effect one of the meshes. The
> > > > easiest way to do this would be just to check if the object influences
> > > > the skin cluster and if it doesn't add it. This would be simple with
> > > > Mel, but is there a way to accomplish this with API? In MFnSkinCluster
> > > > there isn't a method for this and I haven't been able to locate one.
> > > > There's got to be something there for it though.
> > > --http://groups.google.com/group/python_inside_maya
> > --http://groups.google.com/group/python_inside_maya
> --http://groups.google.com/group/python_inside_maya

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

Reply via email to