Use Manifest.toml info instead of bl_info #1

Merged
Victor Chedeville merged 3 commits from Victor-09/space_view3d_stored_views:Cleanup into main 2024-05-20 19:34:05 +02:00
6 changed files with 34 additions and 54 deletions

View File

@ -2,18 +2,6 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
bl_info = {
"name": "Stored Views",
"description": "Save and restore User defined views, pov, layers and display configs",
"author": "nfloyd, Francesco Siddi",
"version": (0, 3, 7),
"blender": (2, 80, 0),
"location": "View3D > Sidebar > View > Stored Views",
"warning": "",
"doc_url": "{BLENDER_MANUAL_URL}/addons/3d_view/stored_views.html",
"category": "3D View"
}
"""
ACKNOWLEDGMENT
==============
@ -83,7 +71,7 @@ class VIEW3D_stored_views_initialize(Operator):
# Addon Preferences
class VIEW3D_stored_views_preferences(AddonPreferences):
bl_idname = __name__
bl_idname = __package__
show_exporters : BoolProperty(
name="Enable I/O Operators",
@ -130,5 +118,5 @@ def unregister():
del bpy.types.Scene.stored_views
if __name__ == "__main__":
if __package__ == "__main__":
register()

View File

@ -1,10 +1,11 @@
schema_version = "1.0.0"
schema_version = "1.0.1"
id = "stored_views"
name = "Stored Views"
version = "0.3.7"
tagline = "Save and restore views, pov, layers & display configs"
maintainer = "Community"
type = "add-on"
permissions = ["files"]
tags = ["3D View"]
blender_version_min = "4.2.0"
license = ["SPDX:GPL-2.0-or-later"]

View File

@ -5,7 +5,7 @@
# Authors: nfloyd, Francesco Siddi
import logging
module_logger = logging.getLogger(__name__)
module_logger = logging.getLogger(__package__)
import hashlib
import bpy
@ -22,7 +22,7 @@ def get_preferences():
class StoredView():
def __init__(self, mode, index=None):
self.logger = logging.getLogger('%s.StoredView' % __name__)
self.logger = logging.getLogger('%s.StoredView' % __package__)
self.scene = bpy.context.scene
self.view3d = bpy.context.space_data
self.index = index
@ -55,7 +55,7 @@ class StoredView():
class POV(StoredView):
def __init__(self, index=None):
super().__init__(mode='POV', index=index)
self.logger = logging.getLogger('%s.POV' % __name__)
self.logger = logging.getLogger('%s.POV' % __package__)
def from_v3d(self, stored_view):
view3d = self.view3d
@ -113,7 +113,7 @@ class POV(StoredView):
def is_modified(context, stored_view):
# TODO: check for others param, currently only perspective
# and perspective_matrix are checked
POV.logger = logging.getLogger('%s.POV' % __name__)
POV.logger = logging.getLogger('%s.POV' % __package__)
view3d = context.space_data
region3d = view3d.region_3d
if region3d.view_perspective != stored_view.perspective:
@ -137,7 +137,7 @@ class POV(StoredView):
# class Layers(StoredView):
# def __init__(self, index=None):
# super().__init__(mode='COLLECTIONS', index=index)
# self.logger = logging.getLogger('%s.Layers' % __name__)
# self.logger = logging.getLogger('%s.Layers' % __package__)
# def from_v3d(self, stored_view):
# view3d = self.view3d
@ -155,7 +155,7 @@ class POV(StoredView):
# @staticmethod
# def is_modified(context, stored_view):
# Layers.logger = logging.getLogger('%s.Layers' % __name__)
# Layers.logger = logging.getLogger('%s.Layers' % __package__)
# if stored_view.camera != context.space_data.camera:
# Layers.logger.debug('lock_camera')
# return True
@ -174,7 +174,7 @@ class POV(StoredView):
# class Display(StoredView):
# def __init__(self, index=None):
# super().__init__(mode='DISPLAY', index=index)
# self.logger = logging.getLogger('%s.Display' % __name__)
# self.logger = logging.getLogger('%s.Display' % __package__)
# def from_v3d(self, stored_view):
# view3d = self.view3d
@ -212,7 +212,7 @@ class POV(StoredView):
# @staticmethod
# def is_modified(context, stored_view):
# Display.logger = logging.getLogger('%s.Display' % __name__)
# Display.logger = logging.getLogger('%s.Display' % __package__)
# view3d = context.space_data
# excludes = ["material_mode", "quad_view", "lock_rotation", "show_sync_view", "use_box_clip", "name"]
# for k, v in stored_view.items():
@ -228,7 +228,7 @@ class POV(StoredView):
class View(StoredView):
def __init__(self, index=None):
super().__init__(mode='VIEW', index=index)
self.logger = logging.getLogger('%s.View' % __name__)
self.logger = logging.getLogger('%s.View' % __package__)
self.pov = POV()
# self.layers = Layers()
# self.display = Display()

View File

@ -8,6 +8,7 @@ import gzip
import os
import pickle
import shutil
import toml
import bpy
from bpy.types import Operator
@ -19,7 +20,6 @@ from bpy_extras.io_utils import (
ExportHelper,
ImportHelper,
)
from .import bl_info
from .core import get_preferences
from .operators import DataStore
@ -79,9 +79,13 @@ class IO_Utils():
@staticmethod
def stored_views_export_to_blsv(filepath, name='Custom Preset'):
# create dictionary with all information
SCRIPT_DIR = os.path.dirname(__file__)
manifest_file = os.path.join(SCRIPT_DIR, "blender_manifest.toml")
bl_info=toml.load(manifest_file)
dump = {"info": {}, "data": {}}
dump["info"]["script"] = bl_info['name']
dump["info"]["script_version"] = bl_info['version']
dump["info"]["script"] = __package__
dump["info"]["script_version"] = bl_info["version"]
dump["info"]["version"] = bpy.app.version
dump["info"]["preset_name"] = name

View File

@ -2,19 +2,6 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
bl_info = {
"name": "Stored Views",
"description": "Save and restore User defined views, pov, layers and display configs",
"author": "nfloyd, Francesco Siddi",
"version": (0, 3, 7),
"blender": (2, 80, 0),
"location": "View3D > Properties > Stored Views",
"warning": "",
"doc_url": "https://wiki.blender.org/index.php/Extensions:2.5/"
"Py/Scripts/3D_interaction/stored_views",
"category": "3D View"
}
"""
ACKNOWLEDGMENT
==============
@ -50,7 +37,7 @@ from bpy.types import (
)
import logging
module_logger = logging.getLogger(__name__)
module_logger = logging.getLogger(__package__)
import gzip
import os
@ -79,7 +66,7 @@ def get_preferences():
class StoredView():
def __init__(self, mode, index=None):
self.logger = logging.getLogger('%s.StoredView' % __name__)
self.logger = logging.getLogger('%s.StoredView' % __package__)
self.scene = bpy.context.scene
self.view3d = bpy.context.space_data
self.index = index
@ -112,7 +99,7 @@ class StoredView():
class POV(StoredView):
def __init__(self, index=None):
super().__init__(mode='POV', index=index)
self.logger = logging.getLogger('%s.POV' % __name__)
self.logger = logging.getLogger('%s.POV' % __package__)
def from_v3d(self, stored_view):
view3d = self.view3d
@ -170,7 +157,7 @@ class POV(StoredView):
def is_modified(context, stored_view):
# TODO: check for others param, currently only perspective
# and perspective_matrix are checked
POV.logger = logging.getLogger('%s.POV' % __name__)
POV.logger = logging.getLogger('%s.POV' % __package__)
view3d = context.space_data
region3d = view3d.region_3d
if region3d.view_perspective != stored_view.perspective:
@ -194,7 +181,7 @@ class POV(StoredView):
class Layers(StoredView):
def __init__(self, index=None):
super().__init__(mode='LAYERS', index=index)
self.logger = logging.getLogger('%s.Layers' % __name__)
self.logger = logging.getLogger('%s.Layers' % __package__)
def from_v3d(self, stored_view):
view3d = self.view3d
@ -212,7 +199,7 @@ class Layers(StoredView):
@staticmethod
def is_modified(context, stored_view):
Layers.logger = logging.getLogger('%s.Layers' % __name__)
Layers.logger = logging.getLogger('%s.Layers' % __package__)
if stored_view.lock_camera_and_layers != context.space_data.lock_camera_and_layers:
Layers.logger.debug('lock_camera_and_layers')
return True
@ -231,7 +218,7 @@ class Layers(StoredView):
class Display(StoredView):
def __init__(self, index=None):
super().__init__(mode='DISPLAY', index=index)
self.logger = logging.getLogger('%s.Display' % __name__)
self.logger = logging.getLogger('%s.Display' % __package__)
def from_v3d(self, stored_view):
view3d = self.view3d
@ -269,7 +256,7 @@ class Display(StoredView):
@staticmethod
def is_modified(context, stored_view):
Display.logger = logging.getLogger('%s.Display' % __name__)
Display.logger = logging.getLogger('%s.Display' % __package__)
view3d = context.space_data
excludes = ["material_mode", "quad_view", "lock_rotation", "show_sync_view", "use_box_clip", "name"]
for k, v in stored_view.items():
@ -285,7 +272,7 @@ class Display(StoredView):
class View(StoredView):
def __init__(self, index=None):
super().__init__(mode='VIEW', index=index)
self.logger = logging.getLogger('%s.View' % __name__)
self.logger = logging.getLogger('%s.View' % __package__)
self.pov = POV()
self.layers = Layers()
self.display = Display()
@ -1179,7 +1166,7 @@ class VIEW3D_PT_properties_stored_views(Panel):
bl_category = "View"
def draw(self, context):
self.logger = logging.getLogger('%s Properties panel' % __name__)
self.logger = logging.getLogger('%s Properties panel' % __package__)
layout = self.layout
if bpy.ops.view3d.stored_views_initialize.poll():
@ -1287,7 +1274,7 @@ class VIEW3D_PT_properties_stored_views(Panel):
# Addon Preferences
class VIEW3D_OT_stored_views_preferences(AddonPreferences):
bl_idname = __name__
bl_idname = __package__
show_exporters: BoolProperty(
name="Enable I/O Operators",
@ -1353,5 +1340,5 @@ def unregister():
del bpy.types.Scene.stored_views
if __name__ == "__main__":
if __package__ == "__main__":
register()

View File

@ -5,7 +5,7 @@
# Authors: nfloyd, Francesco Siddi
import logging
module_logger = logging.getLogger(__name__)
module_logger = logging.getLogger(__package__)
import bpy
import blf
@ -164,7 +164,7 @@ class VIEW3D_PT_properties_stored_views(Panel):
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
self.logger = logging.getLogger('%s Properties panel' % __name__)
self.logger = logging.getLogger('%s Properties panel' % __package__)
layout = self.layout
if bpy.ops.view3d.stored_views_initialize.poll():