[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48151] trunk/blender/release/scripts/ startup/bl_ui/properties_texture.py: Fix [#31714] Pinning object context causes texture list to disappear

Bastien Montagne montagne29 at wanadoo.fr
Thu Jun 21 09:32:15 CEST 2012


Revision: 48151
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48151
Author:   mont29
Date:     2012-06-21 07:32:06 +0000 (Thu, 21 Jun 2012)
Log Message:
-----------
Fix [#31714] Pinning object context causes texture list to disappear

Problem was py code of main texture panel was not doing any check on the pinned id, assuming it managed the textures itself - but this is not the case of the Object datablock...

All work actually done by Sergey, was just missing the Lamp specific case. Checked both in code and with tests, quite sure all cases are now correctly handled!

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_texture.py

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_texture.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_texture.py	2012-06-21 07:14:39 UTC (rev 48150)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_texture.py	2012-06-21 07:32:06 UTC (rev 48151)
@@ -23,6 +23,7 @@
 from bpy.types import (Brush,
                        Lamp,
                        Material,
+                       Object,
                        ParticleSettings,
                        Texture,
                        World)
@@ -80,6 +81,15 @@
     return idblock
 
 
+def id_tex_datablock(bid):
+    if isinstance(bid, Object):
+        if bid.type == 'LAMP':
+            return bid.data
+        return bid.active_material
+
+    return bid
+
+
 class TextureButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
@@ -114,7 +124,7 @@
         pin_id = space.pin_id
 
         if space.use_pin_id and not isinstance(pin_id, Texture):
-            idblock = pin_id
+            idblock = id_tex_datablock(pin_id)
             pin_id = None
 
         if not space.use_pin_id:




More information about the Bf-blender-cvs mailing list