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:
-rw-r--r--source/Makefile1
-rw-r--r--source/blender/blenloader/intern/readfile.c8
-rw-r--r--source/blender/blenloader/intern/writefile.c3
-rw-r--r--source/blender/editors/Makefile2
-rw-r--r--source/blender/editors/SConscript1
-rw-r--r--source/blender/editors/include/ED_screen.h1
-rw-r--r--source/blender/editors/include/ED_space_api.h1
-rw-r--r--source/blender/editors/interface/resources.c13
-rw-r--r--source/blender/editors/mesh/editmesh_lib.c9
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c6
-rw-r--r--source/blender/editors/mesh/mesh_intern.h1
-rw-r--r--source/blender/editors/screen/area.c1
-rw-r--r--source/blender/editors/screen/screen_ops.c5
-rw-r--r--source/blender/editors/space_api/spacetypes.c1
-rw-r--r--source/blender/editors/space_logic/Makefile54
-rw-r--r--source/blender/editors/space_logic/SConscript18
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c147
-rw-r--r--source/blender/editors/space_logic/logic_header.c126
-rw-r--r--source/blender/editors/space_logic/logic_intern.h55
-rw-r--r--source/blender/editors/space_logic/space_logic.c342
-rw-r--r--source/blender/makesdna/DNA_space_types.h19
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_space.c5
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c26
24 files changed, 839 insertions, 7 deletions
diff --git a/source/Makefile b/source/Makefile
index 535a86e9139..94446f4d1d5 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -226,6 +226,7 @@ PULIB += $(OCGDIR)/blender/ed_action/$(DEBUG_DIR)libed_action.a
PULIB += $(OCGDIR)/blender/ed_nla/$(DEBUG_DIR)libed_nla.a
PULIB += $(OCGDIR)/blender/ed_script/$(DEBUG_DIR)libed_script.a
PULIB += $(OCGDIR)/blender/ed_text/$(DEBUG_DIR)libed_text.a
+PULIB += $(OCGDIR)/blender/ed_logic/$(DEBUG_DIR)libed_logic.a
PULIB += $(OCGDIR)/blender/ed_sequencer/$(DEBUG_DIR)libed_sequencer.a
PULIB += $(OCGDIR)/blender/ed_file/$(DEBUG_DIR)libed_file.a
PULIB += $(OCGDIR)/blender/ed_info/$(DEBUG_DIR)libed_info.a
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6cde040e5fd..e4afdb6b7b5 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4733,6 +4733,14 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
}
snode->nodetree= snode->edittree= NULL;
}
+ else if(sl->spacetype==SPACE_LOGIC) {
+ SpaceLogic *slogic= (SpaceLogic *)sl;
+
+ if(slogic->gpd) {
+ slogic->gpd= newdataadr(fd, slogic->gpd);
+ direct_link_gpencil(fd, slogic->gpd);
+ }
+ }
else if(sl->spacetype==SPACE_SEQ) {
SpaceSeq *sseq= (SpaceSeq *)sl;
if(sseq->gpd) {
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 943e23861ad..f8112406e80 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1884,6 +1884,9 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
else if(sl->spacetype==SPACE_NODE){
writestruct(wd, DATA, "SpaceNode", 1, sl);
}
+ else if(sl->spacetype==SPACE_LOGIC){
+ writestruct(wd, DATA, "SpaceLogic", 1, sl);
+ }
sl= sl->next;
}
}
diff --git a/source/blender/editors/Makefile b/source/blender/editors/Makefile
index 8a819195fbd..62bf612b09d 100644
--- a/source/blender/editors/Makefile
+++ b/source/blender/editors/Makefile
@@ -29,6 +29,6 @@
# Bounces make to subdirectories.
SOURCEDIR = source/blender/editors
-DIRS = armature mesh animation object sculpt_paint datafiles transform screen curve gpencil physics preview uvedit space_outliner space_time space_view3d interface util space_api space_graph space_image space_node space_buttons space_info space_file space_sound space_action space_nla space_script space_text space_sequencer
+DIRS = armature mesh animation object sculpt_paint datafiles transform screen curve gpencil physics preview uvedit space_outliner space_time space_view3d interface util space_api space_graph space_image space_node space_buttons space_info space_file space_sound space_action space_nla space_script space_text space_sequencer space_logic
include nan_subdirs.mk
diff --git a/source/blender/editors/SConscript b/source/blender/editors/SConscript
index a99d21b19a4..9baaf7ae7a5 100644
--- a/source/blender/editors/SConscript
+++ b/source/blender/editors/SConscript
@@ -29,6 +29,7 @@ SConscript(['datafiles/SConscript',
'space_script/SConscript',
'space_text/SConscript',
'space_sequencer/SConscript',
+ 'space_logic/SConscript',
'transform/SConscript',
'screen/SConscript',
'sculpt_paint/SConscript',
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index c2beb34e7b5..ef682c871bc 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -118,6 +118,7 @@ int ED_operator_node_active(struct bContext *C);
int ED_operator_ipo_active(struct bContext *C);
int ED_operator_sequencer_active(struct bContext *C);
int ED_operator_image_active(struct bContext *C);
+int ED_operator_logic_active(struct bContext *C);
int ED_operator_object_active(struct bContext *C);
int ED_operator_editmesh(struct bContext *C);
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index 08d2894ddf7..f2b46369d13 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -50,6 +50,7 @@ void ED_spacetype_nla(void);
void ED_spacetype_script(void);
void ED_spacetype_text(void);
void ED_spacetype_sequencer(void);
+void ED_spacetype_logic(void);
/* calls for instancing and freeing spacetype static data
called in WM_init_exit */
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index edf2f160285..da0f66af02e 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -156,6 +156,9 @@ char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case SPACE_NODE:
ts= &btheme->tnode;
break;
+ case SPACE_LOGIC:
+ ts= &btheme->tlogic;
+ break;
default:
ts= &btheme->tv3d;
break;
@@ -398,6 +401,7 @@ static void ui_theme_init_new(bTheme *btheme)
ui_theme_init_new_do(&btheme->toops);
ui_theme_init_new_do(&btheme->ttime);
ui_theme_init_new_do(&btheme->tnode);
+ ui_theme_init_new_do(&btheme->tlogic);
}
@@ -608,6 +612,9 @@ void ui_theme_init_userdef(void)
SETCOL(btheme->tnode.syntaxv, 142, 138, 145, 255); /* generator */
SETCOL(btheme->tnode.syntaxc, 120, 145, 120, 255); /* group */
+ /* space logic */
+ btheme->tlogic= btheme->tv3d;
+
}
@@ -1233,6 +1240,12 @@ void init_userdef_do_versions(void)
if(btheme->tui.wcol_num.outline[3]==0)
ui_widget_color_init(&btheme->tui);
+
+ /* Logic editor theme, check for alpha==0 is safe, then color was never set */
+ if(btheme->tlogic.syntaxn[3]==0) {
+ /* re-uses syntax color storage */
+ btheme->tlogic= btheme->tv3d;
+ }
}
}
diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c
index bfa381550df..e1b63022dd4 100644
--- a/source/blender/editors/mesh/editmesh_lib.c
+++ b/source/blender/editors/mesh/editmesh_lib.c
@@ -51,11 +51,13 @@ editmesh_lib: generic (no UI, no menus) operations/evaluators for editmesh data
#include "BLI_editVert.h"
#include "BKE_customdata.h"
+#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_utildefines.h"
#include "ED_mesh.h"
+#include "ED_screen.h"
#include "ED_view3d.h"
#include "mesh_intern.h"
@@ -2278,3 +2280,10 @@ void EM_free_uv_vert_map(UvVertMap *vmap)
}
}
+/* poll call for mesh operators requiring a view3d context */
+int EM_view3d_poll(bContext *C)
+{
+ if(ED_operator_editmesh(C) && ED_operator_view3d_active(C))
+ return 1;
+ return 0;
+}
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 83ef88a48a3..b26fded4fb6 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -966,7 +966,7 @@ void MESH_OT_spin(wmOperatorType *ot)
/* api callbacks */
ot->invoke= spin_mesh_invoke;
ot->exec= spin_mesh_exec;
- ot->poll= ED_operator_editmesh;
+ ot->poll= EM_view3d_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1073,7 +1073,7 @@ void MESH_OT_screw(wmOperatorType *ot)
/* api callbacks */
ot->invoke= screw_mesh_invoke;
ot->exec= screw_mesh_exec;
- ot->poll= ED_operator_editmesh;
+ ot->poll= EM_view3d_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -4995,7 +4995,7 @@ void MESH_OT_rip(wmOperatorType *ot)
/* api callbacks */
ot->invoke= mesh_rip_invoke;
- ot->poll= ED_operator_editmesh; // XXX + v3d!
+ ot->poll= EM_view3d_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index f7d2fcfc1f2..83a4211dda1 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -135,6 +135,7 @@ extern int convex(float *v1, float *v2, float *v3, float *v4);
extern struct EditFace *EM_face_from_faces(EditMesh *em, struct EditFace *efa1,
struct EditFace *efa2, int i1, int i2, int i3, int i4);
+extern int EM_view3d_poll(struct bContext *C);
/* ******************* editmesh_loop.c */
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index c2521bd5b2c..07d8fb370e6 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1048,6 +1048,7 @@ static char *windowtype_pup(void)
"|Outliner %x3" //232
"|Buttons Window %x4" //251
"|Node Editor %x16"
+ "|Logic Editor %x17"
"|%l" //254
"|File Browser %x5" //290
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index dae7a7cedd5..2aa6758850e 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -179,6 +179,11 @@ int ED_operator_image_active(bContext *C)
return ed_spacetype_test(C, SPACE_IMAGE);
}
+int ED_operator_logic_active(bContext *C)
+{
+ return ed_spacetype_test(C, SPACE_LOGIC);
+}
+
int ED_operator_object_active(bContext *C)
{
return NULL != CTX_data_active_object(C);
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 9a4d1f329e8..4f9c1f4b7a7 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -73,6 +73,7 @@ void ED_spacetypes_init(void)
ED_spacetype_script();
ED_spacetype_text();
ED_spacetype_sequencer();
+ ED_spacetype_logic();
// ...
/* register operator types for screen and all spaces */
diff --git a/source/blender/editors/space_logic/Makefile b/source/blender/editors/space_logic/Makefile
new file mode 100644
index 00000000000..e07a5bbf4a9
--- /dev/null
+++ b/source/blender/editors/space_logic/Makefile
@@ -0,0 +1,54 @@
+#
+# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+#
+# ***** 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) 2007 Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL LICENSE BLOCK *****
+#
+# Makes module object directory and bounces make to subdirectories.
+
+LIBNAME = ed_logic
+DIR = $(OCGDIR)/blender/$(LIBNAME)
+
+include nan_compile.mk
+
+CFLAGS += $(LEVEL_1_C_WARNINGS)
+
+CPPFLAGS += -I$(NAN_GLEW)/include
+CPPFLAGS += -I$(OPENGL_HEADERS)
+
+# not very neat....
+CPPFLAGS += -I../../windowmanager
+CPPFLAGS += -I../../blenloader
+CPPFLAGS += -I../../blenkernel
+CPPFLAGS += -I../../blenlib
+CPPFLAGS += -I../../makesdna
+CPPFLAGS += -I../../makesrna
+CPPFLAGS += -I../../imbuf
+CPPFLAGS += -I../../python
+CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+
+# own include
+
+CPPFLAGS += -I../include
diff --git a/source/blender/editors/space_logic/SConscript b/source/blender/editors/space_logic/SConscript
new file mode 100644
index 00000000000..46a9858a836
--- /dev/null
+++ b/source/blender/editors/space_logic/SConscript
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+Import ('env')
+
+sources = env.Glob('*.c')
+
+incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
+incs += ' ../../makesrna'
+
+defs = []
+
+if env['WITH_BF_GAMEENGINE']:
+ defs.append('GAMEBLENDER=1')
+
+ if env['WITH_BF_SOLID']:
+ defs.append('USE_SUMO_SOLID')
+
+env.BlenderLib ( 'bf_editors_space_game', sources, Split(incs), defs, libtype=['core'], priority=[120] )
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;
+}
+
+
+
diff --git a/source/blender/editors/space_logic/logic_header.c b/source/blender/editors/space_logic/logic_header.c
new file mode 100644
index 00000000000..d0e905728be
--- /dev/null
+++ b/source/blender/editors/space_logic/logic_header.c
@@ -0,0 +1,126 @@
+/**
+ * $Id$
+ *
+ * ***** 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 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string.h>
+#include <stdio.h>
+
+#include "DNA_space_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+
+#include "BKE_context.h"
+#include "BKE_screen.h"
+#include "BKE_main.h"
+
+#include "ED_screen.h"
+#include "ED_types.h"
+#include "ED_util.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+#include "UI_view2d.h"
+
+#include "logic_intern.h"
+
+/* ************************ header area region *********************** */
+
+
+static void do_logic_buttons(bContext *C, void *arg, int event)
+{
+// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C);
+}
+
+static uiBlock *logic_addmenu(bContext *C, ARegion *ar, void *arg_unused)
+{
+// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C);
+ uiBlock *block;
+ short yco= 0, menuwidth=120;
+
+ block= uiBeginBlock(C, ar, "logic_addmenu", UI_EMBOSSP);
+// uiBlockSetButmFunc(block, do_logic_addmenu, NULL);
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+
+ uiTextBoundsBlock(block, 50);
+ uiBlockSetDirection(block, UI_TOP);
+ uiEndBlock(C, block);
+
+ return block;
+}
+
+void logic_header_buttons(const bContext *C, ARegion *ar)
+{
+ ScrArea *sa= CTX_wm_area(C);
+// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C);
+ uiBlock *block;
+ short xco, yco= 3;
+
+ block= uiBeginBlock(C, ar, "header logic", UI_EMBOSS);
+ uiBlockSetHandleFunc(block, do_logic_buttons, NULL);
+
+ xco= ED_area_header_standardbuttons(C, block, yco);
+
+ if((sa->flag & HEADER_NO_PULLDOWN)==0) {
+ int xmax;
+
+ xmax= GetButStringLength("View");
+ uiDefPulldownBut(block, logic_addmenu, NULL,
+ "View", xco, yco, xmax-3, 20, "");
+ xco+= xmax;
+
+ xmax= GetButStringLength("Select");
+ uiDefPulldownBut(block, logic_addmenu, NULL,
+ "Select", xco, yco, xmax-3, 20, "");
+ xco+= xmax;
+
+ xmax= GetButStringLength("Add");
+ uiDefPulldownBut(block, logic_addmenu, NULL,
+ "Add", xco, yco, xmax-3, 20, "");
+ xco+= xmax;
+ }
+
+ uiBlockSetEmboss(block, UI_EMBOSS);
+
+ UI_view2d_totRect_set(&ar->v2d, xco+XIC+100, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin));
+
+ uiEndBlock(C, block);
+ uiDrawBlock(C, block);
+}
+
+
diff --git a/source/blender/editors/space_logic/logic_intern.h b/source/blender/editors/space_logic/logic_intern.h
new file mode 100644
index 00000000000..773a36bdb2d
--- /dev/null
+++ b/source/blender/editors/space_logic/logic_intern.h
@@ -0,0 +1,55 @@
+/**
+ * $Id:
+ *
+ * ***** 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 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef ED_LOGIC_INTERN_H
+#define ED_LOGIC_INTERN_H
+
+/* internal exports only */
+struct bContext;
+struct ARegion;
+struct ARegionType;
+struct ScrArea;
+struct SpaceLogic;
+struct Object;
+struct wmOperatorType;
+struct Scene;
+
+/* space_logic.c */
+struct ARegion *logic_has_buttons_region(struct ScrArea *sa);
+
+/* logic_header.c */
+void logic_header_buttons(const struct bContext *C, struct ARegion *ar);
+
+/* logic_ops.c */
+
+/* logic_buttons.c */
+void logic_buttons_register(struct ARegionType *art);
+void LOGIC_OT_properties(struct wmOperatorType *ot);
+
+#endif /* ED_LOGIC_INTERN_H */
+
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
new file mode 100644
index 00000000000..12eeed35ec8
--- /dev/null
+++ b/source/blender/editors/space_logic/space_logic.c
@@ -0,0 +1,342 @@
+/**
+ * $Id:
+ *
+ * ***** 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 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string.h>
+#include <stdio.h>
+
+#include "DNA_image_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+#include "DNA_space_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+
+#include "BKE_context.h"
+#include "BKE_screen.h"
+#include "BKE_utildefines.h"
+
+#include "ED_space_api.h"
+#include "ED_screen.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"
+
+/* ******************** manage regions ********************* */
+
+ARegion *logic_has_buttons_region(ScrArea *sa)
+{
+ ARegion *ar, *arnew;
+
+ for(ar= sa->regionbase.first; ar; ar= ar->next)
+ if(ar->regiontype==RGN_TYPE_UI)
+ return ar;
+
+ /* add subdiv level; after header */
+ for(ar= sa->regionbase.first; ar; ar= ar->next)
+ if(ar->regiontype==RGN_TYPE_HEADER)
+ break;
+
+ /* is error! */
+ if(ar==NULL) return NULL;
+
+ arnew= MEM_callocN(sizeof(ARegion), "buttons for image");
+
+ BLI_insertlinkafter(&sa->regionbase, ar, arnew);
+ arnew->regiontype= RGN_TYPE_UI;
+ arnew->alignment= RGN_ALIGN_LEFT;
+
+ arnew->flag = RGN_FLAG_HIDDEN;
+
+ return arnew;
+}
+
+/* ******************** default callbacks for image space ***************** */
+
+static SpaceLink *logic_new(const bContext *C)
+{
+ ARegion *ar;
+ SpaceLogic *slogic;
+
+ slogic= MEM_callocN(sizeof(SpaceLogic), "initlogic");
+ slogic->spacetype= SPACE_LOGIC;
+
+ /* header */
+ ar= MEM_callocN(sizeof(ARegion), "header for logic");
+
+ BLI_addtail(&slogic->regionbase, ar);
+ ar->regiontype= RGN_TYPE_HEADER;
+ ar->alignment= RGN_ALIGN_BOTTOM;
+
+ /* buttons/list view */
+ ar= MEM_callocN(sizeof(ARegion), "buttons for logic");
+
+ BLI_addtail(&slogic->regionbase, ar);
+ ar->regiontype= RGN_TYPE_UI;
+ ar->alignment= RGN_ALIGN_LEFT;
+
+ /* main area */
+ ar= MEM_callocN(sizeof(ARegion), "main area for logic");
+
+ BLI_addtail(&slogic->regionbase, ar);
+ ar->regiontype= RGN_TYPE_WINDOW;
+
+ return (SpaceLink *)slogic;
+}
+
+/* not spacelink itself */
+static void logic_free(SpaceLink *sl)
+{
+// Spacelogic *slogic= (SpaceLogic*) sl;
+
+// if(slogic->gpd)
+// XXX free_gpencil_data(slogic->gpd);
+
+}
+
+
+/* spacetype; init callback */
+static void logic_init(struct wmWindowManager *wm, ScrArea *sa)
+{
+
+}
+
+static SpaceLink *logic_duplicate(SpaceLink *sl)
+{
+ SpaceLogic *slogicn= MEM_dupallocN(sl);
+
+ return (SpaceLink *)slogicn;
+}
+
+void logic_operatortypes(void)
+{
+ WM_operatortype_append(LOGIC_OT_properties);
+
+}
+
+void logic_keymap(struct wmWindowManager *wm)
+{
+ ListBase *keymap= WM_keymap_listbase(wm, "Logic Generic", SPACE_LOGIC, 0);
+
+ WM_keymap_add_item(keymap, "LOGIC_OT_properties", NKEY, KM_PRESS, 0, 0);
+}
+
+static void logic_refresh(const bContext *C, ScrArea *sa)
+{
+// SpaceLogic *slogic= (SpaceImage*)CTX_wm_space_data(C);
+// Object *obedit= CTX_data_edit_object(C);
+
+}
+
+static void logic_listener(ARegion *ar, wmNotifier *wmn)
+{
+ /* context changes */
+ switch(wmn->category) {
+ case NC_SCENE:
+ switch(wmn->data) {
+ case ND_FRAME:
+ ED_region_tag_redraw(ar);
+ break;
+
+ case ND_OB_ACTIVE:
+ ED_region_tag_redraw(ar);
+ break;
+ }
+ break;
+ case NC_OBJECT:
+ break;
+ }
+}
+
+static int logic_context(const bContext *C, const char *member, bContextDataResult *result)
+{
+// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C);
+
+
+ return 0;
+}
+
+/************************** main region ***************************/
+
+
+/* add handlers, stuff you only do once or on area/region changes */
+static void logic_main_area_init(wmWindowManager *wm, ARegion *ar)
+{
+ ListBase *keymap;
+
+ UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
+
+ /* own keymaps */
+ keymap= WM_keymap_listbase(wm, "Logic Generic", SPACE_LOGIC, 0);
+ WM_event_add_keymap_handler(&ar->handlers, keymap);
+}
+
+static void logic_main_area_draw(const bContext *C, ARegion *ar)
+{
+ /* draw entirely, view changes should be handled here */
+// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C);
+ View2D *v2d= &ar->v2d;
+ float col[3];
+
+ /* clear and setup matrix */
+ UI_GetThemeColor3fv(TH_BACK, col);
+ glClearColor(col[0], col[1], col[2], 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* we set view2d from own zoom and offset each time */
+// image_main_area_set_view2d(sima, ar, scene);
+
+ UI_view2d_view_ortho(C, v2d);
+
+ /* scrollers? */
+ /*scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_UNIT_VALUES, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+ UI_view2d_scrollers_draw(C, v2d, scrollers);
+ UI_view2d_scrollers_free(scrollers);*/
+}
+
+
+/* *********************** buttons region ************************ */
+
+/* add handlers, stuff you only do once or on area/region changes */
+static void logic_buttons_area_init(wmWindowManager *wm, ARegion *ar)
+{
+ ListBase *keymap;
+
+ ED_region_panels_init(wm, ar);
+
+ keymap= WM_keymap_listbase(wm, "Logic Generic", SPACE_LOGIC, 0);
+ WM_event_add_keymap_handler(&ar->handlers, keymap);
+}
+
+static void logic_buttons_area_draw(const bContext *C, ARegion *ar)
+{
+ ED_region_panels(C, ar, 1, NULL);
+}
+
+/************************* header region **************************/
+
+/* add handlers, stuff you only do once or on area/region changes */
+static void logic_header_area_init(wmWindowManager *wm, ARegion *ar)
+{
+ ED_region_header_init(ar);
+}
+
+static void logic_header_area_draw(const bContext *C, ARegion *ar)
+{
+ float col[3];
+
+ /* clear */
+ if(ED_screen_area_active(C))
+ UI_GetThemeColor3fv(TH_HEADER, col);
+ else
+ UI_GetThemeColor3fv(TH_HEADERDESEL, col);
+
+ glClearColor(col[0], col[1], col[2], 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* set view2d view matrix for scrolling (without scrollers) */
+ UI_view2d_view_ortho(C, &ar->v2d);
+
+ logic_header_buttons(C, ar);
+
+ /* restore view matrix? */
+ UI_view2d_view_restore(C);
+}
+
+/**************************** spacetype *****************************/
+
+/* only called once, from space/spacetypes.c */
+void ED_spacetype_logic(void)
+{
+ SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype logic");
+ ARegionType *art;
+
+ st->spaceid= SPACE_LOGIC;
+
+ st->new= logic_new;
+ st->free= logic_free;
+ st->init= logic_init;
+ st->duplicate= logic_duplicate;
+ st->operatortypes= logic_operatortypes;
+ st->keymap= logic_keymap;
+ st->refresh= logic_refresh;
+ st->context= logic_context;
+
+ /* regions: main window */
+ art= MEM_callocN(sizeof(ARegionType), "spacetype logic region");
+ art->regionid = RGN_TYPE_WINDOW;
+ art->keymapflag= ED_KEYMAP_FRAMES;
+ art->init= logic_main_area_init;
+ art->draw= logic_main_area_draw;
+ art->listener= logic_listener;
+ art->keymapflag= 0;
+
+ BLI_addhead(&st->regiontypes, art);
+
+ /* regions: listview/buttons */
+ art= MEM_callocN(sizeof(ARegionType), "spacetype logic region");
+ art->regionid = RGN_TYPE_UI;
+ art->minsizex= 220; // XXX
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
+ art->listener= logic_listener;
+ art->init= logic_buttons_area_init;
+ 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;
+ art->minsizey= HEADERY;
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+ art->init= logic_header_area_init;
+ art->draw= logic_header_area_draw;
+
+ BLI_addhead(&st->regiontypes, art);
+
+ BKE_spacetype_register(st);
+}
+
+
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 4c2c2520ee3..97f0d3e53f3 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -361,6 +361,21 @@ typedef struct SpaceNode {
#define SNODE_TEX_WORLD 1
#define SNODE_TEX_BRUSH 2
+typedef struct SpaceLogic {
+ SpaceLink *next, *prev;
+ ListBase regionbase; /* storage of regions for inactive spaces */
+ int spacetype;
+ float blockscale;
+
+ short blockhandler[8];
+
+ short flag, pad;
+ int pad2;
+
+ struct bGPdata *gpd; /* grease-pencil data */
+} SpaceLogic;
+
+
typedef struct SpaceImaSel {
SpaceLink *next, *prev;
ListBase regionbase; /* storage of regions for inactive spaces */
@@ -753,8 +768,8 @@ enum {
SPACE_SCRIPT,
SPACE_TIME,
SPACE_NODE,
- SPACEICONMAX = SPACE_NODE
-/* SPACE_LOGIC */
+ SPACE_LOGIC,
+ SPACEICONMAX = SPACE_LOGIC
};
#endif
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 2b9592fca56..9d554c88a95 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -244,6 +244,7 @@ typedef struct bTheme {
ThemeSpace toops;
ThemeSpace ttime;
ThemeSpace tnode;
+ ThemeSpace tlogic;
/* 20 sets of bone colors for this theme */
ThemeWireColor tarm[20];
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index debe6851451..3b8b88beaff 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -54,6 +54,7 @@ EnumPropertyItem space_type_items[] = {
{SPACE_SCRIPT, "SCRIPTS_WINDOW", 0, "Scripts Window", ""},
{SPACE_TIME, "TIMELINE", 0, "Timeline", ""},
{SPACE_NODE, "NODE_EDITOR", 0, "Node Editor", ""},
+ {SPACE_LOGIC, "LOGIC_EDITOR", 0, "Logic Editor", ""},
{0, NULL, 0, NULL, NULL}};
#define DC_RGB {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors."}
@@ -118,7 +119,9 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
case SPACE_TIME:
return &RNA_SpaceTimeline;
case SPACE_NODE:
- return &RNA_SpaceNodeEditor;*/
+ return &RNA_SpaceNodeEditor;
+ case SPACE_LOGIC:
+ return &RNA_SpaceLogicEditor;*/
default:
return &RNA_Space;
}
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 04006f51c7c..65d83bec552 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -891,6 +891,26 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
RNA_def_property_update(prop, NC_WINDOW, NULL);
}
+static void rna_def_userdef_theme_space_logic(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* space_buts */
+
+ srna= RNA_def_struct(brna, "ThemeLogicEditor", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_ui_text(srna, "Theme Logic Editor", "Theme settings for the Logic Editor.");
+
+ rna_def_userdef_theme_spaces_main(srna, SPACE_LOGIC);
+
+ prop= RNA_def_property(srna, "panel", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Panel", "");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+}
+
+
static void rna_def_userdef_theme_space_buts(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1321,6 +1341,11 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "ThemeNodeEditor");
RNA_def_property_ui_text(prop, "Node Editor", "");
+ prop= RNA_def_property(srna, "logic_editor", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "tlogic");
+ RNA_def_property_struct_type(prop, "ThemeLogicEditor");
+ RNA_def_property_ui_text(prop, "Logic Editor", "");
+
prop= RNA_def_property(srna, "outliner", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "toops");
RNA_def_property_struct_type(prop, "ThemeOutliner");
@@ -1357,6 +1382,7 @@ static void rna_def_userdef_dothemes(BlenderRNA *brna)
rna_def_userdef_theme_space_outliner(brna);
rna_def_userdef_theme_space_info(brna);
rna_def_userdef_theme_space_sound(brna);
+ rna_def_userdef_theme_space_logic(brna);
rna_def_userdef_theme_colorset(brna);
rna_def_userdef_themes(brna);
}