[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37088] trunk/blender/source/blender/ python: mathutils support for color arithmetic, also some minor whitespace edits.

2011-06-02 Thread Campbell Barton
Revision: 37088
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37088
Author:   campbellbarton
Date: 2011-06-02 08:29:16 + (Thu, 02 Jun 2011)
Log Message:
---
mathutils support for color arithmetic, also some minor whitespace edits. 

Modified Paths:
--
trunk/blender/source/blender/python/BPY_extern.h
trunk/blender/source/blender/python/generic/bgl.c
trunk/blender/source/blender/python/generic/bgl.h
trunk/blender/source/blender/python/generic/bpy_internal_import.c
trunk/blender/source/blender/python/generic/mathutils_Color.c
trunk/blender/source/blender/python/generic/mathutils_Euler.c
trunk/blender/source/blender/python/generic/mathutils_Matrix.c
trunk/blender/source/blender/python/generic/mathutils_Vector.c
trunk/blender/source/blender/python/generic/mathutils_geometry.c
trunk/blender/source/blender/python/intern/bpy.c
trunk/blender/source/blender/python/intern/bpy.h
trunk/blender/source/blender/python/intern/bpy_app.h
trunk/blender/source/blender/python/intern/bpy_driver.c
trunk/blender/source/blender/python/intern/bpy_interface.c
trunk/blender/source/blender/python/intern/bpy_library.c
trunk/blender/source/blender/python/intern/bpy_props.c
trunk/blender/source/blender/python/intern/bpy_props.h
trunk/blender/source/blender/python/intern/bpy_rna.c
trunk/blender/source/blender/python/intern/bpy_rna.h

Modified: trunk/blender/source/blender/python/BPY_extern.h
===
--- trunk/blender/source/blender/python/BPY_extern.h2011-06-02 04:58:27 UTC 
(rev 37087)
+++ trunk/blender/source/blender/python/BPY_extern.h2011-06-02 08:29:16 UTC 
(rev 37088)
@@ -67,14 +67,14 @@
 // void BPY_free_pyconstraint_links(struct Text *text);
 //
 void BPY_python_start(int argc, const char **argv);
-void BPY_python_end( void );
-// void init_syspath( int first_time );
-// void syspath_append( char *dir );
-// void BPY_rebuild_syspath( void );
-// int BPY_path_update( void );
+void BPY_python_end(void);
+// void init_syspath(int first_time);
+// void syspath_append(char *dir);
+// void BPY_rebuild_syspath(void);
+// int BPY_path_update(void);
 //
-// int BPY_Err_getLinenumber( void );
-// const char *BPY_Err_getFilename( void );
+// int BPY_Err_getLinenumber(void);
+// const char *BPY_Err_getFilename(void);
 
 /* 2.5 UI Scripts */
 intBPY_filepath_exec(struct bContext *C, const char *filepath, 
struct ReportList *reports);

Modified: trunk/blender/source/blender/python/generic/bgl.c
===
--- trunk/blender/source/blender/python/generic/bgl.c   2011-06-02 04:58:27 UTC 
(rev 37087)
+++ trunk/blender/source/blender/python/generic/bgl.c   2011-06-02 08:29:16 UTC 
(rev 37088)
@@ -62,16 +62,16 @@
 buffer which is twice as deep as it is wide or high.
 );
 
-static PyObject *Method_Buffer( PyObject * self, PyObject *args );
+static PyObject *Method_Buffer(PyObject *self, PyObject *args);
 
 /* Buffer sequence methods */
 
-static int Buffer_len( PyObject * self );
-static PyObject *Buffer_item( PyObject * self, int i );
-static PyObject *Buffer_slice( PyObject * self, int begin, int end );
-static int Buffer_ass_item( PyObject * self, int i, PyObject * v );
-static int Buffer_ass_slice( PyObject * self, int begin, int end,
-PyObject * seq );
+static int Buffer_len(PyObject *self);
+static PyObject *Buffer_item(PyObject *self, int i);
+static PyObject *Buffer_slice(PyObject *self, int begin, int end);
+static int Buffer_ass_item(PyObject *self, int i, PyObject *v);
+static int Buffer_ass_slice(PyObject *self, int begin, int end,
+PyObject *seq);
 
 static PySequenceMethods Buffer_SeqMethods = {
( lenfunc ) Buffer_len, 
/*sq_length */
@@ -86,11 +86,11 @@
(ssizeargfunc) NULL,/* 
sq_inplace_repeat */
 };
 
-static void Buffer_dealloc( PyObject * self );
-static PyObject *Buffer_tolist( PyObject * self );
-static PyObject *Buffer_dimensions( PyObject * self );
-static PyObject *Buffer_getattr( PyObject * self, char *name );
-static PyObject *Buffer_repr( PyObject * self );
+static void Buffer_dealloc(PyObject *self);
+static PyObject *Buffer_tolist(PyObject *self);
+static PyObject *Buffer_dimensions(PyObject *self);
+static PyObject *Buffer_getattr(PyObject *self, char *name);
+static PyObject *Buffer_repr(PyObject *self);
 
 PyTypeObject BGL_bufferType = {
PyVarObject_HEAD_INIT(NULL, 0)

Modified: trunk/blender/source/blender/python/generic/bgl.h
===
--- trunk/blender/source/blender/python/generic/bgl.h   2011-06-02 04:58:27 UTC 
(rev 37087)
+++ 

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37089] trunk/lib/windows/wintab/INCLUDE/ wintab.h: fix compile on Windows

2011-06-02 Thread Andrea Weikert
Revision: 37089
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37089
Author:   elubie
Date: 2011-06-02 08:34:57 + (Thu, 02 Jun 2011)
Log Message:
---
fix compile on Windows
* renamed conflicting #define INT to INTEGRAL - this conflicts with #define in 
windows.h, and was a really badly chosen name for a macro!
* detected when this file threw off compiling of wglew.h, which uses the INT 
#define from windows.h

Modified Paths:
--
trunk/lib/windows/wintab/INCLUDE/wintab.h

Modified: trunk/lib/windows/wintab/INCLUDE/wintab.h
===
--- trunk/lib/windows/wintab/INCLUDE/wintab.h   2011-06-02 08:29:16 UTC (rev 
37088)
+++ trunk/lib/windows/wintab/INCLUDE/wintab.h   2011-06-02 08:34:57 UTC (rev 
37089)
@@ -84,18 +84,18 @@
 typedef DWORD FIX32;   /* fixed-point arithmetic type 
*/
 
 #ifndef NOFIX32
-   #define INT(x)  HIWORD(x)
+   #define INTEGRAL(x) HIWORD(x)
#define FRAC(x) LOWORD(x)
 
#define CASTFIX32(x)((FIX32)((x)*65536L))
 
-   #define ROUND(x)(INT(x) + (FRAC(x)  (WORD)0x8000))
+   #define ROUND(x)(INTEGRAL(x) + (FRAC(x)  (WORD)0x8000))
 
#define FIX_MUL(c, a, b)
\
(c = (((DWORD)FRAC(a) * FRAC(b))  16) +   \
-   (DWORD)INT(a) * FRAC(b) +   
\
-   (DWORD)INT(b) * FRAC(a) +   
\
-   ((DWORD)INT(a) * INT(b)  16))
+   (DWORD)INTEGRAL(a) * FRAC(b) +  
\
+   (DWORD)INTEGRAL(b) * FRAC(a) +  
\
+   ((DWORD)INTEGRAL(a) * INTEGRAL(b)  16))
 
#ifdef _WINDLL
#define FIX_DIV_SC static
@@ -111,7 +111,7 @@
temp = ((a / b)  16); 
\
rem = a % b;
\
btemp = b;  
\
-   if (INT(btemp)  256) { 
\
+   if (INTEGRAL(btemp)  256) {
\
rem = 8;  
\
}   
\
else {  
\

___
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 [37090] trunk/blender/source/blender/ makesrna/intern/rna_sequencer.c: fix [#27553] Weird resulsts when animating opacity on (color) strip

2011-06-02 Thread Campbell Barton
Revision: 37090
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37090
Author:   campbellbarton
Date: 2011-06-02 08:45:28 + (Thu, 02 Jun 2011)
Log Message:
---
fix [#27553] Weird resulsts when animating opacity on (color) strip

Modified Paths:
--
trunk/blender/source/blender/makesrna/intern/rna_sequencer.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
===
--- trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
2011-06-02 08:34:57 UTC (rev 37089)
+++ trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
2011-06-02 08:45:28 UTC (rev 37090)
@@ -588,11 +588,16 @@
 }
 
 /* do_versions? */
-static float rna_Sequence_opacity_get(PointerRNA *ptr) {
-   return ((Sequence*)(ptr-data))-blend_opacity / 100.0f;
+static float rna_Sequence_opacity_get(PointerRNA *ptr)
+{
+   Sequence *seq= (Sequence*)(ptr-data);
+   return seq-blend_opacity / 100.0f;
 }
-static void rna_Sequence_opacity_set(PointerRNA *ptr, float value) {
-   ((Sequence*)(ptr-data))-blend_opacity = value * 100.0f;
+static void rna_Sequence_opacity_set(PointerRNA *ptr, float value)
+{
+   Sequence *seq= (Sequence*)(ptr-data);
+   CLAMP(value, 0.0f, 1.0f);
+   seq-blend_opacity = value * 100.0f;
 }
 
 

___
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 [37091] trunk/blender/source/blender/ editors/space_view3d/view3d_view.c: fix [#27557] Linked object (camera) should not be able to set position by us

2011-06-02 Thread Campbell Barton
Revision: 37091
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37091
Author:   campbellbarton
Date: 2011-06-02 08:55:26 + (Thu, 02 Jun 2011)
Log Message:
---
fix [#27557] Linked object (camera) should not be able to set position by using 
camera to view operator

Modified Paths:
--
trunk/blender/source/blender/editors/space_view3d/view3d_view.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c 
2011-06-02 08:45:28 UTC (rev 37090)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c 
2011-06-02 08:55:26 UTC (rev 37091)
@@ -391,12 +391,15 @@
 
 static int view3d_setcameratoview_poll(bContext *C)
 {
-   View3D *v3d = CTX_wm_view3d(C);
-   RegionView3D *rv3d= CTX_wm_region_view3d(C);
+   View3D *v3d= CTX_wm_view3d(C);
+   if(v3d  v3d-camera  v3d-camera-id.lib==NULL) {
+   RegionView3D *rv3d= CTX_wm_region_view3d(C);
+   if(rv3d  !rv3d-viewlock) {
+   return 1;
+   }
+   }
 
-   if (v3d==NULL || v3d-camera==NULL) return 0;
-   if (rv3d  rv3d-viewlock != 0)return 0;
-   return 1;
+   return 0;
 }
 
 void VIEW3D_OT_setcameratoview(wmOperatorType *ot)

___
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 [37092] trunk/blender/source/blender/ python/intern/bpy_interface.c: committed this by mistake.

2011-06-02 Thread Campbell Barton
Revision: 37092
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37092
Author:   campbellbarton
Date: 2011-06-02 09:04:07 + (Thu, 02 Jun 2011)
Log Message:
---
committed this by mistake.

Modified Paths:
--
trunk/blender/source/blender/python/intern/bpy_interface.c

Modified: trunk/blender/source/blender/python/intern/bpy_interface.c
===
--- trunk/blender/source/blender/python/intern/bpy_interface.c  2011-06-02 
08:55:26 UTC (rev 37091)
+++ trunk/blender/source/blender/python/intern/bpy_interface.c  2011-06-02 
09:04:07 UTC (rev 37092)
@@ -171,8 +171,6 @@
 
 /* defined in AUD_C-API.cpp */
 extern PyObject *AUD_initPython(void);
-/* defined in gpu_python.c */
-extern PyObject *GPU_initPython(void);
 
 static struct _inittab bpy_internal_modules[]= {
{(char *)noise, BPyInit_noise},
@@ -181,7 +179,6 @@
{(char *)bgl, BPyInit_bgl},
{(char *)blf, BPyInit_blf},
{(char *)aud, AUD_initPython},
-   {(char *)gpu, GPU_initPython},
{NULL, NULL}
 };
 

___
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 [37093] trunk/lib/win64/wintab/INCLUDE/ wintab.h: The same compilation error fix as in with 32bit wintab file:

2011-06-02 Thread Sergey Sharybin
Revision: 37093
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37093
Author:   nazgul
Date: 2011-06-02 09:21:41 + (Thu, 02 Jun 2011)
Log Message:
---
The same compilation error fix as in with 32bit wintab file:
rename macro INT to INTEGRAL.

Modified Paths:
--
trunk/lib/win64/wintab/INCLUDE/wintab.h

Modified: trunk/lib/win64/wintab/INCLUDE/wintab.h
===
--- trunk/lib/win64/wintab/INCLUDE/wintab.h 2011-06-02 09:04:07 UTC (rev 
37092)
+++ trunk/lib/win64/wintab/INCLUDE/wintab.h 2011-06-02 09:21:41 UTC (rev 
37093)
@@ -81,18 +81,18 @@
 typedef DWORD FIX32;   /* fixed-point arithmetic type 
*/
 
 #ifndef NOFIX32
-   #define INT(x)  HIWORD(x)
+   #define INTEGRAL(x) HIWORD(x)
#define FRAC(x) LOWORD(x)
 
#define CASTFIX32(x)((FIX32)((x)*65536L))
 
-   #define ROUND(x)(INT(x) + (FRAC(x)  (WORD)0x8000))
+   #define ROUND(x)(INTEGRAL(x) + (FRAC(x)  (WORD)0x8000))
 
#define FIX_MUL(c, a, b)
\
(c = (((DWORD)FRAC(a) * FRAC(b))  16) +   \
-   (DWORD)INT(a) * FRAC(b) +   
\
-   (DWORD)INT(b) * FRAC(a) +   
\
-   ((DWORD)INT(a) * INT(b)  16))
+   (DWORD)INTEGRAL(a) * FRAC(b) +  
\
+   (DWORD)INTEGRAL(b) * FRAC(a) +  
\
+   ((DWORD)INTEGRAL(a) * INTEGRAL(b)  16))
 
#ifdef _WINDLL
#define FIX_DIV_SC static
@@ -108,7 +108,7 @@
temp = ((a / b)  16); \
rem = a % b;
\
btemp = b;  
\
-   if (INT(btemp)  256) { \
+   if (INTEGRAL(btemp)  256) {
\
rem = 8;  
\
}   
\
else {  
\

___
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 [37094] branches/soc-2011-garlic: Almost complete the i18n system, including:

2011-06-02 Thread xiao xiangquan
Revision: 37094
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37094
Author:   xiaoxiangquan
Date: 2011-06-02 11:22:22 + (Thu, 02 Jun 2011)
Log Message:
---
Almost complete the i18n system, including:
Copy unifont..ttf.gz from source tree to target datafile path( now ONLY works 
with cmake );
Set the locale the same with system's setting;
If need unicode font, unzip and load unifont when init ui styles;
Apply gettext() to labels in space_info.py, who are the main menu items.

Each of these should have been commit one by one. As they work well according 
to my tests, so I just lazily send a long list.

Modified Paths:
--
branches/soc-2011-garlic/release/scripts/startup/bl_ui/space_info.py
branches/soc-2011-garlic/source/blender/blenfont/BLF_api.h
branches/soc-2011-garlic/source/blender/blenfont/intern/blf.c
branches/soc-2011-garlic/source/blender/blenfont/intern/blf_lang.c
branches/soc-2011-garlic/source/blender/blenlib/BLI_fileops.h
branches/soc-2011-garlic/source/blender/blenlib/BLI_path_util.h
branches/soc-2011-garlic/source/blender/blenlib/intern/fileops.c
branches/soc-2011-garlic/source/blender/blenlib/intern/path_util.c
branches/soc-2011-garlic/source/blender/editors/datafiles/CMakeLists.txt
branches/soc-2011-garlic/source/blender/editors/include/ED_datafiles.h
branches/soc-2011-garlic/source/blender/editors/interface/interface_style.c
branches/soc-2011-garlic/source/blender/windowmanager/intern/wm_init_exit.c
branches/soc-2011-garlic/source/creator/CMakeLists.txt
branches/soc-2011-garlic/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp

Added Paths:
---
branches/soc-2011-garlic/release/datafiles/fonts/

branches/soc-2011-garlic/release/datafiles/fonts/unifont-5.1.20080907.ttf.zip
branches/soc-2011-garlic/source/blender/editors/datafiles/bunifont.ttf.c

Added: 
branches/soc-2011-garlic/release/datafiles/fonts/unifont-5.1.20080907.ttf.zip
===
(Binary files differ)


Property changes on: 
branches/soc-2011-garlic/release/datafiles/fonts/unifont-5.1.20080907.ttf.zip
___
Added: svn:executable
   + *
Added: svn:mime-type
   + application/octet-stream

Modified: branches/soc-2011-garlic/release/scripts/startup/bl_ui/space_info.py
===
--- branches/soc-2011-garlic/release/scripts/startup/bl_ui/space_info.py
2011-06-02 09:21:41 UTC (rev 37093)
+++ branches/soc-2011-garlic/release/scripts/startup/bl_ui/space_info.py
2011-06-02 11:22:22 UTC (rev 37094)
@@ -18,6 +18,7 @@
 
 # pep8 compliant
 import bpy
+from blf import gettext as _
 
 
 class INFO_HT_header(bpy.types.Header):
@@ -44,7 +45,7 @@
 sub.menu(INFO_MT_help)
 
 if window.screen.show_fullscreen:
-layout.operator(screen.back_to_previous, icon='SCREEN_BACK', 
text=Back to Previous)
+layout.operator(screen.back_to_previous, icon='SCREEN_BACK', 
text=_(Back to Previous))
 layout.separator()
 else:
 layout.template_ID(context.window, screen, new=screen.new, 
unlink=screen.delete)
@@ -70,11 +71,11 @@
 
 sinfo = context.space_data
 row = layout.row(align=True)
-row.prop(sinfo, show_report_debug, text=Debug)
-row.prop(sinfo, show_report_info, text=Info)
-row.prop(sinfo, show_report_operator, text=Operators)
-row.prop(sinfo, show_report_warning, text=Warnings)
-row.prop(sinfo, show_report_error, text=Errors)
+row.prop(sinfo, show_report_debug, text=_(Debug))
+row.prop(sinfo, show_report_info, text=_(Info))
+row.prop(sinfo, show_report_operator, text=_(Operators))
+row.prop(sinfo, show_report_warning, text=_(Warnings))
+row.prop(sinfo, show_report_error, text=_(Errors))
 
 row = layout.row()
 row.enabled = sinfo.show_report_operator
@@ -85,7 +86,7 @@
 
 
 class INFO_MT_report(bpy.types.Menu):
-bl_label = Report
+bl_label = _(Report)
 
 def draw(self, context):
 layout = self.layout
@@ -97,31 +98,31 @@
 
 
 class INFO_MT_file(bpy.types.Menu):
-bl_label = File
+bl_label = _(File);
 
 def draw(self, context):
 layout = self.layout
 
 layout.operator_context = 'EXEC_AREA'
-layout.operator(wm.read_homefile, text=New, icon='NEW')
+layout.operator(wm.read_homefile, text=_(New), icon='NEW')
 layout.operator_context = 'INVOKE_AREA'
-layout.operator(wm.open_mainfile, text=Open..., icon='FILE_FOLDER')
+layout.operator(wm.open_mainfile, text=_(Open...), 
icon='FILE_FOLDER')
 layout.menu(INFO_MT_file_open_recent)
 layout.operator(wm.recover_last_session, icon='RECOVER_LAST')
-layout.operator(wm.recover_auto_save, text=Recover Auto 

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37095] branches/soc-2011-pepper/source/ blender/editors/transform: Bugfix: Time Slide tool broken

2011-06-02 Thread Joshua Leung
Revision: 37095
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37095
Author:   aligorith
Date: 2011-06-02 11:51:38 + (Thu, 02 Jun 2011)
Log Message:
---
Bugfix: Time Slide tool broken

Dunno how long this has been broken for (*), but the Time Slide
transform tool in DopeSheet no longer did anything most of the time.
It appeared to be be caused by some blotched indexing code from ages
ago. I've fixed this problem, as well as preventing the case where it
would also give errors when only a single key was selected.

(*) Does anyone actually use this tool? IIRC, this was added during
Orange, though I can't find the commit for this anymore or why it was
added. Probably it might be better to just let it go...

Modified Paths:
--
branches/soc-2011-pepper/source/blender/editors/transform/transform.c

branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c

Modified: branches/soc-2011-pepper/source/blender/editors/transform/transform.c
===
--- branches/soc-2011-pepper/source/blender/editors/transform/transform.c   
2011-06-02 11:22:22 UTC (rev 37094)
+++ branches/soc-2011-pepper/source/blender/editors/transform/transform.c   
2011-06-02 11:51:38 UTC (rev 37095)
@@ -5801,8 +5801,8 @@
char str[200];
 
/* calculate mouse co-ordinates */
-   UI_view2d_region_to_view(v2d, mval[0], mval[0], cval[0], cval[1]);
-   UI_view2d_region_to_view(v2d, t-imval[0], t-imval[0], sval[0], 
sval[1]);
+   UI_view2d_region_to_view(v2d, mval[0], mval[1], cval[0], cval[1]);
+   UI_view2d_region_to_view(v2d, t-imval[0], t-imval[1], sval[0], 
sval[1]);
 
/* t-values[0] stores cval[0], which is the current mouse-pointer 
location (in frames) */
// XXX Need to be able to repeat this

Modified: 
branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c
===
--- 
branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c
   2011-06-02 11:22:22 UTC (rev 37094)
+++ 
branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c
   2011-06-02 11:51:38 UTC (rev 37095)
@@ -3129,13 +3129,22 @@
/* check if we're supposed to be setting minx/maxx for TimeSlide */
if (t-mode == TFM_TIME_SLIDE) {
float min=9.0f, max=-9.0f;
-   int i;

-   td= (t-data + 1);
-   for (i=1; i  count; i+=3, td+=3) {
-   if (min  *(td-val)) min= *(td-val);
-   if (max  *(td-val)) max= *(td-val);
+   if (count  1) {
+   /* search for min/max selected values to transform */
+   int i;
+   
+   td= t-data;
+   for (i=0; i  count; i++, td++) {
+   if (min  *(td-val)) min= *(td-val);
+   if (max  *(td-val)) max= *(td-val);
+   }
}
+   else {
+   /* just use the current frame ranges */
+   min = (float)PSFRA;
+   max = (float)PEFRA;
+   }

/* minx/maxx values used by TimeSlide are stored as a
 * calloced 2-float array in t-customData. This gets freed

___
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 [37096] branches/soc-2011-pepper/source/ blender/editors/transform/transform_conversions.c: Time-Slide Fix:

2011-06-02 Thread Joshua Leung
Revision: 37096
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37096
Author:   aligorith
Date: 2011-06-02 11:58:13 + (Thu, 02 Jun 2011)
Log Message:
---
Time-Slide Fix:

Second attempt at fix for only having a single-key selected. In this
case, it just uses the start/end frame as it's min/max

Modified Paths:
--

branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c

Modified: 
branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c
===
--- 
branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c
   2011-06-02 11:51:38 UTC (rev 37095)
+++ 
branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c
   2011-06-02 11:58:13 UTC (rev 37096)
@@ -3129,18 +3129,15 @@
/* check if we're supposed to be setting minx/maxx for TimeSlide */
if (t-mode == TFM_TIME_SLIDE) {
float min=9.0f, max=-9.0f;
+   int i;

-   if (count  1) {
-   /* search for min/max selected values to transform */
-   int i;
-   
-   td= t-data;
-   for (i=0; i  count; i++, td++) {
-   if (min  *(td-val)) min= *(td-val);
-   if (max  *(td-val)) max= *(td-val);
-   }
+   td= t-data;
+   for (i=0; i  count; i++, td++) {
+   if (min  *(td-val)) min= *(td-val);
+   if (max  *(td-val)) max= *(td-val);
}
-   else {
+   
+   if (min == max) {
/* just use the current frame ranges */
min = (float)PSFRA;
max = (float)PEFRA;

___
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 [37097] branches/soc-2011-pepper/source/ blender/editors/animation: Deleting keyframes usability tweak:

2011-06-02 Thread Joshua Leung
Revision: 37097
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37097
Author:   aligorith
Date: 2011-06-02 12:21:55 + (Thu, 02 Jun 2011)
Log Message:
---
Deleting keyframes usability tweak:
There won't be dangling empty actions left behind anymore in the
DopeSheet channel list after you've deleted all their keyframes (and
don't want to add keyframes to them anymore).

Of course, this poses problems with more actions getting created if
you then go and keyframe those objects again. If this does turn out to
be an equally bad problem, then another approach from the channel
filtering code side (probably aided by the restructed code) will help
(though doesn't solve the problem where people complain of having
heaps of empty actions dangling from objects they no longer want
animated).

Modified Paths:
--

branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c

branches/soc-2011-pepper/source/blender/editors/animation/keyframes_general.c

Modified: 
branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c
===
--- 
branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c  
2011-06-02 11:58:13 UTC (rev 37096)
+++ 
branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c  
2011-06-02 12:21:55 UTC (rev 37097)
@@ -515,12 +515,34 @@
 *  - Drivers
 *  - TODO... some others?
 */
-   if (fcu-grp)
-   action_groups_remove_channel(adt-action, fcu);
-   else if ((ac)  (ac-datatype == ANIMCONT_DRIVERS))
+   if ((ac)  (ac-datatype == ANIMCONT_DRIVERS)) {
+   /* driver F-Curve */
BLI_remlink(adt-drivers, fcu);
-   else if (adt-action)
-   BLI_remlink(adt-action-curves, fcu);
+   }
+   else if (adt-action) {
+   /* remove from group or action, whichever one owns the 
F-Curve */
+   if (fcu-grp)
+   action_groups_remove_channel(adt-action, fcu);
+   else
+   BLI_remlink(adt-action-curves, fcu);
+   
+   /* if action has no more F-Curves as a result of this, unlink 
it from
+* AnimData if it did not come from a NLA Strip being tweaked.
+*
+* This is done so that we don't have dangling Object+Action 
entries in
+* channel list that are empty, and linger around long after 
the data they
+* are for has disappeared (and probably won't come back).
+*/
+   // XXX: does everybody always want this?
+   /* XXX: there's a problem where many actions could 
build up in the file if multiple
+* full add/delete cycles are performed on the same 
objects, but assume that this is rare
+*/
+   if ((adt-action-curves.first == NULL)  (adt-flag  
ADT_NLA_EDIT_ON)==0)
+   {
+   id_us_min(adt-action-id);
+   adt-action = NULL;
+   }
+   }

/* free the F-Curve itself */
free_fcurve(fcu);

Modified: 
branches/soc-2011-pepper/source/blender/editors/animation/keyframes_general.c
===
--- 
branches/soc-2011-pepper/source/blender/editors/animation/keyframes_general.c   
2011-06-02 11:58:13 UTC (rev 37096)
+++ 
branches/soc-2011-pepper/source/blender/editors/animation/keyframes_general.c   
2011-06-02 12:21:55 UTC (rev 37097)
@@ -111,7 +111,7 @@
 {
int i;

-   if(fcu-bezt==NULL) /* ignore baked curves */
+   if (fcu-bezt==NULL) /* ignore baked curves */
return;
 
/* Delete selected BezTriples */
@@ -124,7 +124,7 @@
}

/* Free the array of BezTriples if there are not keyframes */
-   if(fcu-totvert == 0)
+   if (fcu-totvert == 0)
clear_fcurve_keys(fcu);
 }
 

___
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 [37098] trunk/blender/source/blender: fix for [#27410] Manual save kills actual .blend file if disk space is low

2011-06-02 Thread Andrea Weikert
Revision: 37098
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37098
Author:   elubie
Date: 2011-06-02 12:44:59 + (Thu, 02 Jun 2011)
Log Message:
---
fix for [#27410] Manual save kills actual .blend file if disk space is low
- moved do_history into WM_write_file after successful write of .blend@ 
temporary file
- Added new file flag, to avoid writing history on writing the startup.blend, 
autosave files and undo.

Thanks Campbell, Brecht for review!

Modified Paths:
--
trunk/blender/source/blender/blenkernel/BKE_global.h
trunk/blender/source/blender/blenkernel/intern/blender.c
trunk/blender/source/blender/blenloader/intern/writefile.c
trunk/blender/source/blender/windowmanager/intern/wm_files.c

Modified: trunk/blender/source/blender/blenkernel/BKE_global.h
===
--- trunk/blender/source/blender/blenkernel/BKE_global.h2011-06-02 
12:21:55 UTC (rev 37097)
+++ trunk/blender/source/blender/blenkernel/BKE_global.h2011-06-02 
12:44:59 UTC (rev 37098)
@@ -145,6 +145,7 @@
 #define G_FILE_IGNORE_DEPRECATION_WARNINGS (1  22)   /* deprecated */
 #define G_FILE_RECOVER  (1  23)
 #define G_FILE_RELATIVE_REMAP   (1  24)
+#define G_FILE_HISTORY  (1  25)
 
 /* G.windowstate */
 #define G_WINDOWSTATE_USERDEF  0

Modified: trunk/blender/source/blender/blenkernel/intern/blender.c
===
--- trunk/blender/source/blender/blenkernel/intern/blender.c2011-06-02 
12:21:55 UTC (rev 37097)
+++ trunk/blender/source/blender/blenkernel/intern/blender.c2011-06-02 
12:44:59 UTC (rev 37098)
@@ -523,7 +523,8 @@
static int counter= 0;
char filepath[FILE_MAXDIR+FILE_MAXFILE];
char numstr[32];
-   
+   int fileflags = G.fileflags  ~(G_FILE_HISTORY); /* don't do 
file history on undo */
+
/* calculate current filepath */
counter++;
counter= counter % U.undosteps; 
@@ -531,7 +532,7 @@
BLI_snprintf(numstr, sizeof(numstr), %d.blend, counter);
BLI_make_file_string(/, filepath, btempdir, numstr);

-   success= BLO_write_file(CTX_data_main(C), filepath, 
G.fileflags, NULL, NULL);
+   success= BLO_write_file(CTX_data_main(C), filepath, fileflags, 
NULL, NULL);

BLI_strncpy(curundo-str, filepath, sizeof(curundo-str));
}

Modified: trunk/blender/source/blender/blenloader/intern/writefile.c
===
--- trunk/blender/source/blender/blenloader/intern/writefile.c  2011-06-02 
12:21:55 UTC (rev 37097)
+++ trunk/blender/source/blender/blenloader/intern/writefile.c  2011-06-02 
12:44:59 UTC (rev 37098)
@@ -2520,6 +2520,41 @@
return endwrite(wd);
 }
 
+/* do reverse file history: .blend1 - .blend2, .blend - .blend1 */
+/* return: success(0), failure(1) */
+static int do_history(const char *name, ReportList *reports)
+{
+   char tempname1[FILE_MAXDIR+FILE_MAXFILE], 
tempname2[FILE_MAXDIR+FILE_MAXFILE];
+   int hisnr= U.versions;
+   
+   if(U.versions==0) return 0;
+   if(strlen(name)2) {
+   BKE_report(reports, RPT_ERROR, Unable to make version backup: 
filename too short);
+   return 1;
+   }
+   
+   while(hisnr  1) {
+   BLI_snprintf(tempname1, sizeof(tempname1), %s%d, name, 
hisnr-1);
+   BLI_snprintf(tempname2, sizeof(tempname2), %s%d, name, hisnr);
+   
+   if(BLI_rename(tempname1, tempname2)) {
+   BKE_report(reports, RPT_ERROR, Unable to make version 
backup);
+   return 1;
+   }   
+   hisnr--;
+   }
+
+   /* is needed when hisnr==1 */
+   BLI_snprintf(tempname1, sizeof(tempname1), %s%d, name, hisnr);
+
+   if(BLI_rename(name, tempname1)) {
+   BKE_report(reports, RPT_ERROR, Unable to make version backup);
+   return 1;
+   }
+
+   return 0;
+}
+
 /* return: success (1) */
 int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, 
ReportList *reports, int *thumb)
 {
@@ -2571,45 +2606,52 @@
err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, 
write_flags, thumb);
close(file);
 
-   /* rename/compress */
-   if(!err) {
-   if(write_flags  G_FILE_COMPRESS) {
-   /* compressed files have the same ending as regular 
files... only from 2.4!!! */
-   char gzname[FILE_MAXDIR+FILE_MAXFILE+4];
-   int ret;
+   if (err) {
+   BKE_report(reports, RPT_ERROR, strerror(errno));
+   remove(tempname);
 
-   /* first 

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37099] branches/soc-2011-pepper/release/ scripts/startup/bl_operators/nla.py: Added operator to remove all useless unused actions from the current

2011-06-02 Thread Joshua Leung
Revision: 37099
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37099
Author:   aligorith
Date: 2011-06-02 13:03:46 + (Thu, 02 Jun 2011)
Log Message:
---
Added operator to remove all useless unused actions from the current
.blend file.
* From operator search, find Clear Useless Actions
* Action library actions are preserved by this operator. It targets
actions without any F-Curves
* By default, only actions which are single-user (where that user is a
Fake user) will be targeted. This can be changed to have it target any
dangling action that doesn't have any F-Curves
* A save/reload cycle is still required to fully remove such Actions
from the current file. Though at least now it's a simpler process to
have these semi-automatically removed ;)

Modified Paths:
--
branches/soc-2011-pepper/release/scripts/startup/bl_operators/nla.py

Modified: branches/soc-2011-pepper/release/scripts/startup/bl_operators/nla.py
===
--- branches/soc-2011-pepper/release/scripts/startup/bl_operators/nla.py
2011-06-02 12:44:59 UTC (rev 37098)
+++ branches/soc-2011-pepper/release/scripts/startup/bl_operators/nla.py
2011-06-02 13:03:46 UTC (rev 37099)
@@ -168,3 +168,37 @@
 def invoke(self, context, event):
 wm = context.window_manager
 return wm.invoke_props_dialog(self)
+
+#
+
+class ClearUselessActions(bpy.types.Operator):
+'''Mark actions with no F-Curves for deletion after save+reload of file 
preserving action libraries'''
+bl_idname = anim.clear_useless_actions
+bl_label = Clear Useless Actions
+bl_options = {'REGISTER', 'UNDO'}
+
+only_unused = BoolProperty(name=Only Unused, 
+description=Only unused (Fake User only) actions get considered,
+default=True)
+
+@classmethod
+def poll(cls, context):
+return len(bpy.data.actions) != 0
+
+def execute(self, context):
+removed = 0
+
+for action in bpy.data.actions:
+# if only user is fake user...
+if ((self.only_unused is False) or 
+(action.use_fake_user and action.users == 1)):
+
+# if it has F-Curves, then it's a action library (i.e. walk, 
wave, jump, etc.) 
+# and should be left alone as that's what fake users are for!
+if not action.fcurves:
+# mark action for deletion
+action.user_clear()
+removed += 1
+
+self.report({'INFO'}, Removed %d empty and/or fake-user only Actions 
% (removed))
+return {'FINISHED'}

___
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 [37100] branches/soc-2011-radish/source/ blender/editors/sculpt_paint/paint_vertex.c: My earlier custom auto normalize is no longer necessary to maint

2011-06-02 Thread Jason Hays
Revision: 37100
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37100
Author:   jason_hays22
Date: 2011-06-02 14:15:07 + (Thu, 02 Jun 2011)
Log Message:
---
My earlier custom auto normalize is no longer necessary to maintain inner group 
ratios (since the system changed)

Modified Paths:
--
branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c

Modified: 
branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c
===
--- branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c 
2011-06-02 13:03:46 UTC (rev 37099)
+++ branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c 
2011-06-02 14:15:07 UTC (rev 37100)
@@ -1041,7 +1041,7 @@
 I need to resolve a precision error issue, however:
 dividing can cause the weights to drop to 0
 */
-static void do_wp_auto_normalize_locked_groups(Mesh *me, MDeformVert *dvert, 
char* map)
+/*static void do_wp_auto_normalize_locked_groups(Mesh *me, MDeformVert *dvert, 
char* map)
 {
float highestSum = 0.0f;
float currentSum;
@@ -1081,7 +1081,7 @@
}
}
}
-}
+}*/
 /* Jason was here */
 /*static char get_locked_flag(Object *ob, int vgroup)
 {
@@ -1096,7 +1096,7 @@
return 0;
 }*/
 /* Jason was here */
-static int locked_group_exists(Object *ob)
+/*static int locked_group_exists(Object *ob)
 {
bDeformGroup *defgroup = ob-defbase.first;
while(defgroup) {
@@ -1106,7 +1106,7 @@
defgroup = defgroup-next;
}
return FALSE;
-}
+}*/
 /* Jason was here */
 /*
 See if the current deform group has a locked group
@@ -1277,11 +1277,11 @@
dw-weight = oldw;
} else if(bone_groups[dw-def_nr]) {
redistribute_weight_change(me-dvert+index, dw, oldw, 
flags, defcnt, bone_groups);
-   do_wp_auto_normalize_locked_groups(me, me-dvert, 
validmap);
+   //do_weight_paint_auto_normalize(me-dvert+index, 
vgroup, validmap);//do_wp_auto_normalize_locked_groups(me, me-dvert, validmap);
}
-   } else {
+   } //else if(bone_groups[dw-def_nr]) // should it be disabled for the 
active group if it is not a bone group
do_weight_paint_auto_normalize(me-dvert+index, vgroup, 
validmap);
-   }
+   
 }
 // Jason
 static char *wpaint_make_validmap(Object *ob);

___
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 [37101] trunk/blender/source/blender/ editors/interface: UI: fix two issues with expanded enum property buttons:

2011-06-02 Thread Brecht Van Lommel
Revision: 37101
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37101
Author:   blendix
Date: 2011-06-02 14:18:51 + (Thu, 02 Jun 2011)
Log Message:
---
UI: fix two issues with expanded enum property buttons:
* they were too slow for dynamic python enums, calling the callback
  to list the items for each button, to get a tooltip
* enum tooltips sometimes were showing the same description twice

Modified Paths:
--
trunk/blender/source/blender/editors/interface/interface.c
trunk/blender/source/blender/editors/interface/interface_handlers.c
trunk/blender/source/blender/editors/interface/interface_intern.h
trunk/blender/source/blender/editors/interface/interface_regions.c

Modified: trunk/blender/source/blender/editors/interface/interface.c
===
--- trunk/blender/source/blender/editors/interface/interface.c  2011-06-02 
14:15:07 UTC (rev 37100)
+++ trunk/blender/source/blender/editors/interface/interface.c  2011-06-02 
14:18:51 UTC (rev 37101)
@@ -1668,7 +1668,7 @@
return 0;
 }
 
-void ui_set_but_default(bContext *C, uiBut *UNUSED(but), short all)
+void ui_set_but_default(bContext *C, short all)
 {
PointerRNA ptr;
 
@@ -2481,28 +2481,8 @@
icon= RNA_property_ui_icon(prop);
}
}
-
-   if(!tip) {
-   if(type == ROW  proptype == PROP_ENUM) {
-   EnumPropertyItem *item;
-   int i, totitem, free;
-
-   RNA_property_enum_items(block-evil_C, ptr, 
prop, item, totitem, free);
-
-   for(i=0; itotitem; i++) {
-   if(item[i].identifier[0]  
item[i].value == (int)max) {
-   if(item[i].description[0])
-   tip= 
item[i].description;
-   break;
-   }
-   }
-
-   if(free)
-   MEM_freeN(item);
-   }
-   }

-   if(!tip)
+   if(!tip  proptype != PROP_ENUM)
tip= RNA_property_ui_description(prop);
 
if(min == max || a1 == -1 || a2 == -1) {

Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===
--- trunk/blender/source/blender/editors/interface/interface_handlers.c 
2011-06-02 14:15:07 UTC (rev 37100)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c 
2011-06-02 14:18:51 UTC (rev 37101)
@@ -4445,7 +4445,7 @@
else if(ELEM(event-type, DELKEY, PADPERIOD)  event-val == 
KM_PRESS) {
/* ctrl+del - reset active button; del - reset a whole 
array*/
if (!(ELEM3(but-type, HSVCIRCLE, HSVCUBE, HISTOGRAM)))
-   ui_set_but_default(C, but, !event-ctrl);
+   ui_set_but_default(C, !event-ctrl);
}
/* handle menu */
else if(event-type == RIGHTMOUSE  event-val == KM_PRESS) {

Modified: trunk/blender/source/blender/editors/interface/interface_intern.h
===
--- trunk/blender/source/blender/editors/interface/interface_intern.h   
2011-06-02 14:15:07 UTC (rev 37100)
+++ trunk/blender/source/blender/editors/interface/interface_intern.h   
2011-06-02 14:18:51 UTC (rev 37101)
@@ -369,7 +369,7 @@
 extern int ui_set_but_string(struct bContext *C, uiBut *but, const char *str);
 extern int ui_get_but_string_max_length(uiBut *but);
 
-extern void ui_set_but_default(struct bContext *C, uiBut *but, short all);
+extern void ui_set_but_default(struct bContext *C, short all);
 
 extern void ui_set_but_soft_range(uiBut *but, double value);
 

Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===
--- trunk/blender/source/blender/editors/interface/interface_regions.c  
2011-06-02 14:15:07 UTC (rev 37100)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c  
2011-06-02 14:18:51 UTC (rev 37101)
@@ -370,6 +370,27 @@
data-color[data-totline]= 0xFF;
data-totline++;
}
+
+   if(but-type == ROW) {
+   EnumPropertyItem *item;
+   int i, totitem, free;
+
+   RNA_property_enum_items(C, but-rnapoin, but-rnaprop, 
item, totitem, free);
+
+   for(i=0; itotitem; i++) {
+   

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37102] trunk/blender/release/scripts: addons now show expanded list again (since Brecht' s commit now makes it fast)

2011-06-02 Thread Campbell Barton
Revision: 37102
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37102
Author:   campbellbarton
Date: 2011-06-02 15:21:47 + (Thu, 02 Jun 2011)
Log Message:
---
addons now show expanded list again (since Brecht's commit now makes it fast)
also add utility function for getting cleaned, unique names from python: 
bpy_extras.io_utils.unique_name(...)

Modified Paths:
--
trunk/blender/release/scripts/modules/bpy_extras/io_utils.py
trunk/blender/release/scripts/startup/bl_ui/space_userpref.py

Modified: trunk/blender/release/scripts/modules/bpy_extras/io_utils.py
===
--- trunk/blender/release/scripts/modules/bpy_extras/io_utils.py
2011-06-02 14:18:51 UTC (rev 37101)
+++ trunk/blender/release/scripts/modules/bpy_extras/io_utils.py
2011-06-02 15:21:47 UTC (rev 37102)
@@ -29,6 +29,7 @@
 path_reference,
 path_reference_copy,
 path_reference_mode,
+unique_name
 )
 
 import bpy
@@ -298,3 +299,43 @@
 os.makedirs(dir_to)
 
 shutil.copy(file_src, file_dst)
+
+
+def unique_name(key, name, name_dict, name_max=-1, clean_func=None):
+
+Helper function for storing unique names which may have special characters
+stripped and restricted to a maximum length.
+
+:arg key: unique item this name belongs to, name_dict[key] will be reused
+   when available.
+   This can be the object, mesh, material, etc instance its self.
+:type key: any hashable object assosiated with the *name*.
+:arg name: The name used to create a unique value in *name_dict*.
+:type name: string
+:arg name_dict: This is used to cache namespace to ensure no collisions
+   occur, this should be an empty dict initially and only modified by this
+   function.
+:type name_dict: dict
+:arg clean_func: Function to call on *name* before creating a unique value.
+:type clean_func: function
+
+name_new = name_dict.get(key)
+if name_new is None:
+count = 1
+name_dict_values = name_dict.values()
+name_new = name_new_orig = name if clean_func is None else 
clean_func(name)
+
+if name_max == -1:
+while name_new in name_dict_values:
+name_new = %s.%03d % (name_new_orig, count)
+count += 1
+else:
+name_new = name_new[:name_max]
+while name_new in name_dict_values:
+count_str = %03d % count
+name_new = %.*s.%s % (name_max - (len(count_str) + 1), 
name_new_orig, count_str)
+count += 1
+
+name_dict[key] = name_new
+
+return name_new

Modified: trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
===
--- trunk/blender/release/scripts/startup/bl_ui/space_userpref.py   
2011-06-02 14:18:51 UTC (rev 37101)
+++ trunk/blender/release/scripts/startup/bl_ui/space_userpref.py   
2011-06-02 15:21:47 UTC (rev 37102)
@@ -890,7 +890,7 @@
 col = split.column()
 col.prop(context.window_manager, addon_search, text=, 
icon='VIEWZOOM')
 col.label(text=Categories)
-col.prop(context.window_manager, addon_filter, text=)  # , 
expand=True, too slow with dynamic enum.
+col.prop(context.window_manager, addon_filter, expand=True)
 
 col.label(text=Supported Level)
 col.prop(context.window_manager, addon_support, expand=True)

___
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 [37103] trunk/blender/source/blender/ render/intern/source/pointdensity.c: Fix #27241: crash with point density texture when using particle age/veloci

2011-06-02 Thread Brecht Van Lommel
Revision: 37103
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37103
Author:   blendix
Date: 2011-06-02 16:59:12 + (Thu, 02 Jun 2011)
Log Message:
---
Fix #27241: crash with point density texture when using particle age/velocity
fallof for object vertices.

Modified Paths:
--
trunk/blender/source/blender/render/intern/source/pointdensity.c

Modified: trunk/blender/source/blender/render/intern/source/pointdensity.c
===
--- trunk/blender/source/blender/render/intern/source/pointdensity.c
2011-06-02 15:21:47 UTC (rev 37102)
+++ trunk/blender/source/blender/render/intern/source/pointdensity.c
2011-06-02 16:59:12 UTC (rev 37103)
@@ -362,10 +362,18 @@
density = pdr-squared_radius;
else if (pdr-falloff_type == TEX_PD_FALLOFF_ROOT)
density = sqrt(dist);
-   else if (pdr-falloff_type == TEX_PD_FALLOFF_PARTICLE_AGE)
-   density = dist*MIN2(pdr-point_data[pdr-offset + index], 1.0f);
-   else if (pdr-falloff_type == TEX_PD_FALLOFF_PARTICLE_VEL)
-   density = dist*len_v3(pdr-point_data + index*3)*pdr-velscale;
+   else if (pdr-falloff_type == TEX_PD_FALLOFF_PARTICLE_AGE) {
+   if (pdr-point_data_used  POINT_DATA_LIFE)
+   density = dist*MIN2(pdr-point_data[pdr-offset + 
index], 1.0f);
+   else
+   density = dist;
+   }
+   else if (pdr-falloff_type == TEX_PD_FALLOFF_PARTICLE_VEL) {
+   if (pdr-point_data_used  POINT_DATA_VEL)
+   density = dist*len_v3(pdr-point_data + 
index*3)*pdr-velscale;
+   else
+   density = dist;
+   }

if (pdr-density_curve  dist != 0.0f) {
density = curvemapping_evaluateF(pdr-density_curve, 0, 
density/dist)*dist;

___
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 [37104] branches/soc-2011-pepper/release/ scripts/modules/retarget.py: 2nd commit of mine.

2011-06-02 Thread Benjy Cook
Revision: 37104
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37104
Author:   benjycook
Date: 2011-06-02 17:19:07 + (Thu, 02 Jun 2011)
Log Message:
---
2nd commit of mine. Contains retarget.py, which has functions for retargeting 
an animated armature to a second one, given a user mapping of the hiearchy. 
Currently creates an intermediate skeleton that solves some of the major 
issues. WIP

Added Paths:
---
branches/soc-2011-pepper/release/scripts/modules/retarget.py

Added: branches/soc-2011-pepper/release/scripts/modules/retarget.py
===
--- branches/soc-2011-pepper/release/scripts/modules/retarget.py
(rev 0)
+++ branches/soc-2011-pepper/release/scripts/modules/retarget.py
2011-06-02 17:19:07 UTC (rev 37104)
@@ -0,0 +1,136 @@
+import bpy
+from mathutils import *
+from math import radians, acos
+performer_obj = bpy.data.objects[performer]
+enduser_obj = bpy.data.objects[enduser]
+scene = bpy.context.scene
+
+# dictionary of mapping
+bonemap = { LeftFoot: (DEF_Foot.L,DEF_Toes.L),
+LeftUpLeg: DEF_Thigh.L,
+Hips: DEF_Hip,
+LowerBack: DEF_Spine,
+Spine: DEF_Torso,
+Neck: DEF_Neck,
+Neck1: DEF_Neck,
+Head: DEF_Head,
+LeftShoulder: DEF_Shoulder.L,
+LeftArm: DEF_Forearm.L,
+LeftForeArm: DEF_Arm.L,
+LeftHand: DEF_Hand.L,
+RightShoulder: DEF_Shoulder.R,
+RightArm: DEF_Forearm.R,
+RightForeArm: DEF_Arm.R,
+RightHand: DEF_Hand.R,
+RightFoot: (DEF_Foot.R,DEF_Toes.R),
+RightUpLeg: DEF_Thigh.R,
+RightLeg: DEF_Shin.R,
+LeftLeg: DEF_Shin.L}
+# creation of a reverse map
+# multiple keys get mapped to list values
+bonemapr = {}
+for key in bonemap.keys():
+if not bonemap[key] in bonemapr:
+if type(bonemap[key])==type((0,0)):
+for key_x in bonemap[key]:
+bonemapr[key_x] = [key]
+else:
+bonemapr[bonemap[key]] = [key]
+else:
+bonemapr[bonemap[key]].append(key)
+
+# list of empties created to keep track of original
+# position data
+# in final product, these locations can be stored as custom props
+
+constraints = []
+
+#creation of intermediate armature
+# the intermediate armature has the hiearchy of the end user,
+# does not have rotation inheritence
+# and bone roll is identical to the performer
+# its purpose is to copy over the rotations
+# easily while concentrating on the hierarchy changes
+def createIntermediate():
+
+#creates and keyframes an empty with its location
+#the original position of the tail bone
+#useful for storing the important data in the original motion
+#i.e. using this empty to IK the chain to that pos.
+def locOfOriginal(inter_bone,perf_bone):
+if not perf_bone.name+Org in bpy.data.objects:
+bpy.ops.object.add()
+empty = bpy.context.active_object
+empty.name = perf_bone.name+Org
+empty = bpy.data.objects[perf_bone.name+Org]
+offset = perf_bone.vector
+scaling = perf_bone.length / inter_bone.length
+offset/=scaling
+empty.location = inter_bone.head + offset
+empty.keyframe_insert(location)
+
+#Simple 1to1 retarget of a bone
+def singleBoneRetarget(inter_bone,perf_bone):
+perf_world_rotation = perf_bone.matrix * 
performer_obj.matrix_world 
+inter_world_base_rotation = inter_bone.bone.matrix_local * 
inter_obj.matrix_world
+inter_world_base_inv = Matrix(inter_world_base_rotation)
+inter_world_base_inv.invert()
+return (inter_world_base_inv.to_3x3() * 
perf_world_rotation.to_3x3()).to_4x4()
+
+#uses 1to1 and interpolation/averaging to match many to 1 retarget
+def manyPerfToSingleInterRetarget(inter_bone,performer_bones_s):
+retarget_matrices = [singleBoneRetarget(inter_bone,perf_bone) for 
perf_bone in performer_bones_s]
+lerp_matrix = Matrix()
+for i in range(len(retarget_matrices)-1):
+first_mat = retarget_matrices[i]
+next_mat = retarget_matrices[i+1]
+lerp_matrix = first_mat.lerp(next_mat,0.5)
+return lerp_matrix
+
+#determines the type of hierachy change needed and calls the 
+#right function
+def retargetPerfToInter(inter_bone):
+if inter_bone.name in bonemapr.keys():
+perf_bone_name = bonemapr[inter_bone.name]
+#is it a 1 to many?
+if type(bonemap[perf_bone_name[0]])==type((0,0)):
+perf_bone = performer_bones[perf_bone_name[0]]
+if inter_bone.name == bonemap[perf_bone_name[0]][0]:
+locOfOriginal(inter_bone,perf_bone)
+ 

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37105] branches/soc-2011-radish: Made misc vgroups unable to change bone groups' weights when auto normalize is active

2011-06-02 Thread Jason Hays
Revision: 37105
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37105
Author:   jason_hays22
Date: 2011-06-02 17:28:04 + (Thu, 02 Jun 2011)
Log Message:
---
Made misc vgroups unable to change bone groups' weights when auto normalize is 
active

Added buttons for locking all vgroups, unlocking all vgroups, and inverting the 
locks of all vgroups

Modified Paths:
--

branches/soc-2011-radish/release/scripts/startup/bl_ui/properties_data_mesh.py
branches/soc-2011-radish/source/blender/editors/object/object_intern.h
branches/soc-2011-radish/source/blender/editors/object/object_ops.c
branches/soc-2011-radish/source/blender/editors/object/object_vgroup.c
branches/soc-2011-radish/source/blender/editors/sculpt_paint/paint_vertex.c

Modified: 
branches/soc-2011-radish/release/scripts/startup/bl_ui/properties_data_mesh.py
===
--- 
branches/soc-2011-radish/release/scripts/startup/bl_ui/properties_data_mesh.py  
2011-06-02 17:19:07 UTC (rev 37104)
+++ 
branches/soc-2011-radish/release/scripts/startup/bl_ui/properties_data_mesh.py  
2011-06-02 17:28:04 UTC (rev 37105)
@@ -139,6 +139,7 @@
 col = row.column(align=True)
 # Jason was here #
 col.prop(group, flag)
+
 col.operator(object.vertex_group_add, icon='ZOOMIN', text=)
 col.operator(object.vertex_group_remove, icon='ZOOMOUT', text=)
 col.menu(MESH_MT_vertex_group_specials, icon='DOWNARROW_HLT', 
text=)
@@ -149,6 +150,12 @@
 if group:
 row = layout.row()
 row.prop(group, name)
+#Jason was here
+row = layout.row()
+sub = row.row(align=True)
+sub.operator(object.vertex_group_lock_all, text=Lock All)
+sub.operator(object.vertex_group_invert_locks, text=Invert Locks)
+sub.operator(object.vertex_group_unlock_all, text=Unlock All)
 
 if ob.mode == 'EDIT' and len(ob.vertex_groups)  0:
 row = layout.row()

Modified: branches/soc-2011-radish/source/blender/editors/object/object_intern.h
===
--- branches/soc-2011-radish/source/blender/editors/object/object_intern.h  
2011-06-02 17:19:07 UTC (rev 37104)
+++ branches/soc-2011-radish/source/blender/editors/object/object_intern.h  
2011-06-02 17:28:04 UTC (rev 37105)
@@ -199,6 +199,11 @@
 void OBJECT_OT_vertex_group_normalize(struct wmOperatorType *ot);
 void OBJECT_OT_vertex_group_normalize_all(struct wmOperatorType *ot);
 void OBJECT_OT_vertex_group_levels(struct wmOperatorType *ot);
+/* Jason was here */
+void OBJECT_OT_vertex_group_lock_all(struct wmOperatorType *ot);
+void OBJECT_OT_vertex_group_invert_locks(struct wmOperatorType *ot);
+void OBJECT_OT_vertex_group_unlock_all(struct wmOperatorType *ot);
+
 void OBJECT_OT_vertex_group_invert(struct wmOperatorType *ot);
 void OBJECT_OT_vertex_group_blend(struct wmOperatorType *ot);
 void OBJECT_OT_vertex_group_clean(struct wmOperatorType *ot);

Modified: branches/soc-2011-radish/source/blender/editors/object/object_ops.c
===
--- branches/soc-2011-radish/source/blender/editors/object/object_ops.c 
2011-06-02 17:19:07 UTC (rev 37104)
+++ branches/soc-2011-radish/source/blender/editors/object/object_ops.c 
2011-06-02 17:28:04 UTC (rev 37105)
@@ -173,6 +173,11 @@
WM_operatortype_append(OBJECT_OT_vertex_group_copy);
WM_operatortype_append(OBJECT_OT_vertex_group_normalize);
WM_operatortype_append(OBJECT_OT_vertex_group_normalize_all);
+   /* Jason was here */
+   WM_operatortype_append(OBJECT_OT_vertex_group_invert_locks);
+   WM_operatortype_append(OBJECT_OT_vertex_group_lock_all);
+   WM_operatortype_append(OBJECT_OT_vertex_group_unlock_all);
+
WM_operatortype_append(OBJECT_OT_vertex_group_invert);
WM_operatortype_append(OBJECT_OT_vertex_group_levels);
WM_operatortype_append(OBJECT_OT_vertex_group_blend);

Modified: branches/soc-2011-radish/source/blender/editors/object/object_vgroup.c
===
--- branches/soc-2011-radish/source/blender/editors/object/object_vgroup.c  
2011-06-02 17:19:07 UTC (rev 37104)
+++ branches/soc-2011-radish/source/blender/editors/object/object_vgroup.c  
2011-06-02 17:28:04 UTC (rev 37105)
@@ -829,8 +829,34 @@
 
if (dvert_array) MEM_freeN(dvert_array);
 }
+/* Jason was here */
+static void vgroup_invert_locks(Object *ob)
+{
+   bDeformGroup *dg = ob-defbase.first;
+   while(dg) {
+   dg-flag = !dg-flag;
+   dg = dg-next;
+   }
+}
+/* Jason was here */
+static void vgroup_lock_all(Object *ob)
+{
+   bDeformGroup *dg = ob-defbase.first;
+   while(dg) {
+   dg-flag = TRUE;
+   dg = dg-next;
+   }
+}
+/* Jason 

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37106] trunk/blender/source/blender: Fix related to #27309: group nodes with a linked datablock that was missing would crash.

2011-06-02 Thread Brecht Van Lommel
Revision: 37106
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37106
Author:   blendix
Date: 2011-06-02 17:34:01 + (Thu, 02 Jun 2011)
Log Message:
---
Fix related to #27309: group nodes with a linked datablock that was missing 
would crash.

Modified Paths:
--
trunk/blender/source/blender/blenkernel/intern/node.c
trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenkernel/intern/node.c
===
--- trunk/blender/source/blender/blenkernel/intern/node.c   2011-06-02 
17:28:04 UTC (rev 37105)
+++ trunk/blender/source/blender/blenkernel/intern/node.c   2011-06-02 
17:34:01 UTC (rev 37106)
@@ -350,7 +350,7 @@
 /* groups display their internal tree name as label */
 static const char *group_label(bNode *node)
 {
-   return node-id-name+2;
+   return (node-id)? node-id-name+2: Missing Datablock;
 }
 
 void register_node_type_group(ListBase *lb)
@@ -2072,11 +2072,12 @@
bNodeTree *ngroup= (bNodeTree*)node-id;
bNodeSocket *sock;

-   if((ngroup-init  NTREE_TYPE_INIT)==0)
+   if(ngroup  (ngroup-init  NTREE_TYPE_INIT)==0)
ntreeInitTypes(ngroup);

node-stack_index = index;
-   index += ntree_begin_exec_tree(ngroup);
+   if(ngroup)
+   index += ntree_begin_exec_tree(ngroup);

for (sock=node-inputs.first; sock; sock=sock-next) {
if (sock-link  sock-link-fromsock) {
@@ -2199,7 +2200,7 @@
if(node-type==CMP_NODE_CURVE_RGB)
curvemapping_premultiply(node-storage, 0);
}
-   if(node-type==NODE_GROUP)
+   if(node-type==NODE_GROUP  node-id)
composit_begin_exec((bNodeTree *)node-id, stack + 
node-stack_index);
 
}
@@ -2225,7 +2226,7 @@
if(node-type==CMP_NODE_CURVE_RGB)
curvemapping_premultiply(node-storage, 1);

-   if(node-type==NODE_GROUP)
+   if(node-type==NODE_GROUP  node-id)
composit_end_exec((bNodeTree *)node-id, stack + 
node-stack_index);
 
node-need_exec= 0;

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===
--- trunk/blender/source/blender/blenloader/intern/readfile.c   2011-06-02 
17:28:04 UTC (rev 37105)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c   2011-06-02 
17:34:01 UTC (rev 37106)
@@ -2093,7 +2093,7 @@
for (node=ntree-nodes.first; node; node=node-next) {
if (node-type==NODE_GROUP) {
bNodeTree *ngroup= (bNodeTree*)node-id;
-   if (ngroup-flag  NTREE_DO_VERSIONS)
+   if (ngroup  (ngroup-flag  NTREE_DO_VERSIONS))
lib_node_do_versions_group(node);
}
}

___
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 [37107] branches/soc-2011-onion/source/ blender/blenkernel/intern/multires.c: Revision: 28682

2011-06-02 Thread Jason Wilkins
Revision: 37107
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37107
Author:   jwilkins
Date: 2011-06-02 22:52:20 + (Thu, 02 Jun 2011)
Log Message:
---
Revision: 28682
Author: nicholasbishop
Date: 11:23:51 PM, Saturday, May 08, 2010
Message:
* Small refactoring to improve readability, no functionality changes.
* Replaced the invert and add parameters of disp_run to a single DispOp 
parameter. This makes explicit that we can CALC disps, APPLY disps, and ADD 
disps.
* Renamed mat in disp run.

Modified Paths:
--
branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c

Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c
===
--- branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c 
2011-06-02 17:34:01 UTC (rev 37106)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c 
2011-06-02 22:52:20 UTC (rev 37107)
@@ -65,8 +65,14 @@
 static const int multires_grid_tot[] = {0, 4, 9, 25, 81, 289, 1089, 4225, 
16641, 66049, 263169, 1050625, 4198401, 16785409};
 static const int multires_side_tot[] = {0, 2, 3, 5,  9,  17,  33,   65,   129, 
  257,   513,1025,2049,4097};
 
+typedef enum {
+   APPLY_DISPS,
+   CALC_DISPS,
+   ADD_DISPS,
+} DispOp;
+
 static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert);
-static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, int invert, 
int add, DMGridData **oldGridData, int totlvl);
+static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DispOp op, 
DMGridData **oldGridData, int totlvl);
 
 DerivedMesh *get_multires_dm(Scene *scene, MultiresModifierData *mmd, Object 
*ob)
 {
@@ -595,7 +601,7 @@
cddm-release(cddm);
 
/* calc disps */
-   multiresModifier_disp_run(dispdm, me, 1, 0, 
origdm-getGridData(origdm), totlvl);
+   multiresModifier_disp_run(dispdm, me, CALC_DISPS, 
origdm-getGridData(origdm), totlvl);
 
origdm-release(origdm);
dispdm-release(dispdm);
@@ -662,7 +668,7 @@
multires_reallocate_mdisps(me, mdisps, totlvl); 
 
/* compute displacements */
-   multiresModifier_disp_run(highdm, me, 1, 0, subGridData, 
totlvl);
+   multiresModifier_disp_run(highdm, me, CALC_DISPS, subGridData, 
totlvl);
 
/* free */
highdm-release(highdm);
@@ -707,7 +713,7 @@
}
 }
 
-static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, int invert, 
int add, DMGridData **oldGridData, int totlvl)
+static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DispOp op, 
DMGridData **oldGridData, int totlvl)
 {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*)dm;
DMGridData **gridData, **subGridData;
@@ -717,7 +723,7 @@
int i, /*numGrids,*/ gridSize, dGridSize, dSkip;
 
if(!mdisps) {
-   if(invert)
+   if(op == CALC_DISPS)
mdisps = CustomData_add_layer(me-fdata, CD_MDISPS, 
CD_DEFAULT, NULL, me-totface);
else
return;
@@ -756,7 +762,7 @@
float *sco = subgrid[x + y*gridSize].co;
float *no = subgrid[x + y*gridSize].no;
float *data = 
dispgrid[dGridSize*y*dSkip + x*dSkip];
-   float mat[3][3], tx[3], ty[3], disp[3], 
d[3];
+   float tan_to_ob_mat[3][3], tx[3], 
ty[3], disp[3], d[3];
 
/* construct tangent space matrix */
grid_tangent(gridSize, gIndex, x, y, 0, 
subGridData, tx);
@@ -769,31 +775,36 @@
//mul_v3_fl(ty, 1.0f/(gridSize-1));
//cross_v3_v3v3(no, tx, ty);
 
-   column_vectors_to_mat3(mat, tx, ty, no);
+   column_vectors_to_mat3(tan_to_ob_mat, 
tx, ty, no);
 
-   if(!invert) {
-   /* convert to object space and 
add */
-   mul_v3_m3v3(disp, mat, data);
+   switch(op) {
+   case APPLY_DISPS:
+   /* Convert displacement to 
object space
+  and add to grid points */
+   mul_v3_m3v3(disp, 
tan_to_ob_mat, data);
add_v3_v3v3(co, sco, disp);
-   }
-   else if(!add) {
-   /* convert difference to 

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37108] branches/soc-2011-onion/source/ blender/gpu/intern/gpu_buffers.c: Revision: 29263

2011-06-02 Thread Jason Wilkins
Revision: 37108
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37108
Author:   jwilkins
Date: 2011-06-02 23:07:30 + (Thu, 02 Jun 2011)
Log Message:
---
Revision: 29263
Author: nicholasbishop
Date: 1:30:22 AM, Sunday, June 06, 2010
Message:
* Fixed bug in the buffer VBO code; no reading from a buffer mapped as 
GL_WRITE_ONLY.

Modified Paths:
--
branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c

Modified: branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c
===
--- branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c 
2011-06-02 22:52:20 UTC (rev 37107)
+++ branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c 
2011-06-02 23:07:30 UTC (rev 37108)
@@ -575,11 +575,13 @@
   that is what opengl will use */
for(j = 0; j  gridsize-1; ++j) {
for(k = 0; k  gridsize-1; ++k) 
{
-   
normal_quad_v3(vert_data[(j+1)*gridsize + (k+1)].no,
-   
vert_data[(j+1)*gridsize + k].co,
-   
vert_data[(j+1)*gridsize + k+1].co,
-   
vert_data[j*gridsize + k+1].co,
-   
vert_data[j*gridsize + k].co);
+   float norm[3];
+   normal_quad_v3(norm,
+   
grid[(j+1)*gridsize + k].co,
+   
grid[(j+1)*gridsize + k+1].co,
+   grid[j*gridsize 
+ k+1].co,
+   grid[j*gridsize 
+ k].co);
+   
copy_v3_v3(vert_data[(j+1)*gridsize + (k+1)].no, norm);
}
}
}

___
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 [37109] trunk/blender/source/blender/ editors/uvedit/uvedit_parametrizer.c: Quiet warnings for picky compilers.

2011-06-02 Thread Campbell Barton
Revision: 37109
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37109
Author:   campbellbarton
Date: 2011-06-02 23:10:05 + (Thu, 02 Jun 2011)
Log Message:
---
Quiet warnings for picky compilers.

Modified Paths:
--
trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c
===
--- trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c   
2011-06-02 23:07:30 UTC (rev 37108)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c   
2011-06-02 23:10:05 UTC (rev 37109)
@@ -4140,7 +4140,7 @@
 
param_assert(phandle-state == PHANDLE_STATE_ALLOCATED);
 
-   phandle-ncharts = p_connect_pairs(phandle, impl);
+   phandle-ncharts = p_connect_pairs(phandle, (PBool)impl);
phandle-charts = p_split_charts(phandle, chart, phandle-ncharts);
 
p_chart_delete(phandle-construction_chart);
@@ -4189,7 +4189,7 @@
for (i = 0; i  phandle-ncharts; i++) {
for (f=phandle-charts[i]-faces; f; f=f-nextlink)
p_face_backup_uvs(f);
-   p_chart_lscm_begin(phandle-charts[i], live, abf);
+   p_chart_lscm_begin(phandle-charts[i], (PBool)live, (PBool)abf);
}
 }
 

___
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 [37110] trunk/blender/source/gameengine/ GamePlayer/ghost/GPG_ghost.cpp: Fix for [#27562] audaspace not playing files in blenderplayer

2011-06-02 Thread Joerg Mueller
Revision: 37110
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37110
Author:   nexyon
Date: 2011-06-02 23:25:38 + (Thu, 02 Jun 2011)
Log Message:
---
Fix for [#27562] audaspace not playing files in blenderplayer

blenderplayer wasn't initialising ffmpeg

This might also fix [#27558] GE Sound works in Blender but not in runtimes

Modified Paths:
--
trunk/blender/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp

Modified: trunk/blender/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
===
--- trunk/blender/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp  
2011-06-02 23:10:05 UTC (rev 37109)
+++ trunk/blender/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp  
2011-06-02 23:25:38 UTC (rev 37110)
@@ -71,6 +71,7 @@
 #include BLO_runtime.h
 #include IMB_imbuf.h
 #include BKE_text.h
+#include BKE_sound.h

int GHOST_HACK_getFirstFile(char buf[]);

@@ -449,6 +450,8 @@
U.audioformat = 0x24;
U.audiochannels = 2;
 
+   sound_init_once();
+
/* if running blenderplayer the last argument can't be parsed since it 
has to be the filename. */
isBlenderPlayer = !BLO_is_a_runtime(argv[0]);
if (isBlenderPlayer)

___
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 [37111] branches/soc-2011-onion/source/ blender/blenkernel/intern/multires.c: Revision: 29350

2011-06-02 Thread Jason Wilkins
Revision: 37111
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37111
Author:   jwilkins
Date: 2011-06-02 23:31:18 + (Thu, 02 Jun 2011)
Log Message:
---
Revision: 29350
Author: nicholasbishop
Date: 5:46:29 PM, Tuesday, June 08, 2010
Message:
* A little refactoring, pulled some common code together in multire

Modified Paths:
--
branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c

Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c
===
--- branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c 
2011-06-02 23:25:38 UTC (rev 37110)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c 
2011-06-02 23:31:18 UTC (rev 37111)
@@ -607,6 +607,19 @@
dispdm-release(dispdm);
 }
 
+static DMGridData **copy_grids(DMGridData **grids, int totgrid, int gridsize)
+{
+   DMGridData **grids_copy = MEM_callocN(sizeof(DMGridData*) * totgrid, 
subgrids);
+   int i;
+
+   for(i = 0; i  totgrid; ++i) {
+   grids_copy[i] = 
MEM_callocN(sizeof(DMGridData)*gridsize*gridsize, subgrid);
+   memcpy(grids_copy[i], grids[i], 
sizeof(DMGridData)*gridsize*gridsize);
+   }
+
+   return grids_copy;
+}
+
 static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int 
totlvl, int updateblock, int simple)
 {
Mesh *me = ob-data;
@@ -645,16 +658,12 @@
lowGridSize = lowdm-getGridSize(lowdm);
lowGridData = lowdm-getGridData(lowdm);
 
-   subGridData = MEM_callocN(sizeof(float*)*numGrids, 
subGridData*);
+   /* backup subsurf grids */
+   subGridData = copy_grids(highGridData, numGrids, highGridSize);
 
-   for(i = 0; i  numGrids; ++i) {
-   /* backup subsurf grids */
-   subGridData[i] = 
MEM_callocN(sizeof(DMGridData)*highGridSize*highGridSize, subGridData);
-   memcpy(subGridData[i], highGridData[i], 
sizeof(DMGridData)*highGridSize*highGridSize);
-
-   /* overwrite with current displaced grids */
+   /* overwrite with current displaced grids */
+   for(i = 0; i  numGrids; ++i)
multires_copy_dm_grid(highGridData[i], lowGridData[i], 
highGridSize, lowGridSize);
-   }
 
/* low lower level dm no longer needed at this point */
lowdm-release(lowdm);
@@ -855,15 +864,13 @@
lowGridData = lowdm-getGridData(lowdm);
gridData = dm-getGridData(dm);
 
-   subGridData = MEM_callocN(sizeof(DMGridData*)*numGrids, 
subGridData*);
+   /* backup subsurf grids */
+   subGridData = copy_grids(highGridData, numGrids, 
highGridSize);
+
diffGrid = 
MEM_callocN(sizeof(DMGridData)*lowGridSize*lowGridSize, diff);
 
+   /* write difference of subsurf and displaced low level 
into high subsurf */
for(i = 0; i  numGrids; ++i) {
-   /* backup subsurf grids */
-   subGridData[i] = 
MEM_callocN(sizeof(DMGridData)*highGridSize*highGridSize, subGridData);
-   memcpy(subGridData[i], highGridData[i], 
sizeof(DMGridData)*highGridSize*highGridSize);
-
-   /* write difference of subsurf and displaced 
low level into high subsurf */
for(j = 0; j  lowGridSize*lowGridSize; ++j)
sub_v3_v3v3(diffGrid[j].co, 
gridData[i][j].co, lowGridData[i][j].co);
 

___
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 [37112] branches/soc-2011-onion/: mergeinfo

2011-06-02 Thread Jason Wilkins
Revision: 37112
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37112
Author:   jwilkins
Date: 2011-06-03 00:11:54 + (Fri, 03 Jun 2011)
Log Message:
---
mergeinfo 

Property Changed:

branches/soc-2011-onion/


Property changes on: branches/soc-2011-onion
___
Modified: svn:mergeinfo
   - /branches/soc-2010-jwilkins:28499-37009
/trunk/blender:36833-37054
   + /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28682,29263,29350
/trunk/blender:36833-37054

___
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 [37113] trunk/blender/source/blender/ python/intern/bpy_props.c: pre-allocate the array when converting py/ rna enums, also fix for memory leak with b

2011-06-02 Thread Campbell Barton
Revision: 37113
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37113
Author:   campbellbarton
Date: 2011-06-03 03:19:22 + (Fri, 03 Jun 2011)
Log Message:
---
pre-allocate the array when converting py/rna enums, also fix for memory leak 
with bad values.

Modified Paths:
--
trunk/blender/source/blender/python/intern/bpy_props.c

Modified: trunk/blender/source/blender/python/intern/bpy_props.c
===
--- trunk/blender/source/blender/python/intern/bpy_props.c  2011-06-03 
00:11:54 UTC (rev 37112)
+++ trunk/blender/source/blender/python/intern/bpy_props.c  2011-06-03 
03:19:22 UTC (rev 37113)
@@ -644,7 +644,9 @@
 
 static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, 
int *defvalue, const short is_enum_flag)
 {
-   EnumPropertyItem *items= NULL;
+#  define PREALLOC_ENUM
+
+   EnumPropertyItem *items;
PyObject *item;
int seq_len, i, totitem= 0;
short def_used= 0;
@@ -681,18 +683,23 @@
/* blank value */
*defvalue= 0;
 
+#ifdef PREALLOC_ENUM
+   items= MEM_callocN(sizeof(EnumPropertyItem) * (seq_len + 1), 
RNA_enum_items_reserve);
+#endif
+
for(i=0; iseq_len; i++) {
EnumPropertyItem tmp= {0, , 0, , };
 
item= PySequence_Fast_GET_ITEM(seq_fast, i);
-   if(PyTuple_Check(item)==0) {
-   PyErr_SetString(PyExc_TypeError, EnumProperty(...): 
expected a sequence of tuples for the enum items);
-   if(items) MEM_freeN(items);
-   return NULL;
-   }
 
+   /* this also checks for a tuple */
if(!PyArg_ParseTuple(item, sss, tmp.identifier, tmp.name, 
tmp.description)) {
-   PyErr_SetString(PyExc_TypeError, EnumProperty(...): 
expected an identifier, name and description in the tuple);
+#ifdef PREALLOC_ENUM
+   MEM_freeN(items);
+#else
+   if(items) MEM_freeN(items);
+#endif
+   PyErr_SetString(PyExc_TypeError, EnumProperty(...): 
expected an tuple containing (identifier, name description));
return NULL;
}
 
@@ -712,11 +719,18 @@
def_used++; /* only ever 1 */
}
}
-
+#ifdef PREALLOC_ENUM
+   items[i]= tmp;
+#else
RNA_enum_item_add(items, totitem, tmp);
+#endif
}
 
+#ifdef PREALLOC_ENUM
+   /* do nohing */
+#else
RNA_enum_item_end(items, totitem);
+#endif
 
if(is_enum_flag) {
/* strict check that all set members were used */
@@ -741,6 +755,8 @@
}
 
return items;
+
+#  undef PREALLOC_ENUM
 }
 
 static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA 
*ptr, PropertyRNA *prop, int *free)

___
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 [37114] trunk/blender/source/blender/ python/intern/bpy_props.c: when making the C/RNA copy of the python enum, duplicate all strings since theres no

2011-06-02 Thread Campbell Barton
Revision: 37114
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37114
Author:   campbellbarton
Date: 2011-06-03 04:21:41 + (Fri, 03 Jun 2011)
Log Message:
---
when making the C/RNA copy of the python enum, duplicate all strings since 
theres no guarantee python wont free them immediately after, though in practice 
this isn't so common.

Modified Paths:
--
trunk/blender/source/blender/python/intern/bpy_props.c

Modified: trunk/blender/source/blender/python/intern/bpy_props.c
===
--- trunk/blender/source/blender/python/intern/bpy_props.c  2011-06-03 
03:19:22 UTC (rev 37113)
+++ trunk/blender/source/blender/python/intern/bpy_props.c  2011-06-03 
04:21:41 UTC (rev 37114)
@@ -642,18 +642,27 @@
Py_RETURN_NONE;
 }
 
+/* copies orig to buf, then sets orig to buf, returns copy length */
+static size_t strswapbufcpy(char *buf, const char **orig)
+{
+   const char *src= *orig;
+   char *dst= buf;
+   size_t i= 0;
+   *orig= buf;
+   while((*dst= *src)) { dst++; src++; i++; }
+   return i + 1; /* include '\0' */
+}
+
 static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, 
int *defvalue, const short is_enum_flag)
 {
-#  define PREALLOC_ENUM
-
EnumPropertyItem *items;
PyObject *item;
-   int seq_len, i, totitem= 0;
+   const Py_ssize_t seq_len= PySequence_Fast_GET_SIZE(seq_fast);
+   Py_ssize_t totbuf= 0;
+   int i;
short def_used= 0;
const char *def_cmp= NULL;
 
-   seq_len= PySequence_Fast_GET_SIZE(seq_fast);
-
if(is_enum_flag) {
if(seq_len  RNA_ENUM_BITFLAG_SIZE) {
PyErr_SetString(PyExc_TypeError, EnumProperty(...): 
maximum  STRINGIFY(RNA_ENUM_BITFLAG_SIZE)  members for a ENUM_FLAG type 
property);
@@ -683,55 +692,52 @@
/* blank value */
*defvalue= 0;
 
-#ifdef PREALLOC_ENUM
-   items= MEM_callocN(sizeof(EnumPropertyItem) * (seq_len + 1), 
RNA_enum_items_reserve);
-#endif
+   items= MEM_callocN(sizeof(EnumPropertyItem) * (seq_len + 1), 
enum_items_from_py1);
 
for(i=0; iseq_len; i++) {
EnumPropertyItem tmp= {0, , 0, , };
+   Py_ssize_t id_str_size;
+   Py_ssize_t name_str_size;
+   Py_ssize_t desc_str_size;
 
item= PySequence_Fast_GET_ITEM(seq_fast, i);
 
-   /* this also checks for a tuple */
-   if(!PyArg_ParseTuple(item, sss, tmp.identifier, tmp.name, 
tmp.description)) {
-#ifdef PREALLOC_ENUM
-   MEM_freeN(items);
-#else
-   if(items) MEM_freeN(items);
-#endif
-   PyErr_SetString(PyExc_TypeError, EnumProperty(...): 
expected an tuple containing (identifier, name description));
-   return NULL;
-   }
+   if( (PyTuple_CheckExact(item)) 
+   (PyTuple_GET_SIZE(item) == 3) 
+   (tmp.identifier=  
_PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), id_str_size)) 
+   (tmp.name=
_PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), name_str_size)) 
+   (tmp.description= 
_PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), desc_str_size))
+   ) {
+   if(is_enum_flag) {
+   tmp.value= 1i;
 
-   if(is_enum_flag) {
-   tmp.value= 1i;
+   if(def  PySet_Contains(def, 
PyTuple_GET_ITEM(item, 0))) {
+   *defvalue |= tmp.value;
+   def_used++;
+   }
+   }
+   else {
+   tmp.value= i;
 
-   if(def  PySet_Contains(def, PyTuple_GET_ITEM(item, 
0))) {
-   *defvalue |= tmp.value;
-   def_used++;
+   if(def  def_used == 0  strcmp(def_cmp, 
tmp.identifier)==0) {
+   *defvalue= tmp.value;
+   def_used++; /* only ever 1 */
+   }
}
+
+   items[i]= tmp;
+
+   /* calculate combine string length */
+   totbuf += id_str_size + name_str_size + desc_str_size + 
3; /* 3 is for '\0's */
}
else {
-   tmp.value= i;
+   MEM_freeN(items);
+   PyErr_SetString(PyExc_TypeError, EnumProperty(...): 
expected an tuple containing (identifier, name description));
+   return NULL;
+   }
 
-   if(def  def_used == 0  

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37115] trunk/blender/source/blender/ python/intern/bpy_props.c: disable python/ string enum duplication from last commit because the array of duplica

2011-06-02 Thread Campbell Barton
Revision: 37115
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37115
Author:   campbellbarton
Date: 2011-06-03 04:39:18 + (Fri, 03 Jun 2011)
Log Message:
---
disable python/string enum duplication from last commit because the array of 
duplicated strings can be freed and the pointers to the strings referenced 
still, the problem with python freeing strings that RNA references remains.

Modified Paths:
--
trunk/blender/source/blender/python/intern/bpy_props.c

Modified: trunk/blender/source/blender/python/intern/bpy_props.c
===
--- trunk/blender/source/blender/python/intern/bpy_props.c  2011-06-03 
04:21:41 UTC (rev 37114)
+++ trunk/blender/source/blender/python/intern/bpy_props.c  2011-06-03 
04:39:18 UTC (rev 37115)
@@ -642,6 +642,7 @@
Py_RETURN_NONE;
 }
 
+#if 0
 /* copies orig to buf, then sets orig to buf, returns copy length */
 static size_t strswapbufcpy(char *buf, const char **orig)
 {
@@ -652,6 +653,7 @@
while((*dst= *src)) { dst++; src++; i++; }
return i + 1; /* include '\0' */
 }
+#endif
 
 static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, 
int *defvalue, const short is_enum_flag)
 {
@@ -760,6 +762,10 @@
}
}
 
+   /* disabled duplicating strings because the array can still be freed and
+* the strings from it referenced, for now we can't support dynamically
+* created strings from python. */
+#if 0
/* this would all work perfectly _but_ the python strings may be freed
 * immediately after use, so we need to duplicate them, ugh.
 * annoying because it works most of the time without this. */
@@ -777,6 +783,7 @@
items=items_dup;
}
/* end string duplication */
+#endif
 
return items;
 }

___
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 [37116] trunk/blender/source/blender/ blenkernel/intern/particle.c: Fix for [#27461] Particle Instance modifier doesn't work correctly with Hair Dynam

2011-06-02 Thread Janne Karhu
Revision: 37116
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=37116
Author:   jhk
Date: 2011-06-03 05:51:39 + (Fri, 03 Jun 2011)
Log Message:
---
Fix for [#27461] Particle Instance modifier doesn't work correctly with Hair 
Dynamics.
* Wrong matrix used for dynamic hair.

Modified Paths:
--
trunk/blender/source/blender/blenkernel/intern/particle.c

Modified: trunk/blender/source/blender/blenkernel/intern/particle.c
===
--- trunk/blender/source/blender/blenkernel/intern/particle.c   2011-06-03 
04:39:18 UTC (rev 37115)
+++ trunk/blender/source/blender/blenkernel/intern/particle.c   2011-06-03 
05:51:39 UTC (rev 37116)
@@ -4018,7 +4018,11 @@
init_particle_interpolation(sim-ob, psys, pa, pind);
do_particle_interpolation(psys, p, pa, t, pind, state);
 
-   if(!keyed  !cached) {
+   if(pind.dm) {
+   mul_m4_v3(sim-ob-obmat, state-co);
+   mul_mat3_m4_v3(sim-ob-obmat, state-vel);
+   }
+   else if(!keyed  !cached  !(psys-flag  PSYS_GLOBAL_HAIR)) {
if((pa-flag  PARS_REKEY)==0) {
psys_mat_hair_to_global(sim-ob, sim-psmd-dm, 
part-from, pa, hairmat);
mul_m4_v3(hairmat, state-co);

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