[Bf-blender-cvs] [94527ed] temp-sybren-poselib: Removed now-unused code of old poselib-previews addon.

Sybren A. Stüvel noreply at git.blender.org
Thu Dec 15 11:07:34 CET 2016


Commit: 94527ed77c65bda18915216121c7c27cd5b9d2a1
Author: Sybren A. Stüvel
Date:   Thu Dec 15 10:12:47 2016 +0100
Branches: temp-sybren-poselib
https://developer.blender.org/rB94527ed77c65bda18915216121c7c27cd5b9d2a1

Removed now-unused code of old poselib-previews addon.

===================================================================

M	release/scripts/startup/bl_operators/poselib.py
M	release/scripts/startup/bl_ui/__init__.py
M	release/scripts/startup/bl_ui/properties_data_armature.py

===================================================================

diff --git a/release/scripts/startup/bl_operators/poselib.py b/release/scripts/startup/bl_operators/poselib.py
index 1c6db8e..997bff4 100644
--- a/release/scripts/startup/bl_operators/poselib.py
+++ b/release/scripts/startup/bl_operators/poselib.py
@@ -91,9 +91,6 @@ class POSELIB_OT_render_previews(Operator):
         return {'RUNNING_MODAL'}
 
     def render_pose(self, context, plib, plib_index):
-        import tempfile
-        import os.path
-
         marker = plib.pose_markers[plib_index]
         marker.preview_frame_index = plib_index
         self.log.info('Rendering pose %s at frame %i', marker.name, marker.frame)
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
index f5d544f..3938584 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -140,31 +140,12 @@ def register():
             options={'ENUM_FLAG'},
             )
 
-    # properties_data_armature.py
-    from . import properties_data_armature
-    bpy.types.Action.pose_previews = EnumProperty(
-        items=properties_data_armature.pose_preview_items,
-        update=properties_data_armature.update_pose)
-    bpy.types.Action.pose_previews_dir = StringProperty(
-        name='Thumbnail Path',
-        subtype='DIR_PATH',
-        default='',
-        # update=filepath_update
-    )
-
-
     # done...
 
 
 def unregister():
     bpy.utils.unregister_module(__name__)
 
-    from . import properties_data_armature
-
-    # del bpy.types.Object.pose_previews
-    if properties_data_armature.previews:
-        bpy.utils.previews.remove(properties_data_armature.previews)
-
 
 # Define a default UIList, when a list does not need any custom drawing...
 # Keep in sync with its #defined name in UI_interface.h
diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py
index 0921fec..f1c03f0 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -161,56 +161,6 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, Panel):
         sub.operator("pose.group_deselect", text="Deselect")
 
 
-previews = None
-
-
-def pose_preview_items(poselib, context):
-    global previews
-    import os.path
-
-    if context is None or not poselib.pose_previews_dir:
-        return []
-
-    directory = bpy.path.abspath(poselib.pose_previews_dir)
-    if not os.path.isdir(directory):
-        return []
-
-    if previews is not None and directory == previews.get('pose_previews_dir', None):
-        return previews.pose_previews
-
-    if previews is None:
-        previews = bpy.utils.previews.new()
-    else:
-        previews.clear()
-
-    no_thumbnail = os.path.join(os.path.dirname(__file__),
-                                'thumbnails',
-                                'no_thumbnail.png')
-    no_thumb_thumb = previews.load('NO THUMBNAIL', no_thumbnail, 'IMAGE')
-
-    enum_items = []
-    for pose_idx, pose_marker in enumerate(poselib.pose_markers):
-        filepath = os.path.join(directory, '%s.png' % pose_marker.name)
-        if os.path.exists(filepath):
-            thumb = previews.load(pose_marker.name, filepath, 'IMAGE')
-        else:
-            print('Warning: "%s" does not exist' % filepath)
-            thumb = no_thumb_thumb
-
-        enum_items.append((pose_marker.name, pose_marker.name, pose_marker.name,
-                           thumb.icon_id, pose_idx))
-
-    previews.pose_previews = enum_items
-    previews['pose_previews_dir'] = directory
-    return previews.pose_previews
-
-
-def update_pose(poselib_action, context):
-    pose_name = poselib_action.pose_previews
-    poselib_action.pose_markers.active = poselib_action.pose_markers[pose_name]
-    bpy.ops.poselib.apply_pose(pose_index=poselib_action.pose_markers.active_index)
-
-
 class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
     bl_label = "Pose Library"
     bl_options = {'DEFAULT_CLOSED'}
@@ -230,10 +180,6 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
         if not poselib:
             return
 
-        # layout.template_icon_view(
-        #     poselib, 'pose_markers',
-        #     show_labels=True,
-        # )
         # list of poses in pose library
         row = layout.row()
         row.template_list("UI_UL_list", "pose_markers", poselib, "pose_markers",
@@ -269,11 +215,8 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
         for marker in poselib.pose_markers:
             col.label(marker.name, icon_value=poselib.preview.icon_id, icon_frame=marker.preview_frame_index)
 
-        #~ layout.template_icon_view(poselib, 'pose_previews', show_labels=True)
-        layout.prop(poselib, "pose_previews_dir")
-        col.operator_context = 'INVOKE_DEFAULT'
-
         row = layout.row(align=True)
+        row.operator_context = 'INVOKE_DEFAULT'
         row.operator("poselib.render_previews", text='Render OGL').render_method='OPENGL'
         row.operator("poselib.render_previews", text='Render Full').render_method='FULL'




More information about the Bf-blender-cvs mailing list