Exemplo n.º 1
0
    def invoke(self, context, event):
        if self.image_format == 'PNG':
            self.filename_ext = ".png"
        else:
            self.filename_ext = ".exr"

        return ExportHelper.invoke(self, context, event)
Exemplo n.º 2
0
    def invoke(self, context, event):
        if self.image_format == 'PNG':
            self.filename_ext = ".png"
        else:
            self.filename_ext = ".exr"

        return ExportHelper.invoke(self, context, event)
Exemplo n.º 3
0
 def invoke(self, context: bpy.types.Context, event: bpy.types.Event):
     preferences = get_preferences(context)
     if preferences:
         self.export_invisibles = bool(preferences.export_invisibles)
         self.export_only_selections = bool(
             preferences.export_only_selections)
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 4
0
    def invoke(self, context, event):
        settings = context.scene.get(self.scene_key)
        self.will_save_settings = False
        if settings:
            try:
                for (k, v) in settings.items():
                    if k == "export_selected": # Back compatibility for export_selected --> use_selection
                        setattr(self, "use_selection", v)
                        del settings[k]
                        settings["use_selection"] = v
                        print("export_selected is now renamed use_selection, and will be deleted in a few release")
                    else:
                        setattr(self, k, v)
                self.will_save_settings = True

            except (AttributeError, TypeError):
                self.report({"ERROR"}, "Loading export settings failed. Removed corrupted settings")
                del context.scene[self.scene_key]

        import sys
        preferences = bpy.context.preferences
        for addon_name in preferences.addons.keys():
            try:
                if hasattr(sys.modules[addon_name], 'glTF2ExportUserExtension') or hasattr(sys.modules[addon_name], 'glTF2ExportUserExtensions'):
                    extension_panel_unregister_functors.append(sys.modules[addon_name].register_panel())
            except Exception:
                pass

        self.has_active_extenions = len(extension_panel_unregister_functors) > 0
        return ExportHelper.invoke(self, context, event)
Exemplo n.º 5
0
    def invoke(self, context, event):
        settings = context.scene.get(self.scene_key)
        self.will_save_settings = False
        self.has_active_extenions = False
        if settings:
            try:
                for (k, v) in settings.items():
                    setattr(self, k, v)
                self.will_save_settings = True

            except (AttributeError, TypeError):
                self.report({
                    "ERROR"
                }, "Loading export settings failed. Removed corrupted settings"
                            )
                del context.scene[self.scene_key]

        import sys
        if bpy.app.version < (2, 80, 0):
            preferences = bpy.context.user_preferences
        else:
            preferences = bpy.context.preferences
        for addon_name in preferences.addons.keys():
            try:
                if hasattr(sys.modules[addon_name],
                           'glTF2ExportUserExtension') or hasattr(
                               sys.modules[addon_name],
                               'glTF2ExportUserExtensions'):
                    extension_panel_unregister_functors.append(
                        sys.modules[addon_name].register_panel())
                    self.has_active_extenions = True
            except Exception:
                pass

        return ExportHelper.invoke(self, context, event)
Exemplo n.º 6
0
 def invoke(self, context, event):
     self.exporter = (self.exporter_str or self.exporter) # make sure properties are up-to-date
     if self.use_file_browser:
         self.filepath = context.blend_data.filepath or "untitled"
         self.generate_name(context)
         return ExportHelper.invoke(self, context, event)
     else:
         return self.execute(context)
Exemplo n.º 7
0
 def invoke(self, context: bpy.types.Context,
            event: bpy.types.Event) -> Set[str]:
     if bpy.app.version < (2, 83):
         return cast(
             Set[str],
             bpy.ops.wm.export_blender_version_warning("INVOKE_DEFAULT", ),
         )
     preferences = get_preferences(context)
     if preferences:
         self.export_invisibles = bool(preferences.export_invisibles)
         self.export_only_selections = bool(
             preferences.export_only_selections)
     return cast(Set[str], ExportHelper.invoke(self, context, event))
Exemplo n.º 8
0
    def invoke(self, context, event):
        settings = context.scene.get(constants.EXPORT_SETTINGS_KEY)
        if settings:
            try:
                restore_export_settings(self.properties, settings)
            except AttributeError as e:
                logging.error("Loading export settings failed:")
                logging.exception(e)
                logging.debug("Removed corrupted settings")

                del context.scene[constants.EXPORT_SETTINGS_KEY]

        return ExportHelper.invoke(self, context, event)
Exemplo n.º 9
0
    def invoke(self, context, event):
        settings = context.scene.get(constants.EXPORT_SETTINGS_KEY)
        if settings:
            try:
                restore_export_settings(self.properties, settings)
            except AttributeError as e:
                logging.error("Loading export settings failed:")
                logging.exception(e)
                logging.debug("Removed corrupted settings")

                del context.scene[constants.EXPORT_SETTINGS_KEY]

        return ExportHelper.invoke(self, context, event)
Exemplo n.º 10
0
    def invoke(self, context, event):
        settings = context.scene.get(self.scene_key)
        self.will_save_settings = False
        if settings:
            try:
                for (k, v) in settings.items():
                    setattr(self, k, v)
                self.will_save_settings = True

            except (AttributeError, TypeError):
                self.report({"ERROR"}, "Loading export settings failed. Removed corrupted settings")
                del context.scene[self.scene_key]

        return ExportHelper.invoke(self, context, event)
Exemplo n.º 11
0
 def invoke(self, context: bpy.types.Context,
            event: bpy.types.Event) -> Set[str]:
     preferences = get_preferences(context)
     if preferences:
         self.export_invisibles = bool(preferences.export_invisibles)
         self.export_only_selections = bool(
             preferences.export_only_selections)
     if not use_legacy_importer_exporter() and "gltf" not in dir(
             bpy.ops.export_scene):
         return cast(
             Set[str],
             bpy.ops.wm.gltf2_addon_disabled_warning("INVOKE_DEFAULT", ),
         )
     return cast(Set[str], ExportHelper.invoke(self, context, event))
	def check(self, context):

		if self.md5type == '1':
			self.filename_ext = '.md5camera'
			self.filter_glob = '*.md5camera' # no effect?
		else:
			self.filename_ext = '.md5mesh'
			self.filter_glob = '*.md5mesh;*.md5anim'

		#print("CHECK -", self.filename)
		if self.filename.startswith(('.md5camera', '.md5mesh')):
			self.filename = '' #NEEDS FIX!


		return ExportHelper.check(self, context)
Exemplo n.º 13
0
    def invoke(self, context, event):
        settings = NifExportSettings()
        settings.load(context)

        # find all available properties and their default values
        self.prop_defs = get_export_properties()

        # enumerate properties, if a setting exists and differs from current property value,
        # change the property value
        for k in self.prop_defs:
            setting_val = settings.get(k)

            if setting_val != None and getattr(self.properties, k) != setting_val:
                setattr(self.properties, k, setting_val)
                #print('new value of', k, 'is', getattr(self.properties, k))

        filename = settings.get('filename')
        if filename is not None:
            self.filepath = filename

        return ExportHelper.invoke(self, context, event)
Exemplo n.º 14
0
 def invoke(self, context, event):
     CurrentFormatProperties._clear_props()
     
     if self.format:
         op = get_op(self.format)
         op_class = type(op.get_instance())
         
         CurrentFormatProperties._add_props(op_class)
         
         if self.format == "wm.collada_export":
             # Special case: Collada (built-in) -- has no
             # explicitly defined Python properties
             CurrentFormatProperties.second_life = bpy.props.BoolProperty(
                 name="Export for Second Life",
                 description="Compatibility mode for Second Life",
                 default=False,
                 )
     else:
         self.visible_name = "Blend"
         self.filename_ext = ".blend"
         self.filter_glob = "*.blend"
     
     self.filepath = context.object.name + self.filename_ext
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 15
0
 def invoke(self, context, event):
     CurrentFormatProperties._clear_props()
     
     if self.format:
         op = get_op(self.format)
         op_class = type(op.get_instance())
         
         CurrentFormatProperties._add_props(op_class)
         
         if self.format == "wm.collada_export":
             # Special case: Collada (built-in) -- has no
             # explicitly defined Python properties
             CurrentFormatProperties.second_life = bpy.props.BoolProperty(
                 name="Export for Second Life",
                 description="Compatibility mode for Second Life",
                 default=False,
                 )
     else:
         self.visible_name = "Blend"
         self.filename_ext = ".blend"
         self.filter_glob = "*.blend"
     
     self.filepath = context.object.name + self.filename_ext
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 16
0
 def invoke(self, context, event):
     self.fill_props()
     self.prepare_filepath(context)
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 17
0
 def invoke(self, context, event):
     self.fill_props()
     self.prepare_filepath(context)
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 18
0
 def invoke(self, context, event):
     #restore_settings_export(self.properties)
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 19
0
 def invoke(self, context, event):
     obj = context.active_object
     if obj != None:
         self.filepath = strip_nnn(obj.name) + self.filename_ext
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 20
0
 def invoke(self, context, event):
     if not context.active_object:
         self.report({'WARNING'}, "Please activate an object.")
         return {'CANCELLED'}
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 21
0
 def invoke(self, context, event):
     if context.active_object != None:
         self.filepath = context.active_object.name + self.filename_ext
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 22
0
 def invoke(self, context, event):
   return ExportHelper.invoke(self, context, event)
Exemplo n.º 23
0
    def invoke(self, context, event):
        eobj = None
        if not kGModel3do in bpy.data.groups or len(
                bpy.data.groups[kGModel3do].objects) == 0:
            # Get one selected object
            if len(bpy.context.selected_objects) == 0:
                print(
                    "Error: could not determine which objects to export. Put into '{}' group or select (1) top object in hierarchy!"
                    .format(kGModel3do))
                self.report({'ERROR'}, 'No object selected to export')
                return {'CANCELLED'}

            if len(bpy.context.selected_objects) > 1:
                print(
                    "Error: could not determine which objects to export, more then 1 object selected!"
                )
                self.report({'ERROR'}, 'Too many objects selected to export')
                return {'CANCELLED'}

            eobj = bpy.context.selected_objects[0]

        else:  # Model3do goup
            objs = bpy.data.groups[kGModel3do].objects
            if len(objs) == 0:
                print(
                    "Error: could not determine which objects to export, no object in '{}' group!"
                    .format(kGModel3do))
                self.report(
                    {'ERROR'},
                    "No object in group '{}' to export".format(kGModel3do))
                return {'CANCELLED'}
            elif len(objs) > 1:
                for obj in objs:
                    if obj.select:
                        if not eobj is None:
                            print(
                                "Error: could not determine which objects to export, too many objects selected in '{}' group!"
                                .format(kGModel3do))
                            self.report({
                                'ERROR'
                            }, "Too many objects selected in group '{}' to export"
                                        .format(kGModel3do))
                            return {'CANCELLED'}
                        eobj = obj
                if eobj is None:
                    print(
                        "Error: could not determine which objects to export, no object selected in '{}' group!"
                        .format(kGModel3do))
                    self.report(
                        {'ERROR'},
                        "No object selected in group '{}' to export".format(
                            kGModel3do))
                    return {'CANCELLED'}
            else:
                eobj = objs[0]

        if 'EMPTY' != eobj.type != 'MESH':
            print(
                "Error: selected object is of type '{}', can only export an object with type 'MESH' or 'EMPTY'!"
                .format(eobj.type))
            self.report({'ERROR'},
                        "Cannot export selected object of a type '{}'".format(
                            eobj.type))
            return {'CANCELLED'}

        while eobj.parent != None:
            eobj = eobj.parent

        self.obj = eobj
        self.filepath = bpy.path.ensure_ext(self.obj.name, self.filename_ext)
        return ExportHelper.invoke(self, context, event)
Exemplo n.º 24
0
	def invoke(self, context, event):
		self.restore()
		return ExportHelper.invoke(self, context, event)
Exemplo n.º 25
0
 def invoke(self, context, event):
     self.filename_ext = ".blend"
     self.filepath = pfopath + "/prod/scenes/untitled"
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 26
0
 def invoke(self, context, event):
     restore_settings_export(self.properties)
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 27
0
 def invoke(self, context, evt):
     if context.scene.yabee_settings.first_run:
         context.scene.yabee_settings.reset_defaults()
     return ExportHelper.invoke(self, context, evt)
Exemplo n.º 28
0
    def invoke(self, context, event):
        # Initializes self.scene and self.obj by searching for a top object which represents 3DO model
        try:
            self.scene = bpy.context.scene.copy()
            self.animation_flags = self.scene.animation_flags
            self.animation_type = self.scene.animation_type

            fps = self.scene.render.fps
            for e in reversed(_get_fps_enum_list()):
                if e[0] == str(fps):
                    self.fps = str(e[0])
                    break
                elif fps < float(e[0]):
                    self.fps = str(e[0])
                    break

            eobj = None
            if not kGModel3do in bpy.data.groups or len(
                    bpy.data.groups[kGModel3do].objects) == 0:
                # Get one selected object
                if len(bpy.context.selected_objects) == 0:
                    print(
                        "Error: could not determine which objects to export. Put into '{}' group or select (1) top object in hierarchy!"
                        .format(kGModel3do))
                    self.report({'ERROR'}, 'No object selected to export')
                    bpy.data.scenes.remove(self.scene, True)
                    return {'CANCELLED'}

                if len(bpy.context.selected_objects) > 1:
                    print(
                        "Error: could not determine which objects to export, more then 1 object selected!"
                    )
                    self.report({'ERROR'},
                                'Too many objects selected to export')
                    bpy.data.scenes.remove(self.scene, True)
                    return {'CANCELLED'}

                eobj = bpy.context.selected_objects[0]

            else:  # Model3do group
                objs = bpy.data.groups[kGModel3do].objects
                if len(objs) == 0:
                    print(
                        "Error: could not determine which objects to export animation data from. No object in '{}' group!"
                        .format(kGModel3do))
                    self.report(
                        {'ERROR'},
                        "No object in group '{}' to export animation data from"
                        .format(kGModel3do))
                    bpy.data.scenes.remove(self.scene, True)
                    return {'CANCELLED'}
                elif len(objs) > 1:
                    for obj in objs:
                        if obj.select:
                            if not eobj is None:
                                print(
                                    "Error: could not determine from which objects to export animation data. Too many objects selected in '{}' group!"
                                    .format(kGModel3do))
                                self.report({
                                    'ERROR'
                                }, "Too many objects selected in group '{}' to export animation data from"
                                            .format(kGModel3do))
                                bpy.data.scenes.remove(self.scene, True)
                                return {'CANCELLED'}
                            eobj = obj
                    if eobj is None:
                        print(
                            "Error: could not determine which from objects to export animation data from. No object selected in '{}' group!"
                            .format(kGModel3do))
                        self.report({
                            'ERROR'
                        }, "No object selected in group '{}' to export animation data from"
                                    .format(kGModel3do))
                        bpy.data.scenes.remove(self.scene, True)
                        return {'CANCELLED'}
                else:
                    eobj = objs[0]

            if 'EMPTY' != eobj.type != 'MESH':
                print(
                    "Error: selected object is of type '{}', can only export the animation data from an object with type 'MESH' or 'EMPTY'!"
                    .format(eobj.type))
                self.report({
                    'ERROR'
                }, "Cannot export animation data from selected object of a type '{}'"
                            .format(eobj.type))
                bpy.data.scenes.remove(self.scene, True)
                return {'CANCELLED'}

            # Get the top obj
            while eobj.parent != None:
                eobj = eobj.parent

            self.obj = eobj
            kfname = bpy.path.display_name_from_filepath(self.obj.name)
            self.filepath = bpy.path.ensure_ext(kfname, self.filename_ext)
            return ExportHelper.invoke(self, context, event)

        except:
            if self.scene:
                bpy.data.scenes.remove(self.scene, True)
            raise
Exemplo n.º 29
0
 def invoke(self, context, event):
     obj = context.active_object
     if obj != None:
         self.filepath = strip_nnn(obj.name) + self.filename_ext
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 30
0
 def invoke(self, context, event):
     if context.active_object != None:
         self.filepath = context.active_object.name + self.filename_ext
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 31
0
 def invoke(self, context, event):
     self.fill_props()
     self.filepath = context.object.name + self.filename_ext
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 32
0
 def invoke( self, context, event ):
     return ExportHelper.invoke( self, context, event )
Exemplo n.º 33
0
 def invoke(self, context, evt):
     if context.scene.yabee_settings.first_run:
         context.scene.yabee_settings.reset_defaults()
     return ExportHelper.invoke(self, context, evt)
Exemplo n.º 34
0
 def invoke(self, context, event):
     self.filepath = "Production Folder"
     return ExportHelper.invoke(self, context, event)
Exemplo n.º 35
0
 def invoke(self, context, event):
     restore_opifex_settings(self.properties)
     return ExportHelper.invoke(self, context, event)