Take the 2-minute tour ×
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It's 100% free, no registration required.

I am trying to write a script to set Interface colours for individual scenes. When I switch scenes in the Info bar drop down menu I want to change the Info Bar background colour. This gives better feedback for scene swapping/tracking. So far I've got bpy.context.user_preferences.themes[0].info.space.header = (1,0,0)

  • I guess I need to create an open list of scenes that I can append later.

  • Then allocate the spectrum of colours to it?

  • Not sure I can create a UI to allocate colours to scenes, so I'll have to bump the values in increments instead.

But first I'm stuck on calling the colour change (I considered iterating a bunch of themes and switching them as needed). At the BA forum it was suggested that the scene change is a frame change event but I'm not sure how to separate that from any other frame changes...

Hopefully if I can set up colours for the info bar I could tie them to node scene inputs.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Cool idea, I wrote this addon for me just now and I triggered the Header draw event. You can copy it from below or from here: scene_colored_header.py

#scene_colored_header.py
bl_info = {
           "name": "Colored Header for each scene",
           "author": "Leon95, Idea: 3pointedit",
           "version": (1, 0),
           "blender": (2, 50, 0),
           "location": "Properties > Scene Tab > Scene Panel > Display Color",
           "description": "Define a Header Color for every scene and display it in the Header",
           "category": "Scene"
           }

import bpy

def hndl_draw(self, context):
    row = self.layout.row()
    row.prop(context.scene, "headerColor")

def header_refresh(self, context):
    #assign the property to the header theme every time it is redrawn
    bpy.context.user_preferences.themes[0].info.space.header = context.scene.headerColor[:3]

def register():
    #add a new property to the scene type
    bpy.types.Scene.headerColor = bpy.props.FloatVectorProperty(
                                     name = "Display Color",
                                     subtype = "COLOR",
                                     size = 4,
                                     min = 0.0,
                                     max = 1.0,
                                     default = (0.355,0.366,0.57,1.0))

    bpy.types.SCENE_PT_scene.append(hndl_draw)
    bpy.types.INFO_HT_header.append(header_refresh)

def unregister():
    bpy.types.SCENE_PT_scene.remove(hndl_draw)
    bpy.types.INFO_HT_header.remove(header_refresh)
    bpy.context.user_preferences.themes[0].info.space.header = (0.447,0.447,0.447)
    del bpy.types.Scene.headerColor


if __name__ == "__main__":
    register()
share|improve this answer
    
The coolest thing is that you can animate the header color :) –  Leon95 Aug 30 at 20:57
1  
+1 This is pretty sweet. A cool idea from op indeed, registered and currently using it. Only critique is by default the color changes are rather subtle. –  iKlsR Aug 30 at 21:04
    
That is AWESOME, thanks sooo much! At least now I have a script to learn from, win win. –  3pointedit Aug 31 at 7:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.