Code cleanup:
authorThomas Dinges <blender@dingto.org>
Fri, 13 Apr 2012 00:04:56 +0000 (00:04 +0000)
committerThomas Dinges <blender@dingto.org>
Fri, 13 Apr 2012 00:04:56 +0000 (00:04 +0000)
* Remove some non used *_button_register functions, panels are done in python.
* Remove do_node_region_buttons, was not used anymore.

Fix:
* Only show Grease Pencil panel in the Node editor, when there is a valid nodetree.

source/blender/editors/space_logic/logic_buttons.c
source/blender/editors/space_logic/logic_intern.h
source/blender/editors/space_logic/space_logic.c
source/blender/editors/space_node/node_buttons.c
source/blender/editors/space_sequencer/sequencer_buttons.c
source/blender/editors/space_sequencer/sequencer_intern.h
source/blender/editors/space_sequencer/space_sequencer.c

index b98e6995f46f5e66c0ef9951e08b4dfac304e940..dcead6c01db4194312ccfe1289243be2911cef44 100644 (file)
 #include "interface_intern.h"
 #include "logic_intern.h"
 
 #include "interface_intern.h"
 #include "logic_intern.h"
 
-#if 0
-static void do_logic_panel_events(bContext *C, void *arg, int event)
-{
-       
-       switch(event) {
-               
-       }
-}
-
-
-/* *** */
-
-static void logic_panel_properties(const bContext *C, Panel *pa)
-{
-//     SpaceLogic *slogic= CTX_wm_space_logic(C);
-       uiBlock *block;
-       
-       block= uiLayoutAbsoluteBlock(pa->layout);
-       uiBlockSetHandleFunc(block, do_logic_panel_events, NULL);
-
-}      
-
-static void logic_panel_view_properties(const bContext *C, Panel *pa)
-{
-       //      SpaceLogic *slogic= CTX_wm_space_logic(C);
-       uiBlock *block;
-       
-       block= uiLayoutAbsoluteBlock(pa->layout);
-       uiBlockSetHandleFunc(block, do_logic_panel_events, NULL);
-       
-}      
-#endif
-
-void logic_buttons_register(ARegionType *UNUSED(art))
-{
-#if 0
-       PanelType *pt;
-
-       pt= MEM_callocN(sizeof(PanelType), "spacetype logic panel properties");
-       strcpy(pt->idname, "LOGIC_PT_properties");
-       strcpy(pt->label, "Logic Properties");
-       pt->draw= logic_panel_properties;
-       BLI_addtail(&art->paneltypes, pt);
-
-       pt= MEM_callocN(sizeof(PanelType), "spacetype logic view properties");
-       strcpy(pt->idname, "LOGIC_PT_view_properties");
-       strcpy(pt->label, "View Properties");
-       pt->draw= logic_panel_view_properties;
-       BLI_addtail(&art->paneltypes, pt);
-#endif
-
-}
-
 static int logic_properties(bContext *C, wmOperator *UNUSED(op))
 {
        ScrArea *sa= CTX_wm_area(C);
 static int logic_properties(bContext *C, wmOperator *UNUSED(op))
 {
        ScrArea *sa= CTX_wm_area(C);
index 3e0b13e9d6c1cecc3c49a5c62215b841569812a1..38b122f64b6f4b3a0ecfedf1e1f166920e04c976 100644 (file)
@@ -48,7 +48,6 @@ struct ARegion *logic_has_buttons_region(struct ScrArea *sa);
 /* logic_ops.c */
 
 /* logic_buttons.c */
 /* logic_ops.c */
 
 /* logic_buttons.c */
-void logic_buttons_register(struct ARegionType *art);
 void LOGIC_OT_properties(struct wmOperatorType *ot);
 void LOGIC_OT_links_cut(struct wmOperatorType *ot);
 
 void LOGIC_OT_properties(struct wmOperatorType *ot);
 void LOGIC_OT_links_cut(struct wmOperatorType *ot);
 
index 1b6d72cbc3e9fa5191b53272746fab7e2e449290..82175f83d39ee7a7d1d683ab3ef5f2c8cd161abf 100644 (file)
@@ -337,8 +337,6 @@ void ED_spacetype_logic(void)
        art->draw= logic_buttons_area_draw;
        BLI_addhead(&st->regiontypes, art);
 
        art->draw= logic_buttons_area_draw;
        BLI_addhead(&st->regiontypes, art);
 
-       logic_buttons_register(art);
-
        /* regions: header */
        art= MEM_callocN(sizeof(ARegionType), "spacetype logic region");
        art->regionid = RGN_TYPE_HEADER;
        /* regions: header */
        art= MEM_callocN(sizeof(ARegionType), "spacetype logic region");
        art->regionid = RGN_TYPE_HEADER;
index dac185bf46e8b4e8cf4b509b130db21c3d3e3a3d..49151cc5dcd37b0bc65f845982e7b21b9b571147 100644 (file)
 
 
 /* ******************* node space & buttons ************** */
 
 
 /* ******************* node space & buttons ************** */
-#define B_NOP          1
-#define B_REDR         2
-
-static void do_node_region_buttons(bContext *C, void *UNUSED(arg), int event)
-{
-       //SpaceNode *snode= CTX_wm_space_node(C);
-       
-       switch(event) {
-       case B_REDR:
-               ED_area_tag_redraw(CTX_wm_area(C));
-               return; /* no notifier! */
-       }
-}
 
 /* poll callback for active node */
 static int active_node_poll(const bContext *C, PanelType *UNUSED(pt))
 
 /* poll callback for active node */
 static int active_node_poll(const bContext *C, PanelType *UNUSED(pt))
@@ -94,7 +81,6 @@ static void active_node_panel(const bContext *C, Panel *pa)
        bNodeTree *ntree= (snode) ? snode->edittree : NULL;
        bNode *node = (ntree) ? nodeGetActive(ntree) : NULL; // xxx... for editing group nodes
        uiLayout *layout= pa->layout;
        bNodeTree *ntree= (snode) ? snode->edittree : NULL;
        bNode *node = (ntree) ? nodeGetActive(ntree) : NULL; // xxx... for editing group nodes
        uiLayout *layout= pa->layout;
-       uiBlock *block;
        PointerRNA ptr;
        
        /* verify pointers, and create RNA pointer for the node */
        PointerRNA ptr;
        
        /* verify pointers, and create RNA pointer for the node */
@@ -105,11 +91,6 @@ static void active_node_panel(const bContext *C, Panel *pa)
        //else
                RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr); 
        
        //else
                RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr); 
        
-       /* set update callback */
-       // xxx is this really needed
-       block= uiLayoutGetBlock(layout);
-       uiBlockSetHandleFunc(block, do_node_region_buttons, NULL);
-       
        /* draw this node's name, etc. */
        uiItemR(layout, &ptr, "label", 0, NULL, ICON_NODE);
        uiItemS(layout);
        /* draw this node's name, etc. */
        uiItemR(layout, &ptr, "label", 0, NULL, ICON_NODE);
        uiItemS(layout);
@@ -179,6 +160,7 @@ void node_buttons_register(ARegionType *art)
        strcpy(pt->idname, "NODE_PT_gpencil");
        strcpy(pt->label, "Grease Pencil");
        pt->draw= gpencil_panel_standard;
        strcpy(pt->idname, "NODE_PT_gpencil");
        strcpy(pt->label, "Grease Pencil");
        pt->draw= gpencil_panel_standard;
+       pt->poll= active_node_poll;
        BLI_addtail(&art->paneltypes, pt);
 }
 
        BLI_addtail(&art->paneltypes, pt);
 }
 
index 81712ec10c4c1e85e1c41d2f8f3c87039a23cbb5..aeedafa999246b072ed4df91a7472b58cd8e9c72 100644 (file)
 
 #include "sequencer_intern.h"
 
 
 #include "sequencer_intern.h"
 
-
-static void do_sequencer_panel_events(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
-{
-
-}
-
-
-static void sequencer_panel_view_properties(const bContext *UNUSED(C), Panel *pa)
-{
-       uiBlock *block;
-
-       block = uiLayoutAbsoluteBlock(pa->layout);
-       uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
-       
-}
-
-
-static void sequencer_panel_properties(const bContext *UNUSED(C), Panel *pa)
-{
-       uiBlock *block;
-       
-       block = uiLayoutAbsoluteBlock(pa->layout);
-       uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
-
-}      
-
-void sequencer_buttons_register(ARegionType *art)
-{
-       PanelType *pt;
-
-       pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer strip properties");
-       strcpy(pt->idname, "SEQUENCER_PT_properties");
-       strcpy(pt->label, "Strip Properties");
-       pt->draw = sequencer_panel_properties;
-       BLI_addtail(&art->paneltypes, pt);
-
-       pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer view properties");
-       strcpy(pt->idname, "SEQUENCER_PT_view_properties");
-       strcpy(pt->label, "View Properties");
-       pt->draw = sequencer_panel_view_properties;
-       BLI_addtail(&art->paneltypes, pt);
-
-}
-
 /* **************** operator to open/close properties view ************* */
 
 static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
 /* **************** operator to open/close properties view ************* */
 
 static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
index 7acaaf76c6271186e09c4f623151c4165e3fb6b5..c40a809e6af9ffeab639a5b22e30b644ba4a15ac 100644 (file)
@@ -176,7 +176,6 @@ struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf);
 /* sequencer_buttons.c */
 
 void SEQUENCER_OT_properties(struct wmOperatorType *ot);
 /* sequencer_buttons.c */
 
 void SEQUENCER_OT_properties(struct wmOperatorType *ot);
-void sequencer_buttons_register(struct ARegionType *art);
 
 #endif /* __SEQUENCER_INTERN_H__ */
 
 
 #endif /* __SEQUENCER_INTERN_H__ */
 
index 82965426b6d6ffad1173bbbea986d842ed6a09b7..ec340dd323e4e1aa5ad06e394be171bfcff5c461 100644 (file)
@@ -570,10 +570,6 @@ void ED_spacetype_sequencer(void)
        art->init = sequencer_buttons_area_init;
        art->draw = sequencer_buttons_area_draw;
        BLI_addhead(&st->regiontypes, art);
        art->init = sequencer_buttons_area_init;
        art->draw = sequencer_buttons_area_draw;
        BLI_addhead(&st->regiontypes, art);
-       
-       /* Keep as python only for now
-        * sequencer_buttons_register(art);
-        */
 
        /* regions: header */
        art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
 
        /* regions: header */
        art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");