Merge branch 'master' into blender2.8

This commit is contained in:
2018-03-23 12:05:55 +01:00
29 changed files with 554 additions and 477 deletions

View File

@@ -641,7 +641,7 @@ void cloth_free_modifier_extern(ClothModifierData *clmd )
**/
static void cloth_to_object (Object *ob, ClothModifierData *clmd, float (*vertexCos)[3])
{
unsigned int i = 0;
unsigned int i = 0;
Cloth *cloth = clmd->clothObject;
if (clmd->clothObject) {

View File

@@ -180,8 +180,8 @@ static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3
/* dot_v3v3 */
#define INPR(v1, v2) ( (v1)[0] * (v2)[0] + (v1)[1] * (v2)[1] + (v1)[2] * (v2)[2])
double tempV1[3], tempV2[3], tempV4[3];
double a, b, c, d, e, f;
double tempV1[3], tempV2[3], tempV4[3];
double a, b, c, d, e, f;
VECSUB ( tempV1, p1, p3 );
VECSUB ( tempV2, p2, p3 );

View File

@@ -54,7 +54,7 @@
#include "BKE_animsys.h"
#include "BKE_armature.h"
#include "BKE_bvhutils.h" /* bvh tree */
#include "BKE_bvhutils.h" /* bvh tree */
#include "BKE_colorband.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_constraint.h"
@@ -4516,7 +4516,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
*/
tree = BLI_kdtree_new(psys->totpart);
/* loop through particles and insert valid ones to the tree */
/* loop through particles and insert valid ones to the tree */
p = 0;
for (ParticleData *pa = psys->particles; p < psys->totpart; p++, pa++) {
/* Proceed only if particle is active */

View File

@@ -63,8 +63,8 @@ typedef union {
} EdgeUUID;
typedef struct SortFace {
EdgeUUID es[4];
unsigned int index;
EdgeUUID es[4];
unsigned int index;
} SortFace;
/* Used to detect polys (faces) using exactly the same vertices. */
@@ -127,28 +127,28 @@ static int search_face_cmp(const void *v1, const void *v2)
if (sfa->es[0].edval > sfb->es[0].edval) {
return 1;
}
else if (sfa->es[0].edval < sfb->es[0].edval) {
else if (sfa->es[0].edval < sfb->es[0].edval) {
return -1;
}
else if (sfa->es[1].edval > sfb->es[1].edval) {
else if (sfa->es[1].edval > sfb->es[1].edval) {
return 1;
}
else if (sfa->es[1].edval < sfb->es[1].edval) {
else if (sfa->es[1].edval < sfb->es[1].edval) {
return -1;
}
else if (sfa->es[2].edval > sfb->es[2].edval) {
else if (sfa->es[2].edval > sfb->es[2].edval) {
return 1;
}
else if (sfa->es[2].edval < sfb->es[2].edval) {
else if (sfa->es[2].edval < sfb->es[2].edval) {
return -1;
}
else if (sfa->es[3].edval > sfb->es[3].edval) {
else if (sfa->es[3].edval > sfb->es[3].edval) {
return 1;
}
else if (sfa->es[3].edval < sfb->es[3].edval) {
else if (sfa->es[3].edval < sfb->es[3].edval) {
return -1;
}

View File

@@ -354,16 +354,15 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i
return (ret_value);
}
/*
/**
* This function compares a packed file to a 'real' file.
* It returns an integer indicating if:
*
* PF_EQUAL - the packed file and original file are identical
* PF_DIFFERENT - the packed file and original file differ
* PF_NOFILE - the original file doens't exist
* - PF_EQUAL: the packed file and original file are identical
* - PF_DIFFERENT: the packed file and original file differ
* - PF_NOFILE: the original file doens't exist
*/
int checkPackedFile(const char *filename, PackedFile *pf)
{
BLI_stat_t st;

View File

@@ -947,7 +947,7 @@ void BKE_sculpt_update_mesh_elements(
if (!CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK)) {
#if 1
BKE_sculpt_mask_layers_ensure(ob, mmd);
#else /* if we wanted to support adding mask data while multi-res painting, we would need to do this */
#else /* if we wanted to support adding mask data while multi-res painting, we would need to do this */
if ((ED_sculpt_mask_layers_ensure(ob, mmd) & ED_SCULPT_MASK_LAYER_CALC_LOOP)) {
/* remake the derived mesh */
ob->recalc |= OB_RECALC_DATA;

View File

@@ -800,7 +800,7 @@ static void distribute_invalid(Scene *scene, ParticleSystem *psys, int from)
}
}
/* Creates a distribution of coordinates on a DerivedMesh */
/* Creates a distribution of coordinates on a DerivedMesh */
/* This is to denote functionality that does not yet work with mesh - only derived mesh */
static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, ParticleSimulationData *sim, int from)
{
@@ -950,9 +950,9 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
return 0;
}
element_weight = MEM_callocN(sizeof(float)*totelem, "particle_distribution_weights");
particle_element= MEM_callocN(sizeof(int)*totpart, "particle_distribution_indexes");
jitter_offset = MEM_callocN(sizeof(float)*totelem, "particle_distribution_jitoff");
element_weight = MEM_callocN(sizeof(float) * totelem, "particle_distribution_weights");
particle_element = MEM_callocN(sizeof(int) * totpart, "particle_distribution_indexes");
jitter_offset = MEM_callocN(sizeof(float) * totelem, "particle_distribution_jitoff");
/* Calculate weights from face areas */
if ((part->flag&PART_EDISTR || children) && from != PART_FROM_VERT) {

View File

@@ -473,7 +473,7 @@ MALWAYS_INLINE __m128 _bli_math_fastpow24(const __m128 arg)
*/
/* 0x3F4CCCCD = 4/5 */
/* 0x4F55A7FB = 2^(127/(4/5) - 127) * 0.994^(1/(4/5)) */
/* error max = 0.17 avg = 0.0018 |avg| = 0.05 */
/* error max = 0.17, avg = 0.0018, |avg| = 0.05 */
__m128 x = _bli_math_fastpow(0x3F4CCCCD, 0x4F55A7FB, arg);
__m128 arg2 = _mm_mul_ps(arg, arg);
__m128 arg4 = _mm_mul_ps(arg2, arg2);

View File

@@ -3748,7 +3748,7 @@ void orthographic_m4(float matrix[4][4], const float left, const float right, co
matrix[3][0] = -(right + left) / Xdelta;
matrix[1][1] = 2.0f / Ydelta;
matrix[3][1] = -(top + bottom) / Ydelta;
matrix[2][2] = -2.0f / Zdelta; /* note: negate Z */
matrix[2][2] = -2.0f / Zdelta; /* note: negate Z */
matrix[3][2] = -(farClip + nearClip) / Zdelta;
}
@@ -3767,7 +3767,7 @@ void perspective_m4(float mat[4][4], const float left, const float right, const
}
mat[0][0] = nearClip * 2.0f / Xdelta;
mat[1][1] = nearClip * 2.0f / Ydelta;
mat[2][0] = (right + left) / Xdelta; /* note: negate Z */
mat[2][0] = (right + left) / Xdelta; /* note: negate Z */
mat[2][1] = (top + bottom) / Ydelta;
mat[2][2] = -(farClip + nearClip) / Zdelta;
mat[2][3] = -1.0f;

View File

@@ -931,13 +931,13 @@ size_t BLI_str_partition_ex(
if (end) {
if (from_right) {
for (tmp = end - 1; (tmp >= str) && (*tmp != *d); tmp--);
if (tmp < str) {
if (tmp < str) {
tmp = NULL;
}
}
else {
tmp = func(str, *d);
if (tmp >= end) {
if (tmp >= end) {
tmp = NULL;
}
}

View File

@@ -8406,7 +8406,7 @@ static const char *dataname(short id_code)
case ID_WO: return "Data from WO";
case ID_SCR: return "Data from SCR";
case ID_VF: return "Data from VF";
case ID_TXT : return "Data from TXT";
case ID_TXT: return "Data from TXT";
case ID_SPK: return "Data from SPK";
case ID_LP: return "Data from LP";
case ID_SO: return "Data from SO";

View File

@@ -1029,7 +1029,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
ED_armature_deselect_all(obedit);
/* Create a bone */
/* Create a bone */
bone = ED_armature_edit_bone_add(obedit->data, name);
copy_v3_v3(bone->head, curs);

View File

@@ -602,7 +602,7 @@ void ED_armature_from_edit(bArmature *arm)
if (len_sq <= SQUARE(0.000001f)) { /* FLT_EPSILON is too large? */
EditBone *fBone;
/* Find any bones that refer to this bone */
/* Find any bones that refer to this bone */
for (fBone = arm->edbo->first; fBone; fBone = fBone->next) {
if (fBone->parent == eBone)
fBone->parent = eBone->parent;

View File

@@ -231,7 +231,7 @@ void ED_pose_de_selectall(Object *ob, int select_mode, const bool ignore_visibil
return;
}
/* Determine if we're selecting or deselecting */
/* Determine if we're selecting or deselecting */
if (select_mode == SEL_TOGGLE) {
select_mode = SEL_SELECT;
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {

View File

@@ -54,11 +54,13 @@ void ED_undo_paint_push_begin(int type, const char *name, UndoRestoreCb restore,
void ED_undo_paint_push_end(int type);
/* paint_image.c */
/* image painting specific undo */
void ED_image_undo_restore(struct bContext *C, struct ListBase *lb);
void ED_image_undo_free(struct ListBase *lb);
void ED_imapaint_clear_partial_redraw(void);
void ED_imapaint_dirty_region(struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h, bool find_old);
void ED_imapaint_bucket_fill(struct bContext *C, float color[3], struct wmOperator *op);
/* paint_image_undo.c */
void ED_image_undo_push_begin(const char *name);
void ED_image_undo_push_end(void);
void ED_image_undo_restore(void);
#endif /* __ED_PAINT_H__ */

View File

@@ -1211,10 +1211,10 @@ static void step_to_grid(float *step, int *power, int unit)
* - Units + clamping args will be checked, to make sure they are valid values that can be used
* so it is very possible that we won't return grid at all!
*
* - xunits,yunits = V2D_UNIT_* grid steps in seconds or frames
* - xclamp,yclamp = V2D_CLAMP_* only show whole-number intervals
* - winx = width of region we're drawing to, note: not used but keeping for completeness.
* - winy = height of region we're drawing into
* - xunits,yunits = V2D_UNIT_* grid steps in seconds or frames
* - xclamp,yclamp = V2D_CLAMP_* only show whole-number intervals
* - winx = width of region we're drawing to, note: not used but keeping for completeness.
* - winy = height of region we're drawing into
*/
View2DGrid *UI_view2d_grid_calc(
Scene *scene, View2D *v2d,

View File

@@ -1947,7 +1947,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
BMIter fiter;
BMFace *f;
/* Check if select faces are triangles */
/* Check if select faces are triangles */
BM_ITER_MESH (f, &fiter, em->bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
if (f->len > 4) {

View File

@@ -247,7 +247,7 @@ static void um_arraystore_cd_free(BArrayCustomData *bcd)
BArrayCustomData *bcd_next = bcd->next;
const int stride = CustomData_sizeof(bcd->type);
BArrayStore *bs = BLI_array_store_at_size_get(&um_arraystore.bs_stride, stride);
for (int i = 0; i < bcd->states_len; i++) {
for (int i = 0; i < bcd->states_len; i++) {
if (bcd->states[i]) {
BLI_array_store_state_remove(bs, bcd->states[i]);
}

View File

@@ -367,7 +367,7 @@ static void dynamicPaint_bakeImageSequence(DynamicPaintBakeJob *job)
scene->r.cfra = (int)frame;
ED_update_for_newframe(job->bmain, scene, job->view_layer, job->depsgraph);
/* Init surface */
/* Init surface */
if (!dynamicPaint_createUVSurface(scene, surface, job->progress, job->do_update)) {
job->success = 0;
return;
@@ -508,7 +508,7 @@ static int dynamicpaint_bake_exec(struct bContext *C, struct wmOperator *op)
WM_set_locked_interface(CTX_wm_manager(C), true);
/* Bake Dynamic Paint */
/* Bake Dynamic Paint */
WM_jobs_start(CTX_wm_manager(C), wm_job);
return OPERATOR_FINISHED;

View File

@@ -901,23 +901,23 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot)
/** \name Swap Area Operator
* \{ */
/* operator state vars used:
* sa1 start area
* sa2 area to swap with
*
/* operator state vars used:
* sa1 start area
* sa2 area to swap with
*
* functions:
*
*
* init() set custom data for operator, based on actionzone event custom data
*
* cancel() cancel the operator
*
* exit() cleanup, send notifier
*
*
* cancel() cancel the operator
*
* exit() cleanup, send notifier
*
* callbacks:
*
*
* invoke() gets called on shift+lmb drag in actionzone
* call init(), add handler
*
*
* modal() accept modal events while doing it
*/
@@ -1458,35 +1458,35 @@ static void SCREEN_OT_area_move(wmOperatorType *ot)
/** \name Split Area Operator
* \{ */
/*
* operator state vars:
/*
* operator state vars:
* fac spit point
* dir direction 'v' or 'h'
*
*
* operator customdata:
* area pointer to (active) area
* x, y last used mouse pos
* x, y last used mouse pos
* (more, see below)
*
*
* functions:
*
*
* init() set default property values, find area based on context
*
* apply() split area based on state vars
*
* exit() cleanup, send notifier
*
*
* apply() split area based on state vars
*
* exit() cleanup, send notifier
*
* cancel() remove duplicated area
*
*
* callbacks:
*
*
* exec() execute without any user interaction, based on state vars
* call init(), apply(), exit()
*
*
* invoke() gets called on mouse click in action-widget
* call init(), add modal handler
* call apply() with initial motion
*
*
* modal() accept modal events while doing it
* call move-areas code with delta motion
* call exit() or cancel() and remove handler

View File

@@ -47,6 +47,7 @@ set(SRC
paint_image.c
paint_image_2d.c
paint_image_proj.c
paint_image_undo.c
paint_mask.c
paint_ops.c
paint_stroke.c

View File

@@ -39,7 +39,6 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_threads.h"
#include "BLT_translation.h"
@@ -54,7 +53,6 @@
#include "BKE_context.h"
#include "BKE_DerivedMesh.h"
#include "BKE_brush.h"
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_node.h"
@@ -87,43 +85,10 @@
#include "paint_intern.h"
typedef struct UndoImageTile {
struct UndoImageTile *next, *prev;
char idname[MAX_ID_NAME]; /* name instead of pointer*/
char ibufname[IMB_FILENAME_SIZE];
union {
float *fp;
unsigned int *uint;
void *pt;
} rect;
unsigned short *mask;
int x, y;
Image *ima;
short source, use_float;
char gen_type;
bool valid;
} UndoImageTile;
/* this is a static resource for non-globality,
* Maybe it should be exposed as part of the
* paint operation, but for now just give a public interface */
static ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0};
static SpinLock undolock;
void image_undo_init_locks(void)
{
BLI_spin_init(&undolock);
}
void image_undo_end_locks(void)
{
BLI_spin_end(&undolock);
}
ImagePaintPartialRedraw *get_imapaintpartial(void)
{
@@ -135,296 +100,6 @@ void set_imapaintpartial(struct ImagePaintPartialRedraw *ippr)
imapaintpartial = *ippr;
}
/* UNDO */
typedef enum {
COPY = 0,
RESTORE = 1,
RESTORE_COPY = 2
} CopyMode;
static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, CopyMode mode)
{
if (mode == COPY) {
/* copy or swap contents of tile->rect and region in ibuf->rect */
IMB_rectcpy(tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
if (ibuf->rect_float) {
SWAP(float *, tmpibuf->rect_float, tile->rect.fp);
}
else {
SWAP(unsigned int *, tmpibuf->rect, tile->rect.uint);
}
}
else {
if (mode == RESTORE_COPY) {
IMB_rectcpy(tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
}
/* swap to the tmpbuf for easy copying */
if (ibuf->rect_float) {
SWAP(float *, tmpibuf->rect_float, tile->rect.fp);
}
else {
SWAP(unsigned int *, tmpibuf->rect, tile->rect.uint);
}
IMB_rectcpy(ibuf, tmpibuf, tile->x * IMAPAINT_TILE_SIZE,
tile->y * IMAPAINT_TILE_SIZE, 0, 0, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
if (mode == RESTORE) {
if (ibuf->rect_float) {
SWAP(float *, tmpibuf->rect_float, tile->rect.fp);
}
else {
SWAP(unsigned int *, tmpibuf->rect, tile->rect.uint);
}
}
}
}
void *image_undo_find_tile(Image *ima, ImBuf *ibuf, int x_tile, int y_tile, unsigned short **mask, bool validate)
{
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
UndoImageTile *tile;
short use_float = ibuf->rect_float ? 1 : 0;
for (tile = lb->first; tile; tile = tile->next) {
if (tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source) {
if (tile->use_float == use_float) {
if (STREQ(tile->idname, ima->id.name) && STREQ(tile->ibufname, ibuf->name)) {
if (mask) {
/* allocate mask if requested */
if (!tile->mask) {
tile->mask = MEM_callocN(sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE,
"UndoImageTile.mask");
}
*mask = tile->mask;
}
if (validate)
tile->valid = true;
return tile->rect.pt;
}
}
}
}
return NULL;
}
void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int x_tile, int y_tile, unsigned short **mask, bool **valid, bool proj, bool find_prev)
{
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
UndoImageTile *tile;
int allocsize;
short use_float = ibuf->rect_float ? 1 : 0;
void *data;
/* check if tile is already pushed */
/* in projective painting we keep accounting of tiles, so if we need one pushed, just push! */
if (find_prev) {
data = image_undo_find_tile(ima, ibuf, x_tile, y_tile, mask, true);
if (data)
return data;
}
if (*tmpibuf == NULL)
*tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat | IB_rect);
tile = MEM_callocN(sizeof(UndoImageTile), "UndoImageTile");
BLI_strncpy(tile->idname, ima->id.name, sizeof(tile->idname));
tile->x = x_tile;
tile->y = y_tile;
/* add mask explicitly here */
if (mask)
*mask = tile->mask = MEM_callocN(sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE,
"UndoImageTile.mask");
allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
allocsize *= (ibuf->rect_float) ? sizeof(float) : sizeof(char);
tile->rect.pt = MEM_mapallocN(allocsize, "UndeImageTile.rect");
BLI_strncpy(tile->ibufname, ibuf->name, sizeof(tile->ibufname));
tile->gen_type = ima->gen_type;
tile->source = ima->source;
tile->use_float = use_float;
tile->valid = true;
tile->ima = ima;
if (valid)
*valid = &tile->valid;
undo_copy_tile(tile, *tmpibuf, ibuf, COPY);
if (proj)
BLI_spin_lock(&undolock);
undo_paint_push_count_alloc(UNDO_PAINT_IMAGE, allocsize);
BLI_addtail(lb, tile);
if (proj)
BLI_spin_unlock(&undolock);
return tile->rect.pt;
}
void image_undo_remove_masks(void)
{
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
UndoImageTile *tile;
for (tile = lb->first; tile; tile = tile->next) {
if (tile->mask) {
MEM_freeN(tile->mask);
tile->mask = NULL;
}
}
}
static void image_undo_restore_runtime(ListBase *lb)
{
ImBuf *ibuf, *tmpibuf;
UndoImageTile *tile;
tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32,
IB_rectfloat | IB_rect);
for (tile = lb->first; tile; tile = tile->next) {
Image *ima = tile->ima;
ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
undo_copy_tile(tile, tmpibuf, ibuf, RESTORE);
GPU_free_image(ima); /* force OpenGL reload (maybe partial update will operate better?) */
if (ibuf->rect_float)
ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */
if (ibuf->mipmap[0])
ibuf->userflags |= IB_MIPMAP_INVALID; /* force mipmap recreatiom */
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
BKE_image_release_ibuf(ima, ibuf, NULL);
}
IMB_freeImBuf(tmpibuf);
}
void ED_image_undo_restore(bContext *C, ListBase *lb)
{
Main *bmain = CTX_data_main(C);
Image *ima = NULL;
ImBuf *ibuf, *tmpibuf;
UndoImageTile *tile;
tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32,
IB_rectfloat | IB_rect);
for (tile = lb->first; tile; tile = tile->next) {
short use_float;
/* find image based on name, pointer becomes invalid with global undo */
if (ima && STREQ(tile->idname, ima->id.name)) {
/* ima is valid */
}
else {
ima = BLI_findstring(&bmain->image, tile->idname, offsetof(ID, name));
}
ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
if (ima && ibuf && !STREQ(tile->ibufname, ibuf->name)) {
/* current ImBuf filename was changed, probably current frame
* was changed when painting on image sequence, rather than storing
* full image user (which isn't so obvious, btw) try to find ImBuf with
* matched file name in list of already loaded images */
BKE_image_release_ibuf(ima, ibuf, NULL);
ibuf = BKE_image_get_ibuf_with_name(ima, tile->ibufname);
}
if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float)) {
BKE_image_release_ibuf(ima, ibuf, NULL);
continue;
}
if (ima->gen_type != tile->gen_type || ima->source != tile->source) {
BKE_image_release_ibuf(ima, ibuf, NULL);
continue;
}
use_float = ibuf->rect_float ? 1 : 0;
if (use_float != tile->use_float) {
BKE_image_release_ibuf(ima, ibuf, NULL);
continue;
}
undo_copy_tile(tile, tmpibuf, ibuf, RESTORE_COPY);
GPU_free_image(ima); /* force OpenGL reload */
if (ibuf->rect_float)
ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */
if (ibuf->mipmap[0])
ibuf->userflags |= IB_MIPMAP_INVALID; /* force mipmap recreatiom */
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
DEG_id_tag_update(&ima->id, 0);
BKE_image_release_ibuf(ima, ibuf, NULL);
}
IMB_freeImBuf(tmpibuf);
}
void ED_image_undo_free(ListBase *lb)
{
UndoImageTile *tile;
for (tile = lb->first; tile; tile = tile->next)
MEM_freeN(tile->rect.pt);
}
static void image_undo_end(void)
{
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
UndoImageTile *tile;
int deallocsize = 0;
int allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
/* first dispose of invalid tiles (may happen due to drag dot for instance) */
for (tile = lb->first; tile;) {
if (!tile->valid) {
UndoImageTile *tmp_tile = tile->next;
deallocsize += allocsize * ((tile->use_float) ? sizeof(float) : sizeof(char));
MEM_freeN(tile->rect.pt);
BLI_freelinkN(lb, tile);
tile = tmp_tile;
}
else {
tile = tile->next;
}
}
/* don't forget to remove the size of deallocated tiles */
undo_paint_push_count_alloc(UNDO_PAINT_IMAGE, -deallocsize);
ED_undo_paint_push_end(UNDO_PAINT_IMAGE);
}
static void image_undo_invalidate(void)
{
UndoImageTile *tile;
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
for (tile = lb->first; tile; tile = tile->next)
tile->valid = false;
}
/* Imagepaint Partial Redraw & Dirty Region */
void ED_imapaint_clear_partial_redraw(void)
@@ -454,7 +129,7 @@ void ED_imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w, int
if (w == 0 || h == 0)
return;
if (!imapaintpartial.enabled) {
imapaintpartial.x1 = x;
imapaintpartial.y1 = y;
@@ -476,7 +151,7 @@ void ED_imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w, int
image_undo_push_tile(ima, ibuf, &tmpibuf, tx, ty, NULL, NULL, false, find_old);
ibuf->userflags |= IB_BITMAPDIRTY;
if (tmpibuf)
IMB_freeImBuf(tmpibuf);
}
@@ -658,8 +333,9 @@ bool paint_use_opacity_masking(Brush *brush)
false : true;
}
void paint_brush_color_get(struct Scene *scene, struct Brush *br, bool color_correction, bool invert, float distance,
float pressure, float color[3], struct ColorManagedDisplay *display)
void paint_brush_color_get(
struct Scene *scene, struct Brush *br, bool color_correction, bool invert, float distance,
float pressure, float color[3], struct ColorManagedDisplay *display)
{
if (invert)
copy_v3_v3(color, BKE_brush_secondary_color_get(scene, br));
@@ -794,20 +470,11 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const flo
}
settings->imapaint.flag |= IMAGEPAINT_DRAWING;
ED_undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
ED_image_undo_restore, ED_image_undo_free, NULL);
ED_image_undo_push_begin(op->type->name);
return pop;
}
/* restore painting image to previous state. Used for anchored and drag-dot style brushes*/
static void paint_stroke_restore(void)
{
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
image_undo_restore_runtime(lb);
image_undo_invalidate();
}
static void paint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr)
{
PaintOperation *pop = paint_stroke_mode_data(stroke);
@@ -844,7 +511,7 @@ static void paint_stroke_update_step(bContext *C, struct PaintStroke *stroke, Po
BKE_brush_alpha_set(scene, brush, max_ff(0.0f, startalpha * alphafac));
if ((brush->flag & BRUSH_DRAG_DOT) || (brush->flag & BRUSH_ANCHORED)) {
paint_stroke_restore();
ED_image_undo_restore();
}
if (pop->mode == PAINT_MODE_3D_PROJECT) {
@@ -921,7 +588,7 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke)
WM_paint_cursor_end(CTX_wm_manager(C), pop->cursor);
}
image_undo_end();
ED_image_undo_push_end();
/* duplicate warning, see texpaint_init */
#if 0
@@ -1544,8 +1211,7 @@ void ED_imapaint_bucket_fill(struct bContext *C, float color[3], wmOperator *op)
SpaceImage *sima = CTX_wm_space_image(C);
Image *ima = sima->image;
ED_undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
ED_image_undo_restore, ED_image_undo_free, NULL);
ED_image_undo_push_begin(op->type->name);
paint_2d_bucket_fill(C, color, NULL, NULL, NULL);

View File

@@ -5396,8 +5396,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
scene->toolsettings->imapaint.flag |= IMAGEPAINT_DRAWING;
ED_undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
ED_image_undo_restore, ED_image_undo_free, NULL);
ED_image_undo_push_begin(op->type->name);
/* allocate and initialize spatial data structures */
project_paint_begin(C, &ps, false, 0);

View File

@@ -0,0 +1,396 @@
/*
* ***** 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.
*
* 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 *****
*/
/** \file blender/editors/sculpt_paint/paint_image_undo.c
* \ingroup edsculpt
*/
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_threads.h"
#include "DNA_image_types.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "BKE_context.h"
#include "BKE_image.h"
#include "BKE_main.h"
#include "DEG_depsgraph.h"
#include "ED_paint.h"
#include "GPU_draw.h"
#include "paint_intern.h"
typedef struct UndoImageTile {
struct UndoImageTile *next, *prev;
char idname[MAX_ID_NAME]; /* name instead of pointer*/
char ibufname[IMB_FILENAME_SIZE];
union {
float *fp;
unsigned int *uint;
void *pt;
} rect;
unsigned short *mask;
int x, y;
Image *ima;
short source, use_float;
char gen_type;
bool valid;
} UndoImageTile;
/* this is a static resource for non-globality,
* Maybe it should be exposed as part of the
* paint operation, but for now just give a public interface */
static SpinLock undolock;
void image_undo_init_locks(void)
{
BLI_spin_init(&undolock);
}
void image_undo_end_locks(void)
{
BLI_spin_end(&undolock);
}
/* UNDO */
typedef enum {
COPY = 0,
RESTORE = 1,
RESTORE_COPY = 2
} CopyMode;
static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, CopyMode mode)
{
if (mode == COPY) {
/* copy or swap contents of tile->rect and region in ibuf->rect */
IMB_rectcpy(tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
if (ibuf->rect_float) {
SWAP(float *, tmpibuf->rect_float, tile->rect.fp);
}
else {
SWAP(unsigned int *, tmpibuf->rect, tile->rect.uint);
}
}
else {
if (mode == RESTORE_COPY) {
IMB_rectcpy(tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
}
/* swap to the tmpbuf for easy copying */
if (ibuf->rect_float) {
SWAP(float *, tmpibuf->rect_float, tile->rect.fp);
}
else {
SWAP(unsigned int *, tmpibuf->rect, tile->rect.uint);
}
IMB_rectcpy(ibuf, tmpibuf, tile->x * IMAPAINT_TILE_SIZE,
tile->y * IMAPAINT_TILE_SIZE, 0, 0, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
if (mode == RESTORE) {
if (ibuf->rect_float) {
SWAP(float *, tmpibuf->rect_float, tile->rect.fp);
}
else {
SWAP(unsigned int *, tmpibuf->rect, tile->rect.uint);
}
}
}
}
void *image_undo_find_tile(Image *ima, ImBuf *ibuf, int x_tile, int y_tile, unsigned short **mask, bool validate)
{
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
UndoImageTile *tile;
short use_float = ibuf->rect_float ? 1 : 0;
for (tile = lb->first; tile; tile = tile->next) {
if (tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source) {
if (tile->use_float == use_float) {
if (STREQ(tile->idname, ima->id.name) && STREQ(tile->ibufname, ibuf->name)) {
if (mask) {
/* allocate mask if requested */
if (!tile->mask) {
tile->mask = MEM_callocN(sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE,
"UndoImageTile.mask");
}
*mask = tile->mask;
}
if (validate) {
tile->valid = true;
}
return tile->rect.pt;
}
}
}
}
return NULL;
}
void *image_undo_push_tile(
Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int x_tile, int y_tile,
unsigned short **mask, bool **valid, bool proj, bool find_prev)
{
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
UndoImageTile *tile;
int allocsize;
short use_float = ibuf->rect_float ? 1 : 0;
void *data;
/* check if tile is already pushed */
/* in projective painting we keep accounting of tiles, so if we need one pushed, just push! */
if (find_prev) {
data = image_undo_find_tile(ima, ibuf, x_tile, y_tile, mask, true);
if (data) {
return data;
}
}
if (*tmpibuf == NULL) {
*tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat | IB_rect);
}
tile = MEM_callocN(sizeof(UndoImageTile), "UndoImageTile");
BLI_strncpy(tile->idname, ima->id.name, sizeof(tile->idname));
tile->x = x_tile;
tile->y = y_tile;
/* add mask explicitly here */
if (mask) {
*mask = tile->mask = MEM_callocN(sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE,
"UndoImageTile.mask");
}
allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
allocsize *= (ibuf->rect_float) ? sizeof(float) : sizeof(char);
tile->rect.pt = MEM_mapallocN(allocsize, "UndeImageTile.rect");
BLI_strncpy(tile->ibufname, ibuf->name, sizeof(tile->ibufname));
tile->gen_type = ima->gen_type;
tile->source = ima->source;
tile->use_float = use_float;
tile->valid = true;
tile->ima = ima;
if (valid) {
*valid = &tile->valid;
}
undo_copy_tile(tile, *tmpibuf, ibuf, COPY);
if (proj) {
BLI_spin_lock(&undolock);
}
undo_paint_push_count_alloc(UNDO_PAINT_IMAGE, allocsize);
BLI_addtail(lb, tile);
if (proj) {
BLI_spin_unlock(&undolock);
}
return tile->rect.pt;
}
void image_undo_remove_masks(void)
{
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
UndoImageTile *tile;
for (tile = lb->first; tile; tile = tile->next) {
if (tile->mask) {
MEM_freeN(tile->mask);
tile->mask = NULL;
}
}
}
static void image_undo_restore_runtime(ListBase *lb)
{
ImBuf *ibuf, *tmpibuf;
UndoImageTile *tile;
tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32,
IB_rectfloat | IB_rect);
for (tile = lb->first; tile; tile = tile->next) {
Image *ima = tile->ima;
ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
undo_copy_tile(tile, tmpibuf, ibuf, RESTORE);
GPU_free_image(ima); /* force OpenGL reload (maybe partial update will operate better?) */
if (ibuf->rect_float) {
ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */
}
if (ibuf->mipmap[0]) {
ibuf->userflags |= IB_MIPMAP_INVALID; /* force mipmap recreatiom */
}
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
BKE_image_release_ibuf(ima, ibuf, NULL);
}
IMB_freeImBuf(tmpibuf);
}
static void image_undo_restore_list(bContext *C, ListBase *lb)
{
Main *bmain = CTX_data_main(C);
Image *ima = NULL;
ImBuf *ibuf, *tmpibuf;
UndoImageTile *tile;
tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32,
IB_rectfloat | IB_rect);
for (tile = lb->first; tile; tile = tile->next) {
short use_float;
/* find image based on name, pointer becomes invalid with global undo */
if (ima && STREQ(tile->idname, ima->id.name)) {
/* ima is valid */
}
else {
ima = BLI_findstring(&bmain->image, tile->idname, offsetof(ID, name));
}
ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
if (ima && ibuf && !STREQ(tile->ibufname, ibuf->name)) {
/* current ImBuf filename was changed, probably current frame
* was changed when painting on image sequence, rather than storing
* full image user (which isn't so obvious, btw) try to find ImBuf with
* matched file name in list of already loaded images */
BKE_image_release_ibuf(ima, ibuf, NULL);
ibuf = BKE_image_get_ibuf_with_name(ima, tile->ibufname);
}
if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float)) {
BKE_image_release_ibuf(ima, ibuf, NULL);
continue;
}
if (ima->gen_type != tile->gen_type || ima->source != tile->source) {
BKE_image_release_ibuf(ima, ibuf, NULL);
continue;
}
use_float = ibuf->rect_float ? 1 : 0;
if (use_float != tile->use_float) {
BKE_image_release_ibuf(ima, ibuf, NULL);
continue;
}
undo_copy_tile(tile, tmpibuf, ibuf, RESTORE_COPY);
GPU_free_image(ima); /* force OpenGL reload */
if (ibuf->rect_float) {
ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */
}
if (ibuf->mipmap[0]) {
ibuf->userflags |= IB_MIPMAP_INVALID; /* force mipmap recreatiom */
}
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
DEG_id_tag_update(&ima->id, 0);
BKE_image_release_ibuf(ima, ibuf, NULL);
}
IMB_freeImBuf(tmpibuf);
}
static void image_undo_free_list(ListBase *lb)
{
UndoImageTile *tile;
for (tile = lb->first; tile; tile = tile->next) {
MEM_freeN(tile->rect.pt);
}
}
void ED_image_undo_push_begin(const char *name)
{
ED_undo_paint_push_begin(UNDO_PAINT_IMAGE, name, image_undo_restore_list, image_undo_free_list, NULL);
}
void ED_image_undo_push_end(void)
{
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
UndoImageTile *tile;
int deallocsize = 0;
int allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
/* first dispose of invalid tiles (may happen due to drag dot for instance) */
for (tile = lb->first; tile;) {
if (!tile->valid) {
UndoImageTile *tmp_tile = tile->next;
deallocsize += allocsize * ((tile->use_float) ? sizeof(float) : sizeof(char));
MEM_freeN(tile->rect.pt);
BLI_freelinkN(lb, tile);
tile = tmp_tile;
}
else {
tile = tile->next;
}
}
/* don't forget to remove the size of deallocated tiles */
undo_paint_push_count_alloc(UNDO_PAINT_IMAGE, -deallocsize);
ED_undo_paint_push_end(UNDO_PAINT_IMAGE);
}
static void image_undo_invalidate(void)
{
UndoImageTile *tile;
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
for (tile = lb->first; tile; tile = tile->next) {
tile->valid = false;
}
}
/* restore painting image to previous state. Used for anchored and drag-dot style brushes*/
void ED_image_undo_restore(void)
{
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
image_undo_restore_runtime(lb);
image_undo_invalidate();
}

View File

@@ -176,12 +176,6 @@ typedef struct ImagePaintPartialRedraw {
#define IMAPAINT_TILE_NUMBER(size) (((size) + IMAPAINT_TILE_SIZE - 1) >> IMAPAINT_TILE_BITS)
int image_texture_paint_poll(struct bContext *C);
void *image_undo_find_tile(struct Image *ima, struct ImBuf *ibuf, int x_tile, int y_tile, unsigned short **mask, bool validate);
void *image_undo_push_tile(struct Image *ima, struct ImBuf *ibuf, struct ImBuf **tmpibuf, int x_tile, int y_tile, unsigned short **, bool **valid, bool proj, bool find_prev);
void image_undo_remove_masks(void);
void image_undo_init_locks(void);
void image_undo_end_locks(void);
void imapaint_image_update(struct SpaceImage *sima, struct Image *image, struct ImBuf *ibuf, short texpaint);
struct ImagePaintPartialRedraw *get_imapaintpartial(void);
void set_imapaintpartial(struct ImagePaintPartialRedraw *ippr);
@@ -190,15 +184,25 @@ int get_imapaint_zoom(struct bContext *C, float *zoomx, float *zoomy);
void *paint_2d_new_stroke(struct bContext *, struct wmOperator *, int mode);
void paint_2d_redraw(const struct bContext *C, void *ps, bool final);
void paint_2d_stroke_done(void *ps);
void paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], const bool eraser, float pressure, float distance, float size);
void paint_2d_bucket_fill(const struct bContext *C, const float color[3], struct Brush *br, const float mouse_init[2], void *ps);
void paint_2d_gradient_fill(const struct bContext *C, struct Brush *br, const float mouse_init[2], const float mouse_final[2], void *ps);
void *paint_proj_new_stroke(struct bContext *C, struct Object *ob, const float mouse[2], int mode);
void paint_proj_stroke(const struct bContext *C, void *ps, const float prevmval_i[2], const float mval_i[2], const bool eraser, float pressure, float distance, float size);
void paint_2d_stroke(
void *ps, const float prev_mval[2], const float mval[2],
const bool eraser, float pressure, float distance, float size);
void paint_2d_bucket_fill(
const struct bContext *C, const float color[3], struct Brush *br, const float mouse_init[2], void *ps);
void paint_2d_gradient_fill(
const struct bContext *C, struct Brush *br, const float mouse_init[2], const float mouse_final[2], void *ps);
void *paint_proj_new_stroke(
struct bContext *C, struct Object *ob, const float mouse[2], int mode);
void paint_proj_stroke(
const struct bContext *C, void *ps, const float prevmval_i[2], const float mval_i[2],
const bool eraser, float pressure, float distance, float size);
void paint_proj_redraw(const struct bContext *C, void *pps, bool final);
void paint_proj_stroke_done(void *ps);
void paint_brush_color_get(struct Scene *scene, struct Brush *br, bool color_correction, bool invert, float distance, float pressure, float color[3], struct ColorManagedDisplay *display);
void paint_brush_color_get(
struct Scene *scene, struct Brush *br,
bool color_correction, bool invert, float distance, float pressure, float color[3],
struct ColorManagedDisplay *display);
bool paint_use_opacity_masking(struct Brush *brush);
void paint_brush_init_tex(struct Brush *brush);
void paint_brush_exit_tex(struct Brush *brush);
@@ -214,7 +218,18 @@ void PAINT_OT_delete_texture_paint_slot(struct wmOperatorType *ot);
void PAINT_OT_image_paint(struct wmOperatorType *ot);
void PAINT_OT_add_simple_uvs(struct wmOperatorType *ot);
/* uv sculpting */
/* paint_image_undo.c */
void *image_undo_find_tile(
struct Image *ima, struct ImBuf *ibuf, int x_tile, int y_tile,
unsigned short **mask, bool validate);
void *image_undo_push_tile(
struct Image *ima, struct ImBuf *ibuf, struct ImBuf **tmpibuf, int x_tile, int y_tile,
unsigned short **, bool **valid, bool proj, bool find_prev);
void image_undo_remove_masks(void);
void image_undo_init_locks(void);
void image_undo_end_locks(void);
/* sculpt_uv.c */
int uv_sculpt_poll(struct bContext *C);
int uv_sculpt_keymap_poll(struct bContext *C);

View File

@@ -2626,8 +2626,7 @@ static int image_invert_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
if (support_undo) {
ED_undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
ED_image_undo_restore, ED_image_undo_free, NULL);
ED_image_undo_push_begin(op->type->name);
/* not strictly needed, because we only imapaint_dirty_region to invalidate all tiles
* but better do this right in case someone copies this for a tool that uses partial redraw better */
ED_imapaint_clear_partial_redraw();

View File

@@ -486,7 +486,7 @@ static int txtfmt_pov_find_specialvar(const char *string)
{
int i, len;
/* Modifiers */
if (STR_LITERAL_STARTSWITH(string, "dispersion_samples", len)) i = len;
if (STR_LITERAL_STARTSWITH(string, "dispersion_samples", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "projected_through", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "double_illuminate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "expand_thresholds", len)) i = len;
@@ -498,7 +498,7 @@ static int txtfmt_pov_find_specialvar(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "max_trace_level", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "gray_threshold", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pretrace_start", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "normal_indices", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "normal_indices", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "normal_vectors", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vertex_vectors", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "noise_generator", len)) i = len;
@@ -577,7 +577,7 @@ static int txtfmt_pov_find_specialvar(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "autostop", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "caustics", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "octaves", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "aa_level", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "aa_level", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "frequency", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fog_offset", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "modulation", len)) i = len;
@@ -642,45 +642,45 @@ static int txtfmt_pov_find_specialvar(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "radius", len)) i = len;
/* Camera Types and options*/
else if (STR_LITERAL_STARTSWITH(string, "omni_directional_stereo", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "lambert_cylindrical", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "miller_cylindrical", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "lambert_azimuthal", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ultra_wide_angle", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "camera_direction", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "camera_location ", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "van_der_grinten", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "aitoff_hammer", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "smyth_craster", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "orthographic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "camera_right", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "blur_samples", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "plate_carree", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "camera_type", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "perspective", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mesh_camera", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "focal_point", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "balthasart", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "confidence", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "parallaxe", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "hobo_dyer", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "camera_up", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "panoramic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "eckert_vi", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "eckert_iv", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mollweide", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "aperture", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "behrmann", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "variance", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "stereo", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "icosa", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tetra", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "octa", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mercator", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "omnimax", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fisheye", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "edwards", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "peters", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "gall", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "lambert_cylindrical", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "miller_cylindrical", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "lambert_azimuthal", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ultra_wide_angle", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "camera_direction", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "camera_location ", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "van_der_grinten", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "aitoff_hammer", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "smyth_craster", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "orthographic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "camera_right", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "blur_samples", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "plate_carree", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "camera_type", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "perspective", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mesh_camera", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "focal_point", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "balthasart", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "confidence", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "parallaxe", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "hobo_dyer", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "camera_up", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "panoramic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "eckert_vi", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "eckert_iv", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mollweide", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "aperture", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "behrmann", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "variance", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "stereo", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "icosa", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tetra", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "octa", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mercator", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "omnimax", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fisheye", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "edwards", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "peters", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "gall", len)) i = len;
else i = 0;
/* If next source char is an identifier (eg. 'i' in "definate") no match */

View File

@@ -2014,8 +2014,8 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
EvaluationContext eval_ctx;
Bone *bone;
Object *ob = vc->obact;
unsigned int *vbuffer = NULL; /* selection buffer */
unsigned int *col; /* color in buffer */
unsigned int *vbuffer = NULL; /* selection buffer */
unsigned int *col; /* color in buffer */
int bone_only;
int bone_selected = 0;
int totobj = MAXPICKBUF; /* XXX solve later */

View File

@@ -915,7 +915,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
}
else if (is_next_sel) {
/* A segment, add the edge normal */
sub_v3_v3v3(tvec, bp->vec, bp_next->vec );
sub_v3_v3v3(tvec, bp->vec, bp_next->vec);
normalize_v3(tvec);
add_v3_v3(normal, tvec);
}