Revision: 38370
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38370
Author:   blendix
Date:     2011-07-13 17:52:23 +0000 (Wed, 13 Jul 2011)
Log Message:
-----------
Fix #26704: activating a texture node inside material nodes did not show that
texture in the texture properties.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_texture.py
    trunk/blender/source/blender/editors/space_buttons/buttons_context.c

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_texture.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_texture.py   
2011-07-13 17:24:33 UTC (rev 38369)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_texture.py   
2011-07-13 17:52:23 UTC (rev 38370)
@@ -88,15 +88,15 @@
     @classmethod
     def poll(cls, context):
         engine = context.scene.render.engine
-        if not hasattr(context, "texture_slot"):
+        if not (hasattr(context, "texture_slot") or hasattr(context, 
"texture_node")):
             return False
         return ((context.material or context.world or context.lamp or 
context.brush or context.texture or context.particle_system or 
isinstance(context.space_data.pin_id, bpy.types.ParticleSettings))
             and (engine in cls.COMPAT_ENGINES))
 
     def draw(self, context):
         layout = self.layout
-        slot = context.texture_slot
-        node = context.texture_node
+        slot = getattr(context, "texture_slot", None)
+        node = getattr(context, "texture_node", None)
         space = context.space_data
         tex = context.texture
         idblock = context_tex_datablock(context)

Modified: trunk/blender/source/blender/editors/space_buttons/buttons_context.c
===================================================================
--- trunk/blender/source/blender/editors/space_buttons/buttons_context.c        
2011-07-13 17:24:33 UTC (rev 38369)
+++ trunk/blender/source/blender/editors/space_buttons/buttons_context.c        
2011-07-13 17:52:23 UTC (rev 38370)
@@ -218,7 +218,7 @@
        return 0;
 }
 
-static int buttons_context_path_material(ButsContextPath *path)
+static int buttons_context_path_material(ButsContextPath *path, int 
for_texture)
 {
        Object *ob;
        PointerRNA *ptr= &path->ptr[path->len-1];
@@ -236,6 +236,9 @@
                        ma= give_current_material(ob, ob->actcol);
                        RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
                        path->len++;
+
+                       if(for_texture && 
give_current_material_texture_node(ma))
+                               return 1;
                        
                        ma= give_node_material(ma);
                        if(ma) {
@@ -432,7 +435,7 @@
                }
        }
        /* try material */
-       if(buttons_context_path_material(path)) {
+       if(buttons_context_path_material(path, 1)) {
                ma= path->ptr[path->len-1].data;
 
                if(ma) {
@@ -524,7 +527,7 @@
                        found= buttons_context_path_particle(path);
                        break;
                case BCONTEXT_MATERIAL:
-                       found= buttons_context_path_material(path);
+                       found= buttons_context_path_material(path, 0);
                        break;
                case BCONTEXT_TEXTURE:
                        found= buttons_context_path_texture(path);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to