[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17346] branches/projection-paint/source/ blender/src/imagepaint.c: WIP commit before some optimizations,

2008-11-06 Thread Campbell Barton
Revision: 17346
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=17346
Author:   campbellbarton
Date: 2008-11-06 09:01:11 +0100 (Thu, 06 Nov 2008)

Log Message:
---
WIP commit before some optimizations,
fix for possible divide by zero.
added BarryCentricWeights2f(), returns weights for points outside the triangle.

Modified Paths:
--
branches/projection-paint/source/blender/src/imagepaint.c

Modified: branches/projection-paint/source/blender/src/imagepaint.c
===
--- branches/projection-paint/source/blender/src/imagepaint.c   2008-11-06 
03:31:25 UTC (rev 17345)
+++ branches/projection-paint/source/blender/src/imagepaint.c   2008-11-06 
08:01:11 UTC (rev 17346)
@@ -135,6 +135,7 @@
 
 // #define PROJ_DEBUG_PAINT 1
 // #define PROJ_DEBUG_NOSCANLINE 1
+//#define PROJ_DEBUG_NOSEAMBLEED 1
 
 /* projectFaceFlags options */
 #define PROJ_FACE_IGNORE   10/* When the face is hidden, backfacing 
or occluded */
@@ -144,7 +145,6 @@
 #define PROJ_FACE_SEAM314
 #define PROJ_FACE_SEAM415
 
-
 #define PROJ_BUCKET_NULL   0
 #define PROJ_BUCKET_INIT   10
 // #define PROJ_BUCKET_CLONE_INIT  11
@@ -191,8 +191,9 @@
short projectIsOcclude; /* Use raytraced occlusion? - 
ortherwise will paint right through to the back*/
short projectIsBackfaceCull;/* ignore faces with normals pointing 
away, skips a lot of raycasts if your normals are correctly flipped */
short projectIsOrtho;
+#ifndef PROJ_DEBUG_NOSEAMBLEED
float projectSeamBleed;
-   
+#endif
/* clone vars */
float cloneOfs[2];

@@ -411,21 +412,48 @@
}
 }
 
-/* assume they intersect */
-static void BarryCentricWeights2f(float v1[2], float v2[2], float v3[2], float 
pt[2], float w[3]) {
+/* The point must be inside the triangle */
+static void BaryCentricWeightsSimple2f(float v1[2], float v2[2], float v3[2], 
float pt[2], float w[3]) {
float wtot;
w[0] = AreaF2Dfl(v2, v3, pt);
w[1] = AreaF2Dfl(v3, v1, pt);
w[2] = AreaF2Dfl(v1, v2, pt);
wtot = w[0]+w[1]+w[2];
-   w[0]/=wtot;
-   w[1]/=wtot;
-   w[2]/=wtot;
+   if (wtot  0.0) { /* just incase */
+   w[0]/=wtot;
+   w[1]/=wtot;
+   w[2]/=wtot;
+   } else {
+   w[0] = w[1] = w[2] = 1.0/3.0; /* dummy values for zero area 
face */
+   }
 }
 
+/* also works for points outside the triangle */
+#define SIDE_OF_LINE(pa,pb,pp) 
((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1]))
+static void BaryCentricWeights2f(float v1[2], float v2[2], float v3[2], float 
pt[2], float w[3]) {
+   float wtot = AreaF2Dfl(v1, v2, v3);
+   if (wtot  0.0) {
+   w[0] = AreaF2Dfl(v2, v3, pt);
+   w[1] = AreaF2Dfl(v3, v1, pt);
+   w[2] = AreaF2Dfl(v1, v2, pt);
+   
+   /* negate weights when 'pt' is on the outer side of the the 
triangles edge */
+   if ((SIDE_OF_LINE(v2,v3, pt)0.0) != (SIDE_OF_LINE(v2,v3, 
v1)0.0)) w[0]/= -wtot;
+   else
w[0]/=  wtot;
+
+   if ((SIDE_OF_LINE(v3,v1, pt)0.0) != (SIDE_OF_LINE(v3,v1, 
v2)0.0)) w[1]/= -wtot;
+   else
w[1]/=  wtot;
+
+   if ((SIDE_OF_LINE(v1,v2, pt)0.0) != (SIDE_OF_LINE(v1,v2, 
v3)0.0)) w[2]/= -wtot;
+   else
w[2]/=  wtot;
+   } else {
+   w[0] = w[1] = w[2] = 1.0/3.0; /* dummy values for zero area 
face */
+   }
+}
+
 static float tri_depth_2d(float v1[3], float v2[3], float v3[3], float pt[2], 
float w[3])
 {
-   BarryCentricWeights2f(v1,v2,v3,pt,w);
+   BaryCentricWeightsSimple2f(v1,v2,v3,pt,w);
return (v1[2]*w[0]) + (v2[2]*w[1]) + (v3[2]*w[2]);
 }
 
@@ -749,6 +777,7 @@
 }

 
+#ifndef PROJ_DEBUG_NOSEAMBLEED
 static int check_seam(ProjectPaintState *ps, int orig_face, int orig_i1_fidx, 
int orig_i2_fidx)
 {
LinkNode *node;
@@ -825,6 +854,7 @@
(check_seam(ps, face_index, 2,0) ? PROJ_FACE_SEAM3 : 0);
}
 }
+#endif // PROJ_DEBUG_NOSEAMBLEED
 
 static float angleToLength(float angle)
 {
@@ -1004,7 +1034,7 @@
float pixelScreenCo[4] )
 {
float w[3];
-   BarryCentricWeights2f(uv1co,uv2co,uv3co,uv,w);
+   BaryCentricWeightsSimple2f(uv1co,uv2co,uv3co,uv,w);
pixelScreenCo[0] = v1co[0]*w[0] + v2co[0]*w[1] + v3co[0]*w[2];
pixelScreenCo[1] = v1co[1]*w[0] + v2co[1]*w[1] + v3co[1]*w[2];

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17348] branches/animsys2/source/blender/ src/editaction.c: AnimSys2: Dopesheet Bugfix

2008-11-06 Thread Joshua Leung
Revision: 17348
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=17348
Author:   aligorith
Date: 2008-11-06 12:26:09 +0100 (Thu, 06 Nov 2008)

Log Message:
---
AnimSys2: Dopesheet Bugfix

Made the Action Channel expand widgets easier to click on. Previously, clicks 
were only detected left of the widgets.

Modified Paths:
--
branches/animsys2/source/blender/src/editaction.c

Modified: branches/animsys2/source/blender/src/editaction.c
===
--- branches/animsys2/source/blender/src/editaction.c   2008-11-06 11:05:54 UTC 
(rev 17347)
+++ branches/animsys2/source/blender/src/editaction.c   2008-11-06 11:26:09 UTC 
(rev 17348)
@@ -4401,9 +4401,9 @@
case ACTTYPE_GROUP: 
{
bActionGroup *agrp= (bActionGroup *)act_channel;
-   short offset= (datatype == ACTCONT_DOPESHEET)? 
7 : 0;
+   short offset= (datatype == ACTCONT_DOPESHEET)? 
21 : 0;

-   if ((mval[0]  offset+17)  
(agrp-channels.first)) {
+   if ((mval[0]  (offset+17))  
(agrp-channels.first)) {
/* toggle expand */
agrp-flag ^= AGRP_EXPANDED;
}
@@ -4433,7 +4433,7 @@
case ACTTYPE_ACHAN:
{
bActionChannel *achan= (bActionChannel 
*)act_channel;
-   short offset= (datatype == ACTCONT_DOPESHEET)? 
7 : 0;
+   short offset= (datatype == ACTCONT_DOPESHEET)? 
21 : 0;

if (mval[0] = (NAMEWIDTH-16)) {
/* toggle protect */
@@ -4443,7 +4443,7 @@
/* toggle mute */
achan-ipo-muteipo = 
(achan-ipo-muteipo)? 0: 1;
}
-   else if (mval[0] = offset+17) {
+   else if (mval[0] = (offset+17)) {
/* toggle expand */
achan-flag ^= ACHAN_EXPANDED;
}   


___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17349] trunk/blender/source/gameengine/ VideoTexture/VideoFFmpeg.cpp: VideoTexture: fix compile error when FFmpeg is disabled.

2008-11-06 Thread Benoit Bolsee
Revision: 17349
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=17349
Author:   ben2610
Date: 2008-11-06 17:01:17 +0100 (Thu, 06 Nov 2008)

Log Message:
---
VideoTexture: fix compile error when FFmpeg is disabled.

Modified Paths:
--
trunk/blender/source/gameengine/VideoTexture/VideoFFmpeg.cpp

Modified: trunk/blender/source/gameengine/VideoTexture/VideoFFmpeg.cpp
===
--- trunk/blender/source/gameengine/VideoTexture/VideoFFmpeg.cpp
2008-11-06 11:26:09 UTC (rev 17348)
+++ trunk/blender/source/gameengine/VideoTexture/VideoFFmpeg.cpp
2008-11-06 16:01:17 UTC (rev 17349)
@@ -21,6 +21,8 @@
 */
 
 // INT64_C fix for some linux machines (C99ism)
+#ifdef WITH_FFMPEG
+
 #define __STDC_CONSTANT_MACROS
 #include stdint.h
 
@@ -33,7 +35,6 @@
 #include Exception.h
 #include VideoFFmpeg.h
 
-#ifdef WITH_FFMPEG
 
 // default framerate
 const double defFrameRate = 25.0;
@@ -274,6 +275,7 @@
if (m_imageName.Ptr() != filename)
m_imageName = filename;
m_preseek = 0;
+   m_avail = false;
play();
}
 


___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17351] trunk/blender/source/gameengine/ VideoTexture/VideoFFmpeg.cpp: VideoTexture: comment was misplaced after previous commit.

2008-11-06 Thread Benoit Bolsee
Revision: 17351
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=17351
Author:   ben2610
Date: 2008-11-07 00:52:47 +0100 (Fri, 07 Nov 2008)

Log Message:
---
VideoTexture: comment was misplaced after previous commit.

Modified Paths:
--
trunk/blender/source/gameengine/VideoTexture/VideoFFmpeg.cpp

Modified: trunk/blender/source/gameengine/VideoTexture/VideoFFmpeg.cpp
===
--- trunk/blender/source/gameengine/VideoTexture/VideoFFmpeg.cpp
2008-11-06 18:49:53 UTC (rev 17350)
+++ trunk/blender/source/gameengine/VideoTexture/VideoFFmpeg.cpp
2008-11-06 23:52:47 UTC (rev 17351)
@@ -20,9 +20,9 @@
 -
 */
 
-// INT64_C fix for some linux machines (C99ism)
 #ifdef WITH_FFMPEG
 
+// INT64_C fix for some linux machines (C99ism)
 #define __STDC_CONSTANT_MACROS
 #include stdint.h
 


___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17352] branches/blender2.5/blender/source /blender/makesrna: RNA

2008-11-06 Thread Brecht Van Lommel
Revision: 17352
  
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=revroot=bf-blenderrevision=17352
Author:   blendix
Date: 2008-11-07 03:58:25 +0100 (Fri, 07 Nov 2008)

Log Message:
---
RNA

* Added more error prints for wrong definitions, for cases that
  would laters cause problems compiling or crash at runtime, and
  also made messages more clear.
* Added some skeleton code for main/ID/mesh/vertex types for testing.
* Added support for automatic arrays as collections using SDNA.

* Changed how pointers to data work. Now they are always wrapped
  in a PointerRNA struct, which contains the data pointer and type,
  and also the data pointer and type of the ID datablock that this
  belongs to, since for example a vertex on it's own may not have
  enough information for some operations, it also needs the mesh.

* Added some code for defining dependencies with RNA, and looking up
  data with paths like: scenes[0].objects[Cube].data.verts[7].co.
  Note sure either will end up being used, this is experimental.

http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNA

Modified Paths:
--
branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
branches/blender2.5/blender/source/blender/makesrna/RNA_define.h
branches/blender2.5/blender/source/blender/makesrna/RNA_types.h
branches/blender2.5/blender/source/blender/makesrna/intern/SConscript
branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_internal.h
branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c

Added Paths:
---
branches/blender2.5/blender/source/blender/makesrna/intern/rna_ID.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_dependency.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_main.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_mesh.c

Modified: branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
===
--- branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
2008-11-06 23:52:47 UTC (rev 17351)
+++ branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
2008-11-07 02:58:25 UTC (rev 17352)
@@ -27,49 +27,90 @@
 
 struct bContext;
 struct BlenderRNA;
+struct StructRNA;
 struct PropertyRNA;
-struct StructRNA;
+struct PointerRNA;
 struct CollectionPropertyIterator;
+struct Main;
 
-/* Property */
+/* Pointer
+ *
+ * Currently only an RNA pointer to Main can be obtained, this
+ * should  be extended to allow making other pointers as well. */
 
-void RNA_property_notify(struct PropertyRNA *prop, struct bContext *C, void 
*data);
-int RNA_property_readonly(struct PropertyRNA *prop, struct bContext *C, void 
*data);
+void RNA_pointer_main_get(struct Main *main, struct PointerRNA *r_ptr);
 
-int RNA_property_boolean_get(struct PropertyRNA *prop, void *data);
-void RNA_property_boolean_set(struct PropertyRNA *prop, void *data, int value);
-int RNA_property_boolean_get_array(struct PropertyRNA *prop, void *data, int 
index);
-void RNA_property_boolean_set_array(struct PropertyRNA *prop, void *data, int 
index, int value);
+/* Property
+ *
+ * Access to struct properties. All this works with RNA pointers rather than
+ * direct pointers to the data. */
 
-int RNA_property_int_get(struct PropertyRNA *prop, void *data);
-void RNA_property_int_set(struct PropertyRNA *prop, void *data, int value);
-int RNA_property_int_get_array(struct PropertyRNA *prop, void *data, int 
index);
-void RNA_property_int_set_array(struct PropertyRNA *prop, void *data, int 
index, int value);
+int RNA_property_editable(struct PropertyRNA *prop, struct PointerRNA *ptr);
+int RNA_property_evaluated(struct PropertyRNA *prop, struct PointerRNA *ptr);
 
-float RNA_property_float_get(struct PropertyRNA *prop, void *data);
-void RNA_property_float_set(struct PropertyRNA *prop, void *data, float value);
-float RNA_property_float_get_array(struct PropertyRNA *prop, void *data, int 
index);
-void RNA_property_float_set_array(struct PropertyRNA *prop, void *data, int 
index, float value);
+void RNA_property_notify(struct PropertyRNA *prop, struct bContext *C, struct 
PointerRNA *ptr);
 
-void RNA_property_string_get(struct PropertyRNA *prop, void *data, char 
*value);
-int RNA_property_string_length(struct PropertyRNA *prop, void *data);
-void RNA_property_string_set(struct PropertyRNA *prop, void *data, const char 
*value);
+int RNA_property_boolean_get(struct PropertyRNA *prop, struct PointerRNA *ptr);
+void RNA_property_boolean_set(struct PropertyRNA *prop, struct PointerRNA 
*ptr, int value);
+int