Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2009-06-16 17:09:36 +0400
committerTon Roosendaal <ton@blender.org>2009-06-16 17:09:36 +0400
commit2d40b8d56ff100b71dac7c4694f6115dcc0b01b5 (patch)
treee6ad74b116dccf3442290ba4a76bd314729bce6b /source/blender/editors/space_logic/logic_buttons.c
parent7d026421142306dee486628bd15d4f5aa2b77481 (diff)
2.5
Added SpaceLogic, to restore the old logic buttons into. In future it can be used for a more advanced logic editor, with states, behaviour, whatever. We'll see! This commit only adds the backend for new space. Committed this now as reference for when we need another space type. It's still not well plugin-able (dynamic space types), but my idea is to just have a new SpacePlugIn for this, with a neat small API to define all relevant callbacks. Also note the icon for the spacetype is wrong still.
Diffstat (limited to 'source/blender/editors/space_logic/logic_buttons.c')
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c147
1 files changed, 147 insertions, 0 deletions
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
new file mode 100644
index 00000000000..240ddfc2614
--- /dev/null
+++ b/source/blender/editors/space_logic/logic_buttons.c
@@ -0,0 +1,147 @@
+/**
+ * $Id: image_buttons.c 20913 2009-06-16 01:22:56Z blendix $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 by Blender Foundation
+ * All rights reserved.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+
+#include <string.h>
+#include <stdio.h>
+
+#include "DNA_object_types.h"
+#include "DNA_node_types.h"
+#include "DNA_space_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_userdef_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+
+#include "BKE_context.h"
+#include "BKE_global.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_mesh.h"
+#include "BKE_node.h"
+#include "BKE_screen.h"
+#include "BKE_utildefines.h"
+
+#include "ED_space_api.h"
+#include "ED_screen.h"
+#include "ED_util.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "RNA_access.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+#include "UI_view2d.h"
+
+#include "logic_intern.h"
+
+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= (SpaceLogic*)CTX_wm_space_data(C);
+ uiBlock *block;
+
+ block= uiLayoutFreeBlock(pa->layout);
+ uiBlockSetHandleFunc(block, do_logic_panel_events, NULL);
+
+}
+
+static void logic_panel_view_properties(const bContext *C, Panel *pa)
+{
+ // SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C);
+ uiBlock *block;
+
+ block= uiLayoutFreeBlock(pa->layout);
+ uiBlockSetHandleFunc(block, do_logic_panel_events, NULL);
+
+}
+
+
+void logic_buttons_register(ARegionType *art)
+{
+ 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);
+
+}
+
+static int logic_properties(bContext *C, wmOperator *op)
+{
+ ScrArea *sa= CTX_wm_area(C);
+ ARegion *ar= logic_has_buttons_region(sa);
+
+ if(ar) {
+ ar->flag ^= RGN_FLAG_HIDDEN;
+ ar->v2d.flag &= ~V2D_IS_INITIALISED; /* XXX should become hide/unhide api? */
+
+ ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
+ ED_area_tag_redraw(sa);
+ }
+ return OPERATOR_FINISHED;
+}
+
+void LOGIC_OT_properties(wmOperatorType *ot)
+{
+ ot->name= "Properties";
+ ot->idname= "LOGIC_OT_properties";
+
+ ot->exec= logic_properties;
+ ot->poll= ED_operator_logic_active;
+
+ /* flags */
+ ot->flag= 0;
+}
+
+
+