View Full Version : How do I handle user input?
BarbaPappa 03-19-2004, 08:21 AM Hi!
I wondering how to approach a problem. I'll try to explain this as simple as possible, here we go:
I want to align to a planar projection to a polygon. I want the user to be able to click the script, which then asks the user to select a polygon on which the planar projection is aligned to.
The thing i'm unsure about it how to do with the user input. The script should not execute until the user has picked a polygon.
What command do i use to request a face selection by the user?
Thanks
/Magnus
|
|
brubin
03-19-2004, 09:36 AM
string $H[] , $S[] ;
$H = `ls -hl` ;
int $s = `size $H` ;
if($s != 0)
{
$S = `ls -sl` ;
$s= `size $S` ;
if($s != 0)
{
string $P[];
$P = `ls -sl` ;
string $result = `confirmDialog -b "OK" -ma "center" -m ("i\'m a selected polygon\; my name is\: "+$P[0]+"\nwhat do i do next\?")` ;
if($result == "OK") warning "NO clue!!" ;
}
else warning "no poly selected" ;
}
else warning "not in component mode" ;
HIH
s.
BarbaPappa
03-19-2004, 09:45 AM
Hi!
Nice piece of code, but not exactly what I'm looking for. I want the script to ask for the user to select a polygon. Almost like the "best plane texturing tool" where the user is prompted to first select the faces, then press enter, and then select vertices.
I don't want to select the picked face, just get which face the user has clicked on.
Hope it's more clear now..
/Magnus
alesmav
03-19-2004, 10:27 AM
Why do you want to run the script first? Why not first select the face and then run the script. Or if you really want to run the script first, you can make a window with a text like "Please select a face, then press align" and the "Align" button below that text which executes the align script. I'm quite sure this is still very user friendly.
ALES
BarbaPappa
03-19-2004, 10:29 AM
hi!
in this instance. a planar projection is currently selected and i want to keep it selected for additional commands to control the planar projection.
/Magnus
Marcel
03-19-2004, 01:01 PM
You could make a scriptjob that detects a selection change, when the selection is changed you check if a face is selected. If it is, you store the selection, select your planar projection again and do your stuff.
Just thinking out loud :shrug:
BarbaPappa
03-19-2004, 01:05 PM
hmmm, not that familiar with scriptjobs, but I'll look into it... but shouldn't there be some simple way of picking something without selecting it... ?... hmm.. maybe not....
/Magnus
Hi,
Take a look at scriptCtx in the help as another alternative.
BarbaPappa
03-19-2004, 03:58 PM
scriptCtx seems to be the way to go... looks a bit tricky though... I'll try to look around for any example as well as reading up on the function.
Thanks for the help, everyone...
/Magnus
ps. If you know how it works, i wouldn't mind looking at an example ;) .ds
Hi,
// this creates a context (only create once or delete it each time)
{
scriptCtx -t "Howdie Face Tool" -tss 1 -esl 1 -pf 1
-fcs "print Selection1;select tempSelect;delete tempSelect;" myTool;
}
// this is how to work with it
{
sets -n tempSelect; // save selection in a temp set
select -cl; // clear current
setToolTo myTool; // activate context
}
alesmav
03-20-2004, 08:35 AM
So you currently have planar projection selected. You can still run the script I suggested in my previous post, except in the beginning of the script you put the currently selected projection in a string varible. Now you have the projection node name available at any time... You just have to select the face, hit "align" button and voila... Or is it something that I missed again...
ALES
CGTalk Moderation
01-17-2006, 06:00 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.