I need to set weights for some edges from a python script. I have tried looping through object.data.edges and setting bevel_weight values but I can't get it right. It only works if I have first edited some edge's bevel weight by hand from the 3d-view's transform window. But I would like to get it work from my script without any manual hacking.
Steps to reproduce:
Start Blender with default cube and switch to Scripting view.
Try to set weights for all edges:
for edge in C.object.data.edges:
edge.bevel_weight = 1.0
Verify that values changed:
for edge in C.object.data.edges:
edge.bevel_weight
Switch into edit mode in 3d-view and open up transform window by pressing n. Select edges to see that the change did not work (bevel weights are all zero). Switch back to object mode and read values again in scripting console to see that they were reset to zero:
for edge in C.object.data.edges:
edge.bevel_weight
Go back to edit mode and change some edge bevel weight straight from the transform window by hand. Go back to object mode and change values again from the scripting console:
for edge in C.object.data.edges:
edge.bevel_weight = 1.0
This time it works, bevel weights are 1.0 when you go back to edit mode and look from the transform window.
Any ideas? My final need is to apply a bevel modifier to only some set of edges and that's why I'm trying to mark them by using weights. Using vertex group for bevel modifier does not work in my situation, since I need to specify edges, not vertices, which to bevel.
I'm using Blender v2.71.