[Bf-blender-cvs] [d0a3ceb] temp-sybren-poselib: Add first version of poselib previews using new multi-preview ID stuff.

Bastien Montagne noreply at git.blender.org
Tue Nov 1 18:10:44 CET 2016


Commit: d0a3ceb170a9eed74bc6116272b4aa69788320e5
Author: Bastien Montagne
Date:   Tue Nov 1 18:08:34 2016 +0100
Branches: temp-sybren-poselib
https://developer.blender.org/rBd0a3ceb170a9eed74bc6116272b4aa69788320e5

Add first version of poselib previews using new multi-preview ID stuff.

*Neraly* working, for some reason setting floats values for one frame
erase all other frames... Will check that tomorrow.

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

M	release/scripts/startup/bl_operators/poselib.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 c0b7cb8..c7c1184 100644
--- a/release/scripts/startup/bl_operators/poselib.py
+++ b/release/scripts/startup/bl_operators/poselib.py
@@ -115,6 +115,11 @@ class POSELIB_OT_render_previews(Operator):
             bpy.ops.render.render()
         fname = os.path.join(plib.pose_previews_dir, '%s.png' % marker.name)
         bpy.data.images['Render Result'].save_render(bpy.path.abspath(fname))
+        im = bpy.data.images.load(fname)
+        im.scale(128, 128)
+        marker.preview_frame_index = plib_index
+        plib.preview.image_frames_float[plib_index][:] = im.pixels
+        plib.preview.icon_frames_float[plib_index][:] = im.pixels
 
     def invoke(self, context, event):
         wm = context.window_manager
@@ -124,6 +129,12 @@ class POSELIB_OT_render_previews(Operator):
         self.timer = self.wm.event_timer_add(0.01, context.window)
         self.plib_index = 0
 
+        plib = context.object.pose_library
+        plib.preview.icon_size = plib.preview.image_size = (128, 128)
+        plib.preview.frames_number = len(plib.pose_markers)
+        for pmrk in plib.pose_markers:
+            pmrk.preview_frame_index = 0
+
         return {'RUNNING_MODAL'}
 
     def _finish(self, context):
diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py
index 00c688c..e8ca99d 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -266,6 +266,9 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
             layout.prop(pose_marker_active, "camera",
                         text='Camera for %s' % pose_marker_active.name)
 
+        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'




More information about the Bf-blender-cvs mailing list