Cycles: svn merge -r41157:41182 ^/trunk/blender
[blender.git] / source / blender / editors / space_view3d / view3d_toolbar.c
index 58058722a82c291ecd896b5ee6a1cfdb26705323..a3b9e008fa0256ed58c61f31405e590971b2d818 100644 (file)
@@ -249,10 +249,12 @@ void view3d_tool_props_register(ARegionType *art)
 static int view3d_toolshelf(bContext *C, wmOperator *UNUSED(op))
 {
        ScrArea *sa= CTX_wm_area(C);
-       ARegion *ar= view3d_has_tools_region(sa);
+       ARegion *artool, *arprops;
        
-       if(ar)
-               ED_region_toggle_hidden(C, ar);
+       view3d_has_tools_region(sa, &artool, &arprops);
+       
+       if(artool)
+               ED_region_toggle_hidden(C, artool);
 
        return OPERATOR_FINISHED;
 }
@@ -269,3 +271,37 @@ void VIEW3D_OT_toolshelf(wmOperatorType *ot)
        /* flags */
        ot->flag= 0;
 }
+
+/* ********** operator to open/close toolshelf region */
+
+static int view3d_tool_properties(bContext *C, wmOperator *UNUSED(op))
+{
+       ScrArea *sa= CTX_wm_area(C);
+       ARegion *artool, *arprops;
+       
+       view3d_has_tools_region(sa, &artool, &arprops);
+       
+       if(artool && (artool->flag & RGN_FLAG_HIDDEN)) {
+               ED_region_toggle_hidden(C, artool);
+
+               if(arprops && (arprops->flag & RGN_FLAG_HIDDEN))
+                       ED_region_toggle_hidden(C, arprops);
+       }
+       else if(arprops)
+               ED_region_toggle_hidden(C, arprops);
+
+       return OPERATOR_FINISHED;
+}
+
+void VIEW3D_OT_tool_properties(wmOperatorType *ot)
+{
+       ot->name= "Tool Properties";
+       ot->description= "Toggles tool properties display";
+       ot->idname= "VIEW3D_OT_tool_properties";
+       
+       ot->exec= view3d_tool_properties;
+       ot->poll= ED_operator_view3d_active;
+       
+       /* flags */
+       ot->flag= 0;
+}