owl-bt
Version:
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.
27 lines (22 loc) • 748 B
JavaScript
;
(function() {
class TreeDecoratorItemProvider {
constructor(ProjectStore, TreeItemPropertyDtoConverter) {
this._ProjectStore = ProjectStore;
this._treeItemPropertyDtoConverter = TreeItemPropertyDtoConverter;
}
create(dto) {
let desc = this._ProjectStore.getDecoratorTypeDesc(dto.type);
let decorator = {};
angular.extend(decorator, dto);
decorator.type = decorator.type || 'unknown';
decorator.$meta = {
desc: desc
};
decorator.properties = this._treeItemPropertyDtoConverter.convertFromDto(decorator.properties);
return decorator;
}
}
angular.module('editorApp')
.service('TreeDecoratorItemProvider', TreeDecoratorItemProvider);
})();