pruttned / owl-bt

owl-bt is editor for Behavior trees. It has been inspired by Unreal engine behavior trees in a way, that it supports special node items like decorators and services. This makes trees smaller and much more readable.
175 stars 28 forks source link

enhacement: plugins #6

Closed gamagan closed 6 years ago

gamagan commented 6 years ago

When I started playing around with the plugins, I realized how powerful they can be. They were a great addition to owl-bt.

At first, defining a plugin was a little confusing because of catching and because changes to plugin js files are not hot-loaded. Changes made to the plugin files didn't seem to affect existing tree files. Then I realized what's happening. Not that it's a bug; it's just that it could be confusing to a new user. You might want to mention it in the documentation:

  1. owl-bt will not remove existing fields in tree files. If a field is there when the tree file is loaded, it will be written when the file is saved. This confused me because I added a field via plugin, but then deleted the plugin code, but the field was still in the file whenever I saved it. I removed the field manually, restarted owl-bt, and then saved the file and the field was gone.
  2. For changes in owl-bt.js to take effect, owl-bt needs to be restarted. This, combined with 1, was making me think that the plugin wasn't working. Changes to other files are hot-loaded, so it caught me by surprise.

ENHANCEMENT REQUEST:

A) I'm guessing that if you didn't support hot-loading owl-bt.js was because of technical reasons. If this is possible, however, it would be a really nice to have.

B) There is an opportunity to make plugins also work as validators: make the return value of 'onTreeSave' and 'onTreeLoad' determine whether the file can be saved or loaded. Maybe something like this:

gamagan commented 6 years ago

Any progress?

pruttned commented 6 years ago

pls see https://github.com/pruttned/owl-bt/issues/5

pruttned commented 6 years ago

done in 1.3.0

gamagan commented 6 years ago

Thanks, bruh