Wings 3D Development Forum
Selection Groups - Printable Version

+- Wings 3D Development Forum (https://www.wings3d.com/forum)
+-- Forum: Wings 3D (https://www.wings3d.com/forum/forumdisplay.php?fid=1)
+--- Forum: Programming (https://www.wings3d.com/forum/forumdisplay.php?fid=7)
+--- Thread: Selection Groups (/showthread.php?tid=1154)



Selection Groups - Namrata - 04-19-2015

Hello,

I am developing a plugin which requires me to create 100 new vertex selection groups. Could someone please suggest How I can automatically generate these groups having the names like 'group_n' where n will be the group number going from 1-100.

Also, how exactly would I access the vertex number of the vertices added to a particular group?


RE: Selection Groups - micheus - 04-19-2015

It's late here, so if nobody else can help you I can try tomorrow or Monday.

But you can try find answers by looking in the code that manages it: https://github.com/dgud/wings/blob/master/src/wings_sel_cmd.erl


RE: Selection Groups - ggaliens - 04-19-2015

A rough sample of how to add ... (code below has not been compiled or determined to be syntactically correct.
Code:
SSELS = St0#st.ssels,

WeID = % YOU FIGURE IT OUT

MyAcc = fun(_Idx,Acc) ->
     StrIdx = lists:flatten( io_lib:format("group_~p",[_Idx])),
     SetVs =GetSet(_Idx, WeID), %% you must write this function
     Key = {vertex,StrIdx},
     Value = [{WeID, SetVs}]
     gb_trees:enter((Key,Value,Acc),
end,
SSELS2 = lists:foldl(MyAcc, SSELS, lists:seq(1,100)),

St0#st{ssels=SSELS2}