* Wrapped outliner space in RNA, and added a python ui file for the header.
Brecht, would you be able to have a look at this if you have time - I can't figure out how to trigger the python file to register the header instead of what's in outliner_header.c.
This commit is contained in:
37
release/ui/space_outliner.py
Normal file
37
release/ui/space_outliner.py
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
import bpy
|
||||
|
||||
class OUTLINER_HT_header(bpy.types.Header):
|
||||
__space_type__ = "OUTLINER"
|
||||
__idname__ = "OUTLINER_HT_header"
|
||||
|
||||
def draw(self, context):
|
||||
so = context.space_data
|
||||
layout = self.layout
|
||||
|
||||
layout.template_header(context)
|
||||
|
||||
if context.area.show_menus:
|
||||
row = layout.row(align=True)
|
||||
row.itemM(context, "OUTLINER_MT_view")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.itemR(so, "display_mode")
|
||||
|
||||
|
||||
class OUTLINER_MT_view(bpy.types.Menu):
|
||||
__space_type__ = "OUTLINER"
|
||||
__label__ = "View"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
so = context.space_data
|
||||
|
||||
layout.column()
|
||||
row.itemR(so, "show_restriction_columns")
|
||||
#layout.itemO("TEXT_OT_new")
|
||||
|
||||
|
||||
bpy.types.register(OUTLINER_HT_header)
|
||||
bpy.types.register(OUTLINER_MT_view)
|
||||
|
||||
@@ -246,6 +246,7 @@ extern StructRNA RNA_Space;
|
||||
extern StructRNA RNA_SpaceImageEditor;
|
||||
extern StructRNA RNA_SpaceUVEditor;
|
||||
extern StructRNA RNA_SpaceTextEditor;
|
||||
extern StructRNA RNA_SpaceOutliner;
|
||||
extern StructRNA RNA_SpeedControlSequence;
|
||||
extern StructRNA RNA_SpotLamp;
|
||||
extern StructRNA RNA_StringProperty;
|
||||
|
||||
@@ -69,9 +69,10 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
|
||||
return &RNA_SpaceView3D;
|
||||
case SPACE_IPO:
|
||||
return &RNA_SpaceGraphEditor;
|
||||
*/
|
||||
case SPACE_OUTLINER:
|
||||
return &RNA_SpaceOutliner;
|
||||
case SPACE_BUTS:
|
||||
/* case SPACE_BUTS:
|
||||
return &RNA_SpaceButtonsWindow;
|
||||
case SPACE_FILE:
|
||||
return &RNA_SpaceFileBrowser;*/
|
||||
@@ -250,6 +251,40 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Live Unwrap", "Continuously unwrap the selected UV island while transforming pinned vertices.");
|
||||
}
|
||||
|
||||
static void rna_def_space_outliner(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
static EnumPropertyItem display_mode_items[] = {
|
||||
{0, "ALL_SCENES", "All Scenes", ""},
|
||||
{1, "CURRENT_SCENE", "Current Scene", ""},
|
||||
{2, "VISIBLE_LAYERS", "Visible Layers", ""},
|
||||
{3, "SELECTED", "Selected", ""},
|
||||
{4, "ACTIVE", "Active", ""},
|
||||
{5, "SAME_TYPES", "Same Types", ""},
|
||||
{6, "GROUPS", "Groups", ""},
|
||||
{7, "LIBRARIES", "Libraries", ""},
|
||||
{10, "SEQUENCE", "Sequence", ""},
|
||||
{11, "DATABLOCKS", "Datablocks", ""},
|
||||
{12, "USER_PREFERENCES", "User Preferences", ""},
|
||||
{0, NULL, NULL, NULL}};
|
||||
|
||||
srna= RNA_def_struct(brna, "SpaceOutliner", "Space");
|
||||
RNA_def_struct_sdna(srna, "SpaceOops");
|
||||
RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data.");
|
||||
|
||||
prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "outlinevis");
|
||||
RNA_def_property_enum_items(prop, display_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display");
|
||||
|
||||
prop= RNA_def_property(srna, "show_restriction_columns", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS);
|
||||
RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show colum");
|
||||
|
||||
}
|
||||
|
||||
static void rna_def_space_image(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
@@ -400,6 +435,7 @@ void RNA_def_space(BlenderRNA *brna)
|
||||
rna_def_space(brna);
|
||||
rna_def_space_image(brna);
|
||||
rna_def_space_text(brna);
|
||||
rna_def_space_outliner(brna);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user