Stored Views: Fix usage of a reserved Python word in bl_idname
Bump version to 0.3.7 Small style tweaks Fix reported on IRC: - The issue with using .import in the blsv operators, causing crashes when called from the python console - Used **stored_views.import_blsv** and **stored_views.export_blsv**
This commit is contained in:
parent
89dd693b75
commit
443c000799
|
@ -20,13 +20,14 @@ bl_info = {
|
|||
"name": "Stored Views",
|
||||
"description": "Save and restore User defined views, pov, layers and display configs",
|
||||
"author": "nfloyd, Francesco Siddi",
|
||||
"version": (0, 3, 6),
|
||||
"version": (0, 3, 7),
|
||||
"blender": (2, 7, 8),
|
||||
"location": "View3D > Properties > Stored Views",
|
||||
"warning": "",
|
||||
"wiki_url": "https://wiki.blender.org/index.php/Extensions:2.5/"
|
||||
"Py/Scripts/3D_interaction/stored_views",
|
||||
"category": "3D View"}
|
||||
"category": "3D View"
|
||||
}
|
||||
|
||||
"""
|
||||
ACKNOWLEDGMENT
|
||||
|
@ -65,14 +66,14 @@ else:
|
|||
|
||||
import bpy
|
||||
from bpy.props import (
|
||||
BoolProperty,
|
||||
IntProperty,
|
||||
PointerProperty,
|
||||
)
|
||||
BoolProperty,
|
||||
IntProperty,
|
||||
PointerProperty,
|
||||
)
|
||||
from bpy.types import (
|
||||
AddonPreferences,
|
||||
Operator,
|
||||
)
|
||||
AddonPreferences,
|
||||
Operator,
|
||||
)
|
||||
|
||||
|
||||
class VIEW3D_stored_views_initialize(Operator):
|
||||
|
@ -99,20 +100,20 @@ class VIEW3D_stored_views_preferences(AddonPreferences):
|
|||
bl_idname = __name__
|
||||
|
||||
show_exporters = BoolProperty(
|
||||
name="Enable I/O Operators",
|
||||
default=False,
|
||||
description="Enable Import/Export Operations in the UI:\n"
|
||||
"Import Stored Views preset,\n"
|
||||
"Export Stored Views preset and \n"
|
||||
"Import stored views from scene",
|
||||
)
|
||||
name="Enable I/O Operators",
|
||||
default=False,
|
||||
description="Enable Import/Export Operations in the UI:\n"
|
||||
"Import Stored Views preset,\n"
|
||||
"Export Stored Views preset and \n"
|
||||
"Import stored views from scene",
|
||||
)
|
||||
view_3d_update_rate = IntProperty(
|
||||
name="3D view update",
|
||||
description="Update rate of the 3D view redraw\n"
|
||||
"Increse the value if the UI feels sluggish",
|
||||
min=1, max=10,
|
||||
default=1
|
||||
)
|
||||
name="3D view update",
|
||||
description="Update rate of the 3D view redraw\n"
|
||||
"Increse the value if the UI feels sluggish",
|
||||
min=1, max=10,
|
||||
default=1
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
|
|
@ -8,13 +8,13 @@ import shutil
|
|||
import bpy
|
||||
from bpy.types import Operator
|
||||
from bpy.props import (
|
||||
BoolProperty,
|
||||
StringProperty
|
||||
)
|
||||
BoolProperty,
|
||||
StringProperty,
|
||||
)
|
||||
from bpy_extras.io_utils import (
|
||||
ExportHelper,
|
||||
ImportHelper,
|
||||
)
|
||||
ExportHelper,
|
||||
ImportHelper,
|
||||
)
|
||||
from . import bl_info
|
||||
from .core import get_preferences
|
||||
from .operators import DataStore
|
||||
|
@ -162,11 +162,12 @@ class IO_Utils():
|
|||
return False
|
||||
|
||||
# io_filters = sv.settings.io_filters
|
||||
sv_data = {"point_of_views": sv.pov_list,
|
||||
"views": sv.view_list,
|
||||
"layers": sv.layers_list,
|
||||
"displays": sv.display_list}
|
||||
|
||||
sv_data = {
|
||||
"point_of_views": sv.pov_list,
|
||||
"views": sv.view_list,
|
||||
"layers": sv.layers_list,
|
||||
"displays": sv.display_list
|
||||
}
|
||||
for sv_struct, props in dump["data"].items():
|
||||
"""
|
||||
is_filtered = getattr(io_filters, sv_struct)
|
||||
|
@ -203,20 +204,20 @@ class IO_Utils():
|
|||
|
||||
|
||||
class VIEW3D_stored_views_import(Operator, ImportHelper):
|
||||
bl_idname = "stored_views.import"
|
||||
bl_idname = "stored_views.import_blsv"
|
||||
bl_label = "Import Stored Views preset"
|
||||
bl_description = "Import a .blsv preset file to the current Stored Views"
|
||||
|
||||
filename_ext = ".blsv"
|
||||
filter_glob = StringProperty(
|
||||
default="*.blsv",
|
||||
options={'HIDDEN'}
|
||||
)
|
||||
default="*.blsv",
|
||||
options={'HIDDEN'}
|
||||
)
|
||||
replace = BoolProperty(
|
||||
name="Replace",
|
||||
default=True,
|
||||
description="Replace current stored views, otherwise append"
|
||||
)
|
||||
name="Replace",
|
||||
default=True,
|
||||
description="Replace current stored views, otherwise append"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
|
@ -227,7 +228,7 @@ class VIEW3D_stored_views_import(Operator, ImportHelper):
|
|||
exists = os.path.isfile(self.filepath) if self.filepath else False
|
||||
if not exists:
|
||||
self.report({'WARNING'},
|
||||
"No filepath specified, or file could not be found. Operation Cancelled")
|
||||
"No filepath specified or file could not be found. Operation Cancelled")
|
||||
return {'CANCELLED'}
|
||||
|
||||
# apply chosen preset
|
||||
|
@ -258,15 +259,15 @@ class VIEW3D_stored_views_import_from_scene(Operator):
|
|||
bl_description = "Import currently stored views from an another scene"
|
||||
|
||||
scene_name = StringProperty(
|
||||
name="Scene Name",
|
||||
description="A current blend scene",
|
||||
default=""
|
||||
)
|
||||
name="Scene Name",
|
||||
description="A current blend scene",
|
||||
default=""
|
||||
)
|
||||
replace = BoolProperty(
|
||||
name="Replace",
|
||||
default=True,
|
||||
description="Replace current stored views, otherwise append"
|
||||
)
|
||||
name="Replace",
|
||||
default=True,
|
||||
description="Replace current stored views, otherwise append"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
|
@ -300,23 +301,23 @@ class VIEW3D_stored_views_import_from_scene(Operator):
|
|||
|
||||
|
||||
class VIEW3D_stored_views_export(Operator, ExportHelper):
|
||||
bl_idname = "stored_views.export"
|
||||
bl_idname = "stored_views.export_blsv"
|
||||
bl_label = "Export Stored Views preset"
|
||||
bl_description = "Export the current Stored Views to a .blsv preset file"
|
||||
|
||||
filename_ext = ".blsv"
|
||||
filepath = StringProperty(
|
||||
default=os.path.join(IO_Utils.get_preset_path()[0], "untitled")
|
||||
)
|
||||
default=os.path.join(IO_Utils.get_preset_path()[0], "untitled")
|
||||
)
|
||||
filter_glob = StringProperty(
|
||||
default="*.blsv",
|
||||
options={'HIDDEN'}
|
||||
)
|
||||
default="*.blsv",
|
||||
options={'HIDDEN'}
|
||||
)
|
||||
preset_name = StringProperty(
|
||||
name="Preset name",
|
||||
default="",
|
||||
description="Name of the stored views preset"
|
||||
)
|
||||
name="Preset name",
|
||||
default="",
|
||||
description="Name of the stored views preset"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
|
@ -324,4 +325,5 @@ class VIEW3D_stored_views_export(Operator, ExportHelper):
|
|||
|
||||
def execute(self, context):
|
||||
IO_Utils.stored_views_export_to_blsv(self.filepath, self.preset_name)
|
||||
|
||||
return{'FINISHED'}
|
||||
|
|
|
@ -7,9 +7,9 @@ import bpy
|
|||
import blf
|
||||
from . import core
|
||||
from bpy.types import (
|
||||
Operator,
|
||||
Panel,
|
||||
)
|
||||
Operator,
|
||||
Panel,
|
||||
)
|
||||
|
||||
"""
|
||||
If view name display is enabled,
|
||||
|
@ -185,8 +185,8 @@ class VIEW3D_PT_properties_stored_views(Panel):
|
|||
if core.get_preferences():
|
||||
row = layout.row(align=True)
|
||||
row.operator("stored_views.import_from_scene", text="Import from Scene")
|
||||
row.operator("stored_views.import", text="", icon="IMPORT")
|
||||
row.operator("stored_views.export", text="", icon="EXPORT")
|
||||
row.operator("stored_views.import_blsv", text="", icon="IMPORT")
|
||||
row.operator("stored_views.export_blsv", text="", icon="EXPORT")
|
||||
|
||||
data_store = core.DataStore()
|
||||
list = data_store.list
|
||||
|
|
Loading…
Reference in New Issue