For completion, here is what I found out. If I loop through the cvs and set
the weights, it works as expected.
crv_1 = pm.curve(d=1, p=[(0,5,0), (10,10,0)], n='crv_1')
crv_2 = pm.curve(d=1, p=[(0,0,0), (10,0,0)], n='crv_2')
bs = pm.blendShape(crv_1, crv_2)[0]
print(bs.inputTarget[0].baseWeights.get())
# result: ()
num_cvs = crv_2.getShape().numCVs()
# set the weights
for index in range(num_cvs):
bs.inputTarget[0].baseWeights[index].set(1)
print(bs.inputTarget[0].baseWeights.get())
# result: (1.0, 1.0)
BR,
Johan
On Friday, March 13, 2015 at 11:48:48 AM UTC+1, johan Borgström wrote:
>
> Hi,
>
> I want to be able to get and set the base weights of a blendshape. In the
> example below I am using pymel to get the base weights. If I first edit the
> weights in the component editor and then run the script it returns a tuple
> of weights, but if I have not manually edited the weights I get an empty
> tuple back. The same is true if I view the node in the node editor, first
> the baseWeight slot is empty but if I edit the weights, the weights are
> displayed.
>
> How can I get and set the base weights programatically using pymel? is
> that possible?
>
> crv_1 = pm.curve(d=1, p=[(0,0,0), (10,10,0)], n='crv_1')
> crv_2 = pm.curve(d=1, p=[(0,0,0), (10,0,0)], n='crv_2')
>
> bs = pm.blendShape(crv_1, crv_2)[0]
>
> bs_weights = bs.inputTarget[0].baseWeights.get()
> print(bs_weights)
>
>
> BR,
> Johan
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/51ae5aa0-fd63-4cd3-9bad-02d40f6c5647%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.