I am trying get the state of the checkbox in my animation subpanel and would like to set myBool to it's state.
Here is my code:
import bpy
import os
from bpy_extras.io_utils import ExportHelper
from bpy.props import (StringProperty, CollectionProperty, BoolProperty, EnumProperty)
from bpy.types import (Operator, OperatorFileListElement,)
import textwrap
class WorldOriginExport(Operator, ExportHelper):
bl_label = 'Export'
bl_idname = 'object.world_origin_export'
bl_description = textwrap.fill('Moves each selected object to the worlds origin and exports them as a gltf separate', 80)
bl_options = {'PRESET', 'UNDO', 'REGISTER'}
files = CollectionProperty(name = 'File Path', type = OperatorFileListElement,)
directory = StringProperty(subtype = 'DIR_PATH',)
filename_ext = '.gltf'
myBool = False
@classmethod
def poll(cls, context):
sfile = context.space_data
operator = sfile.active_operator
return operator.bl_idname == 'OBJECT_OT_world_origin_export'
def draw(self, context):
layout = self.layout
layout.use_property_split = False
layout.use_property_decorate = False # No animation.
sfile = context.space_data
operator = sfile.active_operator
def execute(self, context):
bpy.ops.export_scene.gltf(filepath = folder_path + os.sep + sel.name)
return {'FINISHED'}
class GltfSeparate_PT_Panel(bpy.types.Panel):
bl_space_type = 'FILE_BROWSER'
bl_region_type = 'TOOL_PROPS'
bl_label = 'glTF Separate'
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
sfile = context.space_data
operator = sfile.active_operator
return operator.bl_idname == 'OBJECT_OT_world_origin_export'
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False # No animation.
class GltfSeparateAnimation_PT_Panel(bpy.types.Panel):
bl_space_type = 'FILE_BROWSER'
bl_region_type = 'TOOL_PROPS'
bl_label = 'Animation1'
bl_parent_id = 'GltfSeparate_PT_Panel'
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
sfile = context.space_data
operator = sfile.active_operator
return operator.bl_idname == 'OBJECT_OT_world_origin_export'
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False # No animation.
class GltfSeparateAnimationAnimation_PT_Panel(bpy.types.Panel):
bl_space_type = 'FILE_BROWSER'
bl_region_type = 'TOOL_PROPS'
bl_label = ''
bl_parent_id = 'GltfSeparateAnimation_PT_Panel'
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
sfile = context.space_data
operator = sfile.active_operator
return operator.bl_idname == 'OBJECT_OT_world_origin_export'
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False # No animation.
def draw_header(self, context):
scene = context.scene
self.layout.prop(scene, "use_gravity", text = 'Animation2')
def register():
bpy.utils.register_class(WorldOriginExport)
bpy.utils.register_class(GltfSeparate_PT_Panel)
bpy.utils.register_class(GltfSeparateAnimation_PT_Panel)
bpy.utils.register_class(GltfSeparateAnimationAnimation_PT_Panel)
def unregister():
bpy.utils.unregister_class(GltfSeparateAnimationAnimation_PT_Panel)
bpy.utils.unregister_class(GltfSeparateAnimation_PT_Panel)
bpy.utils.unregister_class(GltfSeparate_PT_Panel)
bpy.utils.unregister_class(WorldOriginExport)
if name == 'main':
register()
bpy.ops.object.world_origin_export('INVOKE_DEFAULT')