Re-copied trunk over tomato and merging r41929 through r41936 into tomato

This commit is contained in:
Sergey Sharybin 2011-11-16 20:53:00 +00:00
commit 41f67fa0b5
40 changed files with 418 additions and 182 deletions

@ -139,9 +139,9 @@ IF(PYTHONLIBSUNIX_FOUND)
# not used
# SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
ENDIF()
MARK_AS_ADVANCED(
MARK_AS_ADVANCED(
PYTHON_INCLUDE_DIR
PYTHON_LIBRARY
)
ENDIF()
)

@ -1,4 +1,11 @@
set(BLENDER_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/intern/guardedalloc
${CMAKE_SOURCE_DIR}/source/blender/makesdna
${CMAKE_SOURCE_DIR}/source/blender/makesrna
${CMAKE_SOURCE_DIR}/source/blender/blenloader
${CMAKE_BINARY_DIR}/source/blender/makesrna/intern)
set(INC
../render
../device

@ -459,7 +459,7 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
world = context.world
# world = context.world
return False # world and world.node_tree and CyclesButtonsPanel.poll(context)
def draw(self, context):
@ -493,7 +493,7 @@ class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
mat = context.material
# mat = context.material
return False # mat and mat.node_tree and CyclesButtonsPanel.poll(context)
def draw(self, context):
@ -562,7 +562,7 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
pin_id = space.pin_id
use_pin_id = space.use_pin_id
user = context.texture_user
node = context.texture_node
# node = context.texture_node
if not use_pin_id or not isinstance(pin_id, bpy.types.Texture):
pin_id = None
@ -638,7 +638,7 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
tex = context.texture
# tex = context.texture
node = context.texture_node
mapping = node.texture_mapping
@ -664,15 +664,15 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
tex = context.texture
node = context.texture_node
# tex = context.texture
# node = context.texture_node
return False
#return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
tex = context.texture
# tex = context.texture
node = context.texture_node
mapping = node.color_mapping

@ -176,7 +176,13 @@ static inline string get_enum_identifier(PointerRNA& ptr, const char *name)
static inline string blender_absolute_path(BL::BlendData b_data, BL::ID b_id, const string& path)
{
if(path.size() >= 2 && path[0] == '/' && path[1] == '/') {
string dirname = (b_id.library())? b_id.library().filepath(): b_data.filepath();
string dirname;
if(b_id.library())
dirname = blender_absolute_path(b_data, b_id.library(), b_id.library().filepath());
else
dirname = b_data.filepath();
return path_join(path_dirname(dirname), path.substr(2));
}

@ -154,25 +154,23 @@ def resolve_ncase(path):
returning a string with the path if found else return the original path.
"""
import os
def _ncase_path_found(path):
if not path or os.path.exists(path):
if not path or _os.path.exists(path):
return path, True
# filename may be a directory or a file
filename = os.path.basename(path)
dirpath = os.path.dirname(path)
filename = _os.path.basename(path)
dirpath = _os.path.dirname(path)
suffix = path[:0] # "" but ensure byte/str match
if not filename: # dir ends with a slash?
if len(dirpath) < len(path):
suffix = path[:len(path) - len(dirpath)]
filename = os.path.basename(dirpath)
dirpath = os.path.dirname(dirpath)
filename = _os.path.basename(dirpath)
dirpath = _os.path.dirname(dirpath)
if not os.path.exists(dirpath):
if not _os.path.exists(dirpath):
if dirpath == path:
return path, False
@ -184,8 +182,8 @@ def resolve_ncase(path):
# at this point, the directory exists but not the file
# we are expecting 'dirpath' to be a directory, but it could be a file
if os.path.isdir(dirpath):
files = os.listdir(dirpath)
if _os.path.isdir(dirpath):
files = _os.listdir(dirpath)
else:
return path, False
@ -198,7 +196,7 @@ def resolve_ncase(path):
break
if f_iter_nocase:
return os.path.join(dirpath, f_iter_nocase) + suffix, True
return _os.path.join(dirpath, f_iter_nocase) + suffix, True
else:
# cant find the right one, just return the path as is.
return path, False
@ -216,8 +214,7 @@ def ensure_ext(filepath, ext, case_sensitive=False):
:arg case_sensitive: Check for matching case when comparing extensions.
:type case_sensitive: bool
"""
import os
fn_base, fn_ext = os.path.splitext(filepath)
fn_base, fn_ext = _os.path.splitext(filepath)
if fn_base and fn_ext:
if ((case_sensitive and ext == fn_ext) or
(ext.lower() == fn_ext.lower())):

@ -2,4 +2,3 @@ import bpy
bpy.context.object.data.sensor_width = 23.4
bpy.context.object.data.sensor_height = 15.6
bpy.context.object.data.sensor_fit = 'HORIZONTAL'

@ -86,13 +86,8 @@ class CLIP_OT_tracks_to_mesh(Operator):
@classmethod
def poll(cls, context):
if context.space_data.type != 'CLIP_EDITOR':
return False
sc = context.space_data
clip = sc.clip
return clip
return (sc.type == 'CLIP_EDITOR') and sc.clip
def execute(self, context):
sc = context.space_data

@ -147,7 +147,7 @@ class ProjectEdit(Operator):
# opengl buffer may fail, we can't help this, but best report it.
try:
ret = bpy.ops.paint.image_from_view()
bpy.ops.paint.image_from_view()
except RuntimeError as err:
self.report({'ERROR'}, str(err))
return {'CANCELLED'}

@ -106,7 +106,7 @@ def operator_path_is_undo(context, data_path):
# luckily we don't do this!
#
# When we cant find the data owner assume no undo is needed.
data_path_head, data_path_sep, data_path_tail = data_path.rpartition(".")
data_path_head = data_path.rpartition(".")[0]
if not data_path_head:
return False

@ -46,7 +46,6 @@ class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, Panel):
layout = self.layout
md = context.dynamic_paint
ob = context.object
layout.prop(md, "ui_type", expand=True)
@ -129,7 +128,6 @@ class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, Panel):
canvas = context.dynamic_paint.canvas_settings
surface = canvas.canvas_surfaces.active
ob = context.object
surface_type = surface.surface_type
@ -370,8 +368,6 @@ class PHYSICS_PT_dp_cache(PhysicButtonsPanel, Panel):
md.canvas_settings.canvas_surfaces.active.is_cache_user)
def draw(self, context):
layout = self.layout
surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
cache = surface.point_cache
@ -442,7 +438,6 @@ class PHYSICS_PT_dp_brush_velocity(PhysicButtonsPanel, Panel):
layout = self.layout
brush = context.dynamic_paint.brush_settings
ob = context.object
split = layout.split()
@ -478,7 +473,6 @@ class PHYSICS_PT_dp_brush_wave(PhysicButtonsPanel, Panel):
layout = self.layout
brush = context.dynamic_paint.brush_settings
ob = context.object
layout.prop(brush, "wave_type")
if brush.wave_type != 'REFLECT':

@ -115,7 +115,6 @@ class CLIP_PT_tools_tracking(Panel):
def draw(self, context):
layout = self.layout
clip = context.space_data.clip
settings = clip.tracking.settings
row = layout.row(align=True)
@ -641,7 +640,6 @@ class CLIP_PT_tools_clip(Panel):
def draw(self, context):
layout = self.layout
clip = context.space_data.clip
layout.operator("clip.set_viewport_background")
@ -698,9 +696,6 @@ class CLIP_MT_proxy(Menu):
def draw(self, context):
layout = self.layout
sc = context.space_data
clip = sc.clip
layout.operator("clip.rebuild_proxy")
layout.operator("clip.delete_proxy")
@ -805,8 +800,6 @@ class CLIP_MT_select(Menu):
def draw(self, context):
layout = self.layout
sc = context.space_data
layout.operator("clip.select_border")
layout.operator("clip.select_circle")

@ -2276,12 +2276,6 @@ class VIEW3D_PT_background_image(Panel):
bl_label = "Background Images"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
view = context.space_data
#~ bg = context.space_data.background_image
return (view)
def draw_header(self, context):
layout = self.layout
view = context.space_data
@ -2315,16 +2309,15 @@ class VIEW3D_PT_background_image(Panel):
row = box.row()
row.prop(bg, "source", expand=True)
hasbg = False
has_bg = False
if bg.source == 'IMAGE':
row = box.row()
row.template_ID(bg, "image", open="image.open")
if (bg.image):
box.template_image(bg, "image", bg.image_user, compact=True)
hasbg = True
has_bg = True
elif bg.source == 'MOVIE':
has_clip = False
box.prop(bg, 'use_camera_clip')
column = box.column()
@ -2335,14 +2328,14 @@ class VIEW3D_PT_background_image(Panel):
column.template_movieclip(bg, "clip", compact=True)
if bg.use_camera_clip or bg.clip:
hasbg = True
has_bg = True
column = box.column()
column.active = hasbg
column.active = has_bg
column.prop(bg.clip_user, "proxy_render_size", text="")
column.prop(bg.clip_user, "use_render_undistorted")
if hasbg:
if has_bg:
box.prop(bg, "opacity", slider=True)
if bg.view_axis != 'CAMERA':
box.prop(bg, "size")

@ -46,6 +46,7 @@ typedef struct PaintWavePoint {
float height;
float velocity;
float brush_isect;
short state;
} PaintWavePoint;
@ -82,6 +83,7 @@ void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface, char*
#define DPAINT_PAINT_NEW 2
/* PaintWavePoint state */
#define DPAINT_WAVE_ISECT_CHANGED -1
#define DPAINT_WAVE_NONE 0
#define DPAINT_WAVE_OBSTACLE 1
#define DPAINT_WAVE_REFLECT_ONLY 2

@ -86,7 +86,7 @@ void BME_CD_Create(BME_CustomData *data, BME_CustomDataInit *init, int initalloc
if(data->totlayer){
/*alloc memory*/
data->layers = MEM_callocN(sizeof(BME_CustomDataLayer)*data->totlayer, "BMesh Custom Data Layers");
data->pool = BLI_mempool_create(data->totsize, initalloc, initalloc, 0);
data->pool = BLI_mempool_create(data->totsize, initalloc, initalloc, FALSE, FALSE);
/*initialize layer data*/
for(i=0; i < BME_CD_NUMTYPES; i++){
if(init->layout[i]){

@ -55,10 +55,10 @@ BME_Mesh *BME_make_mesh(int allocsize[4])
/*allocate the structure*/
BME_Mesh *bm = MEM_callocN(sizeof(BME_Mesh),"BMesh");
/*allocate the memory pools for the mesh elements*/
bm->vpool = BLI_mempool_create(sizeof(BME_Vert), allocsize[0], allocsize[0], 0);
bm->epool = BLI_mempool_create(sizeof(BME_Edge), allocsize[1], allocsize[1], 0);
bm->lpool = BLI_mempool_create(sizeof(BME_Loop), allocsize[2], allocsize[2], 0);
bm->ppool = BLI_mempool_create(sizeof(BME_Poly), allocsize[3], allocsize[3], 0);
bm->vpool = BLI_mempool_create(sizeof(BME_Vert), allocsize[0], allocsize[0], FALSE, FALSE);
bm->epool = BLI_mempool_create(sizeof(BME_Edge), allocsize[1], allocsize[1], FALSE, FALSE);
bm->lpool = BLI_mempool_create(sizeof(BME_Loop), allocsize[2], allocsize[2], FALSE, FALSE);
bm->ppool = BLI_mempool_create(sizeof(BME_Poly), allocsize[3], allocsize[3], FALSE, FALSE);
return bm;
}
/*

@ -2009,7 +2009,7 @@ void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData
void CustomData_bmesh_init_pool(CustomData *data, int allocsize){
if(data->totlayer)data->pool = BLI_mempool_create(data->totsize, allocsize, allocsize, 0);
if(data->totlayer)data->pool = BLI_mempool_create(data->totsize, allocsize, allocsize, FALSE, FALSE);
}
void CustomData_bmesh_free_block(CustomData *data, void **block)

@ -98,7 +98,8 @@ static int neighY[8] = {0,1,1, 1, 0,-1,-1,-1};
/* paint effect default movement per frame in global units */
#define EFF_MOVEMENT_PER_FRAME 0.05f
/* initial wave time factor */
#define WAVE_TIME_FAC 0.1
#define WAVE_TIME_FAC (1.0f/24.f)
#define WAVE_INIT_SIZE 5.0f
/* drying limits */
#define MIN_WETNESS 0.001f
/* dissolve macro */
@ -149,6 +150,7 @@ typedef struct PaintBakeData {
int *s_num; /* num of realCoord samples */
Vec3f *realCoord; /* current pixel center world-space coordinates for each sample
* ordered as (s_pos+s_num)*/
Bounds3D mesh_bounds;
/* adjacency info */
BakeNeighPoint *bNeighs; /* current global neighbour distances and directions, if required */
@ -969,7 +971,7 @@ struct DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSett
surface->color_spread_speed = 1.0f;
surface->shrink_speed = 1.0f;
surface->wave_damping = 0.05f;
surface->wave_damping = 0.04f;
surface->wave_speed = 1.0f;
surface->wave_timescale = 1.0f;
surface->wave_spring = 0.20f;
@ -1037,6 +1039,7 @@ int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, stru
brush->particle_radius = 0.2f;
brush->particle_smooth = 0.05f;
brush->wave_type = MOD_DPAINT_WAVEB_CHANGE;
brush->wave_factor = 1.0f;
brush->wave_clamp = 0.0f;
brush->smudge_strength = 0.3f;
@ -2070,7 +2073,6 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
PaintUVPoint *tempPoints = NULL;
Vec3f *tempWeights = NULL;
/* MVert *mvert = NULL; */ /* UNUSED */
MFace *mface = NULL;
MTFace *tface = NULL;
Bounds2D *faceBB = NULL;
@ -2081,7 +2083,6 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) return setError(canvas, "Can't bake non-\"image sequence\" formats.");
numOfFaces = dm->getNumFaces(dm);
/* mvert = dm->getVertArray(dm); */ /* UNUSED */
mface = dm->getFaceArray(dm);
/* get uv layer */
@ -2859,7 +2860,12 @@ static void dynamicPaint_mixPaintColors(DynamicPaintSurface *surface, int index,
/* applies given brush intersection value for wave surface */
static void dynamicPaint_mixWaveHeight(PaintWavePoint *wPoint, DynamicPaintBrushSettings *brush, float isect_height)
{
float isect_change = isect_height - wPoint->brush_isect;
int hit = 0;
/* intersection marked regardless of brush type or hit */
wPoint->brush_isect = isect_height;
wPoint->state = DPAINT_WAVE_ISECT_CHANGED;
isect_height *= brush->wave_factor;
/* determine hit depending on wave_factor */
@ -2878,6 +2884,10 @@ static void dynamicPaint_mixWaveHeight(PaintWavePoint *wPoint, DynamicPaintBrush
wPoint->velocity = isect_height;
else if (brush->wave_type == MOD_DPAINT_WAVEB_REFLECT)
wPoint->state = DPAINT_WAVE_REFLECT_ONLY;
else if (brush->wave_type == MOD_DPAINT_WAVEB_CHANGE) {
if (isect_change < 0.0f)
wPoint->height += isect_change*brush->wave_factor;
}
}
}
@ -3235,7 +3245,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
/* Also cast a ray in opposite direction to make sure
* point is at least surrounded by two brush faces */
mul_v3_fl(ray_dir, -1.0f);
negate_v3(ray_dir);
hit.index = -1;
hit.dist = 9999;
@ -4292,6 +4302,9 @@ void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale)
float dt, min_dist, damp_factor;
float wave_speed = surface->wave_speed;
double average_dist = 0.0f;
Bounds3D *mb = &sData->bData->mesh_bounds;
float canvas_size = MAX3((mb->max[0]-mb->min[0]), (mb->max[1]-mb->min[1]), (mb->max[2]-mb->min[2]));
float wave_scale = WAVE_INIT_SIZE/canvas_size;
/* allocate memory */
PaintWavePoint *prevPoint = MEM_mallocN(sData->total_points*sizeof(PaintWavePoint), "Temp previous points for wave simulation");
@ -4307,11 +4320,11 @@ void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale)
average_dist += bNeighs[sData->adj_data->n_index[index]+i].dist;
}
}
average_dist /= sData->adj_data->total_targets;
average_dist *= wave_scale/sData->adj_data->total_targets;
/* determine number of required steps */
steps = (int)ceil((WAVE_TIME_FAC*timescale*surface->wave_timescale) / (average_dist/wave_speed/3));
CLAMP(steps, 1, 15);
CLAMP(steps, 1, 20);
timescale /= steps;
/* apply simulation values for final timescale */
@ -4332,12 +4345,12 @@ void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale)
int numOfN = 0, numOfRN = 0;
int i;
if (wPoint->state) continue;
if (wPoint->state > 0) continue;
/* calculate force from surrounding points */
for (i=0; i<numOfNeighs; i++) {
int n_index = sData->adj_data->n_index[index]+i;
float dist = bNeighs[n_index].dist;
float dist = bNeighs[n_index].dist*wave_scale;
PaintWavePoint *tPoint = &prevPoint[sData->adj_data->n_target[n_index]];
if (!dist || tPoint->state>0) continue;
@ -4381,6 +4394,10 @@ void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale)
#pragma omp parallel for schedule(static)
for (index = 0; index < sData->total_points; index++) {
PaintWavePoint *wPoint = &((PaintWavePoint*)sData->type_data)[index];
/* if there wasnt any brush intersection, clear isect height */
if (wPoint->state == DPAINT_WAVE_NONE) {
wPoint->brush_isect = 0.0f;
}
wPoint->state = DPAINT_WAVE_NONE;
}
@ -4594,10 +4611,11 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc
/*
* Make a transformed copy of canvas derived mesh vertices to avoid recalculation.
*/
#pragma omp parallel for schedule(static)
bData->mesh_bounds.valid = 0;
for (index=0; index<canvasNumOfVerts; index++) {
copy_v3_v3(canvas_verts[index].v, mvert[index].co);
mul_m4_v3(ob->obmat, canvas_verts[index].v);
boundInsert(&bData->mesh_bounds, canvas_verts[index].v);
}
/*

@ -1911,7 +1911,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
switch(type) {
case PART_KINK_CURL:
{
mul_v3_fl(par_vec, -1.f);
negate_v3(par_vec);
if(flat > 0.f) {
float proj[3];
@ -1977,7 +1977,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
mul_qt_v3(par_rot, z_vec);
}
mul_v3_fl(par_vec, -1.f);
negate_v3(par_vec);
normalize_v3_v3(vec_one, par_vec);
inp_y=dot_v3v3(y_vec, vec_one);

@ -2679,7 +2679,7 @@ static float nr_signed_distance_to_plane(float *p, float radius, ParticleCollisi
}
if(pce->inv_nor == 1) {
mul_v3_fl(nor, -1.f);
negate_v3(nor);
d = -d;
}
@ -2799,7 +2799,7 @@ static void collision_point_on_surface(float p[3], ParticleCollisionElement *pce
normalize_v3(nor);
if(pce->inv_nor == 1)
mul_v3_fl(nor, -1.f);
negate_v3(nor);
madd_v3_v3v3fl(co, pce->x0, nor, col->radius);
madd_v3_v3fl(co, e1, pce->uv[0]);

@ -594,6 +594,9 @@ void calc_sequence(Scene *scene, Sequence *seq)
// seq->enddisp= MIN2(seq->seq1->enddisp, seq->seq2->enddisp);
if (seq->seq1) {
/* XXX These resets should not be necessary, but users used to be able to
* edit effect's length, leading to strange results. See #29190. */
seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0;
seq->start= seq->startdisp= MAX3(seq->seq1->startdisp, seq->seq2->startdisp, seq->seq3->startdisp);
seq->enddisp= MIN3(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp);
/* we cant help if strips don't overlap, it wont give useful results.

@ -34,12 +34,45 @@
* \brief Simple fast memory allocator.
*/
struct BLI_mempool;
#ifdef __cplusplus
extern "C"
{
#endif
struct BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, int use_sysmalloc);
void *BLI_mempool_alloc(struct BLI_mempool *pool);
void *BLI_mempool_calloc(struct BLI_mempool *pool);
void BLI_mempool_free(struct BLI_mempool *pool, void *addr);
void BLI_mempool_destroy(struct BLI_mempool *pool);
struct BLI_mempool;
struct BLI_mempool_chunk;
typedef struct BLI_mempool BLI_mempool;
/*allow_iter allows iteration on this mempool. note: this requires that the
first four bytes of the elements never contain the character string
'free'. use with care.*/
BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk,
short use_sysmalloc, short allow_iter);
void *BLI_mempool_alloc(BLI_mempool *pool);
void *BLI_mempool_calloc(BLI_mempool *pool);
void BLI_mempool_free(BLI_mempool *pool, void *addr);
void BLI_mempool_destroy(BLI_mempool *pool);
int BLI_mempool_count(BLI_mempool *pool);
/** iteration stuff. note: this may easy to produce bugs with **/
/*private structure*/
typedef struct BLI_mempool_iter {
BLI_mempool *pool;
struct BLI_mempool_chunk *curchunk;
int curindex;
} BLI_mempool_iter;
/*allow iteration on this mempool. note: this requires that the
first four bytes of the elements never contain the character string
'free'. use with care.*/
void BLI_mempool_allow_iter(BLI_mempool *pool);
void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter);
void *BLI_mempool_iterstep(BLI_mempool_iter *iter);
#ifdef __cplusplus
}
#endif
#endif

@ -60,7 +60,7 @@ GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) {
GHash *gh= MEM_mallocN(sizeof(*gh), info);
gh->hashfp= hashfp;
gh->cmpfp= cmpfp;
gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, 0);
gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, FALSE, FALSE);
gh->cursize= 0;
gh->nentries= 0;

@ -20,7 +20,7 @@
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
* Contributor(s): Geoffery Bantle
*
* ***** END GPL LICENSE BLOCK *****
*/
@ -29,69 +29,112 @@
* \ingroup bli
*/
/*
Simple, fast memory allocator for allocating many elements of the same size.
*/
* Simple, fast memory allocator for allocating many elements of the same size.
*/
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
#include "BLI_mempool.h" /* own include */
#include "DNA_listBase.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_mempool.h"
#include <string.h>
#include <stdlib.h>
typedef struct BLI_freenode{
/* note: copied from BKE_utildefines.h, dont use here because we're in BLI */
#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 FREEWORD MAKE_ID('f', 'r', 'e', 'e')
typedef struct BLI_freenode {
struct BLI_freenode *next;
}BLI_freenode;
int freeword; /* used to identify this as a freed node */
} BLI_freenode;
typedef struct BLI_mempool_chunk{
typedef struct BLI_mempool_chunk {
struct BLI_mempool_chunk *next, *prev;
void *data;
}BLI_mempool_chunk;
} BLI_mempool_chunk;
typedef struct BLI_mempool{
typedef struct BLI_mempool {
struct ListBase chunks;
int esize, csize, pchunk; /*size of elements and chunks in bytes and number of elements per chunk*/
struct BLI_freenode *free; /*free element list. Interleaved into chunk datas.*/
int totalloc, totused; /*total number of elements allocated in total, and currently in use*/
int use_sysmalloc;
}BLI_mempool;
int esize, csize, pchunk; /* size of elements and chunks in bytes
* and number of elements per chunk*/
short use_sysmalloc, allow_iter;
/* keeps aligned to 16 bits */
BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, int use_sysmalloc)
{ BLI_mempool *pool = NULL;
BLI_freenode *free; /* free element list. Interleaved into chunk datas.*/
int totalloc, totused; /* total number of elements allocated in total,
* and currently in use*/
} BLI_mempool;
#define MEMPOOL_ELEM_SIZE_MIN (sizeof(void *) * 2)
BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk,
short use_sysmalloc, short allow_iter)
{
BLI_mempool *pool = NULL;
BLI_freenode *lasttail = NULL, *curnode = NULL;
int i,j, maxchunks;
char *addr;
if (esize < sizeof(void*))
esize = sizeof(void*);
if (esize < MEMPOOL_ELEM_SIZE_MIN)
esize = MEMPOOL_ELEM_SIZE_MIN;
/*allocate the pool structure*/
pool = use_sysmalloc ? malloc(sizeof(BLI_mempool)) : MEM_mallocN(sizeof(BLI_mempool), "memory pool");
pool->esize = esize;
pool->esize = allow_iter ? MAX2(esize, sizeof(BLI_freenode)) : esize;
pool->use_sysmalloc = use_sysmalloc;
pool->pchunk = pchunk;
pool->csize = esize * pchunk;
pool->chunks.first = pool->chunks.last = NULL;
pool->totused= 0;
pool->allow_iter= allow_iter;
maxchunks = tote / pchunk + 1;
if (maxchunks==0) maxchunks = 1;
/*allocate the actual chunks*/
for(i=0; i < maxchunks; i++){
for (i=0; i < maxchunks; i++) {
BLI_mempool_chunk *mpchunk = use_sysmalloc ? malloc(sizeof(BLI_mempool_chunk)) : MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk");
mpchunk->next = mpchunk->prev = NULL;
mpchunk->data = use_sysmalloc ? malloc(pool->csize) : MEM_mallocN(pool->csize, "BLI Mempool Chunk Data");
BLI_addtail(&(pool->chunks), mpchunk);
if(i==0) pool->free = mpchunk->data; /*start of the list*/
if (i==0) {
pool->free = mpchunk->data; /*start of the list*/
if (pool->allow_iter)
pool->free->freeword = FREEWORD;
}
/*loop through the allocated data, building the pointer structures*/
for(addr = mpchunk->data, j=0; j < pool->pchunk; j++){
for (addr = mpchunk->data, j=0; j < pool->pchunk; j++) {
curnode = ((BLI_freenode*)addr);
addr += pool->esize;
curnode->next = (BLI_freenode*)addr;
if (pool->allow_iter) {
if (j != pool->pchunk-1)
curnode->next->freeword = FREEWORD;
curnode->freeword = FREEWORD;
}
}
/*final pointer in the previously allocated chunk is wrong.*/
if(lasttail) lasttail->next = mpchunk->data;
if (lasttail) {
lasttail->next = mpchunk->data;
if (pool->allow_iter)
lasttail->freeword = FREEWORD;
}
/*set the end of this chunks memoryy to the new tail for next iteration*/
lasttail = curnode;
@ -101,15 +144,18 @@ BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk, int use_sysmall
curnode->next = NULL;
return pool;
}
void *BLI_mempool_alloc(BLI_mempool *pool){
void *BLI_mempool_alloc(BLI_mempool *pool)
{
void *retval=NULL;
BLI_freenode *curnode=NULL;
char *addr=NULL;
int j;
pool->totused++;
if(!(pool->free)){
if (!(pool->free)) {
BLI_freenode *curnode=NULL;
char *addr;
int j;
/*need to allocate a new chunk*/
BLI_mempool_chunk *mpchunk = pool->use_sysmalloc ? malloc(sizeof(BLI_mempool_chunk)) : MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk");
mpchunk->next = mpchunk->prev = NULL;
@ -117,10 +163,18 @@ void *BLI_mempool_alloc(BLI_mempool *pool){
BLI_addtail(&(pool->chunks), mpchunk);
pool->free = mpchunk->data; /*start of the list*/
if (pool->allow_iter)
pool->free->freeword = FREEWORD;
for(addr = mpchunk->data, j=0; j < pool->pchunk; j++){
curnode = ((BLI_freenode*)addr);
addr += pool->esize;
curnode->next = (BLI_freenode*)addr;
if (pool->allow_iter) {
curnode->freeword = FREEWORD;
if (j != pool->pchunk-1)
curnode->next->freeword = FREEWORD;
}
}
curnode->next = NULL; /*terminate the list*/
@ -128,25 +182,28 @@ void *BLI_mempool_alloc(BLI_mempool *pool){
}
retval = pool->free;
if (pool->allow_iter)
pool->free->freeword = 0x7FFFFFFF;
pool->free = pool->free->next;
//memset(retval, 0, pool->esize);
return retval;
}
void *BLI_mempool_calloc(BLI_mempool *pool){
void *retval=NULL;
retval = BLI_mempool_alloc(pool);
void *BLI_mempool_calloc(BLI_mempool *pool)
{
void *retval= BLI_mempool_alloc(pool);
memset(retval, 0, pool->esize);
return retval;
}
void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against double frees, dont be stupid!
/* doesnt protect against double frees, dont be stupid! */
void BLI_mempool_free(BLI_mempool *pool, void *addr)
{
BLI_freenode *newhead = addr;
BLI_freenode *curnode=NULL;
char *tmpaddr=NULL;
int i;
if (pool->allow_iter)
newhead->freeword = FREEWORD;
newhead->next = pool->free;
pool->free = newhead;
@ -154,13 +211,17 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against d
/*nothing is in use; free all the chunks except the first*/
if (pool->totused == 0) {
BLI_mempool_chunk *mpchunk=NULL, *first;
BLI_freenode *curnode=NULL;
char *tmpaddr=NULL;
int i;
BLI_mempool_chunk *mpchunk=NULL;
BLI_mempool_chunk *first= pool->chunks.first;
first = pool->chunks.first;
BLI_remlink(&pool->chunks, first);
for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
if(pool->use_sysmalloc) free(mpchunk->data);
for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
if (pool->use_sysmalloc) free(mpchunk->data);
else MEM_freeN(mpchunk->data);
}
@ -170,7 +231,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against d
pool->totalloc = pool->pchunk;
pool->free = first->data; /*start of the list*/
for(tmpaddr = first->data, i=0; i < pool->pchunk; i++){
for (tmpaddr = first->data, i=0; i < pool->pchunk; i++) {
curnode = ((BLI_freenode*)tmpaddr);
tmpaddr += pool->esize;
curnode->next = (BLI_freenode*)tmpaddr;
@ -179,18 +240,63 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against d
}
}
void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
{
if (!pool->allow_iter) {
fprintf(stderr, "%s: Error! you can't iterate over this mempool!\n", __func__);
iter->curchunk = NULL;
iter->curindex = 0;
return;
}
iter->pool = pool;
iter->curchunk = pool->chunks.first;
iter->curindex = 0;
}
static void *bli_mempool_iternext(BLI_mempool_iter *iter)
{
void *ret = NULL;
if (!iter->curchunk || !iter->pool->totused) return NULL;
ret = ((char*)iter->curchunk->data) + iter->pool->esize*iter->curindex;
iter->curindex++;
if (iter->curindex >= iter->pool->pchunk) {
iter->curchunk = iter->curchunk->next;
iter->curindex = 0;
}
return ret;
}
void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
{
BLI_freenode *ret;
do {
ret = bli_mempool_iternext(iter);
} while (ret && ret->freeword == FREEWORD);
return ret;
}
void BLI_mempool_destroy(BLI_mempool *pool)
{
BLI_mempool_chunk *mpchunk=NULL;
if(pool->use_sysmalloc) {
for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
if (pool->use_sysmalloc) {
for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
free(mpchunk->data);
}
BLI_freelist(&(pool->chunks));
free(pool);
}
else {
for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
MEM_freeN(mpchunk->data);
}
BLI_freelistN(&(pool->chunks));

@ -1979,7 +1979,7 @@ static void direct_link_nladata_strips(FileData *fd, ListBase *list)
/* strip's F-Modifiers */
link_list(fd, &strip->modifiers);
direct_link_modifiers(fd, &strip->modifiers);
direct_link_fmodifiers(fd, &strip->modifiers);
}
}

@ -1917,7 +1917,7 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
bAnimContext ac;
rcti rect;
short selectmode=0;
int gesture_mode;
int gesture_mode, extend;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
@ -1930,6 +1930,11 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
rect.ymax= RNA_int_get(op->ptr, "ymax");
gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
extend= RNA_boolean_get(op->ptr, "extend");
if(!extend)
ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, 1, ACHANNEL_SETFLAG_CLEAR);
if (gesture_mode == GESTURE_MODAL_SELECT)
selectmode = ACHANNEL_SETFLAG_ADD;
else
@ -1963,7 +1968,7 @@ static void ANIM_OT_channels_select_border(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, FALSE);
WM_operator_properties_gesture_border(ot, TRUE);
}
/* ******************* Rename Operator ***************************** */

@ -1147,6 +1147,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
int xmax= RNA_int_get(op->ptr, "xmax");
int ymin= RNA_int_get(op->ptr, "ymin");
int ymax= RNA_int_get(op->ptr, "ymax");
int extend= RNA_boolean_get(op->ptr, "extend");
UI_view2d_region_to_view(v2d, xmin, ymin, &xminf, &yminf);
UI_view2d_region_to_view(v2d, xmax, ymax, &xmaxf, &ymaxf);
@ -1166,6 +1167,9 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
break;
}
}
else if (!extend) {
marker->flag &= ~SELECT;
}
}
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
@ -1198,7 +1202,7 @@ static void MARKER_OT_select_border(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, FALSE);
WM_operator_properties_gesture_border(ot, TRUE);
}
/* *********************** (de)select all ***************** */

@ -169,8 +169,13 @@ void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar)
static void area_draw_azone(short x1, short y1, short x2, short y2)
{
int dx= floor(0.3f*(x2-x1));
int dy= floor(0.3f*(y2-y1));
int dx = x2 - x1;
int dy = y2 - y1;
dx= copysign(ceil(0.3f*fabs(dx)), dx);
dy= copysign(ceil(0.3f*fabs(dy)), dy);
glEnable(GL_LINE_SMOOTH);
glColor4ub(255, 255, 255, 180);
fdrawline(x1, y2, x2, y1);
@ -185,8 +190,9 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
fdrawline(x1, y2-dy+1, x2-dx+1, y1);
glColor4ub(0, 0, 0, 150);
fdrawline(x1, y2-2*dy+1, x2-2*dx+1, y1);
}
glDisable(GL_LINE_SMOOTH);
}
static void region_draw_azone_icon(AZone *az)
{
@ -550,19 +556,19 @@ static void area_azone_initialize(ScrArea *sa)
az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
BLI_addtail(&(sa->actionzones), az);
az->type= AZONE_AREA;
az->x1= sa->totrct.xmin;
az->y1= sa->totrct.ymin;
az->x2= sa->totrct.xmin + AZONESPOT;
az->y2= sa->totrct.ymin + AZONESPOT;
az->x1= sa->totrct.xmin - 1;
az->y1= sa->totrct.ymin - 1;
az->x2= sa->totrct.xmin + (AZONESPOT-1);
az->y2= sa->totrct.ymin + (AZONESPOT-1);
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
BLI_addtail(&(sa->actionzones), az);
az->type= AZONE_AREA;
az->x1= sa->totrct.xmax+1;
az->y1= sa->totrct.ymax+1;
az->x2= sa->totrct.xmax-AZONESPOT;
az->y2= sa->totrct.ymax-AZONESPOT;
az->x1= sa->totrct.xmax + 1;
az->y1= sa->totrct.ymax + 1;
az->x2= sa->totrct.xmax - (AZONESPOT-1);
az->y2= sa->totrct.ymax - (AZONESPOT-1);
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
}

@ -269,12 +269,17 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
bAnimContext ac;
rcti rect;
short mode=0, selectmode=0;
int gesture_mode;
int gesture_mode, extend;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* clear all selection if not extending selection */
extend= RNA_boolean_get(op->ptr, "extend");
if (!extend)
deselect_action_keys(&ac, 1, SELECT_SUBTRACT);
/* get settings from operator */
rect.xmin= RNA_int_get(op->ptr, "xmin");
rect.ymin= RNA_int_get(op->ptr, "ymin");
@ -330,7 +335,7 @@ void ACTION_OT_select_border(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, FALSE);
WM_operator_properties_gesture_border(ot, TRUE);
ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
}

@ -869,7 +869,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
MovieTrackingTrack *track;
rcti rect;
rctf rectf;
int change= 0, mode;
int change= 0, mode, extend;
/* get rectangle from operator */
rect.xmin= RNA_int_get(op->ptr, "xmin");
@ -881,6 +881,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
ED_clip_point_stable_pos(C, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
mode= RNA_int_get(op->ptr, "gesture_mode");
extend= RNA_boolean_get(op->ptr, "extend");
/* do actual selection */
track= clip->tracking.tracks.first;
@ -888,8 +889,13 @@ static int border_select_exec(bContext *C, wmOperator *op)
if((track->flag&TRACK_HIDDEN)==0) {
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, sc->user.framenr);
if(MARKER_VISIBLE(sc, marker) && BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) {
if(MARKER_VISIBLE(sc, marker)) {
if(BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) {
BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT);
}
else if(!extend) {
BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, 1);
}
change= 1;
}
@ -921,10 +927,10 @@ void CLIP_OT_select_border(wmOperatorType *ot)
ot->poll= ED_space_clip_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag= OPTYPE_UNDO;
/* properties */
WM_operator_properties_gesture_border(ot, FALSE);
WM_operator_properties_gesture_border(ot, TRUE);
}
/********************** circle select operator *********************/

@ -273,13 +273,20 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
ARegion *ar= CTX_wm_region(C);
rcti rect;
FileSelect ret;
int extend= RNA_boolean_get(op->ptr, "extend");
short select= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
rect.xmin= RNA_int_get(op->ptr, "xmin");
rect.ymin= RNA_int_get(op->ptr, "ymin");
rect.xmax= RNA_int_get(op->ptr, "xmax");
rect.ymax= RNA_int_get(op->ptr, "ymax");
if(!extend) {
SpaceFile *sfile= CTX_wm_space_file(C);
file_deselect_all(sfile, SELECTED_FILE);
}
BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect);
ret = file_select(C, &rect, select ? FILE_SEL_ADD : FILE_SEL_REMOVE, 0);
@ -306,7 +313,7 @@ void FILE_OT_select_border(wmOperatorType *ot)
ot->cancel= WM_border_select_cancel;
/* rna */
WM_operator_properties_gesture_border(ot, 0);
WM_operator_properties_gesture_border(ot, 1);
}
static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)

@ -289,11 +289,17 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
rcti rect;
short mode=0, selectmode=0;
short incl_handles;
int extend;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* clear all selection if not extending selection */
extend= RNA_boolean_get(op->ptr, "extend");
if (!extend)
deselect_graph_keys(&ac, 1, SELECT_SUBTRACT, TRUE);
/* get select mode
* - 'gesture_mode' from the operator specifies how to select
* - 'include_handles' from the operator specifies whether to include handles in the selection
@ -354,7 +360,7 @@ void GRAPH_OT_select_border(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
/* rna */
WM_operator_properties_gesture_border(ot, FALSE);
WM_operator_properties_gesture_border(ot, TRUE);
ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
RNA_def_boolean(ot->srna, "include_handles", 0, "Include Handles", "Are handles tested individually against the selection criteria");

@ -220,6 +220,7 @@ static int borderselect_exec(bContext *C, wmOperator *op)
ARegion *ar= CTX_wm_region(C);
ReportList *reports= CTX_wm_reports(C);
int report_mask= info_report_mask(sinfo);
int extend= RNA_boolean_get(op->ptr, "extend");
Report *report_min, *report_max, *report;
//View2D *v2d= UI_view2d_fromcontext(C);
@ -244,6 +245,16 @@ static int borderselect_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax);
*/
if(!extend) {
for(report= reports->list.first; report; report= report->next) {
if((report->type & report_mask)==0)
continue;
report->flag &= ~SELECT;
}
}
report_min= info_text_pick(sinfo, ar, reports, rect.ymax);
report_max= info_text_pick(sinfo, ar, reports, rect.ymin);
@ -308,7 +319,7 @@ void INFO_OT_select_border(wmOperatorType *ot)
/* ot->flag= OPTYPE_REGISTER; */
/* rna */
WM_operator_properties_gesture_border(ot, FALSE);
WM_operator_properties_gesture_border(ot, TRUE);
}

@ -282,11 +282,17 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
bAnimContext ac;
rcti rect;
short mode=0, selectmode=0;
int extend;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* clear all selection if not extending selection */
extend= RNA_boolean_get(op->ptr, "extend");
if (!extend)
deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_SUBTRACT);
/* get settings from operator */
rect.xmin= RNA_int_get(op->ptr, "xmin");
rect.ymin= RNA_int_get(op->ptr, "ymin");
@ -341,7 +347,7 @@ void NLA_OT_select_border(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, 0);
WM_operator_properties_gesture_border(ot, 1);
RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
}

@ -164,6 +164,7 @@ static int node_borderselect_exec(bContext *C, wmOperator *op)
rcti rect;
rctf rectf;
int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
int extend= RNA_boolean_get(op->ptr, "extend");
rect.xmin= RNA_int_get(op->ptr, "xmin");
rect.ymin= RNA_int_get(op->ptr, "ymin");
@ -180,6 +181,9 @@ static int node_borderselect_exec(bContext *C, wmOperator *op)
else
node->flag &= ~SELECT;
}
else if(!extend) {
node->flag &= ~SELECT;
}
}
node_sort(snode->edittree);
@ -228,7 +232,7 @@ void NODE_OT_select_border(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, FALSE);
WM_operator_properties_gesture_border(ot, TRUE);
RNA_def_boolean(ot->srna, "tweak", 0, "Tweak", "Only activate when mouse is not over a node - useful for tweak gesture");
}

@ -827,6 +827,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
rcti rect;
rctf rectf, rq;
short selecting = (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
int extend = RNA_boolean_get(op->ptr, "extend");
int mval[2];
if(ed==NULL)
@ -852,6 +853,10 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
else seq->flag &= ~SEQ_ALLSEL;
recurs_sel_seq(seq);
}
else if(!extend) {
seq->flag &= ~SEQ_ALLSEL;
recurs_sel_seq(seq);
}
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
@ -880,7 +885,7 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, FALSE);
WM_operator_properties_gesture_border(ot, TRUE);
}
/* ****** Selected Grouped ****** */

@ -1490,7 +1490,7 @@ static void UV_OT_stitch(wmOperatorType *ot)
/* ******************** (de)select all operator **************** */
static int select_all_exec(bContext *C, wmOperator *op)
static void select_all_perform(bContext *C, int action)
{
Scene *scene;
ToolSettings *ts;
@ -1499,7 +1499,6 @@ static int select_all_exec(bContext *C, wmOperator *op)
EditFace *efa;
Image *ima;
MTFace *tf;
int action = RNA_enum_get(op->ptr, "action");
scene= CTX_data_scene(C);
ts= CTX_data_tool_settings(C);
@ -1560,6 +1559,15 @@ static int select_all_exec(bContext *C, wmOperator *op)
}
}
}
}
static int select_all_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
int action= RNA_enum_get(op->ptr, "action");
select_all_perform(C, action);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
@ -2275,7 +2283,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
MTFace *tface;
rcti rect;
rctf rectf;
int change, pinned, select, faces;
int change, pinned, select, faces, extend;
/* get rectangle from operator */
rect.xmin= RNA_int_get(op->ptr, "xmin");
@ -2289,6 +2297,10 @@ static int border_select_exec(bContext *C, wmOperator *op)
/* figure out what to select/deselect */
select= (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
pinned= RNA_boolean_get(op->ptr, "pinned");
extend= RNA_boolean_get(op->ptr, "extend");
if(!extend)
select_all_perform(C, SEL_DESELECT);
if(ts->uv_flag & UV_SYNC_SELECTION)
faces= (ts->selectmode == SCE_SELECT_FACE);
@ -2411,7 +2423,7 @@ static void UV_OT_select_border(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "pinned", 0, "Pinned", "Border select pinned UVs only");
WM_operator_properties_gesture_border(ot, FALSE);
WM_operator_properties_gesture_border(ot, TRUE);
}
/* ******************** circle select operator **************** */

@ -204,9 +204,9 @@ struct MovieCache *IMB_moviecache_create(int keysize, GHashHashFP hashfp, GHashC
MovieCache *cache;
cache= MEM_callocN(sizeof(MovieCache), "MovieCache");
cache->keys_pool= BLI_mempool_create(sizeof(MovieCacheKey), 64, 64, 0);
cache->items_pool= BLI_mempool_create(sizeof(MovieCacheItem), 64, 64, 0);
cache->userkeys_pool= BLI_mempool_create(keysize, 64, 64, 0);
cache->keys_pool= BLI_mempool_create(sizeof(MovieCacheKey), 64, 64, FALSE, FALSE);
cache->items_pool= BLI_mempool_create(sizeof(MovieCacheItem), 64, 64, FALSE, FALSE);
cache->userkeys_pool= BLI_mempool_create(keysize, 64, 64, FALSE, FALSE);
cache->hash= BLI_ghash_new(moviecache_hashhash, moviecache_hashcmp, "MovieClip ImBuf cache hash");
cache->keysize= keysize;

@ -169,6 +169,7 @@ typedef struct DynamicPaintCanvasSettings {
#define MOD_DPAINT_WAVEB_DEPTH 0 /* use intersection depth */
#define MOD_DPAINT_WAVEB_FORCE 1 /* act as a force on intersection area */
#define MOD_DPAINT_WAVEB_REFLECT 2 /* obstacle that reflects waves */
#define MOD_DPAINT_WAVEB_CHANGE 3 /* use change of intersection depth from previous frame */
/* brush ray_dir */
#define MOD_DPAINT_RAY_CANVAS 0

@ -623,8 +623,8 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Damping", "Wave damping factor");
prop= RNA_def_property(srna, "wave_speed", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.01, 3.0);
RNA_def_property_ui_range(prop, 0.01, 1.5, 1, 2);
RNA_def_property_range(prop, 0.01, 5.0);
RNA_def_property_ui_range(prop, 0.20, 4.0, 1, 2);
RNA_def_property_ui_text(prop, "Speed", "Wave propogation speed");
prop= RNA_def_property(srna, "wave_timescale", PROP_FLOAT, PROP_NONE);
@ -696,6 +696,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_dynamicpaint_brush_wave_type[] = {
{MOD_DPAINT_WAVEB_CHANGE, "CHANGE", 0, "Depth Change", ""},
{MOD_DPAINT_WAVEB_DEPTH, "DEPTH", 0, "Obstacle", ""},
{MOD_DPAINT_WAVEB_FORCE, "FORCE", 0, "Force", ""},
{MOD_DPAINT_WAVEB_REFLECT, "REFLECT", 0, "Reflect Only", ""},
@ -758,7 +759,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_wave_type);
RNA_def_property_ui_text(prop, "Brush Effect", "");
RNA_def_property_ui_text(prop, "Wave Type", "");
prop= RNA_def_property(srna, "wave_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, -2.0, 2.0);

@ -191,6 +191,13 @@ static int rna_Sequence_frame_length_get(PointerRNA *ptr)
return seq_tx_get_final_right(seq, 0)-seq_tx_get_final_left(seq, 0);
}
static int rna_Sequence_frame_editable(PointerRNA *ptr)
{
Sequence *seq = (Sequence*)ptr->data;
/* Effect sequences' start frame and length must be readonly! */
return (get_sequence_effect_num_inputs(seq->type))? 0: PROP_EDITABLE;
}
static void rna_Sequence_channel_set(PointerRNA *ptr, int value)
{
Sequence *seq= (Sequence*)ptr->data;
@ -1025,8 +1032,9 @@ static void rna_def_sequence(BlenderRNA *brna)
prop= RNA_def_property(srna, "frame_final_duration", PROP_INT, PROP_TIME);
RNA_def_property_range(prop, 1, MAXFRAME);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip before the handles are applied");
RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip after the handles are applied");
RNA_def_property_int_funcs(prop, "rna_Sequence_frame_length_get", "rna_Sequence_frame_length_set",NULL);
RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "frame_duration", PROP_INT, PROP_TIME);
@ -1040,6 +1048,7 @@ static void rna_def_sequence(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Start Frame", "");
RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_set",NULL); // overlap tests and calc_seq_disp
RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "frame_final_start", PROP_INT, PROP_TIME);
@ -1047,6 +1056,7 @@ static void rna_def_sequence(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Start Frame", "Start frame displayed in the sequence editor after offsets are applied, setting this is equivalent to moving the handle, not the actual start frame");
RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_final_set", NULL); // overlap tests and calc_seq_disp
RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "frame_final_end", PROP_INT, PROP_TIME);
@ -1054,6 +1064,7 @@ static void rna_def_sequence(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "End Frame", "End frame displayed in the sequence editor after offsets are applied");
RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_end_frame_final_set", NULL); // overlap tests and calc_seq_disp
RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "frame_offset_start", PROP_INT, PROP_TIME);