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/blender/blenkernel/BKE_utildefines.h35
-rw-r--r--source/blender/blenlib/BLI_fileops.h7
-rw-r--r--source/blender/blenloader/BLO_blend_defs.h47
-rw-r--r--source/blender/blenloader/CMakeLists.txt1
-rw-r--r--source/blender/blenloader/intern/readblenentry.c1
-rw-r--r--source/blender/blenloader/intern/readfile.c1
-rw-r--r--source/blender/blenloader/intern/writefile.c1
-rw-r--r--source/blender/editors/interface/interface.c8
-rw-r--r--source/blender/editors/interface/interface_handlers.c30
-rw-r--r--source/blender/editors/interface/interface_intern.h8
-rw-r--r--source/blender/editors/interface/interface_widgets.c4
-rw-r--r--source/blender/imbuf/intern/thumbs_blend.c2
12 files changed, 91 insertions, 54 deletions
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h
index 0ed2db2aad2..62415912945 100644
--- a/source/blender/blenkernel/BKE_utildefines.h
+++ b/source/blender/blenkernel/BKE_utildefines.h
@@ -47,41 +47,6 @@ extern "C" {
#define FILE_MAX 1024
#endif
-/* this weirdo pops up in two places ... */
-#if !defined(WIN32)
-# ifndef O_BINARY
-# define O_BINARY 0
-# endif
-#endif
-
-/* INTEGER CODES */
-#ifdef __BIG_ENDIAN__
-/* Big Endian */
-# define MAKE_ID(a, b, c, d) ( (int)(a) << 24 | (int)(b) << 16 | (c) << 8 | (d) )
-#else
-/* Little Endian */
-# define MAKE_ID(a, b, c, d) ( (int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a) )
-#endif
-
-#define DATA MAKE_ID('D', 'A', 'T', 'A')
-#define GLOB MAKE_ID('G', 'L', 'O', 'B')
-
-#define DNA1 MAKE_ID('D', 'N', 'A', '1')
-#define TEST MAKE_ID('T', 'E', 'S', 'T') /* used as preview between 'REND' and 'GLOB' */
-#define REND MAKE_ID('R', 'E', 'N', 'D')
-#define USER MAKE_ID('U', 'S', 'E', 'R')
-
-#define ENDB MAKE_ID('E', 'N', 'D', 'B')
-
-/* Bit operations */
-#define BTST(a, b) ( ( (a) & 1 << (b) ) != 0)
-#define BNTST(a, b) ( ( (a) & 1 << (b) ) == 0)
-#define BTST2(a, b, c) (BTST( (a), (b) ) || BTST( (a), (c) ) )
-#define BSET(a, b) ( (a) | 1 << (b) )
-#define BCLR(a, b) ( (a) & ~(1 << (b)) )
-/* bit-row */
-#define BROW(min, max) (((max) >= 31 ? 0xFFFFFFFF : (1 << (max + 1)) - 1) - ((min) ? ((1 << (min)) - 1) : 0) )
-
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index ac0ec6a52a7..e8d6336a994 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -91,6 +91,13 @@ int BLI_file_older(const char *file1, const char *file2);
struct LinkNode *BLI_file_read_as_lines(const char *file);
void BLI_file_free_lines(struct LinkNode *lines);
+/* this weirdo pops up in two places ... */
+#if !defined(WIN32)
+# ifndef O_BINARY
+# define O_BINARY 0
+# endif
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenloader/BLO_blend_defs.h b/source/blender/blenloader/BLO_blend_defs.h
new file mode 100644
index 00000000000..8005be158ce
--- /dev/null
+++ b/source/blender/blenloader/BLO_blend_defs.h
@@ -0,0 +1,47 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef __BLO_BLEND_DEFS_H__
+#define __BLO_BLEND_DEFS_H__
+
+/** \file BLO_blend_defs.h
+ * \ingroup blenloader
+ * \brief defines for blendfile codes
+ */
+
+/* INTEGER CODES */
+#ifdef __BIG_ENDIAN__
+/* Big Endian */
+# define BLEND_MAKE_ID(a, b, c, d) ( (int)(a) << 24 | (int)(b) << 16 | (c) << 8 | (d) )
+#else
+/* Little Endian */
+# define BLEND_MAKE_ID(a, b, c, d) ( (int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a) )
+#endif
+
+#define DATA BLEND_MAKE_ID('D', 'A', 'T', 'A')
+#define GLOB BLEND_MAKE_ID('G', 'L', 'O', 'B')
+
+#define DNA1 BLEND_MAKE_ID('D', 'N', 'A', '1')
+#define TEST BLEND_MAKE_ID('T', 'E', 'S', 'T') /* used as preview between 'REND' and 'GLOB' */
+#define REND BLEND_MAKE_ID('R', 'E', 'N', 'D')
+#define USER BLEND_MAKE_ID('U', 'S', 'E', 'R')
+
+#define ENDB BLEND_MAKE_ID('E', 'N', 'D', 'B')
+
+#endif /* __BLO_BLEND_DEFS_H__ */
diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt
index a0fe042e7fb..74df5211dad 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -48,6 +48,7 @@ set(SRC
intern/versioning_legacy.c
intern/writefile.c
+ BLO_blend_defs.h
BLO_readfile.h
BLO_runtime.h
BLO_soundfile.h
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index eb12a7bd837..6f4d9b2137c 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -59,6 +59,7 @@
#include "BLO_readfile.h"
#include "BLO_undofile.h"
+#include "BLO_blend_defs.h"
#include "readfile.h"
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 5c8a50c76ca..890a2714d33 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -150,6 +150,7 @@
#include "BLO_readfile.h"
#include "BLO_undofile.h"
+#include "BLO_blend_defs.h"
#include "RE_engine.h"
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 252e81537c4..3b502ae892b 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -163,6 +163,7 @@ Any case: direct data is ALWAYS after the lib block
#include "BLO_writefile.h"
#include "BLO_readfile.h"
#include "BLO_undofile.h"
+#include "BLO_blend_defs.h"
#include "readfile.h"
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index afbabaaa8d7..3d957cba517 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1077,8 +1077,12 @@ static void ui_is_but_sel(uiBut *but, double *value)
int lvalue;
UI_GET_BUT_VALUE_INIT(but, *value);
lvalue = (int)*value;
- if (BTST(lvalue, (but->bitnr)) ) is_push = is_true;
- else is_push = !is_true;
+ if (UI_BITBUT_TEST(lvalue, (but->bitnr))) {
+ is_push = is_true;
+ }
+ else {
+ is_push = !is_true;
+ }
}
else {
switch (but->type) {
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 31bc40326c2..54b391bca6b 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -501,9 +501,9 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
lvalue = (int)value;
if (but->bit) {
- w = BTST(lvalue, but->bitnr);
- if (w) lvalue = BCLR(lvalue, but->bitnr);
- else lvalue = BSET(lvalue, but->bitnr);
+ w = UI_BITBUT_TEST(lvalue, but->bitnr);
+ if (w) lvalue = UI_BITBUT_CLR(lvalue, but->bitnr);
+ else lvalue = UI_BITBUT_SET(lvalue, but->bitnr);
if (but->type == TOGR) {
if (!data->togonly) {
@@ -605,27 +605,27 @@ static void ui_apply_but_TOG3(bContext *C, uiBut *but, uiHandleButtonData *data)
if (but->pointype == SHO) {
short *sp = (short *)but->poin;
- if (BTST(sp[1], but->bitnr)) {
- sp[1] = BCLR(sp[1], but->bitnr);
- sp[0] = BCLR(sp[0], but->bitnr);
+ if (UI_BITBUT_TEST(sp[1], but->bitnr)) {
+ sp[1] = UI_BITBUT_CLR(sp[1], but->bitnr);
+ sp[0] = UI_BITBUT_CLR(sp[0], but->bitnr);
}
- else if (BTST(sp[0], but->bitnr)) {
- sp[1] = BSET(sp[1], but->bitnr);
+ else if (UI_BITBUT_TEST(sp[0], but->bitnr)) {
+ sp[1] = UI_BITBUT_SET(sp[1], but->bitnr);
}
else {
- sp[0] = BSET(sp[0], but->bitnr);
+ sp[0] = UI_BITBUT_SET(sp[0], but->bitnr);
}
}
else {
- if (BTST(*(but->poin + 2), but->bitnr)) {
- *(but->poin + 2) = BCLR(*(but->poin + 2), but->bitnr);
- *(but->poin) = BCLR(*(but->poin), but->bitnr);
+ if (UI_BITBUT_TEST(*(but->poin + 2), but->bitnr)) {
+ *(but->poin + 2) = UI_BITBUT_CLR(*(but->poin + 2), but->bitnr);
+ *(but->poin) = UI_BITBUT_CLR(*(but->poin), but->bitnr);
}
- else if (BTST(*(but->poin), but->bitnr)) {
- *(but->poin + 2) = BSET(*(but->poin + 2), but->bitnr);
+ else if (UI_BITBUT_TEST(*(but->poin), but->bitnr)) {
+ *(but->poin + 2) = UI_BITBUT_SET(*(but->poin + 2), but->bitnr);
}
else {
- *(but->poin) = BSET(*(but->poin), but->bitnr);
+ *(but->poin) = UI_BITBUT_SET(*(but->poin), but->bitnr);
}
}
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 567109e26d0..d39fbbf7e61 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -131,6 +131,14 @@ typedef enum {
/* for scope resize zone */
#define SCOPE_RESIZE_PAD 9
+/* bit button defines */
+/* Bit operations */
+#define UI_BITBUT_TEST(a, b) ( ( (a) & 1 << (b) ) != 0)
+#define UI_BITBUT_SET(a, b) ( (a) | 1 << (b) )
+#define UI_BITBUT_CLR(a, b) ( (a) & ~(1 << (b)) )
+/* bit-row */
+#define UI_BITBUT_ROW(min, max) (((max) >= 31 ? 0xFFFFFFFF : (1 << (max + 1)) - 1) - ((min) ? ((1 << (min)) - 1) : 0) )
+
typedef struct uiLinkLine { /* only for draw/edit */
struct uiLinkLine *next, *prev;
struct uiBut *from, *to;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index ef8d8302fa7..d895beeb184 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1257,9 +1257,9 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
if (but->type == BUT_TOGDUAL) {
int dualset = 0;
if (but->pointype == SHO)
- dualset = BTST(*(((short *)but->poin) + 1), but->bitnr);
+ dualset = UI_BITBUT_TEST(*(((short *)but->poin) + 1), but->bitnr);
else if (but->pointype == INT)
- dualset = BTST(*(((int *)but->poin) + 1), but->bitnr);
+ dualset = UI_BITBUT_TEST(*(((int *)but->poin) + 1), but->bitnr);
widget_draw_icon(but, ICON_DOT, dualset ? 1.0f : 0.25f, rect);
}
diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c
index 1a921c4844c..e387a133bfb 100644
--- a/source/blender/imbuf/intern/thumbs_blend.c
+++ b/source/blender/imbuf/intern/thumbs_blend.c
@@ -35,6 +35,8 @@
#include "BLI_endian_switch.h"
#include "BLI_fileops.h"
+#include "BLO_blend_defs.h"
+
#include "BKE_utildefines.h"
#include "BKE_global.h"