Physion

  • Increase font size
  • Default font size
  • Decrease font size
Welcome, Guest
Username Password: Remember me

Selection Toolbar
(1 viewing) (1) Guest

TOPIC: Selection Toolbar

Selection Toolbar 6 years, 8 months ago #188

  • Lynxx
  • OFFLINE
  • Moderator
  • Java/C#-Developer
  • Posts: 223
After the nice tutorial Creating Custom Toolbars, i made one myself:



Extract the archive and copy "icons" and "scripts"-folder to Physion/data.
Then "Evaluate Script"->"Selection Toolbar.script".

It allows to change a property of multiple selected objects at once.
For example you can change the BodyType, Color, Text and so on for all selected objects.
It also includes 2 comboboxes which contain the usual properties and values (including colors) which you can select.

To autostart the Toolbar in Physion V1.01++:
copy/move the "Selection Toolbar.script" to the "data/scripts/autoload"-folder.

(old) in Physion V1.00 optionally add:
app.evaluateScript("data/scripts/Selection Toolbar.script");

to the end of "data/scripts/ToolBox.script" to execute it automaticly.

Edit: Update V1.01 added 6 buttons to decrease/increase numbers, if no number is in the value-field the buttons will be hidden.

Edit: Update V1.02 added autocompleter for properties & values

Edit: Update V1.03 Property and Value-Field check for Return Pressed and set the value to all property of all selected items, Values-List got automatic execution.
Update V1.04 Added 4 Shortcut-Keys, Ctrl+Shift+Up/Down for the Properties-Field and Alt+Shift+Up/Down for the Values-Field (and automatic execution).
BTW: You can also enter #RRGGBB for colors in the valuefield

Edit: Update V1.05 added "Clear Selection", "Select All" and up to 10 Selection-Setbuttons, use Shift+Click to store a Selection.

Edit: Update V1.06 now you can also add a Set to the Selection with pressing Ctrl or remove the Set from the Selection by pressing Alt.

Edit: Update V1.07 added 4 Move-Buttons which are visible when something is selected, no modifier pressed move by 1, Ctrl = 10, Shift = 0.1, Alt = 0.01
Replaced the 6 Increase/Decrease-Buttons against 2 Buttons (only visible when a number is in the valuefield) which Increase/Decrease with no modifier pressed by 1, Ctrl = 10, Shift = 0.1, Alt = 0.01
Clicking Increase/Decrease-Buttons automaticly set the new value in the selection.
If only 1 Item is selected and you choose some property from the combobox (or by ctrl+shift up/down) and this item got this property it will be set in the value-field.
OnUpdate/OnContact wont be set to valuefield, if it's a color or solid brush it's color will be viewed as #RRGGBB in the valuefield.

Edit: Update V1.08 added translation-functionality and german translation.

Edit: Update V1.09 fix for Physion V1.01 when Toolbar is not in the autoload-folder.

Edit: Update V1.10 added Notice for Physion V1.01++ that Toolbar will be removed when Scene changes (caused by Widget-Fix).

Edit: Update V1.11 added better translation and it will use currently selected language (Physion V1.01++), fix for replaced physicsItemForGraphicsItem, added new V1.01 Properties.

Have fun.
Infinity is vast, especially near end.
bye, Lynxx
Last Edit: 5 years, 11 months ago by Dimitris.

Re: Selection Toolbar 6 years, 8 months ago #219

  • Lynxx
  • OFFLINE
  • Moderator
  • Java/C#-Developer
  • Posts: 223
Update V1.01 added 6 buttons to decrease/increase numbers, if no number is in the value-field the buttons will be hidden.
Infinity is vast, especially near end.
bye, Lynxx

Re: Selection Toolbar 6 years, 8 months ago #224

  • Lynxx
  • OFFLINE
  • Moderator
  • Java/C#-Developer
  • Posts: 223
Update V1.02 added autocompleter for properties & values
Infinity is vast, especially near end.
bye, Lynxx

Re: Selection Toolbar 6 years, 8 months ago #225

  • Dimitris
  • OFFLINE
  • Administrator
  • Posts: 218
It works very well Lynxx.

I am currently trying to do the same thing using the property editor (i.e. multi-selection editing) but your toolbar works so well that I'll probably leave it for later.

One thing: Maybe you should also connect the "returnPressed" signal of the value QLineEdit with the slot where your set the selection's properties. That way editing would be even faster

Re: Selection Toolbar 6 years, 8 months ago #229

  • Lynxx
  • OFFLINE
  • Moderator
  • Java/C#-Developer
  • Posts: 223
admin wrote:
One thing: Maybe you should also connect the "returnPressed" signal of the value QLineEdit with the slot where your set the selection's properties. That way editing would be even faster

Did that, but i'd like to add even more functionality, but got a problem there, tried something like:
 
selectionproperty = new QLineEdit();
selectionproperty.keyPressEvent = function(event) { ... };
 

Also see QWidget keyPressEvent.
My function gets the key pressed, but the QLineEdit will never receive any keypresses.
I tried: event.accept(), event.ignore(), event.setAccepted(false) - but the event.isAccepted() always return true, then i tried to call the "original" function, examples like Tetrix do QFrame::keyPressEvent(event), which wont work either,
also i tried QFrame.keyPressEvent(event), QWidget.keyPressEvent(event), QLineEdit.keyPressEvent(event), parent.keyPressEvent(event), super.keyPressEvent(event).
None of them works.
And i can't get a pointer to the original-function, because "new QLineEdit().keyPressEvent" returns "undefined".

Then i tried to overwrite event(), because there i can define with the return true/false if i want one event, but this didnt work either, the QLineEdit is not even drawed.

How can i call the "super"-function? Or tell the system that i don't want a keypress?
Infinity is vast, especially near end.
bye, Lynxx

Re: Selection Toolbar 6 years, 8 months ago #231

  • Dimitris
  • OFFLINE
  • Administrator
  • Posts: 218
That's an interesting question.

I have been trying for the last hour to find a solution...

[ To be continued ]
Moderators: Lynxx, Glenn555
Time to create page: 0.14 seconds