# ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see # and write to the Free Software Foundation, Inc., 51 Franklin Street, # Fifth Floor, Boston, MA 02110-1301, USA.. # # The Original Code is Copyright (C) 2023 by Kurochkin Ilia ### # All rights reserved. # # Contact: brothermechanic@yandex.com ### # Information: https://gitlab.com/robossembler ### # # The Original Code is: all of this file. # # ***** END GPL LICENSE BLOCK ***** # # -*- coding: utf-8 -*- import os import bpy from bpy.types import ( Panel, Operator, PropertyGroup) from bpy.props import ( StringProperty, EnumProperty, PointerProperty) from .scene_to_json import export_scene_conf bl_info = { 'name': 'Robossembler Tools', 'author': 'brothermechanic@gmail.com', 'version': (0, 1), 'blender': (3, 6, 1), 'location': '3D View > Toolbox', 'description': 'Robossembler pipeline tools', 'warning': '', 'wiki_url': '', 'tracker_url': 'https://gitlab.com/robossembler', 'category': 'Robossembler', } class addon_Properties(PropertyGroup): engine: EnumProperty( name='Physics Engine', description='Selest Target Engine', items=[('BULLET', 'Bullet', ''), ('ODE', 'O D E', ''), ('SIMBODY', 'Simbody', ''), ('OPENSIM', 'OpenSim', '') ] ) conf_file_path: StringProperty( name='Config File Path', description='Input/output config file path', default='', maxlen=1023, subtype='FILE_PATH' ) class RobossemblerPanel(Panel): '''Doc''' bl_label = 'Robossembler Tools' bl_idname = 'ROBOSSEMBLER_PT_PANEL' bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = 'Robossembler' def draw(self, context): prop = context.scene.robossembler_properties layout = self.layout layout.prop(prop, 'conf_file_path') layout.prop(prop, 'engine') col = layout.column() col.alert = True col.scale_y = 2.0 col.operator('export.scene_config', icon='WORLD_DATA', text='Export Scene Config') class RobossemblerOperator(Operator): '''Tooltip''' bl_idname = 'export.scene_config' bl_label = '' bl_description = 'Export scene config' bl_options = {'REGISTER', 'UNDO'} def execute(self, context): prop = context.scene.robossembler_properties conf_file_path = os.path.realpath(bpy.path.abspath((prop.conf_file_path))) physics_engine = prop.engine export_scene_conf(context, conf_file_path, physics_engine) return {'FINISHED'} classes = ( RobossemblerPanel, RobossemblerOperator, addon_Properties) def register(): for cls in classes: bpy.utils.register_class(cls) bpy.types.Scene.robossembler_properties = PointerProperty(type=addon_Properties) def unregister(): for cls in classes: bpy.utils.unregister_class(cls) del bpy.types.Scene.robossembler_properties if __name__ == '__main__': register()