Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved operations and fixed pick block #223

Merged
merged 11 commits into from
Mar 21, 2021
Merged

Conversation

gentlegiantJGC
Copy link
Member

Previously operations were very limited and all of the rendering and behaviour logic was done in the parent tool.
This changes that and moves all the logic into the operation itself.
The OperationUI class has been stripped back to a bare API and the logic has been moved into the subclass DefaultOperationUI.
If you want to retain the default behaviour (including rendering, camera movement and some other things) you will need to switch the class that you subclass.
If instead you want to define your own interaction and rendering behaviour you can do so by subclassing OperationUI and adding on the behaviour.

The unload method is now disable to make it have the same API as tools so you will need to rename those methods.

Finally EVT_BOX_CLICK has been removed. The trigger for it was removed a while back but it has stayed because things were still importing it. This logic can be achieved by listening to EVT_INPUT_PRESS on the canvas and checking the action_id of the event.
If you are using DefaultOperationUI that logic has been handled for you and the method _on_box_click will be run when this action is run. Define this method in the subclass to run the desired code.

With these changes to give the operations more control it is now possible to re-implement the pick block tool.

gentlegiantJGC and others added 11 commits March 18, 2021 16:37
Added documentation
and added a bit of documentation
The BaseToolUI class was doing too much so this has been stripped back to a bare API.
Its logic has been moved into DefaultBaseToolUI along with the camera behaviour.
Previously the operation tool controlled the camera, box and rendering behaviour.
This has now been moved into the operations themselves so that they can in theory control the editor in the same way that tools can.
If _show_pointer is set to True or a number greater than or equal to 1 a one box wide pointer will be drawn.
It also adds a method _on_box_click which will be run each time the box click action is run (default left mouse)
This makes it easy to set up the block pick dropper
@gentlegiantJGC gentlegiantJGC merged commit b02a433 into master Mar 21, 2021
@gentlegiantJGC gentlegiantJGC deleted the fix-pick-block branch March 21, 2021 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant