API PointPicker without HTML UI

Next
 From:  Joe (CTKJOSE)
10961.1 
Hi

I would appreciate any ideas on how to let the user select an unknown amount of points.

I noticed that using PointPicker to select multiple points works fine if the command has a UI/HTML (moi.ui.commandUI is available).
In this case `pointpicker.event` will include events triggered by the `commandUI` in particular:

- Enter key will trigger the "done" event, and the "Esc" key will trigger the "cancel". Both of these events I can catch with `pointpicker.event`.
- You can also use `moi.command.registerCommandSpecificShortcutKey`.

On the other hand, I haven't found a method to indicate that "I'm done selecting points" when you don't have a UI.

I can work around this if I know the number of points to select before entering my `waitForEvent` loop.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10961.2 In reply to 10961.1 
Hi Joe,

re:
> On the other hand, I haven't found a method to indicate that "I'm done selecting points" when
> you don't have a UI.

The way that is done in MoI is by having a a "Done" button. Then Enter or right-click in a viewport are shortcuts for pushing "Done".

Why are you trying to do it without any UI?

Without any UI the pointpicker will still generate a "cancel" event and waitForEvent() will return false when the Esc key is pressed, while a successful pick will generate "finished" so you could look for the cancel to stop picking points.

But it would be best to show UI with a "Done" button so it could behave similar to existing MoI commands.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Joe (CTKJOSE)
10961.3 In reply to 10961.2 
Michael

I appreciate your help.

My UI is running on a separate dialog outside the scope of `moi.command.execCommand()`.

For now, I'm gonna use `Esc`/`cancel`, albeit that was my actual cue to cancel...
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10961.4 In reply to 10961.3 
Hi Joe, if you want to have a "done" type button on your dialog you can have it trigger a UI event itself like this:

onclick="moi.ui.fireUIEvent( 'done' );"

This is done automatically for controls inside of the command UI (they generate a UI event using their id="" value) but you can also trigger it directly as well.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Joe (CTKJOSE)
10961.5 In reply to 10961.4 
Thanks...

That will work really well.

PS:

I know you must be super busy and appreciate your help, still trying to learn and still digging and finding a treasure of information in the forums. So just to add my grain of sand I started to document things in GitHub. It is still in its early stages, I'm mainly just dumping stuff, but hopefully, it will take form.

https://github.com/ctkjose/moi3d
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Michael Gibson
10961.6 In reply to 10961.5 
Hi Joe, thanks for collecting info on GitHub, I have added a link to there from https://moi3d.com/wiki/Scripting

Thanks, - Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All