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:
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r--source/blender/editors/util/CMakeLists.txt34
-rw-r--r--source/blender/editors/util/Makefile2
-rw-r--r--source/blender/editors/util/ed_util.c31
-rw-r--r--source/blender/editors/util/editmode_undo.c4
-rw-r--r--source/blender/editors/util/numinput.c2
-rw-r--r--source/blender/editors/util/undo.c21
6 files changed, 76 insertions, 18 deletions
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt
new file mode 100644
index 00000000000..b4b2fd12cef
--- /dev/null
+++ b/source/blender/editors/util/CMakeLists.txt
@@ -0,0 +1,34 @@
+# $Id: CMakeLists.txt 12931 2007-12-17 18:20:48Z theeth $
+# ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Contributor(s): Jacques Beaurain.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+FILE(GLOB SRC *.c)
+
+SET(INC
+ ../../blenkernel
+ ../../blenlib
+ ../include
+ ../../../../intern/guardedalloc
+ ../../makesdna
+ ../../makesrna
+ ../../windowmanager
+)
+
+BLENDERLIB(bf_editor_util "${SRC}" "${INC}")
diff --git a/source/blender/editors/util/Makefile b/source/blender/editors/util/Makefile
index 303079daeee..8535b3fb402 100644
--- a/source/blender/editors/util/Makefile
+++ b/source/blender/editors/util/Makefile
@@ -15,7 +15,7 @@
#
# 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.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2007 Blender Foundation
# All rights reserved.
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 19bd18ade1f..0d3d8a48b60 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -38,11 +38,11 @@
#include "BLI_editVert.h"
#include "BKE_context.h"
-#include "BKE_global.h"
#include "BKE_main.h"
#include "ED_armature.h"
#include "ED_mesh.h"
+#include "ED_object.h"
#include "ED_sculpt.h"
#include "ED_util.h"
@@ -50,16 +50,43 @@
/* ********* general editor util funcs, not BKE stuff please! ********* */
+void ED_editors_init(bContext *C)
+{
+ Main *bmain= CTX_data_main(C);
+ Scene *sce= CTX_data_scene(C);
+ Object *ob, *obact= (sce && sce->basact)? sce->basact->object: NULL;
+ ID *data;
+
+ /* toggle on modes for objects that were saved with these enabled. for
+ e.g. linked objects we have to ensure that they are actually the
+ active object in this scene. */
+ for(ob=bmain->object.first; ob; ob=ob->id.next) {
+ int mode= ob->mode;
+
+ if(mode && (mode != OB_MODE_POSE)) {
+ ob->mode= 0;
+ data= ob->data;
+
+ if(ob == obact && !ob->id.lib && !(data && data->lib))
+ ED_object_toggle_modes(C, mode);
+ }
+ }
+}
+
/* frees all editmode stuff */
void ED_editors_exit(bContext *C)
{
+ Main *bmain= CTX_data_main(C);
Scene *sce;
+
+ if(!bmain)
+ return;
/* frees all editmode undos */
undo_editmode_clear();
ED_undo_paint_free();
- for(sce=G.main->scene.first; sce; sce= sce->id.next) {
+ for(sce=bmain->scene.first; sce; sce= sce->id.next) {
if(sce->obedit) {
Object *ob= sce->obedit;
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index 8597454fdb5..290c8a64881 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -40,12 +40,10 @@
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
-#include "BKE_object.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
-#include "BKE_utildefines.h"
#include "ED_mesh.h"
@@ -76,7 +74,7 @@ void undo_editmode_menu(void) // history menu
/* ********************************************************************* */
/* ****** XXX ***** */
-void error() {}
+void error(const char *dummy) {}
/* ****** XXX ***** */
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index a5c0bfeb73a..868aa8ac6af 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -30,8 +30,6 @@
#include <math.h> /* fabs */
#include <stdio.h> /* for sprintf */
-#include "BKE_global.h" /* for G */
-#include "BKE_utildefines.h" /* ABS */
#include "WM_types.h"
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 636ce9dcec5..283e2b49f0d 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -38,16 +38,11 @@
#include "BKE_blender.h"
#include "BKE_context.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_object.h"
-#include "BKE_text.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_dynstr.h"
-#include "BKE_utildefines.h"
#include "ED_armature.h"
#include "ED_particle.h"
@@ -116,7 +111,9 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
- ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step);
+ if(!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname)
+ if(U.uiflag & USER_GLOBALUNDO)
+ BKE_undo_name(C, undoname);
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
@@ -139,10 +136,14 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
else {
int do_glob_undo= 0;
- if(obact && obact->mode & OB_MODE_TEXTURE_PAINT)
- ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step);
- else if(obact && obact->mode & OB_MODE_SCULPT)
- ED_undo_paint_step(C, UNDO_PAINT_MESH, step);
+ if(obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
+ if(!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname)
+ do_glob_undo= 1;
+ }
+ else if(obact && obact->mode & OB_MODE_SCULPT) {
+ if(!ED_undo_paint_step(C, UNDO_PAINT_MESH, step, undoname) && undoname)
+ do_glob_undo= 1;
+ }
else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
if(step==1)
PE_undo(CTX_data_scene(C));