PDA

View Full Version : Displaying current selection in UI?


Rivendale
09-26-2004, 01:47 AM
Hi, I have a little problem. I'm trying to redo the editable poly interface for myself to get rid of the command panel. I'm making a minimalistic ui that uses all the tools I usually use, and a few workflow improvements on exsisting tools. The problem I'm having is showing the current selection somehow in my ui; how many verts, edges and polygons that are currently selected. I have gotten as far as this(wich is not very far, heh):

c = $.selectedverts.count as string

...wich gives me a value of how many verts are selected. I want to put this into my ui somehow in a label or a button and I want it updated whenever the selection changes. Of course the value should also change based on wich subobject I'm currently in.

I've been trying like crazy to do this myself but I can't find out how. I want it shown in the same way the normal Editable poly interface shows it, but I can't seem to access that to see how it's done. Any solutions are very appreciated.

CML

dlanier
09-27-2004, 09:11 AM
Hi,

Here is a small example that will help you start.
It updates a label in a rollout floater with the number of selected vertices of the selected mesh.
Hope this helps.


rollout FloaterExample "FloaterExample" width:162 height:98
(
--create a label to show the selected vertices count
label NumVertsLbl "Num Sel Verts : 0" pos:[27,18] width:102 height:22

)
-- create the rollout window and add the rollout
if FloaterExampleFloater != undefined do
(
closerolloutfloater FloaterExampleFloater
)

FloaterExampleFloater = newRolloutFloater "FloaterExample Floater" 200 500
addRollout FloaterExample FloaterExampleFloater

fn UpdateUI =
(
if ($ != undefined and $ != selection) then
(
mesh = snapshotAsMesh $
NumSelVerts = mesh.selectedverts.count as string
FloaterExample.NumVertsLbl.text = "Num Sel Verts : "+NumSelVerts
)
else
(
FloaterExample.NumVertsLbl.text = "Num Sel Verts : 0"
)
)

--Remove any existing callbacks with this ID.
callbacks.removeScripts id:#myselcallback
--Add a new callback function
callbacks.addScript #selectionSetChanged "UpdateUI()" id:#myselcallback


Regards,

CGTalk Moderation
01-19-2006, 09:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.