svn merge ^/trunk/blender -r49867:49886

This commit is contained in:
Campbell Barton
2012-08-14 11:07:42 +00:00
39 changed files with 420 additions and 168 deletions

View File

@@ -24,7 +24,7 @@
"""
Example linux usage
python .~/blenderSVN/blender/build_files/cmake/cmake_netbeans_project.py ~/blenderSVN/cmake
python3 ~/blenderSVN/blender/build_files/cmake/cmake_netbeans_project.py ~/blenderSVN/cmake
Windows not supported so far
"""

View File

@@ -297,6 +297,7 @@ void BKE_sequencer_update_sound(struct Scene *scene, struct bSound *sound);
void BKE_seqence_base_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq);
void BKE_sequence_base_dupli_recursive(struct Scene *scene, struct Scene *scene_to, ListBase *nseqbase, ListBase *seqbase, int dupe_flag);
int BKE_seqence_is_valid_check(struct Sequence *seq);
void BKE_sequencer_clear_scene_in_allseqs(struct Main *bmain, struct Scene *sce);

View File

@@ -1997,7 +1997,10 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
/* Get closest edge to that subpixel on UV map */
{
float pixel[2], dist, t_dist;
float pixel[2];
/* distances only used for comparison */
float dist_squared, t_dist_squared;
int i, uindex[3], edge1_index, edge2_index,
e1_index, e2_index, target_face;
float closest_point[2], lambda, dir_vec[2];
@@ -2019,17 +2022,17 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
/*
* Find closest edge to that pixel
*/
/* Dist to first edge */
/* Dist to first edge */
e1_index = cPoint->v1; e2_index = cPoint->v2; edge1_index = uindex[0]; edge2_index = uindex[1];
dist = dist_to_line_segment_v2(pixel, tface[cPoint->face_index].uv[edge1_index], tface[cPoint->face_index].uv[edge2_index]);
dist_squared = dist_squared_to_line_segment_v2(pixel, tface[cPoint->face_index].uv[edge1_index], tface[cPoint->face_index].uv[edge2_index]);
/* Dist to second edge */
t_dist = dist_to_line_segment_v2(pixel, tface[cPoint->face_index].uv[uindex[1]], tface[cPoint->face_index].uv[uindex[2]]);
if (t_dist < dist) { e1_index = cPoint->v2; e2_index = cPoint->v3; edge1_index = uindex[1]; edge2_index = uindex[2]; dist = t_dist; }
/* Dist to second edge */
t_dist_squared = dist_squared_to_line_segment_v2(pixel, tface[cPoint->face_index].uv[uindex[1]], tface[cPoint->face_index].uv[uindex[2]]);
if (t_dist_squared < dist_squared) { e1_index = cPoint->v2; e2_index = cPoint->v3; edge1_index = uindex[1]; edge2_index = uindex[2]; dist_squared = t_dist_squared; }
/* Dist to third edge */
t_dist = dist_to_line_segment_v2(pixel, tface[cPoint->face_index].uv[uindex[2]], tface[cPoint->face_index].uv[uindex[0]]);
if (t_dist < dist) { e1_index = cPoint->v3; e2_index = cPoint->v1; edge1_index = uindex[2]; edge2_index = uindex[0]; dist = t_dist; }
/* Dist to third edge */
t_dist_squared = dist_squared_to_line_segment_v2(pixel, tface[cPoint->face_index].uv[uindex[2]], tface[cPoint->face_index].uv[uindex[0]]);
if (t_dist_squared < dist_squared) { e1_index = cPoint->v3; e2_index = cPoint->v1; edge1_index = uindex[2]; edge2_index = uindex[0]; dist_squared = t_dist_squared; }
/*

View File

@@ -40,18 +40,22 @@
#include "BLI_math.h"
#include "DNA_mask_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_tracking_types.h"
#include "DNA_sequence_types.h"
#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mask.h"
#include "BKE_node.h"
#include "BKE_sequencer.h"
#include "BKE_tracking.h"
#include "BKE_movieclip.h"
#include "BKE_utildefines.h"
@@ -1561,26 +1565,83 @@ void BKE_mask_free(Mask *mask)
BKE_mask_layer_free_list(&mask->masklayers);
}
static void ntree_unlink_mask_cb(void *calldata, struct ID *UNUSED(owner_id), struct bNodeTree *ntree)
{
ID *id = (ID *)calldata;
bNode *node;
for (node = ntree->nodes.first; node; node = node->next) {
if (node->id == id) {
node->id = NULL;
}
}
}
void BKE_mask_unlink(Main *bmain, Mask *mask)
{
bScreen *scr;
ScrArea *area;
SpaceLink *sl;
Scene *scene;
for (scr = bmain->screen.first; scr; scr = scr->id.next) {
for (area = scr->areabase.first; area; area = area->next) {
for (sl = area->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_CLIP) {
SpaceClip *sc = (SpaceClip *) sl;
switch (sl->spacetype) {
case SPACE_CLIP:
{
SpaceClip *sc = (SpaceClip *)sl;
if (sc->mask_info.mask == mask)
sc->mask_info.mask = NULL;
if (sc->mask_info.mask == mask) {
sc->mask_info.mask = NULL;
}
break;
}
case SPACE_IMAGE:
{
SpaceImage *sima = (SpaceImage *)sl;
if (sima->mask_info.mask == mask) {
sima->mask_info.mask = NULL;
}
break;
}
}
}
}
}
mask->id.us = 0;
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
if (scene->ed) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq)
{
if (seq->mask == mask) {
seq->mask = NULL;
}
}
SEQ_END
}
if (scene->nodetree) {
bNode *node;
for (node = scene->nodetree->nodes.first; node; node = node->next) {
if (node->id == &mask->id) {
node->id = NULL;
}
}
}
}
{
bNodeTreeType *treetype = ntreeGetType(NTREE_COMPOSIT);
treetype->foreach_nodetree(bmain, (void *)mask, &ntree_unlink_mask_cb);
}
BKE_libblock_free(&bmain->mask, mask);
}
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2])

View File

@@ -594,6 +594,9 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, int lock_range)
}
break;
case SEQ_TYPE_MOVIECLIP:
if (seq->clip == NULL)
return;
seq->len = BKE_movieclip_get_duration(seq->clip);
seq->len -= seq->anim_startofs;
@@ -603,8 +606,9 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, int lock_range)
}
break;
case SEQ_TYPE_MASK:
if (seq->mask == NULL)
return;
seq->len = BKE_mask_get_duration(seq->mask);
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
@@ -4038,3 +4042,21 @@ void BKE_sequence_base_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *
}
}
}
/* called on draw, needs to be fast,
* we could cache and use a flag if we want to make checks for file paths resolving for eg. */
int BKE_seqence_is_valid_check(Sequence *seq)
{
switch (seq->type) {
case SEQ_TYPE_MASK:
return (seq->mask != NULL);
case SEQ_TYPE_MOVIECLIP:
return (seq->clip != NULL);
case SEQ_TYPE_SCENE:
return (seq->scene != NULL);
case SEQ_TYPE_SOUND_RAM:
return (seq->sound != NULL);
}
return TRUE;
}

View File

@@ -188,7 +188,7 @@ float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const
if (len == 0.0f) {
rc[0] = p[0] - l1[0];
rc[1] = p[1] - l1[1];
return (float)(sqrt(rc[0] * rc[0] + rc[1] * rc[1]));
return (rc[0] * rc[0] + rc[1] * rc[1]);
}
labda = (rc[0] * (p[0] - l1[0]) + rc[1] * (p[1] - l1[1])) / len;

View File

@@ -4842,19 +4842,27 @@ static void lib_link_scene(FileData *fd, Main *main)
}
if (seq->clip) {
seq->clip = newlibadr(fd, sce->id.lib, seq->clip);
seq->clip->id.us++;
if (seq->clip) {
seq->clip->id.us++;
}
}
if (seq->mask) {
seq->mask = newlibadr(fd, sce->id.lib, seq->mask);
seq->mask->id.us++;
if (seq->mask) {
seq->mask->id.us++;
}
}
if (seq->scene_camera) {
seq->scene_camera = newlibadr(fd, sce->id.lib, seq->scene_camera);
}
if (seq->scene_camera) seq->scene_camera = newlibadr(fd, sce->id.lib, seq->scene_camera);
if (seq->sound) {
seq->scene_sound = NULL;
if (seq->type == SEQ_TYPE_SOUND_HD)
if (seq->type == SEQ_TYPE_SOUND_HD) {
seq->type = SEQ_TYPE_SOUND_RAM;
else
}
else {
seq->sound = newlibadr(fd, sce->id.lib, seq->sound);
}
if (seq->sound) {
seq->sound->id.us++;
seq->scene_sound = sound_add_scene_sound_defaults(sce, seq);

View File

@@ -539,8 +539,8 @@ void BMO_remove_tagged_verts(BMesh *bm, const short oflag)
}
}
/*************************************************************/
/* you need to make remove tagged verts/edges/faces
/**
* you need to make remove tagged verts/edges/faces
* api functions that take a filter callback.....
* and this new filter type will be for opstack flags.
* This is because the BM_remove_taggedXXX functions bypass iterator API.

View File

@@ -1134,7 +1134,7 @@ static BMFace *bm_face_create__sfme(BMesh *bm, BMFace *UNUSED(example))
* The second region has a new face assigned to it.
*
* \par Examples:
*
* <pre>
* Before: After:
* +--------+ +--------+
* | | | |
@@ -1143,6 +1143,7 @@ static BMFace *bm_face_create__sfme(BMesh *bm, BMFace *UNUSED(example))
* | | | f2 |
* | | | |
* +--------+ +--------+
* </pre>
*
* \note the input vertices can be part of the same edge. This will
* result in a two edged face. This is desirable for advanced construction
@@ -1302,12 +1303,13 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
* will be attached to that end and is returned in \a r_e.
*
* \par Examples:
*
* <pre>
* E
* Before: OV-------------TV
*
* E RE
* After: OV------NV-----TV
* </pre>
*
* \return The newly created BMVert pointer.
*/
@@ -1474,7 +1476,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
* and collapses the edge on that vertex.
*
* \par Examples:
*
* <pre>
* Before: OE KE
* ------- -------
* | || |
@@ -1485,6 +1487,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
* ---------------
* | |
* OV TV
* </pre>
*
* \par Restrictions:
* KV is a vertex that must have a valance of exactly two. Furthermore
@@ -1636,7 +1639,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
* Both faces in its radial cycle
*
* \par Examples:
*
* <pre>
* A B
* +--------+ +--------+
* | | | |
@@ -1645,6 +1648,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
* | f2 | | f2 |
* | | | |
* +--------+ +--------+
* </pre>
*
* In the example A, faces \a f1 and \a f2 are joined by a single edge,
* and the euler can safely be used.

View File

@@ -186,7 +186,7 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source)
* \brief Multires Interpolation
*
* mdisps is a grid of displacements, ordered thus:
*
* <pre>
* v1/center----v4/next -> x
* | |
* | |
@@ -194,6 +194,7 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source)
* |
* V
* y
* </pre>
*/
static int compute_mdisp_quad(BMLoop *l, float v1[3], float v2[3], float v3[3], float v4[3],
float e1[3], float e2[3])

View File

@@ -45,20 +45,21 @@
* Turns the face region surrounding a manifold vertex into a single polygon.
*
* \par Example:
*
* <pre>
* +---------+ +---------+
* | \ / | | |
* Before: | v | After: | |
* | / \ | | |
* +---------+ +---------+
*
* </pre>
*
* This function can also collapse edges too
* in cases when it cant merge into faces.
*
* \par Example:
*
* <pre>
* Before: +----v----+ After: +---------+
* </pre>
*
* \note dissolves vert, in more situations then BM_disk_dissolve
* (e.g. if the vert is part of a wire edge, etc).

View File

@@ -54,7 +54,7 @@ int BM_vert_in_edge(BMEdge *e, BMVert *v)
* \brief Other Loop in Face Sharing an Edge
*
* Finds the other loop that shares \a v with \a e loop in \a f.
*
* <pre>
* +----------+
* | |
* | f |
@@ -64,7 +64,7 @@ int BM_vert_in_edge(BMEdge *e, BMVert *v)
* ^ ^ <------- These vert args define direction
* in the face to check.
* The faces loop direction is ignored.
*
* </pre>
*/
BMLoop *BM_face_other_edge_loop(BMFace *f, BMEdge *e, BMVert *v)
{
@@ -92,8 +92,7 @@ BMLoop *BM_face_other_edge_loop(BMFace *f, BMEdge *e, BMVert *v)
* This function returns a loop in \a f that shares an edge with \a v
* The direction is defined by \a v_prev, where the return value is
* the loop of what would be 'v_next'
*
*
* <pre>
* +----------+ <-- return the face loop of this vertex.
* | |
* | f |
@@ -103,6 +102,7 @@ BMLoop *BM_face_other_edge_loop(BMFace *f, BMEdge *e, BMVert *v)
* ^^^^^^ ^ <-- These vert args define direction
* in the face to check.
* The faces loop direction is ignored.
* </pre>
*
* \note \a v_prev and \a v _implicitly_ define an edge.
*/
@@ -143,7 +143,7 @@ BMLoop *BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v)
* \brief Other Loop in Face Sharing a Vert
*
* Finds the other loop that shares \a v with \a e loop in \a f.
*
* <pre>
* +----------+ <-- return the face loop of this vertex.
* | |
* | |
@@ -153,6 +153,7 @@ BMLoop *BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v)
* ^ <------- This loop defines both the face to search
* and the edge, in combination with 'v'
* The faces loop direction is ignored.
* </pre>
*/
BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v)

View File

@@ -203,9 +203,9 @@ void bmesh_disk_edge_remove(BMEdge *e, BMVert *v)
/**
* \brief Next Disk Edge
*
* Find the next edge in a disk cycle
* Find the next edge in a disk cycle
*
* \return Pointer to the next edge in the disk cycle for the vertex v.
* \return Pointer to the next edge in the disk cycle for the vertex v.
*/
BMEdge *bmesh_disk_edge_next(BMEdge *e, BMVert *v)
{

View File

@@ -269,13 +269,15 @@ static void bm_subdivide_multicut(BMesh *bm, BMEdge *edge, const SubDParams *par
* match the input geometry. they're based on the
* pre-split state of the face */
/*
/**
* <pre>
* v3---------v2
* | |
* | |
* | |
* | |
* v4---v0---v1
* </pre>
*/
static void quad_1edge_split(BMesh *bm, BMFace *UNUSED(face),
BMVert **verts, const SubDParams *params)
@@ -313,13 +315,15 @@ static SubDPattern quad_1edge = {
};
/*
/**
* <pre>
* v6--------v5
* | |
* | |v4s
* | |v3s
* | s s |
* v7-v0--v1-v2
* </pre>
*/
static void quad_2edge_split_path(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
const SubDParams *params)
@@ -339,13 +343,15 @@ static SubDPattern quad_2edge_path = {
4,
};
/*
/**
* <pre>
* v6--------v5
* | |
* | |v4s
* | |v3s
* | s s |
* v7-v0--v1-v2
* </pre>
*/
static void quad_2edge_split_innervert(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
const SubDParams *params)
@@ -379,14 +385,15 @@ static SubDPattern quad_2edge_innervert = {
4,
};
/*
/**
* <pre>
* v6--------v5
* | |
* | |v4s
* | |v3s
* | s s |
* v7-v0--v1-v2
*
* </pre>
*/
static void quad_2edge_split_fan(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
const SubDParams *params)
@@ -409,7 +416,8 @@ static SubDPattern quad_2edge_fan = {
4,
};
/*
/**
* <pre>
* s s
* v8--v7--v6-v5
* | |
@@ -418,6 +426,7 @@ static SubDPattern quad_2edge_fan = {
* | v3 s
* | s s |
* v9-v0--v1-v2
* </pre>
*/
static void quad_3edge_split(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
const SubDParams *params)
@@ -446,7 +455,8 @@ static SubDPattern quad_3edge = {
4,
};
/*
/**
* <pre>
* v8--v7-v6--v5
* | s |
* |v9 s s|v4
@@ -455,6 +465,7 @@ static SubDPattern quad_3edge = {
* v11-v0--v1-v2
*
* it goes from bottom up
* </pre>
*/
static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
const SubDParams *params)
@@ -525,7 +536,8 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts
MEM_freeN(lines);
}
/*
/**
* <pre>
* v3
* / \
* / \
@@ -534,6 +546,7 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts
* / \
* v4--v0--v1--v2
* s s
* </pre>
*/
static void tri_1edge_split(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
const SubDParams *params)
@@ -552,7 +565,9 @@ static SubDPattern tri_1edge = {
3,
};
/* v5
/**
* <pre>
* v5
* / \
* s v6/---\ v4 s
* / \ / \
@@ -560,6 +575,7 @@ static SubDPattern tri_1edge = {
* / \/ \/ \
* v8--v0--v1--v2
* s s
* </pre>
*/
static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
const SubDParams *params)
@@ -610,7 +626,8 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
}
}
/*
/**
* <pre>
* v5
* / \
* s v6/---\ v4 s
@@ -619,6 +636,7 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
* / \/ \/ \
* v8--v0--v1--v2
* s s
* </pre>
*/
for (i = 1; i < numcuts + 1; i++) {
for (j = 0; j < i; j++) {

View File

@@ -1029,17 +1029,16 @@ static BMesh *BME_bevel_reinitialize(BMesh *bm)
#endif
/**
* BME_bevel_mesh
* BME_bevel_mesh
*
* Mesh beveling tool:
* Mesh beveling tool:
*
* Bevels an entire mesh. It currently uses the flags of
* its vertices and edges to track topological changes.
* The parameter "value" is the distance to inset (should be negative).
* The parameter "options" is not currently used.
* Bevels an entire mesh. It currently uses the flags of
* its vertices and edges to track topological changes.
* The parameter "value" is the distance to inset (should be negative).
* The parameter "options" is not currently used.
*
* Returns -
* A BMesh pointer to the BM passed as a parameter.
* \return A BMesh pointer to the BM passed as a parameter.
*/
static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int options,

View File

@@ -299,6 +299,11 @@ extern "C" {
*/
void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering);
/**
* @brief Deinitialize the compositor caches and allocated memory.
*/
void COM_deinitialize(void);
/**
* @brief Return a list of highlighted bnodes pointers.
* @return

View File

@@ -99,6 +99,9 @@ bool ExecutionGroup::canContainOperation(NodeOperation *operation)
void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operation)
{
/* should never happen but in rare cases it can - it causes confusing crashes */
BLI_assert(operation->isOperation() == true);
if (containsOperation(operation)) return;
if (canContainOperation(operation)) {
if (!operation->isBufferOperation()) {

View File

@@ -32,23 +32,24 @@ extern "C" {
#include "COM_ExecutionSystem.h"
#include "COM_WorkScheduler.h"
#include "OCL_opencl.h"
#include "COM_MovieDistortionOperation.h"
static ThreadMutex compositorMutex;
static ThreadMutex s_compositorMutex;
static char is_compositorMutex_init = FALSE;
void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
{
if (is_compositorMutex_init == FALSE) { /// TODO: move to blender startup phase
memset(&compositorMutex, 0, sizeof(compositorMutex));
BLI_mutex_init(&compositorMutex);
memset(&s_compositorMutex, 0, sizeof(s_compositorMutex));
BLI_mutex_init(&s_compositorMutex);
OCL_init();
WorkScheduler::initialize(); ///TODO: call workscheduler.deinitialize somewhere
is_compositorMutex_init = TRUE;
}
BLI_mutex_lock(&compositorMutex);
BLI_mutex_lock(&s_compositorMutex);
if (editingtree->test_break(editingtree->tbh)) {
// during editing multiple calls to this method can be triggered.
// make sure one the last one will be doing the work.
BLI_mutex_unlock(&compositorMutex);
BLI_mutex_unlock(&s_compositorMutex);
return;
}
@@ -67,7 +68,7 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
if (editingtree->test_break(editingtree->tbh)) {
// during editing multiple calls to this method can be triggered.
// make sure one the last one will be doing the work.
BLI_mutex_unlock(&compositorMutex);
BLI_mutex_unlock(&s_compositorMutex);
return;
}
}
@@ -77,5 +78,18 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
system->execute();
delete system;
BLI_mutex_unlock(&compositorMutex);
BLI_mutex_unlock(&s_compositorMutex);
}
void COM_deinitialize()
{
if (is_compositorMutex_init)
{
BLI_mutex_lock(&s_compositorMutex);
deintializeDistortionCache();
WorkScheduler::deinitialize();
is_compositorMutex_init = FALSE;
BLI_mutex_unlock(&s_compositorMutex);
BLI_mutex_end(&s_compositorMutex);
}
}

View File

@@ -22,6 +22,7 @@
#include "COM_GroupNode.h"
#include "COM_SocketProxyNode.h"
#include "COM_SetColorOperation.h"
#include "COM_ExecutionSystemHelper.h"
GroupNode::GroupNode(bNode *editorNode) : Node(editorNode)
@@ -31,7 +32,18 @@ GroupNode::GroupNode(bNode *editorNode) : Node(editorNode)
void GroupNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
/* pass */
if (this->getbNode()->id == NULL) {
/* this is a really bad situation - bring on the pink! - so artists know this is bad */
const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f};
int index;
vector<OutputSocket *> &outputsockets = this->getOutputSockets();
for (index = 0; index < outputsockets.size(); index++) {
SetColorOperation *operation = new SetColorOperation();
this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket());
operation->setChannels(warning_color);
graph->addOperation(operation);
}
}
}
void GroupNode::ungroup(ExecutionSystem &system)
@@ -46,8 +58,10 @@ void GroupNode::ungroup(ExecutionSystem &system)
int nodes_start = system.getNodes().size();
/* missing node group datablock can happen with library linking */
if (!subtree)
if (!subtree) {
/* this error case its handled in convertToOperations() so we don't get un-convertred sockets */
return;
}
for (index = 0; index < inputsockets.size(); index++) {
InputSocket *inputSocket = inputsockets[index];

View File

@@ -31,6 +31,15 @@ extern "C" {
vector<DistortionCache *> s_cache;
void deintializeDistortionCache(void)
{
while (s_cache.size()>0)
{
DistortionCache * cache = s_cache.back();
s_cache.pop_back();
delete cache;
}
}
MovieDistortionOperation::MovieDistortionOperation(bool distortion) : NodeOperation()
{
@@ -52,12 +61,14 @@ void MovieDistortionOperation::initExecution()
BKE_movieclip_user_set_frame(&clipUser, this->m_framenumber);
BKE_movieclip_get_size(this->m_movieClip, &clipUser, &calibration_width, &calibration_height);
for (unsigned int i = 0; i < s_cache.size(); i++) {
for (unsigned int i = 0; i < s_cache.size(); i++)
{
DistortionCache *c = (DistortionCache *)s_cache[i];
if (c->isCacheFor(this->m_movieClip, this->m_width, this->m_height,
calibration_width, calibration_height, this->m_distortion))
{
this->m_cache = c;
this->m_cache->updateLastUsage();
return;
}
}
@@ -75,6 +86,21 @@ void MovieDistortionOperation::deinitExecution()
{
this->m_inputOperation = NULL;
this->m_movieClip = NULL;
while (s_cache.size() > COM_DISTORTIONCACHE_MAXSIZE)
{
double minTime = PIL_check_seconds_timer();
vector<DistortionCache*>::iterator minTimeIterator = s_cache.begin();
for (vector<DistortionCache*>::iterator it = s_cache.begin(); it < s_cache.end(); it ++)
{
DistortionCache * cache = *it;
if (cache->getTimeLastUsage()<minTime)
{
minTime = cache->getTimeLastUsage();
minTimeIterator = it;
}
}
s_cache.erase(minTimeIterator);
}
}

View File

@@ -27,8 +27,11 @@
#include "DNA_movieclip_types.h"
extern "C" {
#include "BKE_tracking.h"
#include "PIL_time.h"
}
#define COM_DISTORTIONCACHE_MAXSIZE 10
class DistortionCache {
private:
float m_k1;
@@ -44,6 +47,8 @@ private:
bool m_inverted;
float *m_buffer;
int *m_bufferCalculated;
double timeLastUsage;
public:
DistortionCache(MovieClip *movieclip, int width, int height, int calibration_width, int calibration_height, bool inverted) {
this->m_k1 = movieclip->tracking.camera.k1;
@@ -62,7 +67,29 @@ public:
for (int i = 0; i < this->m_width * this->m_height; i++) {
this->m_bufferCalculated[i] = 0;
}
this->updateLastUsage();
}
~DistortionCache() {
if (this->m_buffer) {
delete[] this->m_buffer;
this->m_buffer = NULL;
}
if (this->m_bufferCalculated) {
delete[] this->m_bufferCalculated;
this->m_bufferCalculated = NULL;
}
}
void updateLastUsage() {
this->timeLastUsage = PIL_check_seconds_timer();
}
inline double getTimeLastUsage() {
return this->timeLastUsage;
}
bool isCacheFor(MovieClip *movieclip, int width, int height, int calibration_width, int claibration_height, bool inverted) {
return this->m_k1 == movieclip->tracking.camera.k1 &&
this->m_k2 == movieclip->tracking.camera.k2 &&
@@ -139,4 +166,6 @@ public:
void setFramenumber(int framenumber) { this->m_framenumber = framenumber; }
};
void deintializeDistortionCache(void);
#endif

View File

@@ -21,9 +21,10 @@
*/
#include "COM_ScreenLensDistortionOperation.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
extern "C" {
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_rand.h"
}
@@ -69,18 +70,18 @@ void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y,
const float uv_dot = u * u + v * v;
int sta = 0, mid = 0, end = 0;
if ((t = 1.f - this->m_kr4 * uv_dot) >= 0.f) {
d = 1.f / (1.f + sqrtf(t));
if ((t = 1.0f - this->m_kr4 * uv_dot) >= 0.0f) {
d = 1.0f / (1.0f + sqrtf(t));
ln[0] = (u * d + 0.5f) * width - 0.5f, ln[1] = (v * d + 0.5f) * height - 0.5f;
sta = 1;
}
if ((t = 1.f - this->m_kg4 * uv_dot) >= 0.f) {
d = 1.f / (1.f + sqrtf(t));
if ((t = 1.0f - this->m_kg4 * uv_dot) >= 0.0f) {
d = 1.0f / (1.0f + sqrtf(t));
ln[2] = (u * d + 0.5f) * width - 0.5f, ln[3] = (v * d + 0.5f) * height - 0.5f;
mid = 1;
}
if ((t = 1.f - this->m_kb4 * uv_dot) >= 0.f) {
d = 1.f / (1.f + sqrtf(t));
if ((t = 1.0f - this->m_kb4 * uv_dot) >= 0.0f) {
d = 1.0f / (1.0f + sqrtf(t));
ln[4] = (u * d + 0.5f) * width - 0.5f, ln[5] = (v * d + 0.5f) * height - 0.5f;
end = 1;
}
@@ -92,36 +93,36 @@ void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y,
{
// RG
const int dx = ln[2] - ln[0], dy = ln[3] - ln[1];
const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.f;
const int ds = (int)(jit ? ((dsf < 4.f) ? 2.f : sqrtf(dsf)) : dsf);
const float sd = 1.f / (float)ds;
const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.0f;
const int ds = (int)(jit ? ((dsf < 4.0f) ? 2.0f : sqrtf(dsf)) : dsf);
const float sd = 1.0f / (float)ds;
for (z = 0; z < ds; ++z) {
const float tz = ((float)z + (jit ? BLI_frand() : 0.5f)) * sd;
t = 1.0f - (this->m_kr4 + tz * this->m_drg) * uv_dot;
d = 1.0f / (1.f + sqrtf(t));
d = 1.0f / (1.0f + sqrtf(t));
const float nx = (u * d + 0.5f) * width - 0.5f;
const float ny = (v * d + 0.5f) * height - 0.5f;
buffer->readCubic(color, nx, ny);
tc[0] += (1.f - tz) * color[0], tc[1] += tz * color[1];
tc[0] += (1.0f - tz) * color[0], tc[1] += tz * color[1];
dr++, dg++;
}
}
{
// GB
const int dx = ln[4] - ln[2], dy = ln[5] - ln[3];
const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.f;
const int ds = (int)(jit ? ((dsf < 4.f) ? 2.f : sqrtf(dsf)) : dsf);
const float sd = 1.f / (float)ds;
const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.0f;
const int ds = (int)(jit ? ((dsf < 4.0f) ? 2.0f : sqrtf(dsf)) : dsf);
const float sd = 1.0f / (float)ds;
for (z = 0; z < ds; ++z) {
const float tz = ((float)z + (jit ? BLI_frand() : 0.5f)) * sd;
t = 1.f - (this->m_kg4 + tz * this->m_dgb) * uv_dot;
d = 1.f / (1.f + sqrtf(t));
t = 1.0f - (this->m_kg4 + tz * this->m_dgb) * uv_dot;
d = 1.0f / (1.0f + sqrtf(t));
const float nx = (u * d + 0.5f) * width - 0.5f;
const float ny = (v * d + 0.5f) * height - 0.5f;
buffer->readCubic(color, nx, ny);
tc[1] += (1.f - tz) * color[1], tc[2] += tz * color[2];
tc[1] += (1.0f - tz) * color[1], tc[2] += tz * color[2];
dg++, db++;
}
@@ -162,16 +163,16 @@ void ScreenLensDistortionOperation::determineUV(float result[4], float x, float
const float u = this->m_sc * ((x + 0.5f) - this->m_cx) / this->m_cx;
const float uv_dot = u * u + v * v;
if ((t = 1.f - this->m_kr4 * uv_dot) >= 0.f) {
d = 1.f / (1.f + sqrtf(t));
if ((t = 1.0f - this->m_kr4 * uv_dot) >= 0.0f) {
d = 1.0f / (1.0f + sqrtf(t));
ln[0] = (u * d + 0.5f) * width - 0.5f, ln[1] = (v * d + 0.5f) * height - 0.5f;
}
if ((t = 1.f - this->m_kg4 * uv_dot) >= 0.f) {
d = 1.f / (1.f + sqrtf(t));
if ((t = 1.0f - this->m_kg4 * uv_dot) >= 0.0f) {
d = 1.0f / (1.0f + sqrtf(t));
ln[2] = (u * d + 0.5f) * width - 0.5f, ln[3] = (v * d + 0.5f) * height - 0.5f;
}
if ((t = 1.f - this->m_kb4 * uv_dot) >= 0.f) {
d = 1.f / (1.f + sqrtf(t));
if ((t = 1.0f - this->m_kb4 * uv_dot) >= 0.0f) {
d = 1.0f / (1.0f + sqrtf(t));
ln[4] = (u * d + 0.5f) * width - 0.5f, ln[5] = (v * d + 0.5f) * height - 0.5f;
}
@@ -180,14 +181,14 @@ void ScreenLensDistortionOperation::determineUV(float result[4], float x, float
{
// RG
const int dx = ln[2] - ln[0], dy = ln[3] - ln[1];
const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.f;
const int ds = (int)(jit ? ((dsf < 4.f) ? 2.f : sqrtf(dsf)) : dsf);
const float sd = 1.f / (float)ds;
const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.0f;
const int ds = (int)(jit ? ((dsf < 4.0f) ? 2.0f : sqrtf(dsf)) : dsf);
const float sd = 1.0f / (float)ds;
z = ds;
const float tz = ((float)z + (1.0f)) * sd;
t = 1.0f - (this->m_kr4 + tz * this->m_drg) * uv_dot;
d = 1.0f / (1.f + sqrtf(t));
d = 1.0f / (1.0f + sqrtf(t));
const float nx = (u * d + 0.5f) * width - 0.5f;
const float ny = (v * d + 0.5f) * height - 0.5f;
result[0] = nx;
@@ -196,14 +197,14 @@ void ScreenLensDistortionOperation::determineUV(float result[4], float x, float
{
// GB
const int dx = ln[4] - ln[2], dy = ln[5] - ln[3];
const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.f;
const int ds = (int)(jit ? ((dsf < 4.f) ? 2.f : sqrtf(dsf)) : dsf);
const float sd = 1.f / (float)ds;
const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.0f;
const int ds = (int)(jit ? ((dsf < 4.0f) ? 2.0f : sqrtf(dsf)) : dsf);
const float sd = 1.0f / (float)ds;
z = ds;
const float tz = ((float)z + (1.0f)) * sd;
t = 1.f - (this->m_kg4 + tz * this->m_dgb) * uv_dot;
d = 1.f / (1.f + sqrtf(t));
t = 1.0f - (this->m_kg4 + tz * this->m_dgb) * uv_dot;
d = 1.0f / (1.0f + sqrtf(t));
const float nx = (u * d + 0.5f) * width - 0.5f;
const float ny = (v * d + 0.5f) * height - 0.5f;
result[2] = nx;
@@ -231,11 +232,12 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input
#define MARGIN 96
#define UPDATE_INPUT \
#define UPDATE_INPUT { \
newInput.xmin = MIN3(newInput.xmin, coords[0], coords[2]); \
newInput.ymin = MIN3(newInput.ymin, coords[1], coords[3]); \
newInput.xmax = MAX3(newInput.xmax, coords[0], coords[2]); \
newInput.ymax = MAX3(newInput.ymax, coords[1], coords[3]);
newInput.ymax = MAX3(newInput.ymax, coords[1], coords[3]); \
} (void)0
rcti newInput;
float margin;
@@ -253,10 +255,9 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input
UPDATE_INPUT;
determineUV(coords, input->xmax, input->ymin);
UPDATE_INPUT;
margin = (ABS(this->m_distortion) + this->m_dispersion) * MARGIN + 2.0f;
margin = (fabsf(this->m_distortion) + this->m_dispersion) * MARGIN + 2.0f;
}
else
{
else {
determineUV(coords, input->xmin, input->ymin, 1.0f, 1.0f);
newInput.xmin = coords[0];
newInput.ymin = coords[1];
@@ -281,6 +282,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input
determineUV(coords, input->xmax, input->ymin, 1.0f, 1.0f);
UPDATE_INPUT;
margin = MARGIN;
printf("margin b: %f\n", margin);
}
#undef UPDATE_INPUT
@@ -290,7 +292,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input
newInput.ymax += margin;
operation = getInputOperation(0);
if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output) ) {
if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output)) {
return true;
}
return false;
@@ -304,13 +306,14 @@ void ScreenLensDistortionOperation::updateVariables(float distortion, float disp
this->m_kr = maxf(minf((this->m_kg + d), 1.0f), -0.999f);
this->m_kb = maxf(minf((this->m_kg - d), 1.0f), -0.999f);
this->m_maxk = MAX3(this->m_kr, this->m_kg, this->m_kb);
this->m_sc = (this->m_data->fit && (this->m_maxk > 0.f)) ? (1.f / (1.f + 2.f * this->m_maxk)) : (1.f / (1.f + this->m_maxk));
this->m_drg = 4.f * (this->m_kg - this->m_kr);
this->m_dgb = 4.f * (this->m_kb - this->m_kg);
this->m_sc = (this->m_data->fit && (this->m_maxk > 0.0f)) ? (1.0f / (1.0f + 2.0f * this->m_maxk)) :
(1.0f / (1.0f + this->m_maxk));
this->m_drg = 4.0f * (this->m_kg - this->m_kr);
this->m_dgb = 4.0f * (this->m_kb - this->m_kg);
this->m_kr4 = this->m_kr * 4.0f;
this->m_kg4 = this->m_kg * 4.0f;
this->m_kb4 = this->m_kb * 4.0f;
this->m_kb4 = this->m_kb * 4.0f;
}
void ScreenLensDistortionOperation::updateDispersionAndDistortion()

View File

@@ -49,8 +49,8 @@ public:
const float getChannel3() { return this->m_channel3; }
void setChannel3(float value) { this->m_channel3 = value; }
const float getChannel4() { return this->m_channel4; }
void setChannel4(float value) { this->m_channel4 = value; }
void setChannels(float value[4])
void setChannel4(const float value) { this->m_channel4 = value; }
void setChannels(const float value[4])
{
this->m_channel1 = value[0];
this->m_channel2 = value[1];

View File

@@ -268,7 +268,7 @@ int view3d_get_view_aligned_coordinate(struct ViewContext *vc, float fp[3], cons
void view3d_get_transformation(const struct ARegion *ar, struct RegionView3D *rv3d, struct Object *ob, struct bglMats *mats);
/* XXX should move to BLI_math */
int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2);
int edge_inside_circle(int centx, int centy, int rad, int x1, int y1, int x2, int y2);
/* get 3d region from context, also if mouse is in header or toolbar */
struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);

View File

@@ -64,6 +64,7 @@ static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4],
ED_view3d_project_float_v2(ar, co1, vec1, mat);
ED_view3d_project_float_v2(ar, co2, vec2, mat);
/* TODO: use dist_squared_to_line_segment_v2() looks like we only ever use for comparison */
return dist_to_line_segment_v2(mvalf, vec1, vec2);
}
@@ -111,8 +112,8 @@ static float edbm_rip_edge_side_measure(BMEdge *e, BMLoop *e_l,
score = len_v2v2(e_v1_co, e_v2_co);
if (dist_to_line_segment_v2(fmval_tweak, e_v1_co, e_v2_co) >
dist_to_line_segment_v2(fmval, e_v1_co, e_v2_co))
if (dist_squared_to_line_segment_v2(fmval_tweak, e_v1_co, e_v2_co) >
dist_squared_to_line_segment_v2(fmval, e_v1_co, e_v2_co))
{
return score;
}

View File

@@ -161,12 +161,12 @@ static float dist_to_rect(float co[2], float pos[2], float min[2], float max[2])
float v1[2] = {min[0], min[1]}, v2[2] = {max[0], min[1]};
float v3[2] = {max[0], max[1]}, v4[2] = {min[0], max[1]};
d1 = dist_to_line_segment_v2(p, v1, v2);
d2 = dist_to_line_segment_v2(p, v2, v3);
d3 = dist_to_line_segment_v2(p, v3, v4);
d4 = dist_to_line_segment_v2(p, v4, v1);
d1 = dist_squared_to_line_segment_v2(p, v1, v2);
d2 = dist_squared_to_line_segment_v2(p, v2, v3);
d3 = dist_squared_to_line_segment_v2(p, v3, v4);
d4 = dist_squared_to_line_segment_v2(p, v4, v1);
return MIN4(d1, d2, d3, d4);
return sqrtf(MIN4(d1, d2, d3, d4));
}
static float dist_to_crns(float co[2], float pos[2], float crns[4][2])
@@ -176,12 +176,12 @@ static float dist_to_crns(float co[2], float pos[2], float crns[4][2])
float *v1 = crns[0], *v2 = crns[1];
float *v3 = crns[2], *v4 = crns[3];
d1 = dist_to_line_segment_v2(p, v1, v2);
d2 = dist_to_line_segment_v2(p, v2, v3);
d3 = dist_to_line_segment_v2(p, v3, v4);
d4 = dist_to_line_segment_v2(p, v4, v1);
d1 = dist_squared_to_line_segment_v2(p, v1, v2);
d2 = dist_squared_to_line_segment_v2(p, v2, v3);
d3 = dist_squared_to_line_segment_v2(p, v3, v4);
d4 = dist_squared_to_line_segment_v2(p, v4, v1);
return MIN4(d1, d2, d3, d4);
return sqrtf(MIN4(d1, d2, d3, d4));
}
static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, ListBase *tracksbase, float co[2])

View File

@@ -704,7 +704,9 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
/* draw the main strip body */
if (is_single_image) { /* single image */
draw_shadedstrip(seq, background_col, BKE_sequence_tx_get_final_left(seq, 0), y1, BKE_sequence_tx_get_final_right(seq, 0), y2);
draw_shadedstrip(seq, background_col,
BKE_sequence_tx_get_final_left(seq, 0), y1,
BKE_sequence_tx_get_final_right(seq, 0), y2);
}
else { /* normal operation */
draw_shadedstrip(seq, background_col, x1, y1, x2, y2);
@@ -745,6 +747,17 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
glDisable(GL_BLEND);
}
if (!BKE_seqence_is_valid_check(seq)) {
glEnable(GL_POLYGON_STIPPLE);
/* panic! */
glColor4ub(255, 0, 0, 255);
glPolygonStipple(stipple_diag_stripes_pos);
glRectf(x1, y1, x2, y2);
glDisable(GL_POLYGON_STIPPLE);
}
get_seq_color3ubv(scene, seq, col);
if (G.moving && (seq->flag & SELECT)) {
if (seq->flag & SEQ_OVERLAP) {

View File

@@ -1523,26 +1523,28 @@ typedef struct BoxSelectUserData {
int select, pass, done;
} BoxSelectUserData;
int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2)
int edge_inside_circle(int centx, int centy, int rad, int x1, int y1, int x2, int y2)
{
int radsq = rad * rad;
float v1[2], v2[2], v3[2];
/* check points in circle itself */
if ( (x1 - centx) * (x1 - centx) + (y1 - centy) * (y1 - centy) <= radsq) return 1;
if ( (x2 - centx) * (x2 - centx) + (y2 - centy) * (y2 - centy) <= radsq) return 1;
/* pointdistline */
v3[0] = centx;
v3[1] = centy;
v1[0] = x1;
v1[1] = y1;
v2[0] = x2;
v2[1] = y2;
if (dist_to_line_segment_v2(v3, v1, v2) < (float)rad) return 1;
return 0;
if ( (x1 - centx) * (x1 - centx) + (y1 - centy) * (y1 - centy) <= radsq) {
return TRUE;
}
else if ( (x2 - centx) * (x2 - centx) + (y2 - centy) * (y2 - centy) <= radsq) {
return TRUE;
}
else {
const float cent[2] = {centx, centy};
const float v1[2] = {x1, y1};
const float v2[2] = {x2, y2};
/* pointdistline */
if (dist_squared_to_line_segment_v2(cent, v1, v2) < (float)radsq) {
return TRUE;
}
}
return FALSE;
}
static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
@@ -2192,7 +2194,7 @@ static void mesh_circle_doSelectEdge(void *userData, BMEdge *eed, int x0, int y0
{
CircleSelectUserData *data = userData;
if (edge_inside_circle(data->mval[0], data->mval[1], (short) data->radius, x0, y0, x1, y1)) {
if (edge_inside_circle(data->mval[0], data->mval[1], (int)data->radius, x0, y0, x1, y1)) {
BM_edge_select_set(data->vc->em->bm, eed, data->select);
}
}

View File

@@ -680,10 +680,10 @@ void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, const float
BMLoop *l;
BMIter iter, liter;
MLoopUV *luv, *nextluv;
float mindist, dist;
float mindist_squared, dist_squared;
int i;
mindist = 1e10f;
mindist_squared = 1e10f;
memset(hit, 0, sizeof(*hit));
BM_mesh_elem_index_ensure(em->bm, BM_VERT);
@@ -698,9 +698,9 @@ void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, const float
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
nextluv = CustomData_bmesh_get(&em->bm->ldata, l->next->head.data, CD_MLOOPUV);
dist = dist_to_line_segment_v2(co, luv->uv, nextluv->uv);
dist_squared = dist_squared_to_line_segment_v2(co, luv->uv, nextluv->uv);
if (dist < mindist) {
if (dist_squared < mindist_squared) {
hit->tf = tf;
hit->efa = efa;
@@ -712,7 +712,7 @@ void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, const float
hit->vert1 = BM_elem_index_get(hit->l->v);
hit->vert2 = BM_elem_index_get(hit->l->next->v);
mindist = dist;
mindist_squared = dist_squared;
}
i++;

View File

@@ -436,6 +436,7 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1)
tbuf.zbuf_float = NULL;
for (a = 0; a < IB_MIPMAP_LEVELS; a++)
tbuf.mipmap[a] = NULL;
tbuf.dds_data.data = NULL;
/* set malloc flag */
tbuf.mall = ibuf2->mall;

View File

@@ -71,16 +71,17 @@ typedef struct bDeformGroup {
#define DG_LOCK_WEIGHT 1
/**
* The following illustrates the orientation of the
* The following illustrates the orientation of the
* bounding box in local space
*
*
*
* <pre>
*
* Z Y
* | /
* |/
* .-----X
*
*
*
*
* 2----------6
* /| /|
* / | / |
@@ -90,6 +91,7 @@ typedef struct bDeformGroup {
* | / | /
* |/ |/
* 0----------4
* </pre>
*/
typedef struct BoundBox {
float vec[8][3];

View File

@@ -102,8 +102,10 @@ typedef struct Strip {
} Strip;
/* The sequence structure is the basic struct used by any strip. each of the strips uses a different sequence structure.*/
/* WATCH IT: first part identical to ID (for use in ipo's) */
/* WATCH IT: first part identical to ID (for use in ipo's)
* the commend above is historic, probably we can drop the ID compatibility, but take care making this change */
/* WATCH ITv2, this is really a 'Strip' in the UI!, name is highly confusing */
typedef struct Sequence {
struct Sequence *next, *prev;
void *tmp; /* tmp var for copying, and tagging for linked selection */
@@ -127,12 +129,14 @@ typedef struct Sequence {
Strip *strip;
struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
struct Scene *scene;
struct Object *scene_camera; /* override scene camera */
/* these ID vars should never be NULL but can be when linked libs fail to load, so check on access */
struct Scene *scene;
struct Object *scene_camera; /* override scene camera */
struct MovieClip *clip; /* for MOVIECLIP strips */
struct Mask *mask; /* for MASK strips */
struct anim *anim; /* for MOVIE strips */
struct MovieClip *clip; /* for MOVIECLIP strips */
struct Mask *mask; /* for MASK strips */
float effect_fader;
float speed_fader;

View File

@@ -501,7 +501,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
prop = RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_DEFORM);
RNA_def_property_ui_text(prop, "Deform", "Bone does not deform any geometry");
RNA_def_property_ui_text(prop, "Deform", "Enable Bone to deform geometry");
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
prop = RNA_def_property(srna, "use_inherit_scale", PROP_BOOLEAN, PROP_NONE);

View File

@@ -1003,16 +1003,19 @@ static void rna_def_strip_color_balance(BlenderRNA *brna)
prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR);
RNA_def_property_ui_text(prop, "Lift", "Color balance lift (shadows)");
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR);
RNA_def_property_ui_text(prop, "Gamma", "Color balance gamma (midtones)");
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR);
RNA_def_property_ui_text(prop, "Gain", "Color balance gain (highlights)");
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
prop = RNA_def_property(srna, "invert_gain", PROP_BOOLEAN, PROP_NONE);
@@ -1344,6 +1347,7 @@ static void rna_def_filter_video(StructRNA *srna)
prop = RNA_def_property(srna, "color_multiply", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "mul");
RNA_def_property_range(prop, 0.0f, 20.0f);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop, "Multiply Colors", "");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
@@ -1351,6 +1355,7 @@ static void rna_def_filter_video(StructRNA *srna)
RNA_def_property_float_sdna(prop, NULL, "sat");
RNA_def_property_range(prop, 0.0f, 20.0f);
RNA_def_property_ui_range(prop, 0.0f, 2.0f, 3, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop, "Saturation", "");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");

View File

@@ -233,6 +233,7 @@ void mask_array(unsigned int mask, float filt[][3])
/**
* Index ordering, scanline based:
*
* <pre>
* --- --- ---
* | 2,0 | 2,1 | 2,2 |
* --- --- ---
@@ -240,6 +241,7 @@ void mask_array(unsigned int mask, float filt[][3])
* --- --- ---
* | 0,0 | 0,1 | 0,2 |
* --- --- ---
* </pre>
*/
void add_filt_fmask_coord(float filt[][3], const float col[4], float *rowbuf, int row_w, int col_h, int x, int y)

View File

@@ -36,6 +36,7 @@ set(INC
../makesdna
../makesrna
../nodes
../compositor
../render/extern/include
../../gameengine/BlenderRoutines
../../../intern/elbeem/extern

View File

@@ -10,7 +10,7 @@ sources = env.Glob('intern/*.c')
incs = '. ../editors/include ../python ../makesdna ../blenlib ../blenkernel'
incs += ' ../nodes ../imbuf ../blenloader ../render/extern/include'
incs += ' ../radiosity/extern/include'
incs += ' ../makesrna ../gpu ../blenfont ../bmesh'
incs += ' ../makesrna ../gpu ../blenfont ../bmesh ../compositor'
incs += ' #/intern/guardedalloc #/intern/memutil #/intern/ghost'
incs += ' #/intern/elbeem #/extern/glew/include'

View File

@@ -31,10 +31,11 @@
#ifndef __WM_TYPES_H__
#define __WM_TYPES_H__
/*
/**
* Overview of WM structs
* ======================
*
* <pre>
* > wmWindowManager (window manager stores a list of windows)
* > > wmWindow (window has an active screen)
* > > > bScreen (link to ScrAreas via 'areabase')
@@ -42,11 +43,12 @@
* > > > > > SpaceLink (base struct for space data for all different space types)
* > > > > ScrArea (stores multiple regions via 'regionbase')
* > > > > > ARegion
*
* </pre>
*
* Window Layout
* =============
*
* <pre>
* wmWindow -> bScreen
* +----------------------------------------------------------+
* |+-----------------------------------------+-------------+ |
@@ -66,11 +68,12 @@
* ||+-------++----------+-------------------+| | |
* |+-----------------------------------------+-------------+ |
* +----------------------------------------------------------+
*
* </pre>
*
* Space Data
* ==========
*
* <pre>
* ScrArea's store a list of space data (SpaceLinks), each of unique type.
* The first one is the displayed in the UI, others are added as needed.
*
@@ -88,14 +91,15 @@
* +-----------------------------+ |
* | |
* +------------------------------+
* </pre>
*
* A common way to get the space from the ScrArea:
*
* <pre>
* if (sa->spacetype == SPACE_VIEW3D) {
* View3D *v3d = sa->spacedata.first;
* ...
* }
*
* </pre>
*/
#ifdef __cplusplus

View File

@@ -112,6 +112,7 @@
#include "BKE_depsgraph.h"
#include "BKE_sound.h"
#include "COM_compositor.h"
#include "IMB_colormanagement.h"
@@ -212,7 +213,6 @@ void WM_init(bContext *C, int argc, const char **argv)
#ifdef WITH_COMPOSITOR
if (1) {
extern void *COM_linker_hack;
extern void *COM_execute;
COM_linker_hack = COM_execute;
}
#endif
@@ -416,6 +416,10 @@ void WM_exit_ext(bContext *C, const short do_python)
BKE_sequencer_free_clipboard(); /* sequencer.c */
BKE_tracking_clipboard_free();
#ifdef WITH_COMPOSITOR
COM_deinitialize();
#endif
free_blender(); /* blender.c, does entire library and spacetypes */
// free_matcopybuf();
free_anim_copybuf();