[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38455] branches/soc-2011-tomato/source/ blender: Camera tracking integration
Sergey Sharybin
g.ulairi at gmail.com
Sun Jul 17 19:26:32 CEST 2011
Revision: 38455
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38455
Author: nazgul
Date: 2011-07-17 17:26:32 +0000 (Sun, 17 Jul 2011)
Log Message:
-----------
Camera tracking integration
===========================
Added compositor node "Movie Clip"
There could be some problems due to bug #27997, but
heneral workflow works fine here.
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/blenkernel/BKE_node.h
branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/node.c
branches/soc-2011-tomato/source/blender/blenlib/BLI_threads.h
branches/soc-2011-tomato/source/blender/blenlib/intern/threads.c
branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree_types.h
branches/soc-2011-tomato/source/blender/nodes/CMP_node.h
branches/soc-2011-tomato/source/blender/nodes/CMakeLists.txt
branches/soc-2011-tomato/source/blender/nodes/intern/CMP_util.h
Added Paths:
-----------
branches/soc-2011-tomato/source/blender/nodes/intern/CMP_nodes/CMP_movieclip.c
Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_node.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_node.h 2011-07-17 17:25:11 UTC (rev 38454)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_node.h 2011-07-17 17:26:32 UTC (rev 38455)
@@ -387,6 +387,7 @@
#define CMP_NODE_COLOR_MATTE 259
#define CMP_NODE_COLORBALANCE 260
#define CMP_NODE_HUECORRECT 261
+#define CMP_NODE_MOVIECLIP 262
#define CMP_NODE_GLARE 301
#define CMP_NODE_TONEMAP 302
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c 2011-07-17 17:25:11 UTC (rev 38454)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c 2011-07-17 17:26:32 UTC (rev 38455)
@@ -55,11 +55,13 @@
#include "DNA_movieclip_types.h"
#include "DNA_object_types.h" /* SELECT */
+#include "BLI_utildefines.h"
+
#include "BLI_blenlib.h"
-#include "BLI_utildefines.h"
#include "BLI_ghash.h"
+#include "BLI_math.h"
#include "BLI_mempool.h"
-#include "BLI_math.h"
+#include "BLI_threads.h"
#include "BKE_library.h"
#include "BKE_global.h"
@@ -288,14 +290,21 @@
ImBuf *ibuf= NULL;
int framenr= user?user->framenr:clip->lastframe;
+ /* cache is supposed to be threadsafe */
ibuf= get_imbuf_cache(clip, user);
if(!ibuf) {
if(clip->source==MCLIP_SRC_SEQUENCE)
ibuf= movieclip_load_sequence_file(clip, framenr);
- else
+ else {
+ /* loading of movies can't happen from concurent threads */
+ BLI_lock_thread(LOCK_MOVIECLIP);
+
ibuf= movieclip_load_movie_file(clip, framenr);
+ BLI_unlock_thread(LOCK_MOVIECLIP);
+ }
+
if(ibuf)
put_imbuf_cache(clip, user, ibuf);
}
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/node.c 2011-07-17 17:25:11 UTC (rev 38454)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/node.c 2011-07-17 17:26:32 UTC (rev 38455)
@@ -3305,6 +3305,10 @@
NodeTagChanged(ntree, node);
}
}
+ else if(node->type==CMP_NODE_MOVIECLIP) {
+ NodeTagChanged(ntree, node);
+ tagged= 1;
+ }
}
return tagged;
@@ -3451,6 +3455,7 @@
register_node_type_cmp_value(ntypelist);
register_node_type_cmp_rgb(ntypelist);
register_node_type_cmp_curve_time(ntypelist);
+ register_node_type_cmp_movieclip(ntypelist);
register_node_type_cmp_composite(ntypelist);
register_node_type_cmp_viewer(ntypelist);
Modified: branches/soc-2011-tomato/source/blender/blenlib/BLI_threads.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenlib/BLI_threads.h 2011-07-17 17:25:11 UTC (rev 38454)
+++ branches/soc-2011-tomato/source/blender/blenlib/BLI_threads.h 2011-07-17 17:26:32 UTC (rev 38455)
@@ -71,6 +71,7 @@
#define LOCK_CUSTOM1 3
#define LOCK_RCACHE 4
#define LOCK_OPENGL 5
+#define LOCK_MOVIECLIP 6
void BLI_lock_thread(int type);
void BLI_unlock_thread(int type);
Modified: branches/soc-2011-tomato/source/blender/blenlib/intern/threads.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenlib/intern/threads.c 2011-07-17 17:25:11 UTC (rev 38454)
+++ branches/soc-2011-tomato/source/blender/blenlib/intern/threads.c 2011-07-17 17:26:32 UTC (rev 38455)
@@ -114,6 +114,7 @@
static pthread_mutex_t _custom1_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _rcache_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t _opengl_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t _movieclip_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_t mainid;
static int thread_levels= 0; /* threads can be invoked inside threads */
@@ -349,6 +350,8 @@
pthread_mutex_lock(&_rcache_lock);
else if (type==LOCK_OPENGL)
pthread_mutex_lock(&_opengl_lock);
+ else if (type==LOCK_MOVIECLIP)
+ pthread_mutex_lock(&_movieclip_lock);
}
void BLI_unlock_thread(int type)
@@ -365,6 +368,8 @@
pthread_mutex_unlock(&_rcache_lock);
else if(type==LOCK_OPENGL)
pthread_mutex_unlock(&_opengl_lock);
+ else if(type==LOCK_MOVIECLIP)
+ pthread_mutex_unlock(&_movieclip_lock);
}
/* Mutex Locks */
Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c 2011-07-17 17:25:11 UTC (rev 38454)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c 2011-07-17 17:26:32 UTC (rev 38455)
@@ -155,8 +155,9 @@
glColor3f(0.0f, 0.0f, 0.0f);
glRectf(x, y, x+ibuf->x*sc->zoom, y+ibuf->y*sc->zoom);
} else {
- if(ibuf->rect_float)
+ if(ibuf->rect_float && !ibuf->rect) {
IMB_rect_from_float(ibuf);
+ }
if(ibuf->rect)
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
Modified: branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c 2011-07-17 17:25:11 UTC (rev 38454)
+++ branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c 2011-07-17 17:26:32 UTC (rev 38455)
@@ -1075,6 +1075,11 @@
uiItemR(layout, ptr, "mode", 0, "", ICON_NONE);
}
+static void node_composit_buts_movieclip(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL);
+}
+
/* only once called */
static void node_composit_set_butfunc(bNodeType *ntype)
{
@@ -1225,6 +1230,9 @@
case CMP_NODE_SEPYCCA:
ntype->uifunc=node_composit_buts_ycc;
break;
+ case CMP_NODE_MOVIECLIP:
+ ntype->uifunc= node_composit_buts_movieclip;
+ break;
default:
ntype->uifunc= NULL;
}
Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree.c 2011-07-17 17:25:11 UTC (rev 38454)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree.c 2011-07-17 17:26:32 UTC (rev 38455)
@@ -2268,7 +2268,21 @@
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
}
+static void def_cmp_movieclip(StructRNA *srna)
+{
+ PropertyRNA *prop;
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "MovieClip");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Movie Clip", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "MovieClipUser", "storage");
+}
+
+
/* -- Texture Nodes --------------------------------------------------------- */
static void def_tex_output(StructRNA *srna)
Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree_types.h 2011-07-17 17:25:11 UTC (rev 38454)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree_types.h 2011-07-17 17:26:32 UTC (rev 38455)
@@ -114,6 +114,7 @@
DefNode( CompositorNode, CMP_NODE_DIST_MATTE, def_cmp_distance_matte, "DISTANCE_MATTE", DistanceMatte, "Distance Matte", "" )
DefNode( CompositorNode, CMP_NODE_COLORBALANCE, def_cmp_colorbalance, "COLORBALANCE", ColorBalance, "Color Balance", "" )
DefNode( CompositorNode, CMP_NODE_HUECORRECT, def_cmp_huecorrect, "HUECORRECT", HueCorrect, "Hue Correct", "" )
+DefNode( CompositorNode, CMP_NODE_MOVIECLIP, def_cmp_movieclip, "MOVIECLIP", MovieClip, "MovieClip", "" )
DefNode( TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" )
DefNode( TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" )
Modified: branches/soc-2011-tomato/source/blender/nodes/CMP_node.h
===================================================================
--- branches/soc-2011-tomato/source/blender/nodes/CMP_node.h 2011-07-17 17:25:11 UTC (rev 38454)
+++ branches/soc-2011-tomato/source/blender/nodes/CMP_node.h 2011-07-17 17:26:32 UTC (rev 38455)
@@ -48,6 +48,7 @@
void register_node_type_cmp_value(ListBase *lb);
void register_node_type_cmp_rgb(ListBase *lb);
void register_node_type_cmp_curve_time(ListBase *lb);
+void register_node_type_cmp_movieclip(ListBase *lb);
void register_node_type_cmp_composite(ListBase *lb);
void register_node_type_cmp_viewer(ListBase *lb);
Modified: branches/soc-2011-tomato/source/blender/nodes/CMakeLists.txt
===================================================================
--- branches/soc-2011-tomato/source/blender/nodes/CMakeLists.txt 2011-07-17 17:25:11 UTC (rev 38454)
+++ branches/soc-2011-tomato/source/blender/nodes/CMakeLists.txt 2011-07-17 17:26:32 UTC (rev 38455)
@@ -75,6 +75,7 @@
intern/CMP_nodes/CMP_mapValue.c
intern/CMP_nodes/CMP_math.c
intern/CMP_nodes/CMP_mixrgb.c
+ intern/CMP_nodes/CMP_movieclip.c
intern/CMP_nodes/CMP_normal.c
intern/CMP_nodes/CMP_normalize.c
intern/CMP_nodes/CMP_outputFile.c
Added: branches/soc-2011-tomato/source/blender/nodes/intern/CMP_nodes/CMP_movieclip.c
===================================================================
--- branches/soc-2011-tomato/source/blender/nodes/intern/CMP_nodes/CMP_movieclip.c (rev 0)
+++ branches/soc-2011-tomato/source/blender/nodes/intern/CMP_nodes/CMP_movieclip.c 2011-07-17 17:26:32 UTC (rev 38455)
@@ -0,0 +1,157 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list