On 23/04/2018 at 10:18, xxxxxxxx wrote:
I have an Object plugin (a generator) in which I want to make and set a Selection Tag with the current edge selection of the active object.
Edges are set, but not the correct ones. What is wrong?
Here the code.
import c4d
from c4d import gui, utils
def main() :
selected = op.GetEdgeS() # Returns a BaseSelect that'll tell us which edges are currently selected
nbr = utils.Neighbor()
nbr.Init(op)
nrEdges = nbr.GetEdgeCount()
tag = op.MakeTag(c4d.Tedgeselection) #create edge selection tag
tag_baseSelect = tag.GetBaseSelect()
tag_baseSelect.SelectAll(nrEdges-1)
for i in range(nrEdges) : # For every edge index of the object...
if selected.IsSelected(i) : # if it's selected...
tag_baseSelect.Select(i) # reflect that in the selection tag.
c4d.EventAdd()
if __name__=='__main__':
main()