Merged changes in the trunk up to revision 36408.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sun, 1 May 2011 13:50:38 +0000 (13:50 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sun, 1 May 2011 13:50:38 +0000 (13:50 +0000)
146 files changed:
CMakeLists.txt
build_files/buildbot/config/user-config-i686.py
build_files/buildbot/config/user-config-x86_64.py
doc/python_api/examples/bpy.types.Operator.1.py
intern/ghost/test/gears/GHOST_C-Test.c
intern/guardedalloc/MEM_sys_types.h
intern/opennl/superlu/superlu_sys_types.h
release/datafiles/.Bfs [deleted file]
release/scripts/presets/interaction/blender.py
release/scripts/presets/interaction/maya.py
release/scripts/startup/bl_operators/mesh.py
release/scripts/startup/bl_operators/object.py
release/scripts/startup/bl_operators/presets.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/properties_data_modifier.py
release/scripts/startup/bl_ui/properties_texture.py
release/scripts/startup/bl_ui/space_image.py
release/scripts/templates/operator_export.py
source/blender/blenfont/BLF_api.h
source/blender/blenfont/intern/blf.c
source/blender/blenfont/intern/blf_font.c
source/blender/blenfont/intern/blf_internal_types.h
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_image.h
source/blender/blenkernel/BKE_material.h
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/BKE_object.h
source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/BKE_shrinkwrap.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/boids.c
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/context.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/idprop.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/mesh_validate.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/texture.c
source/blender/blenkernel/intern/world.c
source/blender/blenlib/intern/math_vector_inline.c
source/blender/blenloader/BLO_readfile.h
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/collada/collada.cpp
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/armature/editarmature.c
source/blender/editors/curve/editcurve.c
source/blender/editors/include/ED_anim_api.h
source/blender/editors/include/ED_view3d.h
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/render/render_internal.c
source/blender/editors/render/render_opengl.c
source/blender/editors/render/render_preview.c
source/blender/editors/render/render_shading.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/screen/screendump.c
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_graph/graph_select.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_time/time_ops.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_fly.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_constraints.c
source/blender/editors/transform/transform_snap.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/imbuf/intern/scaling.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_texture_types.h
source/blender/makesrna/intern/rna_animation.c
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_image.c
source/blender/makesrna/intern/rna_image_api.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_texture.c
source/blender/modifiers/intern/MOD_displace.c
source/blender/modifiers/intern/MOD_edgesplit.c
source/blender/modifiers/intern/MOD_simpledeform.c
source/blender/modifiers/intern/MOD_wave.c
source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
source/blender/python/intern/bpy_interface.c
source/blender/python/intern/bpy_library.c
source/blender/python/intern/bpy_operator.c
source/blender/python/intern/bpy_props.c
source/blender/python/intern/bpy_rna.c
source/blender/python/intern/bpy_rna_anim.c
source/blender/python/intern/bpy_traceback.c
source/blender/python/intern/bpy_util.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/include/render_types.h
source/blender/render/intern/raytrace/reorganize.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/initrender.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/pointdensity.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/volume_precache.c
source/blender/windowmanager/CMakeLists.txt
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_operators.c
source/blenderplayer/bad_level_call_stubs/stubs.c
source/creator/CMakeLists.txt
source/creator/creator.c
source/gameengine/Ketsji/KX_Scene.cpp

index 3711227fdef6223e75bf8d68729f26558b30c960..a3baf582b9f36a1fafca89141d65e49db435bf4c 100644 (file)
@@ -102,8 +102,12 @@ get_blender_version()
 
 # Blender internal features
 option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
+
 option(WITH_PYTHON        "Enable Embedded Python API  (only disable for development)" ON)
+option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default (recommend to leave off)" OFF)
 mark_as_advanced(WITH_PYTHON)  # dont want people disabling this unless they really know what they are doing.
+mark_as_advanced(WITH_PYTHON_SECURITY)  # some distrobutions see this as a security issue, rather then have them patch it, make a build option.
+
 option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
 option(WITH_PYTHON_MODULE "Enable building as a python module (experemental, only enable for development)" OFF)
 option(WITH_BUILDINFO     "Include extra build details (only disable for development & faster builds)" ON)
index 6f0fca18dd4ea69c0b0ceda71c16cf82c80e438b..de8dd93982feaced688fa329d935c86a7b1fe5cf 100644 (file)
@@ -22,20 +22,14 @@ BF_EXPAT_LIB = ''
 WITH_BF_FFMPEG = True
 WITH_BF_STATICFFMPEG = True
 
-# Used for linking against system ffmpeg, but it gives pixelization,, so fall back to ffmpeg from 2.52 temporary
-#BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libavutil.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libdc1394.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libraw1394.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libfaad.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libspeex.a ${BF_FFMPEG_LIBPATH}/libbz2.a ${BF_FFMPEG_LIBPATH}/liboil-0.3.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libgsm.a'
-
 BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
 BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib32'
-BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libextern_libavformat.a ${BF_FFMPEG_LIBPATH}/libextern_libswscale.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libextern_libavcodec.a ${BF_FFMPEG_LIBPATH}/libextern_libavdevice.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libextern_libavutil.a ${BF_FFMPEG_LIBPATH}/libextern_xvidcore.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libextern_libmp3lame.a ${BF_FFMPEG_LIBPATH}/libextern_x264.a'
+BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a'
 
 # Don't depend on system's libstdc++
 WITH_BF_STATICCXX = True
index c44a387c1d61383019a0f000840ff4fc8e30230c..7bae2d232cdc20d8fea8476d2ae314a1ad11e755 100644 (file)
@@ -22,20 +22,14 @@ BF_EXPAT_LIB = ''
 WITH_BF_FFMPEG = True
 WITH_BF_STATICFFMPEG = True
 
-# Used for linking against system ffmpeg, but it gives pixelization,, so fall back to ffmpeg from 2.52 temporary
-#BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libavutil.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libdc1394.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libraw1394.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libfaad.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libspeex.a ${BF_FFMPEG_LIBPATH}/libbz2.a ${BF_FFMPEG_LIBPATH}/liboil-0.3.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libgsm.a'
-
 BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
 BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib64'
-BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libextern_libavformat.a ${BF_FFMPEG_LIBPATH}/libextern_libswscale.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libextern_libavcodec.a ${BF_FFMPEG_LIBPATH}/libextern_libavdevice.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libextern_libavutil.a ${BF_FFMPEG_LIBPATH}/libextern_xvidcore.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libextern_libmp3lame.a ${BF_FFMPEG_LIBPATH}/libextern_x264.a'
+BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a'
 
 # Don't depend on system's libstdc++
 WITH_BF_STATICCXX = True
index 133dc09af46999bd83da5d3fe0454233bd8490c0..fc016508d39dd1cb64c3c313313c135bb57b190a 100644 (file)
@@ -32,7 +32,7 @@ class SimpleMouseOperator(bpy.types.Operator):
 
     def execute(self, context):
         # rather then printing, use the report function,
-        # this way the messag appiers in the header,
+        # this way the message appears in the header,
         self.report({'INFO'}, "Mouse coords are %d %d" % (self.x, self.y))
         return {'FINISHED'}
 
index e8e818abca7c92b9ef0678dde4a61393ed3979e9..b34a37132b60a0c6cb2c762f3a0299739d6473da 100644 (file)
@@ -83,71 +83,71 @@ static void testTimerProc(GHOST_TimerTaskHandle task, GHOST_TUns64 time)
 static void gearGL(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, GLint teeth, GLfloat tooth_depth)
 {
        GLint i;
-    GLfloat r0, r1, r2;
-    GLfloat angle, da;
-    GLfloat u, v, len;
+       GLfloat r0, r1, r2;
+       GLfloat angle, da;
+       GLfloat u, v, len;
        const double pi = 3.14159264;
        
-    r0 = inner_radius;
-    r1 = (float)(outer_radius - tooth_depth/2.0);
-    r2 = (float)(outer_radius + tooth_depth/2.0);
+       r0 = inner_radius;
+       r1 = (float)(outer_radius - tooth_depth/2.0);
+       r2 = (float)(outer_radius + tooth_depth/2.0);
        
-    da = (float)(2.0*pi / teeth / 4.0);
+       da = (float)(2.0*pi / teeth / 4.0);
        
-    glShadeModel(GL_FLAT);
-    glNormal3f(0.0, 0.0, 1.0);
+       glShadeModel(GL_FLAT);
+       glNormal3f(0.0, 0.0, 1.0);
        
-    /* draw front face */
-    glBegin(GL_QUAD_STRIP);
-    for (i=0;i<=teeth;i++) {
+       /* draw front face */
+       glBegin(GL_QUAD_STRIP);
+       for (i=0;i<=teeth;i++) {
                angle = (float)(i * 2.0*pi / teeth);
                glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(width*0.5));
                glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(width*0.5));
                glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(width*0.5));
                glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(width*0.5));
-    }
-    glEnd();
+       }
+       glEnd();
        
-    /* draw front sides of teeth */
-    glBegin(GL_QUADS);
-    da = (float)(2.0*pi / teeth / 4.0);
-    for (i=0;i<teeth;i++) {
+       /* draw front sides of teeth */
+       glBegin(GL_QUADS);
+       da = (float)(2.0*pi / teeth / 4.0);
+       for (i=0;i<teeth;i++) {
                angle = (float)(i * 2.0*pi / teeth);
                glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(width*0.5));
                glVertex3f((float)(r2*cos(angle+da)), (float)(r2*sin(angle+da)), (float)(width*0.5));
                glVertex3f((float)(r2*cos(angle+2*da)), (float)(r2*sin(angle+2*da)), (float)(width*0.5));
                glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(width*0.5));
-    }
-    glEnd();
+       }
+       glEnd();
        
-    glNormal3f(0.0, 0.0, -1.0);
+       glNormal3f(0.0, 0.0, -1.0);
        
        /* draw back face */
-    glBegin(GL_QUAD_STRIP);
-    for (i=0;i<=teeth;i++) {
+       glBegin(GL_QUAD_STRIP);
+       for (i=0;i<=teeth;i++) {
                angle = (float)(i * 2.0*pi / teeth);
                glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(-width*0.5));
                glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(-width*0.5));
                glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(-width*0.5));
                glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(-width*0.5));
-    }
-    glEnd();
+       }
+       glEnd();
        
-    /* draw back sides of teeth */
-    glBegin(GL_QUADS);
-    da = (float)(2.0*pi / teeth / 4.0);
-    for (i=0;i<teeth;i++) {
+       /* draw back sides of teeth */
+       glBegin(GL_QUADS);
+       da = (float)(2.0*pi / teeth / 4.0);
+       for (i=0;i<teeth;i++) {
                angle = (float)(i * 2.0*pi / teeth);
                glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(-width*0.5));
                glVertex3f((float)(r2*cos(angle+2*da)), (float)(r2*sin(angle+2*da)), (float)(-width*0.5));
                glVertex3f((float)(r2*cos(angle+da)), (float)(r2*sin(angle+da)), (float)(-width*0.5));
                glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(-width*0.5));
-    }
-    glEnd();
+       }
+       glEnd();
        
-    /* draw outward faces of teeth */
-    glBegin(GL_QUAD_STRIP);
-    for (i=0;i<teeth;i++) {
+       /* draw outward faces of teeth */
+       glBegin(GL_QUAD_STRIP);
+       for (i=0;i<teeth;i++) {
                angle = (float)(i * 2.0*pi / teeth);
                glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(width*0.5));
                glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(-width*0.5));
@@ -168,22 +168,22 @@ static void gearGL(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, GL
                glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(width*0.5));
                glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(-width*0.5));
                glNormal3f((float)(cos(angle)), (float)(sin(angle)), 0.0);
-    }
-    glVertex3f((float)(r1*cos(0.0)), (float)(r1*sin(0.0)), (float)(width*0.5));
-    glVertex3f((float)(r1*cos(0.0)), (float)(r1*sin(0.0)), (float)(-width*0.5));
-    glEnd();
+       }
+       glVertex3f((float)(r1*cos(0.0)), (float)(r1*sin(0.0)), (float)(width*0.5));
+       glVertex3f((float)(r1*cos(0.0)), (float)(r1*sin(0.0)), (float)(-width*0.5));
+       glEnd();
        
-    glShadeModel(GL_SMOOTH);
+       glShadeModel(GL_SMOOTH);
        
-    /* draw inside radius cylinder */
-    glBegin(GL_QUAD_STRIP);
-    for (i=0;i<=teeth;i++) {
+       /* draw inside radius cylinder */
+       glBegin(GL_QUAD_STRIP);
+       for (i=0;i<=teeth;i++) {
                angle = (float)(i * 2.0*pi / teeth);
                glNormal3f((float)(-cos(angle)), (float)(-sin(angle)), 0.0);
                glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(-width*0.5));
                glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(width*0.5));
-    }
-    glEnd();
+       }
+       glEnd();
 }
 
 
index ff945a8c0c1a44ca92d5b76ca420bea7bd15e778..c5148e84ffed932d1dcfe6d142441504905461bc 100644 (file)
@@ -48,8 +48,8 @@
  *  \ingroup MEM
  */
 
-#ifndef BLO_SYS_TYPES_H
-#define BLO_SYS_TYPES_H
+#ifndef MEM_SYS_TYPES_H
+#define MEM_SYS_TYPES_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -127,5 +127,5 @@ typedef unsigned long uintptr_t;
 }
 #endif
 
-#endif /* eof */
+#endif /* MEM_SYS_TYPES_H */
 
index d8b28e54348f4ef77e563fcbfd324c052356966d..2cd9cab453d684969c01fef85baf00813c224770 100644 (file)
@@ -48,8 +48,8 @@
 // jesterKing: renamed to superlu_sys_types.h
 */
 
-#ifndef BLO_SYS_TYPES_H
-#define BLO_SYS_TYPES_H
+#ifndef SUPERLU_SYS_TYPES_H
+#define SUPERLU_SYS_TYPES_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -129,5 +129,5 @@ typedef unsigned long uintptr_t;
 }
 #endif
 
-#endif /* eof */
+#endif /* SUPERLU_SYS_TYPES_H */
 
diff --git a/release/datafiles/.Bfs b/release/datafiles/.Bfs
deleted file mode 100644 (file)
index 8085442..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/\r
-/tmp/\r
index 603158ed936636e5884781483a8d91c0dc120c07..3b6ce13d7e0b304157d75385eebc2483795ca5c2 100644 (file)
@@ -10,4 +10,4 @@ bpy.context.user_preferences.inputs.select_mouse = 'RIGHT'
 bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
 bpy.context.user_preferences.inputs.view_zoom_axis = 'VERTICAL'
 bpy.context.user_preferences.inputs.view_rotate_method = 'TRACKBALL'
-bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = False
+bpy.context.user_preferences.inputs.invert_mouse_zoom = False
index ec7ecaf46392f315871b530f1fb368989e201e45..62084645081b249ba656cc8d8b75619ff4d7a14b 100644 (file)
@@ -7,4 +7,4 @@ bpy.context.user_preferences.inputs.select_mouse = 'LEFT'
 bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
 bpy.context.user_preferences.inputs.view_zoom_axis = 'HORIZONTAL'
 bpy.context.user_preferences.inputs.view_rotate_method = 'TURNTABLE'
-bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = True
+bpy.context.user_preferences.inputs.invert_mouse_zoom = True
index a37a83f0f09c967246188e815eb6c9c1ea8405bb..44d81ba53df5ac5eaa79c3a2f477525d5cf8589f 100644 (file)
@@ -20,6 +20,8 @@
 
 import bpy
 
+from bpy.props import EnumProperty
+
 
 class MeshSelectInteriorFaces(bpy.types.Operator):
     '''Select faces where all edges have more then 2 face users.'''
@@ -66,17 +68,23 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
 
 class MeshMirrorUV(bpy.types.Operator):
     '''Copy mirror UV coordinates on the X axis based on a mirrored mesh'''
-    bl_idname = "mesh.faces_miror_uv"
+    bl_idname = "mesh.faces_mirror_uv"
     bl_label = "Copy Mirrored UV coords"
     bl_options = {'REGISTER', 'UNDO'}
 
+    direction = EnumProperty(items=(
+                        ('POSITIVE', "Positive", ""),
+                        ('NEGATIVE', "Negative", "")),
+                name="Axis Direction",
+                description="")
+
     @classmethod
     def poll(cls, context):
         ob = context.active_object
         return (ob and ob.type == 'MESH')
 
     def execute(self, context):
-        DIR = 1  # TODO, make an option
+        DIR = (self.direction == 'NEGATIVE')
 
         from mathutils import Vector
 
index d19de50ea6a4e4e2afaa74fc299d4ae2c7139e10..0342a14a1b23c7e1fe4491222b0b010347b24004 100644 (file)
@@ -177,6 +177,9 @@ class SubdivisionSet(bpy.types.Operator):
         if relative and level == 0:
             return {'CANCELLED'}  # nothing to do
 
+        if not relative and level < 0:
+            self.level = level = 0
+
         def set_object_subd(obj):
             for mod in obj.modifiers:
                 if mod.type == 'MULTIRES':
index 30fc802356c5492b05ff738cdecc2ead705ec17b..aa6a11407af0a37d87ee8099210a21fa755a2add 100644 (file)
@@ -264,7 +264,7 @@ class AddPresetInteraction(AddPresetBase, bpy.types.Operator):
     preset_values = [
         "user_preferences.edit.use_drag_immediately",
         "user_preferences.edit.use_insertkey_xyz_to_rgb",
-        "user_preferences.inputs.invert_mouse_wheel_zoom",
+        "user_preferences.inputs.invert_mouse_zoom",
         "user_preferences.inputs.select_mouse",
         "user_preferences.inputs.use_emulate_numpad",
         "user_preferences.inputs.use_mouse_continuous",
index adcd9c7c45a9f6e5c50b1b0dd208d9e4210ede27..d02b2bfbdde1aee001f5e9611b8bf69d9a5e5ff0 100644 (file)
@@ -395,7 +395,7 @@ class WM_MT_context_menu_enum(bpy.types.Menu):
         base_path, prop_string = data_path.rsplit(".", 1)
         value_base = context_path_validate(context, base_path)
 
-        values = [(i.name, i.identifier) for i in value_base.bl_rna.properties[prop_string].items]
+        values = [(i.name, i.identifier) for i in value_base.bl_rna.properties[prop_string].enum_items]
 
         for name, identifier in values:
             prop = self.layout.operator("wm.context_set_enum", text=name)
@@ -837,6 +837,18 @@ class WM_OT_properties_add(bpy.types.Operator):
         item[property] = 1.0
         return {'FINISHED'}
 
+class WM_OT_properties_context_change(bpy.types.Operator):
+    "Change the context tab in a Properties Window"
+    bl_idname = "wm.properties_context_change"
+    bl_label = ""
+
+    context = StringProperty(name="Context", maxlen=32)
+
+    def execute(self, context):
+        context.space_data.context = (self.context)
+               
+        return {'FINISHED'}
+
 
 class WM_OT_properties_remove(bpy.types.Operator):
     '''Internal use (edit a property data_path)'''
index 0e1bd870e7d63342e7bc778ab95ed7e63b6d114f..e640654ea69ae94216c216bd2eab0f9bd0519a5e 100644 (file)
@@ -118,11 +118,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
     def BEVEL(self, layout, ob, md):
         split = layout.split()
 
-        col = split.column()
-        col.prop(md, "width")
-
-        col = split.column()
-        col.prop(md, "use_only_vertices")
+        split.prop(md, "width")
+        split.prop(md, "use_only_vertices")
 
         layout.label(text="Limit Method:")
         layout.row().prop(md, "limit_method", expand=True)
@@ -186,10 +183,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
             col.prop(md, "use_transform")
 
     def CLOTH(self, layout, ob, md):
-        layout.label(text="See Cloth panel.")
+        layout.label(text="Settings can be found inside the Physics context")
 
     def COLLISION(self, layout, ob, md):
-        layout.label(text="See Collision panel.")
+        layout.label(text="Settings can be found inside the Physics context")
 
     def CURVE(self, layout, ob, md):
         split = layout.split()
@@ -265,7 +262,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
         layout.operator("object.explode_refresh", text="Refresh")
 
     def FLUID_SIMULATION(self, layout, ob, md):
-        layout.label(text="See Fluid panel.")
+        layout.label(text="Settings can be found inside the Physics context")
 
     def HOOK(self, layout, ob, md):
         split = layout.split()
@@ -444,7 +441,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
         col.prop(md, "random_position", text="Random", slider=True)
 
     def PARTICLE_SYSTEM(self, layout, ob, md):
-        layout.label(text="See Particle panel.")
+        layout.label(text="Settings can be found inside the Particle context")
 
     def SCREW(self, layout, ob, md):
         split = layout.split()
@@ -541,7 +538,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
             col.prop(md, "lock_y")
 
     def SMOKE(self, layout, ob, md):
-        layout.label(text="See Smoke panel.")
+        layout.label(text="Settings can be found inside the Physics context")
 
     def SMOOTH(self, layout, ob, md):
         split = layout.split(percentage=0.25)
@@ -559,10 +556,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
         col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
 
     def SOFT_BODY(self, layout, ob, md):
-        layout.label(text="See Soft Body panel.")
+        layout.label(text="Settings can be found inside the Physics context")
 
     def SOLIDIFY(self, layout, ob, md):
-
         split = layout.split()
 
         col = split.column()
@@ -578,22 +574,21 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
         col = split.column()
 
         col.prop(md, "offset")
-        colsub = col.column()
-        colsub.active = bool(md.vertex_group)
-        colsub.prop(md, "invert_vertex_group", text="Invert")
+        sub = col.column()
+        sub.active = bool(md.vertex_group)
+        sub.prop(md, "invert_vertex_group", text="Invert")
 
         col.prop(md, "use_even_offset")
         col.prop(md, "use_quality_normals")
-
         col.prop(md, "use_rim")
-        colsub = col.column()
-
-        colsub.label()
-        rowsub = colsub.split(align=True, percentage=0.4)
-        rowsub.prop(md, "material_offset", text="")
-        colsub = rowsub.row()
-        colsub.active = md.use_rim
-        colsub.prop(md, "material_offset_rim", text="Rim")
+        
+        sub = col.column()
+        sub.label()
+        row = sub.split(align=True, percentage=0.4)
+        row.prop(md, "material_offset", text="")
+        row = row.row()
+        row.active = md.use_rim
+        row.prop(md, "material_offset_rim", text="Rim")
 
     def SUBSURF(self, layout, ob, md):
         layout.row().prop(md, "subdivision_type", expand=True)
@@ -610,7 +605,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
         col.prop(md, "show_only_control_edges")
 
     def SURFACE(self, layout, ob, md):
-        layout.label(text="See Fields panel.")
+        layout.label(text="Settings can be found inside the Physics context")
 
     def UV_PROJECT(self, layout, ob, md):
         if ob.type == 'MESH':
index bc0dbc3c170456aba2cda93f0728894835080791..be46eb5dca6c1a876500b55a16cfcf26fa7364c9 100644 (file)
@@ -721,6 +721,15 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel):
         col.prop(pd, "falloff", text="")
         if pd.falloff == 'SOFT':
             col.prop(pd, "falloff_soft")
+        if pd.falloff == "PARTICLE_VELOCITY":
+            col.prop(pd, "falloff_speed_scale")
+        
+        col.prop(pd, "use_falloff_curve")
+        
+        if pd.use_falloff_curve:
+            col = layout.column()
+            col.label(text="Falloff Curve")
+            col.template_curve_mapping(pd, "falloff_curve", brush=False)
 
 
 class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel):
index f3b78de813cd7379c16357a787ccb7ea644baa14..da6318ed39e6339c3d4a35d7503813a78e3c95a8 100644 (file)
@@ -91,7 +91,7 @@ class IMAGE_MT_select(bpy.types.Menu):
         layout.separator()
 
         layout.operator("uv.select_all")
-        layout.operator("uv.select_inverse")
+        layout.operator("uv.select_all", text="Inverse").action = 'INVERT'
         layout.operator("uv.unlink_selected")
 
         layout.separator()
@@ -263,7 +263,7 @@ class IMAGE_MT_uvs(bpy.types.Menu):
         layout.operator("uv.average_islands_scale")
         layout.operator("uv.minimize_stretch")
         layout.operator("uv.stitch")
-        layout.operator("mesh.faces_miror_uv")
+        layout.operator("mesh.faces_mirror_uv")
 
         layout.separator()
 
index af359517e405793da700b95bcd36853680b1d5a9..1b1c90c8a21ae1a4833692cf86d22e6b4b67a698 100644 (file)
@@ -17,7 +17,7 @@ from bpy.props import StringProperty, BoolProperty, EnumProperty
 
 
 class ExportSomeData(bpy.types.Operator, ExportHelper):
-    '''This appiers in the tooltip of the operator and in the generated docs.'''
+    '''This appears in the tooltip of the operator and in the generated docs.'''
     bl_idname = "export.some_data"  # this is important since its how bpy.ops.export.some_data is constructed
     bl_label = "Export Some Data"
 
index 93b9cbc0bdf00e300102ec9aa0925c984e938a4f..44d3cf2c61bdc874253e10dbe84462a569d85f8a 100644 (file)
@@ -157,7 +157,7 @@ void BLF_shadow_offset(int fontid, int x, int y);
  *
  *     BLF_buffer(NULL, NULL, 0, 0, 0);
  */
-void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, unsigned int w, unsigned int h, int nch);
+void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch);
 
 /*
  * Set the color to be used for text.
index 930f55a48fae83e08fbf4f4a1deacaca7b334ce8..5db71948024987837688670125a4a7a480d92947 100644 (file)
@@ -657,7 +657,7 @@ void BLF_shadow_offset(int fontid, int x, int y)
        }
 }
 
-void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, unsigned int w, unsigned int h, int nch)
+void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch)
 {
        FontBLF *font;
 
index 80d0a48954a0063fc251368a55adf74ea03ba255..708b3708ab7fbcd12b20779324098d98f95cd3f9 100644 (file)
@@ -218,7 +218,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
        FT_Vector delta;
        FT_UInt glyph_index;
        float a, *fbuf;
-       int pen_x, y, x, yb;
+       int pen_x, y, x;
        int i, has_kerning, st, chx, chy;
 
        if (!font->glyph_cache || (!font->b_fbuf && !font->b_cbuf))
@@ -276,13 +276,20 @@ void blf_font_buffer(FontBLF *font, const char *str)
                        /* dont draw beyond the buffer bounds */
                        int width_clip= g->width;
                        int height_clip= g->height;
+                       int yb_start= g->pitch < 0 ? 0 : g->height-1;
 
                        if (width_clip + chx > font->bw)        width_clip  -= chx + width_clip - font->bw;
                        if (height_clip + pen_y > font->bh) height_clip -= pen_y + height_clip - font->bh;
-
-                       yb= g->pitch < 0 ? 0 : g->height-1;
                        
+                       /* drawing below the image? */
+                       if(pen_y < 0) {
+                               yb_start += (g->pitch < 0) ? -pen_y : pen_y;
+                               height_clip += pen_y;
+                               pen_y= 0;
+                       }
+
                        if (font->b_fbuf) {
+                               int yb= yb_start;
                                for (y=(chy >= 0 ? 0:-chy); y < height_clip; y++) {
                                        for (x=(chx >= 0 ? 0:-chx); x < width_clip; x++) {
                                                
@@ -311,6 +318,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
                        }
 
                        if (font->b_cbuf) {
+                               int yb= yb_start;
                                for (y= 0; y < height_clip; y++) {
                                        for (x= 0; x < width_clip; x++) {
                                                a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
index deb13006eafb11a9b249c8352ed27931b26bdcf7..c4e192626e870f08b56166f062c42e6dc90166b1 100644 (file)
@@ -200,9 +200,9 @@ typedef struct FontBLF {
        /* the same but unsigned char */
        unsigned char *b_cbuf;
 
-       /* buffer size. */
-       unsigned int bw;
-       unsigned int bh;
+       /* buffer size, keep signed so comparisons with negative values work */
+       int bw;
+       int bh;
 
        /* number of channels. */
        int bch;
index 83d65f3b1f4c6232ece6512b07b3798808f235c4..6c415010953a8096167f60bbc4341ecb3e054bc4 100644 (file)
@@ -44,14 +44,14 @@ extern "C" {
  * and keep comment above the defines.
  * Use STRINGIFY() rather then defining with quotes */
 #define BLENDER_VERSION                        257
-#define BLENDER_SUBVERSION             0
+#define BLENDER_SUBVERSION             1
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0
 
 /* used by packaging tools */
                /* can be left blank, otherwise a,b,c... etc with no quotes */
-#define BLENDER_VERSION_CHAR   a
+#define BLENDER_VERSION_CHAR   b
                /* alpha/beta/rc/release, docs use this */
 #define BLENDER_VERSION_CYCLE  release
 
index 8f0ce8c1660566e08c2a22234a99388df880ebd3..64c29158bd4171bba283ddb4d656baced2cbc574 100644 (file)
@@ -44,14 +44,16 @@ struct ImBuf;
 struct Tex;
 struct anim;
 struct Scene;
+struct Object;
 
 /* call from library */
 void   free_image(struct Image *me);
 
-void   BKE_stamp_info(struct Scene *scene, struct ImBuf *ibuf);
-void   BKE_stamp_buf(struct Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels);
+void   BKE_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf);
+void   BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels);
 int            BKE_alphatest_ibuf(struct ImBuf *ibuf);
-int            BKE_write_ibuf(struct Scene *scene, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
+int            BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
+int            BKE_write_ibuf(struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
 void   BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames);
 int            BKE_add_image_extension(char *string, int imtype);
 int            BKE_ftype_to_imtype(int ftype);
index 523a67eff6758bfd0d01548505e17035efeae65f..c445408609cd0c4c28138d820e4cfd2f1d150fcd 100644 (file)
@@ -55,6 +55,7 @@ struct Material *copy_material(struct Material *ma);
 struct Material *localize_material(struct Material *ma);
 struct Material *give_node_material(struct Material *ma); /* returns node material or self */
 void make_local_material(struct Material *ma);
+void extern_local_matarar(struct Material **matar, short totcol);
 
 void automatname(struct Material *);
 
index ae7ac0dabee09d8f0a99cc8b2df78f811581f2a1..08c150e30e3993a50bdc83012737f77e428ad56e 100644 (file)
@@ -66,7 +66,6 @@ void free_mesh(struct Mesh *me);
 struct Mesh *add_mesh(const char *name);
 struct Mesh *copy_mesh(struct Mesh *me);
 void mesh_update_customdata_pointers(struct Mesh *me);
-void make_local_tface(struct Mesh *me);
 void make_local_mesh(struct Mesh *me);
 void boundbox_mesh(struct Mesh *me, float *loc, float *size);
 void tex_space_mesh(struct Mesh *me);
index fe757b6597012c4c4bb30f187cc0fee2d3bbb96c..3a98f892bd8662a72368aac3bbba5ad987f3d77e 100644 (file)
@@ -91,7 +91,6 @@ struct Object *add_only_object(int type, const char *name);
 struct Object *add_object(struct Scene *scene, int type);
 
 struct Object *copy_object(struct Object *ob);
-void expand_local_object(struct Object *ob);
 void make_local_object(struct Object *ob);
 int object_is_libdata(struct Object *ob);
 int object_data_is_libdata(struct Object *ob);
index 42786e1c9bec9136f14ec31a3ad078cee9508a5e..57829e957f7793d1a7ba85b02de171559f4edd17 100644 (file)
@@ -330,7 +330,7 @@ struct Sequence *sequencer_add_sound_strip(struct bContext *C, ListBase *seqbase
 struct Sequence *sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
 
 /* view3d draw callback, run when not in background view */
-typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, int, int, unsigned int, int, char[256]);
+typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, char[256]);
 extern SequencerDrawView sequencer_view3d_cb;
 
 /* copy/paste */
index 937a46d68dd947dbf24bde4b5f9e6e59b273e2e0..d1fef8b0ce11186456156d3c3b2278bf79b31eb0 100644 (file)
@@ -90,7 +90,7 @@ void space_transform_invert(const struct SpaceTransform *data, float *co);
  *    - Normal projection
  *
  * ShrinkwrapCalcData encapsulates all needed data for shrinkwrap functions.
- * (So that you dont have to pass an enormous ammount of arguments to functions)
+ * (So that you dont have to pass an enormous amount of arguments to functions)
  */
 
 struct Object;
index 9187d07a39f6f7407e6fa4056339b8070d3d5063..a619be07b6aeeee77cf2803f7dba37204257033c 100644 (file)
@@ -284,6 +284,10 @@ endif()
 if(WITH_PYTHON)
        list(APPEND INC ../python ${PYTHON_INCLUDE_DIRS})
        add_definitions(-DWITH_PYTHON)
+
+       if(WITH_PYTHON_SECURITY)
+               add_definitions(-DWITH_PYTHON_SECURITY)
+       endif()
 endif()
 
 if(WITH_OPENMP)
index d6e90ffab1421c922d39371f1c3c6fbd01ec36ff..7d3219d917e3879019187be57402fc2ea1bad35b 100644 (file)
@@ -2558,7 +2558,6 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const
        else {
                const short *no= pMesh->mvert[(&pMesh->mface[face_num].v1)[vert_index]].no;
                normal_short_to_float_v3(fNorm, no);
-               normalize_v3(fNorm); /* XXX, is this needed */
        }
 }
 static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert)
index 5b42948072ff56f7f463b7b25596d03b761dbed8..5b49d9a9841204a94cc16cf8e3a67b1a69829ed4 100644 (file)
@@ -95,6 +95,7 @@ bAction *add_empty_action(const char name[])
 void make_local_action(bAction *act)
 {
        // Object *ob;
+       Main *bmain= G.main;
        bAction *actn;
        int local=0, lib=0;
        
@@ -102,7 +103,7 @@ void make_local_action(bAction *act)
        if (act->id.us==1) {
                act->id.lib= NULL;
                act->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)act, NULL);
+               new_id(&bmain->action, (ID *)act, NULL);
                return;
        }
        
@@ -121,7 +122,7 @@ void make_local_action(bAction *act)
                act->id.lib= NULL;
                act->id.flag= LIB_LOCAL;
                //make_local_action_channels(act);
-               new_id(NULL, (ID *)act, NULL);
+               new_id(&bmain->action, (ID *)act, NULL);
        }
        else if(local && lib) {
                actn= copy_action(act);
@@ -419,11 +420,11 @@ bPoseChannel *verify_pose_channel(bPose *pose, const char *name)
                return NULL;
        
        /* See if this channel exists */
-       for (chan=pose->chanbase.first; chan; chan=chan->next) {
-               if (!strcmp (name, chan->name))
-                       return chan;
+       chan= BLI_findstring(&pose->chanbase, name, offsetof(bPoseChannel, name));
+       if(chan) {
+               return chan;
        }
-       
+
        /* If not, create it and add it */
        chan = MEM_callocN(sizeof(bPoseChannel), "verifyPoseChannel");
        
index 3ff19b01b6c1e91422c04ceb698e12ad5b6fcb9b..b9c70493aee8c2eb707f890f1cd6618970524428 100644 (file)
@@ -195,7 +195,7 @@ AnimData *BKE_copy_animdata (AnimData *adt, const short do_action)
        dadt= MEM_dupallocN(adt);
        
        /* make a copy of action - at worst, user has to delete copies... */
-       if(do_action) {
+       if (do_action) {
                dadt->action= copy_action(adt->action);
                dadt->tmpact= copy_action(adt->tmpact);
        }
@@ -217,11 +217,11 @@ AnimData *BKE_copy_animdata (AnimData *adt, const short do_action)
        return dadt;
 }
 
-int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from, const short do_action)
+int BKE_copy_animdata_id (ID *id_to, ID *id_from, const short do_action)
 {
        AnimData *adt;
 
-       if((id_to && id_from) && (GS(id_to->name) != GS(id_from->name)))
+       if ((id_to && id_from) && (GS(id_to->name) != GS(id_from->name)))
                return 0;
 
        BKE_free_animdata(id_to);
@@ -238,13 +238,13 @@ int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from, const short do_ac
 void BKE_copy_animdata_id_action(struct ID *id)
 {
        AnimData *adt= BKE_animdata_from_id(id);
-       if(adt) {
-               if(adt->action) {
-                       ((ID *)adt->action)->us--;
+       if (adt) {
+               if (adt->action) {
+                       id_us_min((ID *)adt->action);
                        adt->action= copy_action(adt->action);
                }
-               if(adt->tmpact) {
-                       ((ID *)adt->tmpact)->us--;
+               if (adt->tmpact) {
+                       id_us_min((ID *)adt->tmpact);
                        adt->tmpact= copy_action(adt->tmpact);
                }
        }
index a79637eea7302a86ab57453c3f1c32aac059b82a..fd25ebe266f42ccbdd6e97c4c8647cab5a7ac89a 100644 (file)
@@ -137,39 +137,42 @@ void free_armature(bArmature *arm)
 
 void make_local_armature(bArmature *arm)
 {
+       Main *bmain= G.main;
        int local=0, lib=0;
        Object *ob;
-       bArmature *newArm;
-       
-       if (arm->id.lib==NULL)
-               return;
+
+       if (arm->id.lib==NULL) return;
        if (arm->id.us==1) {
                arm->id.lib= NULL;
                arm->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID*)arm, NULL);
+               new_id(&bmain->armature, (ID*)arm, NULL);
                return;
        }
-       
+
+       for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+               if(ob->data == arm) {
+                       if(ob->id.lib) lib= 1;
+                       else local= 1;
+               }
+       }
+
        if(local && lib==0) {
                arm->id.lib= NULL;
                arm->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)arm, NULL);
+               new_id(&bmain->armature, (ID *)arm, NULL);
        }
        else if(local && lib) {
-               newArm= copy_armature(arm);
-               newArm->id.us= 0;
+               bArmature *armn= copy_armature(arm);
+               armn->id.us= 0;
                
-               ob= G.main->object.first;
-               while(ob) {
-                       if(ob->data==arm) {
-                               
+               for(ob= bmain->object.first; ob; ob= ob->id.next) {
+                       if(ob->data == arm) {
                                if(ob->id.lib==NULL) {
-                                       ob->data= newArm;
-                                       newArm->id.us++;
+                                       ob->data= armn;
+                                       armn->id.us++;
                                        arm->id.us--;
                                }
                        }
-                       ob= ob->id.next;
                }
        }
 }
index d1a181046a6c2cf47ebe166459188993cacc5480..ce6a95430e3005025cd3407009d4d0086db3da4c 100644 (file)
@@ -140,8 +140,12 @@ void initglobals(void)
        G.charstart = 0x0000;
        G.charmin = 0x0000;
        G.charmax = 0xffff;
-       
+
+#ifndef WITH_PYTHON_SECURITY /* default */
        G.f |= G_SCRIPT_AUTOEXEC;
+#else
+       G.f &= ~G_SCRIPT_AUTOEXEC;
+#endif
 }
 
 /***/
index 11ea3384c963212492797e95e9966e3a15b4e351..9f808704eeef0c712a26c1c9ba86810968dc5c95 100644 (file)
@@ -1299,7 +1299,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
                                        bpa->data.mode = eBoidMode_OnLand;
                                }
                                /* fly above ground */
-                               else {
+                               else if(bpa->ground) {
                                        pa->state.co[2] = ground_co[2] + pa->size * boids->height;
                                        pa->state.vel[2] = 0.0f;
                                }
index ac532cca7c6039df165ae1974a8cfdfe9ee6f8eb..fa3b756ae27980eb6e98cb5d0b02a1919c468a56 100644 (file)
@@ -180,14 +180,20 @@ void free_brush(Brush *brush)
        curvemapping_free(brush->curve);
 }
 
+static void extern_local_brush(Brush *brush)
+{
+       id_lib_extern((ID *)brush->mtex.tex);
+}
+
 void make_local_brush(Brush *brush)
 {
+
        /* - only lib users: do nothing
-               * - only local users: set flag
-               * - mixed: make copy
-               */
-       
-       Brush *brushn;
+        * - only local users: set flag
+        * - mixed: make copy
+        */
+
+       Main *bmain= G.main;
        Scene *scene;
        int local= 0, lib= 0;
 
@@ -197,19 +203,22 @@ void make_local_brush(Brush *brush)
                /* special case: ima always local immediately */
                brush->clone.image->id.lib= NULL;
                brush->clone.image->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)brush->clone.image, NULL);
+               new_id(&bmain->brush, (ID *)brush->clone.image, NULL);
+               extern_local_brush(brush);
        }
 
-       for(scene= G.main->scene.first; scene; scene=scene->id.next)
+       for(scene= bmain->scene.first; scene && ELEM(0, lib, local); scene=scene->id.next) {
                if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
                        if(scene->id.lib) lib= 1;
                        else local= 1;
                }
+       }
 
        if(local && lib==0) {
                brush->id.lib= NULL;
                brush->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)brush, NULL);
+               new_id(&bmain->brush, (ID *)brush, NULL);
+               extern_local_brush(brush);
 
                /* enable fake user by default */
                if (!(brush->id.flag & LIB_FAKEUSER)) {
@@ -218,17 +227,19 @@ void make_local_brush(Brush *brush)
                }
        }
        else if(local && lib) {
-               brushn= copy_brush(brush);
+               Brush *brushn= copy_brush(brush);
                brushn->id.us= 1; /* only keep fake user */
                brushn->id.flag |= LIB_FAKEUSER;
                
-               for(scene= G.main->scene.first; scene; scene=scene->id.next)
-                       if(paint_brush(&scene->toolsettings->imapaint.paint)==brush)
+               for(scene= bmain->scene.first; scene; scene=scene->id.next) {
+                       if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
                                if(scene->id.lib==NULL) {
                                        paint_brush_set(&scene->toolsettings->imapaint.paint, brushn);
                                        brushn->id.us++;
                                        brush->id.us--;
                                }
+                       }
+               }
        }
 }
 
index 0b29b29e60ff99840753aa609b3423e693459b7c..8bd650b1a423e25a41f293ffb348b72b710d4fc9 100644 (file)
@@ -172,11 +172,7 @@ static void cdDM_getVertCos(DerivedMesh *dm, float (*cos_r)[3])
 static void cdDM_getVertNo(DerivedMesh *dm, int index, float no_r[3])
 {
        CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
-       short *no = cddm->mvert[index].no;
-
-       no_r[0] = no[0]/32767.f;
-       no_r[1] = no[1]/32767.f;
-       no_r[2] = no[2]/32767.f;
+       normal_short_to_float_v3(no_r, cddm->mvert[index].no);
 }
 
 static ListBase *cdDM_getFaceMap(Object *ob, DerivedMesh *dm)
@@ -580,8 +576,9 @@ static void cdDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned cha
        /* there's a conflict here... twosided colors versus culling...? */
        /* defined by history, only texture faces have culling option */
        /* we need that as mesh option builtin, next to double sided lighting */
-       if(col1 && col2)
+       if(col2) {
                glEnable(GL_CULL_FACE);
+       }
 
        cdDM_update_normals_from_pbvh(dm);
 
@@ -773,6 +770,19 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
                }
 
                if( !GPU_buffer_legacy(dm) ) {
+                       /* warning!, this logic is incorrect, see bug [#27175]
+                        * firstly, there are no checks for changes in context, such as texface image.
+                        * secondly, drawParams() sets the GL context, so checking if there is a change
+                        * from lastFlag is too late once glDrawArrays() runs, since drawing the arrays
+                        * will use the modified, OpenGL settings.
+                        * 
+                        * However its tricky to fix this without duplicating the internal logic
+                        * of drawParams(), perhaps we need an argument like...
+                        * drawParams(..., keep_gl_state_but_return_when_changed) ?.
+                        *
+                        * We could also just disable VBO's here, since texface may be deprecated - campbell.
+                        */
+                       
                        glShadeModel( GL_SMOOTH );
                        lastFlag = 0;
                        for(i = 0; i < dm->drawObject->nelements/3; i++) {
index 4e5a1977ab01da24b2d861ce4cb772f58d4991c5..55d455bc5d3b5fe26172b0dd4d04c510d00dcc59 100644 (file)
@@ -451,11 +451,10 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
 
                C->data.recursion= 1;
 
-               for(entry=C->wm.store->entries.first; entry; entry=entry->next) {
-                       if(strcmp(entry->name, member) == 0) {
-                               result->ptr= entry->ptr;
-                               done= 1;
-                       }
+               entry= BLI_findstring(&C->wm.store->entries, member, offsetof(bContextStoreEntry, name));
+               if(entry) {
+                       result->ptr= entry->ptr;
+                       done= 1;
                }
        }
        if(done!=1 && recursion < 2 && C->wm.region) {
@@ -649,7 +648,7 @@ int CTX_data_equals(const char *member, const char *str)
 
 int CTX_data_dir(const char *member)
 {
-       return (strcmp(member, "") == 0);
+       return member[0] == '\0';
 }
 
 void CTX_data_id_pointer_set(bContextDataResult *result, ID *id)
index 34e5fef8074b1700f7a140893d6376f4549540c4..b104c6c9b30b76bdd2d6e8d6c41d61f3443cf52a 100644 (file)
@@ -63,7 +63,8 @@
 #include "BKE_key.h"  
 #include "BKE_library.h"  
 #include "BKE_main.h"  
-#include "BKE_object.h"  
+#include "BKE_object.h"
+#include "BKE_material.h"
 
 
 #include "ED_curve.h"
@@ -216,10 +217,22 @@ Curve *copy_curve(Curve *cu)
        return cun;
 }
 
+static void extern_local_curve(Curve *cu)
+{      
+       id_lib_extern((ID *)cu->vfont);
+       id_lib_extern((ID *)cu->vfontb);        
+       id_lib_extern((ID *)cu->vfonti);
+       id_lib_extern((ID *)cu->vfontbi);
+       
+       if(cu->mat) {
+               extern_local_matarar(cu->mat, cu->totcol);
+       }
+}
+
 void make_local_curve(Curve *cu)
 {
-       Object *ob = NULL;
-       Curve *cun;
+       Main *bmain= G.main;
+       Object *ob;
        int local=0, lib=0;
        
        /* - when there are only lib users: don't do
@@ -229,47 +242,41 @@ void make_local_curve(Curve *cu)
        
        if(cu->id.lib==NULL) return;
 
-       if(cu->vfont) cu->vfont->id.lib= NULL;
-       if(cu->vfontb) cu->vfontb->id.lib= NULL;
-       if(cu->vfonti) cu->vfonti->id.lib= NULL;
-       if(cu->vfontbi) cu->vfontbi->id.lib= NULL;
-
        if(cu->id.us==1) {
                cu->id.lib= NULL;
                cu->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)cu, NULL);
+
+               new_id(&bmain->curve, (ID *)cu, NULL);
+               extern_local_curve(cu);
                return;
        }
-       
-       ob= G.main->object.first;
-       while(ob) {
-               if(ob->data==cu) {
+
+       for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+               if(ob->data == cu) {
                        if(ob->id.lib) lib= 1;
                        else local= 1;
                }
-               ob= ob->id.next;
        }
-       
+
        if(local && lib==0) {
                cu->id.lib= NULL;
                cu->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)cu, NULL);
+
+               new_id(&bmain->curve, (ID *)cu, NULL);
+               extern_local_curve(cu);
        }
        else if(local && lib) {
-               cun= copy_curve(cu);
+               Curve *cun= copy_curve(cu);
                cun->id.us= 0;
-               
-               ob= G.main->object.first;
-               while(ob) {
+
+               for(ob= bmain->object.first; ob; ob= ob->id.next) {
                        if(ob->data==cu) {
-                               
                                if(ob->id.lib==NULL) {
                                        ob->data= cun;
                                        cun->id.us++;
                                        cu->id.us--;
                                }
                        }
-                       ob= ob->id.next;
                }
        }
 }
index 94fbcd9ccb4a8aaf14b34ef01bec01661d902abf..6813d5d18a61c3df57973104cc39fe1c58cc5b62 100644 (file)
@@ -1905,7 +1905,9 @@ static void dag_scene_flush_layers(Scene *sce, int lay)
        }
 
        /* ensure cameras are set as if they are on a visible layer, because
-          they ared still used for rendering or setting the camera view */
+        * they ared still used for rendering or setting the camera view
+        *
+        * XXX, this wont work for local view / unlocked camera's */
        if(sce->camera) {
                node= dag_get_node(sce->theDag, sce->camera);
                node->scelay |= lay;
index 0c722d81f45e6d0c84cbfd822371e6140ffdc2ee..6898615c7537b045cbd1eff58b979599715ee2d1 100644 (file)
@@ -386,7 +386,7 @@ VFont *load_vfont(const char *name)
                        vfont->data = vfd;
 
                        /* if there's a font name, use it for the ID name */
-                       if (strcmp(vfd->name, "")!=0) {
+                       if (vfd->name[0] != '\0') {
                                BLI_strncpy(vfont->id.name+2, vfd->name, sizeof(vfont->id.name)-2);
                        }
                        BLI_strncpy(vfont->name, name, sizeof(vfont->name));
index 80962de973046fb66f2a19401ff6cbf55b0a9758..04fc41e41cc957b303b1705d2d3354fc7e001f01 100644 (file)
@@ -426,35 +426,30 @@ static IDProperty *IDP_CopyGroup(IDProperty *prop)
  * When values name and types match, copy the values, else ignore */
 void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src)
 {
-       IDProperty *loop, *prop;
+       IDProperty *other, *prop;
        for (prop=src->data.group.first; prop; prop=prop->next) {
-               for (loop=dest->data.group.first; loop; loop=loop->next) {
-                       if (strcmp(loop->name, prop->name)==0) {
-                               if(prop->type==loop->type) {
-
-                                       switch (prop->type) {
-                                               case IDP_INT:
-                                               case IDP_FLOAT:
-                                               case IDP_DOUBLE:
-                                                       loop->data= prop->data;
-                                                       break;
-                                               case IDP_GROUP:
-                                                       IDP_SyncGroupValues(loop, prop);
-                                                       break;
-                                               default:
-                                               {
-                                                       IDProperty *tmp= loop;
-                                                       IDProperty *copy= IDP_CopyProperty(prop);
-
-                                                       BLI_insertlinkafter(&dest->data.group, loop, copy);
-                                                       BLI_remlink(&dest->data.group, tmp);
-
-                                                       IDP_FreeProperty(tmp);
-                                                       MEM_freeN(tmp);
-                                               }
-                                       }
+               other= BLI_findstring(&dest->data.group, prop->name, offsetof(IDProperty, name));
+               if (other && prop->type==other->type) {
+                       switch (prop->type) {
+                               case IDP_INT:
+                               case IDP_FLOAT:
+                               case IDP_DOUBLE:
+                                       other->data= prop->data;
+                                       break;
+                               case IDP_GROUP:
+                                       IDP_SyncGroupValues(other, prop);
+                                       break;
+                               default:
+                               {
+                                       IDProperty *tmp= other;
+                                       IDProperty *copy= IDP_CopyProperty(prop);
+
+                                       BLI_insertlinkafter(&dest->data.group, other, copy);
+                                       BLI_remlink(&dest->data.group, tmp);
+
+                                       IDP_FreeProperty(tmp);
+                                       MEM_freeN(tmp);
                                }
-                               break;
                        }
                }
        }
index c44634fed34beca15e13026fa66ae9efdbdd589f..28559812f4d8f068fc52e8936138ddc8c5de9523 100644 (file)
@@ -880,7 +880,7 @@ typedef struct StampData {
        char    rendertime[64];
 } StampData;
 
-static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
+static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int do_prefix)
 {
        char text[256];
        struct tm *tl;
@@ -959,14 +959,14 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
        }
 
        if (scene->r.stamp & R_STAMP_CAMERA) {
-               BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s":"%s", scene->camera ? scene->camera->id.name+2 : "<none>");
+               BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s":"%s", camera ? camera->id.name+2 : "<none>");
        } else {
                stamp_data->camera[0] = '\0';
        }
 
        if (scene->r.stamp & R_STAMP_CAMERALENS) {
-               if (scene->camera && scene->camera->type == OB_CAMERA) {
-                       BLI_snprintf(text, sizeof(text), "%.2f", ((Camera *)scene->camera->data)->lens);
+               if (camera && camera->type == OB_CAMERA) {
+                       BLI_snprintf(text, sizeof(text), "%.2f", ((Camera *)camera->data)->lens);
                }
                else            strcpy(text, "<none>");
 
@@ -1006,18 +1006,18 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
        }
 }
 
-void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels)
+void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels)
 {
        struct StampData stamp_data;
        float w, h, pad;
-       int x, y;
+       int x, y, y_ofs;
        float h_fixed;
        const int mono= blf_mono_font_render; // XXX
        
        if (!rect && !rectf)
                return;
        
-       stampdata(scene, &stamp_data, 1);
+       stampdata(scene, camera, &stamp_data, 1);
 
        /* TODO, do_versions */
        if(scene->r.stamp_font_id < 8)
@@ -1034,8 +1034,17 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
        // BLF_width_and_height(mono, "^|/_AgPpJjlYy", &w, &h_fixed);
        {
                rctf box;
+               float baseline;
                BLF_boundbox(mono, "^|/_AgPpJjlYy", &box);
                h_fixed= box.ymax - box.ymin;
+               
+               /* crude way to get the decent line from A->j*/
+               BLF_boundbox(mono, "A", &box);
+               baseline= box.ymin;
+               BLF_boundbox(mono, "j", &box);
+               y_ofs = (int)(baseline - box.ymin);
+               if(y_ofs < 0) y_ofs= 0; /* should never happen */
+               y_ofs++;
        }
 
        x= 0;
@@ -1050,7 +1059,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y-3, w+3, y+h+2);
 
                /* and draw the text. */
-               BLF_position(mono, x, y, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.file);
 
                /* the extra pixel for background. */
@@ -1065,7 +1074,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                /* and space for background. */
                buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+2);
 
-               BLF_position(mono, x, y+1, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.note);
 
                /* the extra pixel for background. */
@@ -1080,7 +1089,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                /* and space for background. */
                buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+2);
 
-               BLF_position(mono, x, y, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.date);
 
                /* the extra pixel for background. */
@@ -1095,7 +1104,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                /* and space for background. */
                buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+2);
 
-               BLF_position(mono, x, y, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.rendertime);
        }
 
@@ -1110,7 +1119,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, w+2, y+h+2);
 
                /* and pad the text. */
-               BLF_position(mono, x, y+3, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.marker);
 
                /* space width. */
@@ -1125,7 +1134,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
 
                /* and pad the text. */
-               BLF_position(mono, x, y+3, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.time);
 
                /* space width. */
@@ -1139,7 +1148,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
 
                /* and pad the text. */
-               BLF_position(mono, x, y+3, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.frame);
 
                /* space width. */
@@ -1151,7 +1160,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
 
                /* extra space for background. */
                buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
-               BLF_position(mono, x, y+3, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.camera);
 
                /* space width. */
@@ -1163,7 +1172,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
 
                /* extra space for background. */
                buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
-               BLF_position(mono, x, y+3, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.cameralens);
        }
        
@@ -1177,7 +1186,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+3, y+h+2);
 
                /* and pad the text. */
-               BLF_position(mono, x, y+3, 0.0);
+               BLF_position(mono, x, y+y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.scene);
        }
        
@@ -1191,7 +1200,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                /* extra space for background. */
                buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y-3, x+w+pad, y+h+2);
 
-               BLF_position(mono, x, y, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.strip);
        }
 
@@ -1199,14 +1208,14 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
        BLF_buffer(mono, NULL, NULL, 0, 0, 0);
 }
 
-void BKE_stamp_info(Scene *scene, struct ImBuf *ibuf)
+void BKE_stamp_info(Scene *scene, Object *camera, struct ImBuf *ibuf)
 {
        struct StampData stamp_data;
 
        if (!ibuf)      return;
        
        /* fill all the data values, no prefix */
-       stampdata(scene, &stamp_data, 0);
+       stampdata(scene, camera, &stamp_data, 0);
        
        if (stamp_data.file[0])         IMB_metadata_change_field (ibuf, "File",                stamp_data.file);
        if (stamp_data.note[0])         IMB_metadata_change_field (ibuf, "Note",                stamp_data.note);
@@ -1244,7 +1253,7 @@ int BKE_alphatest_ibuf(ImBuf *ibuf)
        return FALSE;
 }
 
-int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
+int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
 {
        int ok;
        (void)subimtype; /* quies unused warnings */
@@ -1339,9 +1348,6 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int
        }
        
        BLI_make_existing_file(name);
-
-       if(scene && scene->r.stamp & R_STAMP_ALL)
-               BKE_stamp_info(scene, ibuf);
        
        ok = IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat);
        if (ok == 0) {
@@ -1351,6 +1357,14 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int
        return(ok);
 }
 
+int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
+{
+       if(scene && scene->r.stamp & R_STAMP_ALL)
+               BKE_stamp_info(scene, camera, ibuf);
+
+       return BKE_write_ibuf(ibuf, name, imtype, subimtype, quality);
+}
+
 
 void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames)
 {
index d308ccbf876c18514823b10be4043ec88b5236c4..f0ac7040deb1b60ddf214b74484713dfc585ac61 100644 (file)
@@ -249,8 +249,8 @@ void free_lattice(Lattice *lt)
 
 void make_local_lattice(Lattice *lt)
 {
+       Main *bmain= G.main;
        Object *ob;
-       Lattice *ltn;
        int local=0, lib=0;
 
        /* - only lib users: do nothing
@@ -262,39 +262,34 @@ void make_local_lattice(Lattice *lt)
        if(lt->id.us==1) {
                lt->id.lib= NULL;
                lt->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)lt, NULL);
+               new_id(&bmain->latt, (ID *)lt, NULL);
                return;
        }
        
-       ob= G.main->object.first;
-       while(ob) {
+       for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
                if(ob->data==lt) {
                        if(ob->id.lib) lib= 1;
                        else local= 1;
                }
-               ob= ob->id.next;
        }
        
        if(local && lib==0) {
                lt->id.lib= NULL;
                lt->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)lt, NULL);
+               new_id(&bmain->latt, (ID *)lt, NULL);
        }
        else if(local && lib) {
-               ltn= copy_lattice(lt);
+               Lattice *ltn= copy_lattice(lt);
                ltn->id.us= 0;
-               
-               ob= G.main->object.first;
-               while(ob) {
+
+               for(ob= bmain->object.first; ob; ob= ob->id.next) {
                        if(ob->data==lt) {
-                               
                                if(ob->id.lib==NULL) {
                                        ob->data= ltn;
                                        ltn->id.us++;
                                        lt->id.us--;
                                }
                        }
-                       ob= ob->id.next;
                }
        }
 }
index 000bdc138a4bcc5c1e155e6fe9c298d74e5825d6..a063458bdb5fbbb5395318ccc8aec3171f72300d 100644 (file)
@@ -268,6 +268,14 @@ Material *localize_material(Material *ma)
        return man;
 }
 
+static void extern_local_material(Material *ma)
+{
+       int i;
+       for(i=0; i < MAX_MTEX; i++) {
+               if(ma->mtex[i]) id_lib_extern((ID *)ma->mtex[i]->tex);
+       }
+}
+
 void make_local_material(Material *ma)
 {
        Main *bmain= G.main;
@@ -287,11 +295,9 @@ void make_local_material(Material *ma)
        if(ma->id.us==1) {
                ma->id.lib= NULL;
                ma->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)ma, NULL);
-               for(a=0; a<MAX_MTEX; a++) {
-                       if(ma->mtex[a]) id_lib_extern((ID *)ma->mtex[a]->tex);
-               }
-               
+
+               new_id(&bmain->mat, (ID *)ma, NULL);
+               extern_local_material(ma);
                return;
        }
        
@@ -351,12 +357,9 @@ void make_local_material(Material *ma)
        if(local && lib==0) {
                ma->id.lib= NULL;
                ma->id.flag= LIB_LOCAL;
-               
-               for(a=0; a<MAX_MTEX; a++) {
-                       if(ma->mtex[a]) id_lib_extern((ID *)ma->mtex[a]->tex);
-               }
-               
-               new_id(NULL, (ID *)ma, NULL);
+
+               new_id(&bmain->mat, (ID *)ma, NULL);
+               extern_local_material(ma);
        }
        else if(local && lib) {
                
@@ -430,6 +433,15 @@ void make_local_material(Material *ma)
        }
 }
 
+/* for curve, mball, mesh types */
+void extern_local_matarar(struct Material **matar, short totcol)
+{
+       short i;
+       for(i= 0; i < totcol; i++) {
+               id_lib_extern((ID *)matar[i]);
+       }
+}
+
 Material ***give_matarar(Object *ob)
 {
        Mesh *me;
index e19a508658e58a23ab868e60cd7713ca1f5ad8a5..555d35726bce7fc7685e5393b489b5366c6294f8 100644 (file)
@@ -67,6 +67,7 @@
 #include "BKE_displist.h"
 #include "BKE_mball.h"
 #include "BKE_object.h"
+#include "BKE_material.h"
 
 /* Global variables */
 
@@ -139,10 +140,17 @@ MetaBall *copy_mball(MetaBall *mb)
        return mbn;
 }
 
+static void extern_local_mball(MetaBall *mb)
+{
+       if(mb->mat) {
+               extern_local_matarar(mb->mat, mb->totcol);
+       }
+}
+
 void make_local_mball(MetaBall *mb)
 {
+       Main *bmain= G.main;
        Object *ob;
-       MetaBall *mbn;
        int local=0, lib=0;
 
        /* - only lib users: do nothing
@@ -154,37 +162,38 @@ void make_local_mball(MetaBall *mb)
        if(mb->id.us==1) {
                mb->id.lib= NULL;
                mb->id.flag= LIB_LOCAL;
+               new_id(&bmain->mball, (ID *)mb, NULL);
+               extern_local_mball(mb);
+               
                return;
        }
-       
-       ob= G.main->object.first;
-       while(ob) {
-               if(ob->data==mb) {
+
+       for(ob= G.main->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+               if(ob->data == mb) {
                        if(ob->id.lib) lib= 1;
                        else local= 1;
                }
-               ob= ob->id.next;
        }
        
        if(local && lib==0) {
                mb->id.lib= NULL;
                mb->id.flag= LIB_LOCAL;
+
+               new_id(&bmain->mball, (ID *)mb, NULL);
+               extern_local_mball(mb);
        }
        else if(local && lib) {
-               mbn= copy_mball(mb);
+               MetaBall *mbn= copy_mball(mb);
                mbn->id.us= 0;
-               
-               ob= G.main->object.first;
-               while(ob) {
-                       if(ob->data==mb) {
-                               
+
+               for(ob= G.main->object.first; ob; ob= ob->id.next) {
+                       if(ob->data == mb) {
                                if(ob->id.lib==NULL) {
                                        ob->data= mbn;
                                        mbn->id.us++;
                                        mb->id.us--;
                                }
                        }
-                       ob= ob->id.next;
                }
        }
 }
index 532e96f303157459289bc85e115882c09d460c34..45a60b842a7e633e29a9387b15a14f2bf14a96c5 100644 (file)
@@ -247,7 +247,7 @@ Mesh *copy_mesh(Mesh *me)
        return men;
 }
 
-void make_local_tface(Mesh *me)
+static void make_local_tface(Main *bmain, Mesh *me)
 {
        MTFace *tface;
        Image *ima;
@@ -264,7 +264,7 @@ void make_local_tface(Mesh *me)
                                        if(ima->id.lib) {
                                                ima->id.lib= NULL;
                                                ima->id.flag= LIB_LOCAL;
-                                               new_id(NULL, (ID *)ima, NULL);
+                                               new_id(&bmain->image, (ID *)ima, NULL);
                                        }
                                }
                        }
@@ -272,58 +272,65 @@ void make_local_tface(Mesh *me)
        }
 }
 
+static void expand_local_mesh(Main *bmain, Mesh *me)
+{
+       id_lib_extern((ID *)me->texcomesh);
+
+       if(me->mtface) {
+               /* why is this an exception? - should not really make local when extern'ing - campbell */
+               make_local_tface(bmain, me);
+       }
+
+       if(me->mat) {
+               extern_local_matarar(me->mat, me->totcol);
+       }
+}
+
 void make_local_mesh(Mesh *me)
 {
        Main *bmain= G.main;
        Object *ob;
-       Mesh *men;
        int local=0, lib=0;
 
        /* - only lib users: do nothing
-               * - only local users: set flag
-               * - mixed: make copy
-               */
-       
+        * - only local users: set flag
+        * - mixed: make copy
+        */
+
        if(me->id.lib==NULL) return;
        if(me->id.us==1) {
                me->id.lib= NULL;
                me->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)me, NULL);
-               
-               if(me->mtface) make_local_tface(me);
-               
+
+               new_id(&bmain->mesh, (ID *)me, NULL);
+               expand_local_mesh(bmain, me);
                return;
        }
-       
-       ob= bmain->object.first;
-       while(ob) {
-               if( me==get_mesh(ob) ) {
+
+       for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+               if(me == ob->data) {
                        if(ob->id.lib) lib= 1;
                        else local= 1;
                }
-               ob= ob->id.next;
        }
-       
+
        if(local && lib==0) {
                me->id.lib= NULL;
                me->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)me, NULL);
-               
-               if(me->mtface) make_local_tface(me);
-               
+
+               new_id(&bmain->mesh, (ID *)me, NULL);
+               expand_local_mesh(bmain, me);
        }
        else if(local && lib) {
-               men= copy_mesh(me);
+               Mesh *men= copy_mesh(me);
                men->id.us= 0;
-               
-               ob= bmain->object.first;
-               while(ob) {
-                       if( me==get_mesh(ob) ) {                                
+
+               for(ob= bmain->object.first; ob; ob= ob->id.next) {
+                       if(me == ob->data) {
                                if(ob->id.lib==NULL) {
                                        set_mesh(ob, men);
                                }
                        }
-                       ob= ob->id.next;
                }
        }
 }
index 7c38688c82e2bb83855605244deca9918f5833b9..34618a19ae9e521fc687c8dcc8200874623f9313 100644 (file)
@@ -307,7 +307,9 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve
 
 int BKE_mesh_validate(Mesh *me, int do_verbose)
 {
-       printf("MESH: %s\n", me->id.name+2);
+       if(do_verbose) {
+               printf("MESH: %s\n", me->id.name+2);
+       }
        return BKE_mesh_validate_arrays(me, me->mvert, me->totvert, me->medge, me->totedge, me->mface, me->totface, do_verbose, TRUE);
 }
 
index b8b57b6bac00a241e5d55ebe581c08e83638c7b5..4b40c07b7a92bd2921f4d30fa0d459c09e173960 100644 (file)
@@ -2244,16 +2244,40 @@ static void group_tag_used_outputs(bNode *gnode, bNodeStack *stack, bNodeStack *
                        }
                }
                
+               /* non-composite trees do all nodes by default */
+               if (ntree->type!=NTREE_COMPOSIT)
+                       node->need_exec = 1;
+               
+               for(sock= node->inputs.first; sock; sock= sock->next) {
+                       bNodeStack *ns = get_socket_stack(stack, sock, gin);
+                       if (ns) {
+                               ns->hasoutput = 1;
+                               
+                               /* sock type is needed to detect rgba or value or vector types */
+                               if(sock->link && sock->link->fromsock)
+                                       ns->sockettype= sock->link->fromsock->type;
+                               else
+                                       sock->ns.sockettype= sock->type;
+                       }
+                       
+                       if(sock->link) {
+                               bNodeLink *link= sock->link;
+                               /* this is the test for a cyclic case */
+                               if(link->fromnode && link->tonode) {
+                                       if(link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF);
+                                       else {
+                                               node->need_exec= 0;
+                                       }
+                               }
+                       }
+               }
+               
                /* set stack types (for local stack entries) */
                for(sock= node->outputs.first; sock; sock= sock->next) {
-                       bNodeStack *ns = get_socket_stack(stack, sock, NULL);
+                       bNodeStack *ns = get_socket_stack(stack, sock, gin);
                        if (ns)
                                ns->sockettype = sock->type;
                }
-               
-               /* non-composite trees do all nodes by default */
-               if (ntree->type!=NTREE_COMPOSIT)
-                       node->need_exec = 1;
        }
 }
 
index 00ebf9ff5a8f5bfe5aa872bef4687b1afde4d38a..2721d02eab612b0f6e3fc33116a2f78b6628d429 100644 (file)
@@ -97,6 +97,7 @@
 #include "BKE_scene.h"
 #include "BKE_sequencer.h"
 #include "BKE_softbody.h"
+#include "BKE_material.h"
 
 #include "LBM_fluidsim.h"
 
@@ -746,51 +747,45 @@ void make_local_camera(Camera *cam)
 {
        Main *bmain= G.main;
        Object *ob;
-       Camera *camn;
        int local=0, lib=0;
 
        /* - only lib users: do nothing
-               * - only local users: set flag
-               * - mixed: make copy
-               */
+        * - only local users: set flag
+        * - mixed: make copy
+        */
        
        if(cam->id.lib==NULL) return;
        if(cam->id.us==1) {
                cam->id.lib= NULL;
                cam->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)cam, NULL);
+               new_id(&bmain->camera, (ID *)cam, NULL);
                return;
        }
        
-       ob= bmain->object.first;
-       while(ob) {
+       for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
                if(ob->data==cam) {
                        if(ob->id.lib) lib= 1;
                        else local= 1;
                }
-               ob= ob->id.next;
        }
        
        if(local && lib==0) {
                cam->id.lib= NULL;
                cam->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)cam, NULL);
+               new_id(&bmain->camera, (ID *)cam, NULL);
        }
        else if(local && lib) {
-               camn= copy_camera(cam);
+               Camera *camn= copy_camera(cam);
                camn->id.us= 0;
                
-               ob= bmain->object.first;
-               while(ob) {
-                       if(ob->data==cam) {
-                               
+               for(ob= bmain->object.first; ob; ob= ob->id.next) {
+                       if(ob->data == cam) {
                                if(ob->id.lib==NULL) {
                                        ob->data= camn;
                                        camn->id.us++;
                                        cam->id.us--;
                                }
                        }
-                       ob= ob->id.next;
                }
        }
 }
@@ -907,7 +902,7 @@ void make_local_lamp(Lamp *la)
        if(la->id.us==1) {
                la->id.lib= NULL;
                la->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)la, NULL);
+               new_id(&bmain->lamp, (ID *)la, NULL);
                return;
        }
        
@@ -923,7 +918,7 @@ void make_local_lamp(Lamp *la)
        if(local && lib==0) {
                la->id.lib= NULL;
                la->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)la, NULL);
+               new_id(&bmain->lamp, (ID *)la, NULL);
        }
        else if(local && lib) {
                lan= copy_lamp(la);
@@ -1376,11 +1371,10 @@ Object *copy_object(Object *ob)
        return obn;
 }
 
-void expand_local_object(Object *ob)
+static void extern_local_object(Object *ob)
 {
        //bActionStrip *strip;
        ParticleSystem *psys;
-       int a;
 
 #if 0 // XXX old animation system
        id_lib_extern((ID *)ob->action);
@@ -1388,10 +1382,11 @@ void expand_local_object(Object *ob)
 #endif // XXX old animation system
        id_lib_extern((ID *)ob->data);
        id_lib_extern((ID *)ob->dup_group);
-       
-       for(a=0; a<ob->totcol; a++) {
-               id_lib_extern((ID *)ob->mat[a]);
-       }
+       id_lib_extern((ID *)ob->poselib);
+       id_lib_extern((ID *)ob->gpd);
+
+       extern_local_matarar(ob->mat, ob->totcol);
+
 #if 0 // XXX old animation system
        for (strip=ob->nlastrips.first; strip; strip=strip->next) {
                id_lib_extern((ID *)strip->act);
@@ -1404,16 +1399,15 @@ void expand_local_object(Object *ob)
 void make_local_object(Object *ob)
 {
        Main *bmain= G.main;
-       Object *obn;
        Scene *sce;
        Base *base;
        int local=0, lib=0;
 
        /* - only lib users: do nothing
-               * - only local users: set flag
-               * - mixed: make copy
-               */
-       
+        * - only local users: set flag
+        * - mixed: make copy
+        */
+
        if(ob->id.lib==NULL) return;
        
        ob->proxy= ob->proxy_from= NULL;
@@ -1421,31 +1415,23 @@ void make_local_object(Object *ob)
        if(ob->id.us==1) {
                ob->id.lib= NULL;
                ob->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)ob, NULL);
-
+               new_id(&bmain->object, (ID *)ob, NULL);
        }
        else {
-               sce= bmain->scene.first;
-               while(sce) {
-                       base= sce->base.first;
-                       while(base) {
-                               if(base->object==ob) {
-                                       if(sce->id.lib) lib++;
-                                       else local++;
-                                       break;
-                               }
-                               base= base->next;
+               for(sce= bmain->scene.first; sce && ELEM(0, lib, local); sce= sce->id.next) {
+                       if(object_in_scene(ob, sce)) {
+                               if(sce->id.lib) lib= 1;
+                               else local= 1;
                        }
-                       sce= sce->id.next;
                }
-               
+
                if(local && lib==0) {
                        ob->id.lib= NULL;
                        ob->id.flag= LIB_LOCAL;
-                       new_id(NULL, (ID *)ob, NULL);
+                       new_id(&bmain->object, (ID *)ob, NULL);
                }
                else if(local && lib) {
-                       obn= copy_object(ob);
+                       Object *obn= copy_object(ob);
                        obn->id.us= 0;
                        
                        sce= bmain->scene.first;
@@ -1466,7 +1452,7 @@ void make_local_object(Object *ob)
                }
        }
        
-       expand_local_object(ob);
+       extern_local_object(ob);
 }
 
 /*
@@ -1574,7 +1560,10 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
                ob->rotmode= target->rotmode;
                mul_m4_m4m4(ob->obmat, target->obmat, gob->obmat);
                if(gob->dup_group) { /* should always be true */
-                       sub_v3_v3(ob->obmat[3], gob->dup_group->dupli_ofs);
+                       float tvec[3];
+                       copy_v3_v3(tvec, gob->dup_group->dupli_ofs);
+                       mul_mat3_m4_v3(ob->obmat, tvec);
+                       sub_v3_v3(ob->obmat[3], tvec);
                }
                object_apply_mat4(ob, ob->obmat, FALSE, TRUE);
        }
@@ -2570,7 +2559,10 @@ void object_handle_update(Scene *scene, Object *ob)
                                        invert_m4_m4(obg->imat, obg->obmat);
                                        mul_m4_m4m4(ob->obmat, ob->proxy_from->obmat, obg->imat);
                                        if(obg->dup_group) { /* should always be true */
-                                               add_v3_v3(ob->obmat[3], obg->dup_group->dupli_ofs);
+                                               float tvec[3];
+                                               copy_v3_v3(tvec, obg->dup_group->dupli_ofs);
+                                               mul_mat3_m4_v3(ob->obmat, tvec);
+                                               sub_v3_v3(ob->obmat[3], tvec);
                                        }
                                }
                                else
index e80289c75ae71c65ee88b9fb2a76636cfbf7216b..5ec4c36177f644d7dc5d79c6fb0d523e90bee789 100644 (file)
@@ -3030,7 +3030,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
 
        psys->totcached = totpart;
 
-       if(psys && psys->lattice){
+       if(psys->lattice){
                end_latt_deform(psys->lattice);
                psys->lattice= NULL;
        }
@@ -3589,28 +3589,38 @@ ParticleSettings *psys_copy_settings(ParticleSettings *part)
        return partn;
 }
 
+static void expand_local_particlesettings(ParticleSettings *part)
+{
+       int i;
+       id_lib_extern((ID *)part->dup_group);
+
+       for(i=0; i<MAX_MTEX; i++) {
+               if(part->mtex[i]) id_lib_extern((ID *)part->mtex[i]->tex);
+       }
+}
+
 void make_local_particlesettings(ParticleSettings *part)
 {
+       Main *bmain= G.main;
        Object *ob;
-       ParticleSettings *par;
        int local=0, lib=0;
 
        /* - only lib users: do nothing
-               * - only local users: set flag
-               * - mixed: make copy
-               */
+        * - only local users: set flag
+        * - mixed: make copy
+        */
        
        if(part->id.lib==0) return;
        if(part->id.us==1) {
                part->id.lib= 0;
                part->id.flag= LIB_LOCAL;
-               new_id(0, (ID *)part, 0);
+               new_id(&bmain->particle, (ID *)part, 0);
+               expand_local_particlesettings(part);
                return;
        }
-       
+
        /* test objects */
-       ob= G.main->object.first;
-       while(ob) {
+       for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
                ParticleSystem *psys=ob->particlesystem.first;
                for(; psys; psys=psys->next){
                        if(psys->part==part) {
@@ -3618,31 +3628,28 @@ void make_local_particlesettings(ParticleSettings *part)
                                else local= 1;
                        }
                }
-               ob= ob->id.next;
        }
        
        if(local && lib==0) {
                part->id.lib= 0;
                part->id.flag= LIB_LOCAL;
-               new_id(0, (ID *)part, 0);
+               new_id(&bmain->particle, (ID *)part, 0);
+               expand_local_particlesettings(part);
        }
        else if(local && lib) {
-               
-               par= psys_copy_settings(part);
-               par->id.us= 0;
+               ParticleSettings *partn= psys_copy_settings(part);
+               partn->id.us= 0;
                
                /* do objects */
-               ob= G.main->object.first;
-               while(ob) {
-                       ParticleSystem *psys=ob->particlesystem.first;
-                       for(; psys; psys=psys->next){
+               for(ob= bmain->object.first; ob; ob= ob->id.next) {
+                       ParticleSystem *psys;
+                       for(psys= ob->particlesystem.first; psys; psys=psys->next){
                                if(psys->part==part && ob->id.lib==0) {
-                                       psys->part= par;
-                                       par->id.us++;
+                                       psys->part= partn;
+                                       partn->id.us++;
                                        part->id.us--;
                                }
                        }
-                       ob= ob->id.next;
                }
        }
 }
index 179aab064b40e486ad77513b06b8b9ea478ccd28..64893bb0b5bbdc983bc1ad9ab38b3e4af8e51ecf 100644 (file)
@@ -938,7 +938,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
                len = ptcache_path(pid, filename);
                newname += len;
        }
-       if(strcmp(pid->cache->name, "")==0 && (pid->cache->flag & PTCACHE_EXTERNAL)==0) {
+       if(pid->cache->name[0] == '\0' && (pid->cache->flag & PTCACHE_EXTERNAL)==0) {
                idname = (pid->ob->id.name+2);
                /* convert chars to hex so they are always a valid filename */
                while('\0' != *idname) {
@@ -1382,7 +1382,7 @@ static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *
                        }
                }
 
-               if(pm && !pm2) {
+               if(!pm2) {
                        *fra1 = 0;
                        *fra2 = pm->frame;
                }
@@ -1844,7 +1844,8 @@ static int ptcache_write(PTCacheID *pid, int cfra, int overwrite)
        if(cache->flag & PTCACHE_DISK_CACHE) {
                error += !ptcache_mem_frame_to_disk(pid, pm);
 
-               if(pm) {
+               // if(pm) /* pm is always set */
+               {
                        ptcache_data_free(pm);
                        ptcache_extra_free(pm);
                        MEM_freeN(pm);
index b2e6f5290c30a21c1d8bf10dcc52744e04187bb0..53b66238ec0a40c85fc8f2dc46d7dcc00420c7c7 100644 (file)
@@ -1858,7 +1858,7 @@ static ImBuf * seq_render_scene_strip_impl(
        ImBuf * ibuf = NULL;
        float frame= seq->sfra + nr + seq->anim_startofs;
        float oldcfra;
-       Object *oldcamera;
+       Object *camera;
        ListBase oldmarkers;
        
        /* Old info:
@@ -1896,59 +1896,65 @@ static ImBuf * seq_render_scene_strip_impl(
        int doseq;
        int doseq_gl= G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : /*(scene->r.seq_flag & R_SEQ_GL_PREV)*/ 1;
        int have_seq= FALSE;
-       Scene *sce= seq->scene; /* dont refer to seq->scene above this point!, it can be NULL */
-       int sce_valid= FALSE;
+       Scene *scene;
 
-       if(sce) {
-               have_seq= (sce->r.scemode & R_DOSEQ) && sce->ed && sce->ed->seqbase.first;
-               sce_valid= (sce->camera || have_seq);
+       /* dont refer to seq->scene above this point!, it can be NULL */
+       if(seq->scene == NULL) {
+               return NULL;
        }
 
-       if (!sce_valid)
-               return NULL;
+       scene= seq->scene;
+
+       have_seq= (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first;
 
-       oldcfra= seq->scene->r.cfra;
-       oldcamera= seq->scene->camera;
+       oldcfra= scene->r.cfra; 
+       scene->r.cfra= frame;
+
+       if(seq->scene_camera)   
+               camera= seq->scene_camera;
+       else {  
+               scene_camera_switch_update(scene);
+               camera= scene->camera;
+       }
+
+       if(scene && have_seq==FALSE && camera==NULL) {
+               scene->r.cfra= oldcfra;
+               return NULL;
+       }
 
        /* prevent eternal loop */
        doseq= context.scene->r.scemode & R_DOSEQ;
        context.scene->r.scemode &= ~R_DOSEQ;
        
-       seq->scene->r.cfra= frame;
-       if(seq->scene_camera)   
-               seq->scene->camera= seq->scene_camera;
-       else    
-               scene_camera_switch_update(seq->scene);
-       
 #ifdef DURIAN_CAMERA_SWITCH
        /* stooping to new low's in hackyness :( */
-       oldmarkers= seq->scene->markers;
-       seq->scene->markers.first= seq->scene->markers.last= NULL;
+       oldmarkers= scene->markers;
+       scene->markers.first= scene->markers.last= NULL;
 #endif
        
-       if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == context.scene || have_seq==0) && seq->scene->camera) {
+       if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq==0) && camera) {
                char err_out[256]= "unknown";
                /* for old scened this can be uninitialized, should probably be added to do_versions at some point if the functionality stays */
                if(context.scene->r.seq_prev_type==0)
                        context.scene->r.seq_prev_type = 3 /* ==OB_SOLID */; 
 
                /* opengl offscreen render */
-               scene_update_for_newframe(context.bmain, seq->scene, seq->scene->lay);
-               ibuf= sequencer_view3d_cb(seq->scene, context.rectx, context.recty, IB_rect, context.scene->r.seq_prev_type, err_out);
+               scene_update_for_newframe(context.bmain, scene, scene->lay);
+               ibuf= sequencer_view3d_cb(scene, camera, context.rectx, context.recty, IB_rect, context.scene->r.seq_prev_type, err_out);
                if(ibuf == NULL) {
                        fprintf(stderr, "seq_render_scene_strip_impl failed to get opengl buffer: %s\n", err_out);
                }
        }
        else {
-               Render *re = RE_GetRender(sce->id.name);
+               Render *re = RE_GetRender(scene->id.name);
                RenderResult rres;
 
                /* XXX: this if can be removed when sequence preview rendering uses the job system */
-               if(rendering || context.scene != sce) {
+               if(rendering || context.scene != scene) {
                        if(re==NULL)
-                               re= RE_NewRender(sce->id.name);
+                               re= RE_NewRender(scene->id.name);
                        
-                       RE_BlenderFrame(re, context.bmain, sce, NULL, sce->lay, frame, FALSE);
+                       RE_BlenderFrame(re, context.bmain, scene, NULL, camera, scene->lay, frame, FALSE);
 
                        /* restore previous state after it was toggled on & off by RE_BlenderFrame */
                        G.rendering = rendering;
@@ -1981,14 +1987,14 @@ static ImBuf * seq_render_scene_strip_impl(
        /* restore */
        context.scene->r.scemode |= doseq;
        
-       seq->scene->r.cfra = oldcfra;
-       seq->scene->camera= oldcamera;
+       scene->r.cfra = oldcfra;
+
        if(frame != oldcfra)
-               scene_update_for_newframe(context.bmain, seq->scene, seq->scene->lay);
+               scene_update_for_newframe(context.bmain, scene, scene->lay);
        
 #ifdef DURIAN_CAMERA_SWITCH
        /* stooping to new low's in hackyness :( */
-       seq->scene->markers= oldmarkers;
+       scene->markers= oldmarkers;
 #endif
 
        return ibuf;
index b9bf10bdf3922f829a2da28382bfe4b93a1a9477..33094313acd0fea8959496b87985244b445fdfe9 100644 (file)
@@ -1541,8 +1541,10 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), uns
        }
 
        glShadeModel(GL_SMOOTH);
-       if(col1 && col2)
+
+       if(col2) {
                glEnable(GL_CULL_FACE);
+       }
 
        glBegin(GL_QUADS);
        for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
index db07fae92454154ecd209fe21f3afec5d6804f6a..ba5d4282416c2cd4153d23fd1d4899a6b7e5e3d0 100644 (file)
@@ -2068,6 +2068,7 @@ void txt_do_redo(Text *text)
                        linep= linep+(text->undo_buf[text->undo_pos]<<8); text->undo_pos++;
                        linep= linep+(text->undo_buf[text->undo_pos]<<16); text->undo_pos++;
                        linep= linep+(text->undo_buf[text->undo_pos]<<24); text->undo_pos++;
+                       (void)linep;
 
                        break;
                case UNDO_INDENT:
index a5412c6269ea7affb56464c953a639b939171d48..866874ee5c86b5acc2fadabb0dcf4b7039bf4a8c 100644 (file)
@@ -73,7 +73,7 @@
 #include "BKE_icons.h"
 #include "BKE_node.h"
 #include "BKE_animsys.h"
-
+#include "BKE_colortools.h"
 
 /* ------------------------------------------------------------------------- */
 
@@ -762,9 +762,8 @@ Tex *copy_texture(Tex *tex)
        
        if(texn->coba) texn->coba= MEM_dupallocN(texn->coba);
        if(texn->env) texn->env= BKE_copy_envmap(texn->env);
-       if(texn->pd) texn->pd= MEM_dupallocN(texn->pd);
+       if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
        if(texn->vd) texn->vd= MEM_dupallocN(texn->vd);
-       
        if(tex->preview) texn->preview = BKE_previewimg_copy(tex->preview);
 
        if(tex->nodetree) {
@@ -795,14 +794,7 @@ Tex *localize_texture(Tex *tex)
                texn->env= BKE_copy_envmap(texn->env);
                id_us_min(&texn->env->ima->id);
        }
-       if(texn->pd) {
-               texn->pd= MEM_dupallocN(texn->pd);
-               if(texn->pd->coba) {
-                       texn->pd->point_tree = NULL;
-                       texn->pd->coba= MEM_dupallocN(texn->pd->coba);
-               }
-
-       }
+       if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
        if(texn->vd) {
                texn->vd= MEM_dupallocN(texn->vd);
                if(texn->vd->dataset)
@@ -843,13 +835,13 @@ void make_local_texture(Tex *tex)
        if(tex->ima) {
                tex->ima->id.lib= NULL;
                tex->ima->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)tex->ima, NULL);
+               new_id(&bmain->image, (ID *)tex->ima, NULL);
        }
 
        if(tex->id.us==1) {
                tex->id.lib= NULL;
                tex->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)tex, NULL);
+               new_id(&bmain->tex, (ID *)tex, NULL);
 
                return;
        }
@@ -906,7 +898,7 @@ void make_local_texture(Tex *tex)
        if(local && lib==0) {
                tex->id.lib= NULL;
                tex->id.flag= LIB_LOCAL;
-               new_id(NULL, (ID *)tex, NULL);
+               new_id(&bmain->tex, (ID *)tex, NULL);
        }
        else if(local && lib) {
                texn= copy_texture(tex);
@@ -1367,6 +1359,13 @@ PointDensity *BKE_add_pointdensity(void)
        pd->object = NULL;
        pd->psys = 0;
        pd->psys_cache_space= TEX_PD_WORLDSPACE;
+       pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1);
+
+       pd->falloff_curve->preset = CURVE_PRESET_LINE;
+       pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
+       curvemap_reset(pd->falloff_curve->cm, &pd->falloff_curve->clipr, pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
+       curvemapping_changed(pd->falloff_curve, 0);
+
        return pd;
 } 
 
@@ -1378,7 +1377,7 @@ PointDensity *BKE_copy_pointdensity(PointDensity *pd)
        pdn->point_tree = NULL;
        pdn->point_data = NULL;
        if(pdn->coba) pdn->coba= MEM_dupallocN(pdn->coba);
-       
+       pdn->falloff_curve = curvemapping_copy(pdn->falloff_curve); /* can be NULL */
        return pdn;
 }
 
@@ -1396,6 +1395,8 @@ void BKE_free_pointdensitydata(PointDensity *pd)
                MEM_freeN(pd->coba);
                pd->coba = NULL;
        }
+
+       curvemapping_free(pd->falloff_curve); /* can be NULL */
 }
 
 void BKE_free_pointdensity(PointDensity *pd)
index ff58e8bd0a4b259b50191be0caa90e1fbe9b9d35..7a76e61c17be00aec9d17443ff9656ffff7a1ff1 100644 (file)
@@ -43,6 +43,8 @@
 #include "DNA_scene_types.h"
 #include "DNA_texture_types.h"
 
+#include "BLI_utildefines.h"
+
 #include "BKE_world.h"
 #include "BKE_library.h"
 #include "BKE_animsys.h"
@@ -134,7 +136,6 @@ void make_local_world(World *wrld)
 {
        Main *bmain= G.main;
        Scene *sce;
-       World *wrldn;
        int local=0, lib=0;
 
        /* - only lib users: do nothing
@@ -150,34 +151,30 @@ void make_local_world(World *wrld)
                return;
        }
        
-       sce= bmain->scene.first;
-       while(sce) {
-               if(sce->world==wrld) {
+       for(sce= bmain->scene.first; sce && ELEM(0, lib, local); sce= sce->id.next) {
+               if(sce->world == wrld) {
                        if(sce->id.lib) lib= 1;
                        else local= 1;
                }
-               sce= sce->id.next;
        }
-       
+
        if(local && lib==0) {
                wrld->id.lib= NULL;
                wrld->id.flag= LIB_LOCAL;
                new_id(NULL, (ID *)wrld, NULL);
        }
        else if(local && lib) {
-               wrldn= copy_world(wrld);
+               World *wrldn= copy_world(wrld);
                wrldn->id.us= 0;
                
-               sce= bmain->scene.first;
-               while(sce) {
-                       if(sce->world==wrld) {
+               for(sce= bmain->scene.first; sce; sce= sce->id.next) {
+                       if(sce->world == wrld) {
                                if(sce->id.lib==NULL) {
                                        sce->world= wrldn;
                                        wrldn->id.us++;
                                        wrld->id.us--;
                                }
                        }
-                       sce= sce->id.next;
                }
        }
 }
index 75520bb8ba087c9de31090c23df4c55881fb23a2..9f6a8afe2d5792088ac4f7b76178c949de1bb49a 100644 (file)
@@ -424,14 +424,14 @@ MINLINE float normalize_v3(float n[3])
        return normalize_v3_v3(n, n);
 }
 
-MINLINE void normal_short_to_float_v3(float *out, const short *in)
+MINLINE void normal_short_to_float_v3(float out[3], const short in[3])
 {
        out[0] = in[0]*(1.0f/32767.0f);
        out[1] = in[1]*(1.0f/32767.0f);
        out[2] = in[2]*(1.0f/32767.0f);
 }
 
-MINLINE void normal_float_to_short_v3(short *out, const float *in)
+MINLINE void normal_float_to_short_v3(short out[3], const float in[3])
 {
        out[0] = (short)(in[0]*32767.0f);
        out[1] = (short)(in[1]*32767.0f);
index 891dc47b4aedfc3cbd1a43a96242f68247e2730a..22083eda1c8d94f0c1e083fdbcf8d6a13d1aeb21 100644 (file)
@@ -148,7 +148,7 @@ BLO_blendhandle_from_memory(
  * 
  * @param bh The blendhandle to access.
  * @param ofblocktype The type of names to get.
- * @param totnames The length of the returned list.
+ * @param tot_names The length of the returned list.
  * @return A BLI_linklist of strings. The string links
  * should be freed with malloc.
  */
@@ -156,7 +156,7 @@ BLO_blendhandle_from_memory(
 BLO_blendhandle_get_datablock_names(
        BlendHandle *bh, 
        int ofblocktype,
-       int *totnames);
+       int *tot_names);
 
 /**
  * Gets the previews of all the datablocks in a file
@@ -165,13 +165,15 @@ BLO_blendhandle_get_datablock_names(
  * 
  * @param bh The blendhandle to access.
  * @param ofblocktype The type of names to get.
+ * @param tot_prev The length of the returned list.
  * @return A BLI_linklist of PreviewImage. The PreviewImage links
  * should be freed with malloc.
  */
        struct LinkNode*
 BLO_blendhandle_get_previews(
        BlendHandle *bh, 
-       int ofblocktype);
+       int ofblocktype,
+       int *tot_prev);
 
 /**
  * Gets the names of all the datablock groups in a
index ae4ba6629a66fd5c4151dd2c8285e29062acc825..abc469a5355dcea2f4aca84be96249a747844b53 100644 (file)
@@ -144,7 +144,7 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype,
        return names;
 }
 
-LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype
+LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *tot_prev)
 {
        FileData *fd= (FileData*) bh;
        LinkNode *previews= NULL;
@@ -153,6 +153,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype)
        int npreviews = 0;
        PreviewImage* prv = NULL;
        PreviewImage* new_prv = NULL;
+       int tot= 0;
        
        for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
                if (bhead->code==ofblocktype) {
@@ -166,6 +167,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype)
                                case ID_LA: /* fall through */
                                        new_prv = MEM_callocN(sizeof(PreviewImage), "newpreview");
                                        BLI_linklist_prepend(&previews, new_prv);
+                                       tot++;
                                        looking = 1;
                                        break;
                                default:
@@ -213,7 +215,8 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype)
                }
                
        }
-       
+
+       *tot_prev= tot;
        return previews;
 }
 
index 55577f54889d6a771fdf8d5bfb8558eff7aa1e75..b4ae2c77f0c781bcbbd251de9e66630062383b66 100644 (file)
@@ -2964,6 +2964,10 @@ static void direct_link_texture(FileData *fd, Tex *tex)
        if(tex->pd) {
                tex->pd->point_tree = NULL;
                tex->pd->coba= newdataadr(fd, tex->pd->coba);
+               tex->pd->falloff_curve= newdataadr(fd, tex->pd->falloff_curve);
+               if(tex->pd->falloff_curve) {
+                       direct_link_curvemapping(fd, tex->pd->falloff_curve);
+               }
        }
        
        tex->vd= newdataadr(fd, tex->vd);
@@ -11741,7 +11745,57 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
        /* put compatibility code here until next subversion bump */
 
        {
+               /* screen view2d settings were not properly initialized [#27164]
+                * v2d->scroll caused the bug but best reset other values too which are in old blend files only.
+                * need to make less ugly - possibly an iterator? */
+               bScreen *screen;
+               for(screen= main->screen.first; screen; screen= screen->id.next) {
+                       ScrArea *sa;
+                       /* add regions */
+                       for(sa= screen->areabase.first; sa; sa= sa->next) {
+                               SpaceLink *sl= sa->spacedata.first;
+                               if(sl->spacetype==SPACE_IMAGE) {
+                                       ARegion *ar;
+                                       for (ar=sa->regionbase.first; ar; ar= ar->next) {
+                                               if(ar->regiontype == RGN_TYPE_WINDOW) {
+                                                       View2D *v2d= &ar->v2d;
+                                                       v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
+                                               }
+                                       }
+                               }
+                               for (sl= sa->spacedata.first; sl; sl= sl->next) {
+                                       if(sl->spacetype==SPACE_IMAGE) {
+                                               ARegion *ar;
+                                               for (ar=sl->regionbase.first; ar; ar= ar->next) {
+                                                       if(ar->regiontype == RGN_TYPE_WINDOW) {
+                                                               View2D *v2d= &ar->v2d;
+                                                               v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               {
+                       /* Initialize texture point density curve falloff */
+                       Tex *tex;
+                       for(tex= main->tex.first; tex; tex= tex->id.next) {
+                               if(tex->pd) {
+                                       if (tex->pd->falloff_speed_scale == 0.0)
+                                               tex->pd->falloff_speed_scale = 100.0;
 
+                                       if (!tex->pd->falloff_curve) {
+                                               tex->pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1);
+
+                                               tex->pd->falloff_curve->preset = CURVE_PRESET_LINE;
+                                               tex->pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
+                                               curvemap_reset(tex->pd->falloff_curve->cm, &tex->pd->falloff_curve->clipr, tex->pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
+                                               curvemapping_changed(tex->pd->falloff_curve, 0);
+                                       }
+                               }
+                       }
+               }
        }
        
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
index 168803ed6892fd55429ffb1cd9c94a86d345270c..e0b773a5eb573568d42f400c7dff05089b081d01 100644 (file)
@@ -1699,6 +1699,7 @@ static void write_textures(WriteData *wd, ListBase *idbase)
                        if(tex->type == TEX_POINTDENSITY && tex->pd) {
                                writestruct(wd, DATA, "PointDensity", 1, tex->pd);
                                if(tex->pd->coba) writestruct(wd, DATA, "ColorBand", 1, tex->pd->coba);
+                               if(tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve);
                        }
                        if(tex->type == TEX_VOXELDATA && tex->vd) writestruct(wd, DATA, "VoxelData", 1, tex->vd);
                        
index 0d822c63094be23ba7bb775648e6bc68efeb35ef..51caf62f6e7b97b45aa8536e169e6e726075f0ef 100644 (file)
@@ -38,6 +38,11 @@ extern "C"
 #include "BKE_scene.h"
 #include "BKE_context.h"
 
+/* make dummy file */
+#include "BLI_storage.h"
+#include "BLI_path_util.h"
+#include "BLI_fileops.h"
+
        int collada_import(bContext *C, const char *filepath)
        {
                DocumentImporter imp (C, filepath);
@@ -48,8 +53,17 @@ extern "C"
 
        int collada_export(Scene *sce, const char *filepath)
        {
-
                DocumentExporter exp;
+
+               /* annoying, collada crashes if file cant be created! [#27162] */
+               if(!BLI_exist(filepath)) {
+                       BLI_make_existing_file(filepath); /* makes the dir if its not there */
+                       if(BLI_touch(filepath) == 0) {
+                               return 0;
+                       }
+               }
+               /* end! */
+
                exp.exportCurrentScene(sce, filepath);
 
                return 1;
index 874dc2237e5935a8646f2a053c65b2bf16e10865..a9f586d50dc7733cb40141b98eb0a9cefbcd40b1 100644 (file)
@@ -3353,6 +3353,7 @@ void ANIM_channel_draw_widgets (bAnimContext *ac, bAnimListElem *ale, uiBlock *b
                        draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_SOLO);
                        offset += ICON_WIDTH; 
                }
+               (void)offset;
        }
        
        /* step 4) draw text... */
index adb011e92be7c14891b41c3d00603613466f22cf..7a8f81294491c07ae50c3b0d05679ca1ec7f3342 100644 (file)
@@ -169,9 +169,9 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int
                        case ANIMTYPE_DSLAT:
                        {
                                /* need to verify that this data is valid for now */
-                               // XXX: ale may be null!
-                               if (ale->adt)
+                               if (ale && ale->adt) {
                                        ale->adt->flag |= ADT_UI_ACTIVE;
+                               }
                        }
                                break;
                }
@@ -1003,7 +1003,7 @@ static void rearrange_action_channels (bAnimContext *ac, bAction *act, short mod
                
                for (agrp= act->groups.first; agrp; agrp= agrp->next) {
                        /* only consider F-Curves if they're visible (group expanded) */
-                       if (EXPANDED_AGRP(agrp)) {
+                       if (EXPANDED_AGRP(ac, agrp)) {
                                rearrange_animchannel_islands(&agrp->channels, rearrange_func, mode, ANIMTYPE_FCURVE);
                        }
                }
index 54c6c991a5f16028036d807feccc6bafdd3be506..be2b6cf9a763e6b22b5797c55af69285297ec098 100644 (file)
@@ -1031,7 +1031,7 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS
                 * but the group isn't expanded...
                 */
                if ( (filter_mode & (ANIMFILTER_SEL|ANIMFILTER_UNSEL)) &&       /* care about selection status */
-                        (EXPANDED_AGRP(agrp)==0) )                                                             /* group isn't expanded */
+                        (EXPANDED_AGRP(ac, agrp)==0) )                                                         /* group isn't expanded */
                {
                        /* if the group itself isn't selected appropriately, we shouldn't consider it's children either */
                        if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) == 0)
@@ -1090,7 +1090,7 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS
                                 *      - group is expanded
                                 *      - we just need the F-Curves present
                                 */
-                               if ( (!(filter_mode & ANIMFILTER_VISIBLE) || EXPANDED_AGRP(agrp)) || (filter_mode & ANIMFILTER_CURVESONLY) ) 
+                               if ( (!(filter_mode & ANIMFILTER_VISIBLE) || EXPANDED_AGRP(ac, agrp)) || (filter_mode & ANIMFILTER_CURVESONLY) )
                                {
                                        /* for the Graph Editor, curves may be set to not be visible in the view to lessen clutter,
                                         * but to do this, we need to check that the group doesn't have it's not-visible flag set preventing 
index f0f33ec3258f29c381ed9eb01ae1c13a1cda2c59..f4e9c7c5d3e3635db5b7c660d67225f648b019e1 100644 (file)
@@ -804,7 +804,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann
                                                
                                                for (ct= targets.first; ct; ct= ct->next) {
                                                        if (ct->tar == srcArm) {
-                                                               if (strcmp(ct->subtarget, "")==0) {
+                                                               if (ct->subtarget[0] == '\0') {
                                                                        ct->tar = tarArm;
                                                                }
                                                                else if (strcmp(ct->subtarget, pchan->name)==0) {
@@ -851,7 +851,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann
                                        
                                        for (ct= targets.first; ct; ct= ct->next) {
                                                if (ct->tar == srcArm) {
-                                                       if (strcmp(ct->subtarget, "")==0) {
+                                                       if (ct->subtarget[0] == '\0') {
                                                                ct->tar = tarArm;
                                                        }
                                                        else if (strcmp(ct->subtarget, pchan->name)==0) {
index 1ab7acef8618b49e7211e6ecd2a25d548b38abd7..cb73f20fe7b54478d7e32a5504cd2453f08433ce 100644 (file)
@@ -951,7 +951,7 @@ static void calc_shapeKeys(Object *obedit)
                                                                                ++i;
                                                                        }
 
-                                                                       fp+= 3; curofp+= 3;     /* alphas */
+                                                                       fp+= 3; /* alphas */
                                                                } else {
                                                                        for (j= 0; j < 3; ++j, ++i) {
                                                                                VECCOPY(fp, bezt->vec[j]);
@@ -1234,7 +1234,6 @@ void make_editNurb(Object *obedit)
        Nurb *nu, *newnu, *nu_act= NULL;
        KeyBlock *actkey;
 
-       if(obedit==NULL) return;
 
        set_actNurb(obedit, NULL);
 
@@ -1591,7 +1590,7 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
        BPoint *bp, *bpn, *newbp;
        int a, b, newu, newv, sel;
 
-       if(obedit && obedit->type==OB_SURF);
+       if(obedit->type==OB_SURF);
        else return OPERATOR_CANCELLED;
 
        cu->lastsel= NULL;
@@ -5662,7 +5661,7 @@ static int delete_exec(bContext *C, wmOperator *op)
        Curve *cu= obedit->data;
        EditNurb *editnurb= cu->editnurb;
        ListBase *nubase= &editnurb->nurbs;
-       Nurb *nu, *next, *nu1;
+       Nurb *nu, *nu1;
        BezTriple *bezt, *bezt1, *bezt2;
        BPoint *bp, *bp1, *bp2;
        int a, cut= 0, type= RNA_enum_get(op->ptr, "type");
@@ -5687,6 +5686,7 @@ static int delete_exec(bContext *C, wmOperator *op)
 
        if(type==0) {
                /* first loop, can we remove entire pieces? */
+               Nurb *next;
                nu= nubase->first;
                while(nu) {
                        next= nu->next;
@@ -5815,7 +5815,6 @@ static int delete_exec(bContext *C, wmOperator *op)
                nu1= NULL;
                nuindex= 0;
                for(nu= nubase->first; nu; nu= nu->next) {
-                       next= nu->next;
                        if(nu->type == CU_BEZIER) {
                                bezt= nu->bezt;
                                for(a=0; a<nu->pntsu-1; a++) {
index 77b46f8864b49ab80a3aed2a8b0dc56786be2a20..620d1dc51ed234192589df62d3d007f7de136167 100644 (file)
@@ -253,7 +253,7 @@ typedef enum eAnimFilter_Flags {
 /* Actions (also used for Dopesheet) */
        /* Action Channel Group */
 #define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED)==0)
-#define EXPANDED_AGRP(agrp) \
+#define EXPANDED_AGRP(ac, agrp) \
        ( ( ((ac)->spacetype == SPACE_IPO) && (agrp->flag & AGRP_EXPANDED_G) ) || \
          ( ((ac)->spacetype != SPACE_IPO) && (agrp->flag & AGRP_EXPANDED)   ) )
 #define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE))
index a3e99e6358e79d7a3dc3a92de54d7caaa6d28bb2..297bd234edd2d9ac806f0533fedf883212b68dcb 100644 (file)
@@ -163,6 +163,8 @@ int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, in
 
 /* get 3d region from context, also if mouse is in header or toolbar */
 struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
+struct ARegion *ED_view3d_context_region_unlock(struct bContext *C);
+int ED_operator_rv3d_unlock_poll(struct bContext *C);
 
 void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d);
 
@@ -173,7 +175,7 @@ void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct AR
        int winx, int winy, float viewmat[][4], float winmat[][4]);
 
 struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag, char err_out[256]);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype, char err_out[256]);
+struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, struct Object *camera, int width, int height, unsigned int flag, int drawtype, char err_out[256]);
 
 
 Base *ED_view3d_give_base_under_cursor(struct bContext *C, const short mval[2]);
@@ -183,5 +185,11 @@ int ED_view3d_lock(struct RegionView3D *rv3d);
 unsigned int ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
 unsigned int ED_viewedit_datamask(struct bScreen *screen);
 
+
+/* assigning view matrix */
+void view3d_apply_mat4(float mat[][4], float *ofs, float *quat, float *dist);
+void view3d_apply_ob(struct Object *ob, float *ofs, float *quat, float *dist, float *lens);
+int view3d_is_ortho(struct View3D *v3d, struct RegionView3D *rv3d);
+
 #endif /* ED_VIEW3D_H */
 
index f8ce278814fa5a4ddd37f43a7b8dbca6447d4ff0..c9b5b9f284836fa86c6378184d61e7ce13bebd25 100644 (file)
@@ -765,8 +765,6 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
        //float alpha;
        GLint scissor[4];
        
-       if (hist==NULL) { printf("hist is null \n"); return; }
-       
        rect.xmin = (float)recti->xmin+1;
        rect.xmax = (float)recti->xmax-1;
        rect.ymin = (float)recti->ymin+SCOPE_RESIZE_PAD+2;
index 1a240f347575aa3e26cdc4644a77e522fc373162..aa5499110e6082e3ffdcbbcdf7ae3c4e324fa2d3 100644 (file)
@@ -362,6 +362,16 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
        /* create tooltip data */
        data= MEM_callocN(sizeof(uiTooltipData), "uiTooltipData");
 
+       /* special case, enum rna buttons only have enum item description, use general enum description too before the spesific one */
+       if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
+               const char *descr= RNA_property_description(but->rnaprop);
+               if(descr && descr[0]) {
+                       BLI_strncpy(data->lines[data->totline], descr, sizeof(data->lines[0]));
+                       data->color[data->totline]= 0xFFFFFF;
+                       data->totline++;
+               }
+       }
+       
        if(but->tip && strlen(but->tip)) {
                BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0]));
                data->color[data->totline]= 0xFFFFFF;
index 60afb6ce2c9dfb5e37ea4a6d2571e2c4bf9c858f..7648d5067b4d5ed61a9c206a1fcddf3a43bae29b 100644 (file)
@@ -673,6 +673,22 @@ static int modifier_can_delete(ModifierData *md)
        return 1;
 }
 
+// Check wheter Modifier is a simulation or not, this is used for switching to the physics/particles context tab
+static int modifier_is_simulation(ModifierData *md)
+{
+       // Physic Tab
+       if(ELEM6(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke, eModifierType_Softbody, eModifierType_Surface)) {
+               return 1;
+       }
+       // Particle Tab
+       else if (md->type == eModifierType_ParticleSystem) {
+               return 2;
+       }
+       else {
+               return 0;
+       }
+}
+
 static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, ModifierData *md, int index, int cageIndex, int lastCageIndex)
 {
        ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -765,8 +781,13 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif
                uiBlockEndAlign(block);
                
                uiBlockSetEmboss(block, UI_EMBOSSN);
-               if (modifier_can_delete(md))
+               // When Modifier is a simulation, show button to switch to context rather than the delete button. 
+               if (modifier_can_delete(md) && !modifier_is_simulation(md))
                        uiItemO(row, "", ICON_X, "OBJECT_OT_modifier_remove");
+               if (modifier_is_simulation(md) == 1)
+                       uiItemStringO(row, "", ICON_BUTS, "WM_OT_properties_context_change", "context", "PHYSICS");
+               else if (modifier_is_simulation(md) == 2)
+                       uiItemStringO(row, "", ICON_BUTS, "WM_OT_properties_context_change", "context", "PARTICLES");
                uiBlockSetEmboss(block, UI_EMBOSS);
        }
 
index 90a83009c4dee6f537f63b30499c97947abe0494..09e4b153d985e4a1a943a2d0eae09139e431cf70 100644 (file)
@@ -575,19 +575,17 @@ static void shadecolors4(char *coltop, char *coldown, const char *color, short s
        coldown[3]= color[3];   
 }
 
-static void round_box_shade_col4(const char *col1, const char *col2, float fac)
+static void round_box_shade_col4(const char col1[4], const char col2[4], const float fac)
 {
-       int faci, facm;
        unsigned char col[4];
-       
-       faci= floor(255.1f*fac);
-       facm= 255-faci;
-       
+       const int faci= FTOCHAR(fac);
+       const int facm= 255-faci;
+
        col[0]= (faci*col1[0] + facm*col2[0])>>8;
        col[1]= (faci*col1[1] + facm*col2[1])>>8;
        col[2]= (faci*col1[2] + facm*col2[2])>>8;
        col[3]= (faci*col1[3] + facm*col2[3])>>8;
-       
+
        glColor4ubv(col);
 }
 
@@ -2316,7 +2314,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
        double value;
        float offs, toffs, fac;
        char outline[3];
-       
+
        widget_init(&wtb);
        widget_init(&wtb1);
        
index b3492a5fb09dc1d158d9e6d6095e626b4145fa48..fa3619883f4be53d3b7d2f8c6be6e92d2c51690b 100644 (file)
@@ -90,21 +90,21 @@ static float icovert[12][3] = {
        {0.0f,0.0f,200.0f}
 };
 static short icoface[20][3] = {
-       {1,0,2},
+       {2,0,1},
        {1,0,5},
-       {2,0,3},
-       {3,0,4},
-       {4,0,5},
+       {3,0,2},
+       {4,0,3},
+       {5,0,4},
        {1,5,10},
        {2,1,6},
        {3,2,7},
        {4,3,8},
        {5,4,9},
-       {10,1,6},
-       {6,2,7},
-       {7,3,8},
-       {8,4,9},
-       {9,5,10},
+       {6,1,10},
+       {7,2,6},
+       {8,3,7},
+       {9,4,8},
+       {10,5,9},
        {6,10,11},
        {7,6,11},
        {8,7,11},
@@ -1081,6 +1081,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
                        }
                        eve= eve->next;
                }
+               recalc_editnormals(em);
                break;
                        
        case PRIM_UVSPHERE: /*  UVsphere */
@@ -1102,7 +1103,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
                        eve= addvertlist(em, vec, NULL);
                        eve->f= 1+2+4;
                        if(a==0) v1= eve;
-                       else addedgelist(em, eve->prev, eve, NULL);
+                       else addedgelist(em, eve, eve->prev, NULL);
                        phi+= phid;
                }
                
@@ -1128,6 +1129,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
                        }
                        eve= eve->next;
                }
+               recalc_editnormals(em);
                break;
        case PRIM_ICOSPHERE: /* Icosphere */
                {
@@ -1320,9 +1322,9 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
        EM_stats_update(em);
        /* simple selection flush OK, based on fact it's a single model */
        EM_select_flush(em); /* flushes vertex -> edge -> face selection */
-       
-       if(type!=PRIM_PLANE && type!=PRIM_MONKEY)
-               EM_recalc_normal_direction(em, 0, 0);   /* otherwise monkey has eyes in wrong direction */
+
+       if(!ELEM5(type, PRIM_GRID, PRIM_PLANE, PRIM_ICOSPHERE, PRIM_UVSPHERE, PRIM_MONKEY))
+               EM_recalc_normal_direction(em, FALSE, TRUE);    /* otherwise monkey has eyes in wrong direction */
 
        BKE_mesh_end_editmesh(obedit->data, em);
 }
index 5901a36980c54460f7ac791070b22ac8f70dfc88..a66c72bf329097175b6186c5710f7aa956c0917a 100644 (file)
@@ -891,13 +891,11 @@ void MESH_OT_split(wmOperatorType *ot)
 }
 
 
-static int extrude_repeat_mesh(bContext *C, wmOperator *op)
+static int extrude_repeat_mesh_exec(bContext *C, wmOperator *op)
 {
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
-       RegionView3D *rv3d = ED_view3d_context_rv3d(C);
-
        int steps = RNA_int_get(op->ptr,"steps");
 
        float offs = RNA_float_get(op->ptr,"offset");
@@ -906,9 +904,7 @@ static int extrude_repeat_mesh(bContext *C, wmOperator *op)
        short a;
 
        /* dvec */
-       dvec[0]= rv3d->persinv[2][0];
-       dvec[1]= rv3d->persinv[2][1];
-       dvec[2]= rv3d->persinv[2][2];
+       RNA_float_get_array(op->ptr, "direction", dvec);
        normalize_v3(dvec);
        dvec[0]*= offs;
        dvec[1]*= offs;
@@ -935,6 +931,17 @@ static int extrude_repeat_mesh(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
+/* get center and axis, in global coords */
+static int extrude_repeat_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+       RegionView3D *rv3d= ED_view3d_context_rv3d(C);
+
+       if(rv3d)
+               RNA_float_set_array(op->ptr, "direction", rv3d->persinv[2]);
+
+       return extrude_repeat_mesh_exec(C, op);
+}
+
 void MESH_OT_extrude_repeat(wmOperatorType *ot)
 {
        /* identifiers */
@@ -943,15 +950,17 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot)
        ot->idname= "MESH_OT_extrude_repeat";
 
        /* api callbacks */
-       ot->exec= extrude_repeat_mesh;
-       ot->poll= ED_operator_editmesh_region_view3d;
+       ot->invoke= extrude_repeat_mesh_invoke;
+       ot->exec= extrude_repeat_mesh_exec;
+       ot->poll= ED_operator_editmesh;
 
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
        /* props */
-       RNA_def_float(ot->srna, "offset", 2.0f, 0.0f, 100.0f, "Offset", "", 0.0f, FLT_MAX);
-       RNA_def_int(ot->srna, "steps", 10, 0, 180, "Steps", "", 0, INT_MAX);
+       RNA_def_float(ot->srna, "offset", 2.0f, 0.0f, 100.0f, "Offset", "", 0.0f, 100.0f);
+       RNA_def_int(ot->srna, "steps", 10, 0, 180, "Steps", "", 0, 180);
+       RNA_def_float_vector(ot->srna, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "Direction", "Direction of extrude", -FLT_MAX, FLT_MAX);
 }
 
 /* ************************** spin operator ******************** */
index b6940e8f8f9218af81ce91037c779bca44884cb2..f3e26cfee364a01556c285657b4de91e99174c66 100644 (file)
@@ -163,6 +163,17 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
        }
 }
 
+static void copy_editface_active_customdata(EditMesh *em, int type, int index)
+{
+       EditFace *efa;
+       int n= CustomData_get_active_layer(&em->fdata, type);
+
+       for(efa= em->faces.first; efa; efa= efa->next) {
+               void *data= CustomData_em_get_n(&em->fdata, efa->data, type, n);
+               CustomData_em_set_n(&em->fdata, efa->data, type, index, data);
+       }
+}
+
 int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_set)
 {
        EditMesh *em;
@@ -176,6 +187,10 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
                        return 0;
 
                EM_add_data_layer(em, &em->fdata, CD_MTFACE, name);
+
+               if(layernum) /* copy data from active UV */
+                       copy_editface_active_customdata(em, CD_MTFACE, layernum);
+
                if(active_set || layernum==0)
                        CustomData_set_layer_active(&em->fdata, CD_MTFACE, layernum);
        }
@@ -234,6 +249,10 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const cha
                        return 0;
 
                EM_add_data_layer(em, &em->fdata, CD_MCOL, name);
+
+               if(layernum) /* copy data from active vertex color layer */
+                       copy_editface_active_customdata(em, CD_MCOL, layernum);
+
                if(active_set || layernum==0)
                        CustomData_set_layer_active(&em->fdata, CD_MCOL, layernum);
        }
index cf3ad26ec253943b1738e6b911010aed0e19d550..763e82b8b53a01bf5efd9900e57dfb61e58af0f6 100644 (file)
@@ -226,8 +226,9 @@ int join_mesh_exec(bContext *C, wmOperator *op)
                                                }
                                                if(b==totcol) {
                                                        matar[b]= ma;
-                                                       if(ma)
-                                                               ma->id.us++;
+                                                       if(ma) {
+                                                               id_us_plus(&ma->id);
+                                                       }
                                                        totcol++;
                                                }
                                                if(totcol>=MAXMAT-1) 
index ce434413a5f2778b077c2273db6b9f521d3b625f..3890eedeb57dffd2614492af662348c2dc241886 100644 (file)
@@ -421,6 +421,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
        unsigned int lay= (v3d)? v3d->lay: scene->lay;
        const short is_animation= RNA_boolean_get(op->ptr, "animation");
        const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
+       struct Object *camera_override= v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
 
        if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.imtype)) {
                BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected.");
@@ -446,9 +447,9 @@ static int screen_render_exec(bContext *C, wmOperator *op)
        seq_stripelem_cache_cleanup();
 
        if(is_animation)
-               RE_BlenderAnim(re, mainp, scene, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, op->reports);
+               RE_BlenderAnim(re, mainp, scene, camera_override, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, op->reports);
        else
-               RE_BlenderFrame(re, mainp, scene, NULL, lay, scene->r.cfra, is_write_still);
+               RE_BlenderFrame(re, mainp, scene, NULL, camera_override, lay, scene->r.cfra, is_write_still);
 
        // no redraw needed, we leave state as we entered it
        ED_update_for_newframe(mainp, scene, CTX_wm_screen(C), 1);
@@ -464,6 +465,7 @@ typedef struct RenderJob {
        Render *re;
        wmWindow *win;
        SceneRenderLayer *srl;
+       struct Object *camera_override;
        int lay;
        short anim, write_still;
        Image *image;
@@ -590,9 +592,9 @@ static void render_startjob(void *rjv, short *stop, short *do_update, float *pro
        rj->progress= progress;
 
        if(rj->anim)
-               RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step, rj->reports);
+               RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->camera_override, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step, rj->reports);
        else
-               RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->lay, rj->scene->r.cfra, rj->write_still);
+               RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->camera_override, rj->lay, rj->scene->r.cfra, rj->write_still);
 }
 
 static void render_endjob(void *rjv)
@@ -679,12 +681,13 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
        int jobflag;
        const short is_animation= RNA_boolean_get(op->ptr, "animation");
        const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
+       struct Object *camera_override= v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
        
        /* only one render job at a time */
        if(WM_jobs_test(CTX_wm_manager(C), scene))
                return OPERATOR_CANCELLED;
 
-       if(!RE_is_rendering_allowed(scene, op->reports, render_error_reports)) {
+       if(!RE_is_rendering_allowed(scene, camera_override, op->reports, render_error_reports)) {
                return OPERATOR_CANCELLED;
        }
 
@@ -761,6 +764,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
        rj->scene= scene;
        rj->win= CTX_wm_window(C);
        rj->srl = srl;
+       rj->camera_override = camera_override;
        rj->lay = (v3d)? v3d->lay: scene->lay;
        rj->anim= is_animation;
        rj->write_still= is_write_still && !is_animation;
index 364b080523733dbc6318c901de3b524c81b1aeb8..626fbce1b2e9162876d5d9a98579e3e2ece652c2 100644 (file)
@@ -114,6 +114,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
        View3D *v3d= oglrender->v3d;
        RegionView3D *rv3d= oglrender->rv3d;
        RenderResult *rr;
+       Object *camera= NULL;
        ImBuf *ibuf;
        void *lock;
        float winmat[4][4];
@@ -140,7 +141,8 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
                /* render 3d view */
                if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
                        /*int is_ortho= scene->r.mode & R_ORTHO;*/
-                       RE_GetCameraWindow(oglrender->re, v3d->camera, scene->r.cfra, winmat);
+                       camera= v3d->camera;
+                       RE_GetCameraWindow(oglrender->re, camera, scene->r.cfra, winmat);
                        
                }
                else {
@@ -190,7 +192,8 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
        else {
                /* shouldnt suddenly give errors mid-render but possible */
                char err_out[256]= "unknown";
-               ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID, err_out);
+               ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID, err_out);
+               camera= scene->camera;
 
                if(ibuf_view) {
                        memcpy(rr->rectf, ibuf_view->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey);
@@ -204,7 +207,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
        /* rr->rectf is now filled with image data */
 
        if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
-               BKE_stamp_buf(scene, NULL, rr->rectf, rr->rectx, rr->recty, 4);
+               BKE_stamp_buf(scene, camera, NULL, rr->rectf, rr->rectx, rr->recty, 4);
 
        RE_ReleaseResult(oglrender->re);
 
@@ -218,7 +221,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
                        char name[FILE_MAX];
                        int ok;
                        BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE);
-                       ok= BKE_write_ibuf(scene, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
+                       ok= BKE_write_ibuf(ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality); /* no need to stamp here */
                        if(ok)  printf("OpenGL Render written to '%s'\n", name);
                        else    printf("OpenGL Render failed to write '%s'\n", name);
                }
@@ -387,6 +390,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
        char name[FILE_MAXDIR+FILE_MAXFILE];
        int ok= 0;
        const short  view_context= (oglrender->v3d != NULL);
+       Object *camera= NULL;
 
        /* update animated image textures for gpu, etc,
         * call before scene_update_for_newframe so modifiers with textuers dont lag 1 frame */
@@ -409,12 +413,17 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
                if(oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) {
                        /* since scene_update_for_newframe() is used rather
                         * then ED_update_for_newframe() the camera needs to be set */
-                       if(scene_camera_switch_update(scene))
+                       if(scene_camera_switch_update(scene)) {
                                oglrender->v3d->camera= scene->camera;
+                       }
+
+                       camera= oglrender->v3d->camera;
                }
        }
        else {
                scene_camera_switch_update(scene);
+
+               camera= scene->camera;
        }
 
        /* render into offscreen buffer */
@@ -433,7 +442,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
                }
                else {
                        BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
-                       ok= BKE_write_ibuf(scene, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
+                       ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
 
                        if(ok==0) {
                                printf("Write error: cannot save %s\n", name);
index 239b078a9108f55ceb34898a01c4545b16b2bc57..1abf5df223c86c6c9a9f89cb2f4e02d5790d739f 100644 (file)
@@ -135,14 +135,15 @@ ImBuf* get_brush_icon(Brush *brush)
                                        if (path[0])
                                                brush->icon_imbuf= IMB_loadiffname(path, flags);
                                }
+
+                               if (brush->icon_imbuf)
+                                       BKE_icon_changed(BKE_icon_getid(&brush->id));
                        }
                }
        }
 
        if (!(brush->icon_imbuf))
                brush->id.icon_id = 0;
-       else
-               BKE_icon_changed(BKE_icon_getid(&(brush->id)));
 
        return brush->icon_imbuf;
 }
@@ -313,15 +314,6 @@ void ED_preview_free_dbase(void)
                free_main(pr_main);
 }
 
-static Object *find_object(ListBase *lb, const char *name)
-{
-       Object *ob;
-       for(ob= lb->first; ob; ob= ob->id.next)
-               if(strcmp(ob->id.name+2, name)==0)
-                       break;
-       return ob;
-}
-
 static int preview_mat_has_sss(Material *mat, bNodeTree *ntree)
 {
        if(mat) {
@@ -528,12 +520,12 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
                        if(la && la->type==LA_SUN && (la->sun_effect_type & LA_SUN_EFFECT_SKY)) {
                                sce->lay= 1<<MA_ATMOS;
                                sce->world= scene->world;
-                               sce->camera= (Object *)find_object(&pr_main->object, "CameraAtmo");
+                               sce->camera= (Object *)BLI_findstring(&pr_main->object, "CameraAtmo", offsetof(ID, name)+2);
                        }
                        else {
                                sce->lay= 1<<MA_LAMP;
                                sce->world= NULL;
-                               sce->camera= (Object *)find_object(&pr_main->object, "Camera");
+                               sce->camera= (Object *)BLI_findstring(&pr_main->object, "Camera", offsetof(ID, name)+2);
                        }
                        sce->r.mode &= ~R_SHADOW;
                        
@@ -1256,10 +1248,11 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
 
                br->icon_imbuf= get_brush_icon(br);
 
+               memset(sp->pr_rect, 0x888888, sp->sizex*sp->sizey*sizeof(unsigned int));
+
                if(!(br->icon_imbuf) || !(br->icon_imbuf->rect))
                        return;
 
-               memset(sp->pr_rect, 0x888888, sp->sizex*sp->sizey*sizeof(unsigned int));
                icon_copy_rect(br->icon_imbuf, sp->sizex, sp->sizey, sp->pr_rect);
 
                *do_update= 1;
index 60b679a38ef30950df2cbf87e69594a0af52cc62..5fde1652243497b3308b33a8ce3de24873398b4c 100644 (file)
@@ -1337,7 +1337,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int
        /* to save, we first get absolute path */
        BLI_path_abs(str, G.main->name);
        
-       if (BKE_write_ibuf(scene, ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) {
+       if (BKE_write_ibuf(ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) {
                retval = OPERATOR_FINISHED;
        }
        else {
index a0a2ede11ef28ce12efa7b8c2f2324f2ece79227..e942cfc8b1fcd38702e78a1749e9eeb310e0212d 100644 (file)
@@ -1133,7 +1133,10 @@ void ED_area_exit(bContext *C, ScrArea *sa)
        ARegion *ar;
 
        if (sa->spacetype == SPACE_FILE) {
-               ED_fileselect_exit(C, (SpaceFile*)(sa) ? sa->spacedata.first : CTX_wm_space_data(C));
+               SpaceLink *sl= sa->spacedata.first;
+               if(sl && sl->spacetype == SPACE_FILE) {
+                       ED_fileselect_exit(C, (SpaceFile *)sl);
+               }
        }
 
        CTX_wm_area_set(C, sa);
index 56a27da54df7a3ba810f09c655ebe75365e7d9ff..b5f980ab7cb4ffdad53e4e49992c5b461fb384ed 100644 (file)
@@ -1871,6 +1871,8 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot)
 static int screen_set_exec(bContext *C, wmOperator *op)
 {
        bScreen *screen= CTX_wm_screen(C);
+       bScreen *screen_prev= screen;
+       
        ScrArea *sa= CTX_wm_area(C);
        int tot= BLI_countlist(&CTX_data_main(C)->screen);
        int delta= RNA_int_get(op->ptr, "delta");
@@ -1879,15 +1881,11 @@ static int screen_set_exec(bContext *C, wmOperator *op)
        if(screen->temp)
                return OPERATOR_CANCELLED;
        
-       /* return to previous state before switching screens */
-       if(sa && sa->full)
-               ED_screen_full_restore(C, sa);
-       
        if(delta==1) {
                while(tot--) {
                        screen= screen->id.next;
                        if(screen==NULL) screen= CTX_data_main(C)->screen.first;
-                       if(screen->winid==0 && screen->full==0)
+                       if(screen->winid==0 && screen->full==0 && screen != screen_prev)
                                break;
                }
        }
@@ -1895,7 +1893,7 @@ static int screen_set_exec(bContext *C, wmOperator *op)
                while(tot--) {
                        screen= screen->id.prev;
                        if(screen==NULL) screen= CTX_data_main(C)->screen.last;
-                       if(screen->winid==0 && screen->full==0)
+                       if(screen->winid==0 && screen->full==0 && screen != screen_prev)
                                break;
                }
        }
@@ -1903,7 +1901,12 @@ static int screen_set_exec(bContext *C, wmOperator *op)
                screen= NULL;
        }
        
-       if(screen) {
+       if(screen && screen_prev != screen) {
+               /* return to previous state before switching screens */
+               if(sa && sa->full) {
+                       ED_screen_full_restore(C, sa); /* may free 'screen_prev' */
+               }
+               
                ED_screen_set(C, screen);
                return OPERATOR_FINISHED;
        }
index c38544fdc37a0e5352c5d2af02244c28d362dfbb..7bc56879a0f29af339c6d19c3023cc08d97d7b77 100644 (file)
@@ -95,7 +95,7 @@ static int screenshot_exec(bContext *C, wmOperator *op)
                        ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
                        ibuf->rect= scd->dumprect;
                        
-                       BKE_write_ibuf(scene, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality);
+                       BKE_write_ibuf(ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality);
 
                        IMB_freeImBuf(ibuf);
 
@@ -280,7 +280,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
                                BKE_makepicstring(name, rd.pic, cfra, rd.imtype, rd.scemode & R_EXTENSION, TRUE);
                                
                                ibuf->rect= sj->dumprect;
-                               ok= BKE_write_ibuf(sj->scene, ibuf, name, rd.imtype, rd.subimtype, rd.quality);
+                               ok= BKE_write_ibuf(ibuf, name, rd.imtype, rd.subimtype, rd.quality);
                                
                                if(ok==0) {
                                        printf("Write error: cannot save %s\n", name);
index 3b4b828d0f66f71cbaccc3f0ab1e29d324018612..577e9739537075d6f2bccb9de35081ac7526d67b 100644 (file)
@@ -517,9 +517,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", RKEY, KM_PRESS, 0, 0);
        RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.use_rake");
 
-       kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", AKEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.use_airbrush");
-
        /* Vertex Paint mode */
        keymap= WM_keymap_find(keyconf, "Vertex Paint", 0, 0);
        keymap->poll= vertex_paint_mode_poll;
index 4eddeaaaf9f6352776ccb35d3ac0d5c701aaa7f9..5d786c1d00b3c1bb40228e0679a5809fd79ab4fe 100644 (file)
@@ -854,7 +854,7 @@ int file_next_exec(bContext *C, wmOperator *UNUSED(unused))
                folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
                folderlist_popdir(sfile->folders_next, sfile->params->dir);
 
-               // update folder_prev so we can check for it in folderlist_clear_next()
+               // update folders_prev so we can check for it in folderlist_clear_next()
                folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
 
                file_change_dir(C, 1);
index f0ffe34476f46e6843dc56738ed4ea0ab3c00fa2..0a8ae56c29198516d6e3d1f65dd5b534f7ecaffb 100644 (file)
@@ -469,13 +469,12 @@ int folderlist_clear_next(struct SpaceFile *sfile)
 /* not listbase itself */
 void folderlist_free(ListBase* folderlist)
 {
-       FolderList *folder;
        if (folderlist){
+               FolderList *folder;
                for(folder= folderlist->first; folder; folder= folder->next)
                        MEM_freeN(folder->foldername);
                BLI_freelistN(folderlist);
        }
-       folderlist= NULL;
 }
 
 ListBase *folderlist_duplicate(ListBase* folderlist)
@@ -1007,7 +1006,7 @@ void filelist_from_library(struct FileList* filelist)
 {
        LinkNode *l, *names, *previews;
        struct ImBuf* ima;
-       int ok, i, nnames, idcode;
+       int ok, i, nprevs, nnames, idcode;
        char filename[FILE_MAXDIR+FILE_MAXFILE];
        char dir[FILE_MAX], group[GROUP_MAX];   
        
@@ -1031,17 +1030,18 @@ void filelist_from_library(struct FileList* filelist)
        
        idcode= groupname_to_code(group);
 
-               // memory for strings is passed into filelist[i].relname
-               // and free'd in freefilelist
-       previews = NULL;
+       /* memory for strings is passed into filelist[i].relname
+        * and free'd in freefilelist */
        if (idcode) {
-               previews= BLO_blendhandle_get_previews(filelist->libfiledata, idcode);
+               previews= BLO_blendhandle_get_previews(filelist->libfiledata, idcode, &nprevs);
                names= BLO_blendhandle_get_datablock_names(filelist->libfiledata, idcode, &nnames);
                /* ugh, no rewind, need to reopen */
                BLO_blendhandle_close(filelist->libfiledata);
                filelist->libfiledata= BLO_blendhandle_from_file(dir, NULL);
                
        } else {
+               previews= NULL;
+               nprevs= 0;
                names= BLO_blendhandle_get_linkable_groups(filelist->libfiledata);
                nnames= BLI_linklist_length(names);
        }
@@ -1064,7 +1064,10 @@ void filelist_from_library(struct FileList* filelist)
                }
        }
        
-       if(previews) {
+       if(previews && (nnames != nprevs)) {
+               printf("filelist_from_library: error, found %d items, %d previews\n", nnames, nprevs);
+       }
+       else if(previews) {
                for (i=0, l= previews; i<nnames; i++, l= l->next) {
                        PreviewImage *img= l->link;
                        
index 04fe2ebf828d76b6f14f9e4c3d48ce1903eee0f5..968953abf62e9ab0f4706f32da0b2d27e2660a2a 100644 (file)
@@ -655,9 +655,10 @@ void ED_fileselect_clear(struct bContext *C, struct SpaceFile *sfile)
 void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile)
 {
        if(!sfile) return;
-       if(sfile->op)
+       if(sfile->op) {
                WM_event_fileselect_event(C, sfile->op, EVT_FILESELECT_EXTERNAL_CANCEL);
-       sfile->op = NULL;
+               sfile->op = NULL;
+       }
 
        folderlist_free(sfile->folders_prev);
        folderlist_free(sfile->folders_next);
index 920f477e7ebe3424ca214654422400de80b7498b..6c713d6e469c273fa7bf3d5e00b51b80c726c3fa 100644 (file)
@@ -484,11 +484,8 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
                 */
                for (ce= ked.list.first; ce; ce= ce->next) {
                        /* set frame for validation callback to refer to */
-                       if (ale)
-                               ked.f1= BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP);
-                       else
-                               ked.f1= ce->cfra;
-                       
+                       ked.f1= BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP);
+
                        /* select elements with frame number matching cfraelem */
                        ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL);
                }
index ab435395d6217a548fe6939363d0b31fba2a73dc..7d4aaf0c70e421e3fca0ec65e373ea7dca3b4541 100644 (file)
@@ -925,7 +925,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
                        }
                        BKE_image_release_renderresult(scene, ima);
                }
-               else if (BKE_write_ibuf(scene, ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) {
+               else if (BKE_write_ibuf(ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) {
                        ok= TRUE;
                }
 
index 68b9170b8371316334255cce44cb32e2174141a5..7d92c308f17b36351f28f900117104da85d6b15b 100644 (file)
@@ -1643,6 +1643,8 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
                BLF_draw_ascii(blf_mono_font, str, sizeof(str));
                dx += BLF_width(blf_mono_font, str);
        }
+
+       (void)dx;
 }
 
 #if 0
index 34380fe4fd6dfe648afe0cabe3bd1d591a50860f..e9559426b81c7017367797e9ead8850f8f004008 100644 (file)
 #include "time_intern.h"
 
 /* ****************** Start/End Frame Operators *******************************/
-
 static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene= CTX_data_scene(C);
-       int frame= CFRA;
-       
+       int frame;
+
        if (scene == NULL)
                return OPERATOR_CANCELLED;
-               
+
+       frame= CFRA;
        /* if 'end frame' (Preview Range or Actual) is less than 'frame', 
         * clamp 'frame' to 'end frame'
         */
@@ -93,11 +93,13 @@ static void TIME_OT_start_frame_set (wmOperatorType *ot)
 static int time_set_efra_exec (bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene= CTX_data_scene(C);
-       int frame= CFRA;
-       
+       int frame;
+
        if (scene == NULL)
                return OPERATOR_CANCELLED;
-               
+
+       frame= CFRA;
+
        /* if 'start frame' (Preview Range or Actual) is greater than 'frame', 
         * clamp 'frame' to 'end frame'
         */
index e68e1657096dc1933becab684752ee70b1af0811..022fa8b64c3462715038217949246e6de1fa17ce 100644 (file)
@@ -1537,7 +1537,7 @@ static void draw_pose_dofs(Object *ob)
                                                        }                                       
                                                        
                                                        if (pchan->ikflag & BONE_IK_XLIMIT) {
-                                                       /* OpenGL requires rotations in degrees; so we're taking the average angle here */
+                                                               /* OpenGL requires rotations in degrees; so we're taking the average angle here */
                                                                theta= RAD2DEGF(0.5f * (pchan->limitmin[0] + pchan->limitmax[0]));
                                                                glRotatef(theta, 1.0f, 0.0f, 0.0f);
                                                                
@@ -1615,10 +1615,17 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                        
                        for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
                                bone= pchan->bone;
-                               if (bone && !(bone->flag & (BONE_HIDDEN_P|BONE_NO_DEFORM|BONE_HIDDEN_PG))) {
-                                       if (bone->flag & (BONE_SELECTED)) {
-                                               if (bone->layer & arm->layer)
-                                                       draw_sphere_bone_dist(smat, imat, pchan, NULL);
+                               if (bone) {
+                                       /* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] 
+                                        * NOTE: this is the only case with NO_DEFORM==0 flag, as this is for envelope influence drawing 
+                                        */
+                                       if ( (bone->flag & (BONE_HIDDEN_P|BONE_NO_DEFORM|BONE_HIDDEN_PG))==0 && 
+                                                ((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) ) 
+                                       {
+                                               if (bone->flag & (BONE_SELECTED)) {
+                                                       if (bone->layer & arm->layer)
+                                                               draw_sphere_bone_dist(smat, imat, pchan, NULL);
+                                               }
                                        }
                                }
                        }
@@ -1642,14 +1649,18 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                        bone= pchan->bone;
                        arm->layer_used |= bone->layer;
                        
-                       if ( (bone) && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)) ) {
+                       /* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
+                       if ( (bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))==0 && 
+                                ((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) ) 
+                       {
                                if (bone->layer & arm->layer) {
                                        int use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM);
                                        glPushMatrix();
-
+                                       
                                        if(use_custom && pchan->custom_tx) {
                                                glMultMatrixf(pchan->custom_tx->pose_mat);
-                                       } else {
+                                       } 
+                                       else {
                                                glMultMatrixf(pchan->pose_mat);
                                        }
                                        
@@ -1710,15 +1721,19 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
                        bone= pchan->bone;
                        
-                       if ((bone) && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))) {
+                       /* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
+                       if ( (bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))==0 && 
+                                ((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) ) 
+                       {
                                if (bone->layer & arm->layer) {
                                        if (pchan->custom) {
                                                if ((dt < OB_SOLID) || (bone->flag & BONE_DRAWWIRE)) {
                                                        glPushMatrix();
-
+                                                       
                                                        if(pchan->custom_tx) {
                                                                glMultMatrixf(pchan->custom_tx->pose_mat);
-                                                       } else {
+                                                       } 
+                                                       else {
                                                                glMultMatrixf(pchan->pose_mat);
                                                        }
                                                        
@@ -1788,7 +1803,10 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                        bone= pchan->bone;
                        arm->layer_used |= bone->layer;
                        
-                       if ((bone) && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))) {
+                       /* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
+                       if ( (bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))==0 && 
+                                ((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) ) 
+                       {
                                if (bone->layer & arm->layer) {
                                        if ((do_dashed & 1) && (pchan->parent)) {
                                                /* Draw a line from our root to the parent's tip 
@@ -1892,7 +1910,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                /* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
                if ((G.f & G_PICKSEL) == 0) {
                        float vec[3];
-
+                       
                        unsigned char col[4];
                        float col_f[4];
                        glGetFloatv(GL_CURRENT_COLOR, col_f); /* incase this is not set below */
@@ -1911,7 +1929,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                                                else if (dt > OB_WIRE) {
                                                        UI_GetThemeColor3ubv(TH_TEXT, col);
                                                }
-
+                                               
                                                /*      Draw names of bone      */
                                                if (arm->flag & ARM_DRAWNAMES) {
                                                        mid_v3_v3v3(vec, pchan->pose_head, pchan->pose_tail);
@@ -1924,10 +1942,10 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                                                        copy_m4_m4(bmat, pchan->pose_mat);
                                                        bone_matrix_translate_y(bmat, pchan->bone->length);
                                                        glMultMatrixf(bmat);
-
+                                                       
                                                        glColor3ubv(col);
                                                        drawaxes(pchan->bone->length*0.25f, OB_ARROWS);
-
+                                                       
                                                        glPopMatrix();
                                                }
                                        }
@@ -2440,7 +2458,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
                /* we use color for solid lighting */
                glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
                glEnable(GL_COLOR_MATERIAL);
-               glColor3ub(255,0,255);  // clear spec
+               glColor3ub(255,255,255);        // clear spec
                glDisable(GL_COLOR_MATERIAL);
                
                glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
index a8cdc99645d313c5b5afc0659eb195755af74c10..93d86f2d97bd168a8e3e7398126740fa122211f5 100644 (file)
@@ -156,6 +156,44 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
        return rv3d;
 }
 
+/* ideally would return an rv3d but in some cases the region is needed too
+ * so return that, the caller can then access the ar->regiondata */
+ARegion *ED_view3d_context_region_unlock(bContext *C)
+{
+       ScrArea *sa= CTX_wm_area(C);
+       if(sa && sa->spacetype==SPACE_VIEW3D) {
+               ARegion *ar= CTX_wm_region(C);
+               if(ar) {
+                       RegionView3D *rv3d= ar->regiondata;
+                       if(rv3d && rv3d->viewlock == 0) {
+                               return ar;
+                       }
+                       else {
+                               ARegion *ar_unlock_user= NULL;
+                               ARegion *ar_unlock= NULL;
+                               for(ar= sa->regionbase.first; ar; ar= ar->next) {
+                                       /* find the first unlocked rv3d */
+                                       if(ar->regiondata && ar->regiontype == RGN_TYPE_WINDOW) {
+                                               rv3d= ar->regiondata;
+                                               if(rv3d->viewlock == 0) {
+                                                       ar_unlock= ar;
+                                                       if(rv3d->persp==RV3D_PERSP || rv3d->persp==RV3D_CAMOB) {
+                                                               ar_unlock_user= ar;
+                                                               break;
+                                                       }
+                                               } 
+                                       }
+                               }
+
+                               /* camera/perspective view get priority when the active region is locked */
+                               if(ar_unlock_user) return ar_unlock_user;
+                               if(ar_unlock) return ar_unlock;
+                       }
+               }
+       }
+       return NULL;
+}
+
 /* Most of the time this isn't needed since you could assume the view matrix was
  * set while drawing, however when functions like mesh_foreachScreenVert are
  * called by selection tools, we can't be sure this object was the last.
index 78538a6f16df3a7eea4af5fdc7e0af1e42335f69..1bbad6220efb2021f1148172b20baa164d672da2 100644 (file)
@@ -2212,7 +2212,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
 }
 
 /* creates own 3d views, used by the sequencer */
-ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype, char err_out[256])
+ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int width, int height, unsigned int flag, int drawtype, char err_out[256])
 {
        View3D v3d= {NULL};
        ARegion ar= {NULL};
@@ -2223,7 +2223,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height
        ar.regiondata= &rv3d;
        ar.regiontype= RGN_TYPE_WINDOW;
 
-       v3d.camera= scene->camera;
+       v3d.camera= camera;
        v3d.lay= scene->lay;
        v3d.drawtype = drawtype;
        v3d.flag2 = V3D_RENDER_OVERRIDE;
index b377bb20baab7d889fee8341a3797c0c561d0fef..2509ae75744567a3f7f5c71a2fbefd834cbed56b 100644 (file)
@@ -790,7 +790,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
                        View3D *v3d = vod->sa->spacedata.first;
 
                        if(v3d->camera) {
-                               view3d_settings_from_ob(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
+                               view3d_apply_ob(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
                        }
 
                        if(rv3d->persp==RV3D_CAMOB) {
@@ -1635,10 +1635,10 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
 
                if (rv3d->persp==RV3D_CAMOB) {
                        rv3d->persp= RV3D_PERSP;
-                       smooth_view(C, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
+                       smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
                }
                else {
-                       smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
+                       smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
                }
        }
 // XXX BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
@@ -1778,10 +1778,10 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a loca
 
        if (rv3d->persp==RV3D_CAMOB) {
                rv3d->persp= RV3D_PERSP;
-               smooth_view(C, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
+               smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
        }
        else {
-               smooth_view(C, NULL, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
+               smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
        }
 
        /* smooth view does viewlock RV3D_BOXVIEW copy */
@@ -1814,10 +1814,12 @@ static int viewcenter_cursor_exec(bContext *C, wmOperator *UNUSED(op))
        Scene *scene= CTX_data_scene(C);
        
        if (rv3d) {
+               ARegion *ar= CTX_wm_region(C);
+
                /* non camera center */
                float new_ofs[3];
                negate_v3_v3(new_ofs, give_cursor(scene, v3d));
-               smooth_view(C, NULL, NULL, new_ofs, NULL, NULL, NULL);
+               smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, NULL, NULL);
                
                /* smooth view does viewlock RV3D_BOXVIEW copy */
        }
@@ -2047,7 +2049,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
                new_dist = ((new_dist*scale) >= 0.001f * v3d->grid)? new_dist*scale:0.001f * v3d->grid;
        }
 
-       smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
+       smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
 
        if(rv3d->viewlock & RV3D_BOXVIEW)
                view3d_boxview_sync(CTX_wm_area(C), ar);
@@ -2146,14 +2148,14 @@ static EnumPropertyItem prop_view_items[] = {
 
 /* would like to make this a generic function - outside of transform */
 
-static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, short view, int perspo, int align_active)
+static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar, float q1, float q2, float q3, float q4, short view, int perspo, int align_active)
 {
-       View3D *v3d = CTX_wm_view3d(C);
-       RegionView3D *rv3d= CTX_wm_region_view3d(C);
+       RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */
        float new_quat[4];
 
        new_quat[0]= q1; new_quat[1]= q2;
        new_quat[2]= q3; new_quat[3]= q4;
+       normalize_qt(new_quat);
 
        if(align_active) {
                /* align to active object */
@@ -2194,7 +2196,7 @@ static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, s
        }
 
        if(rv3d->viewlock) {
-               ED_region_tag_redraw(CTX_wm_region(C));
+               ED_region_tag_redraw(ar);
                return;
        }
 
@@ -2203,14 +2205,14 @@ static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, s
                if (U.uiflag & USER_AUTOPERSP) rv3d->persp= view ? RV3D_ORTHO : RV3D_PERSP;
                else if(rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
 
-               smooth_view(C, v3d->camera, NULL, rv3d->ofs, new_quat, NULL, NULL);
+               smooth_view(C, v3d, ar, v3d->camera, NULL, rv3d->ofs, new_quat, NULL, NULL);
        }
        else {
 
                if (U.uiflag & USER_AUTOPERSP) rv3d->persp= view ? RV3D_ORTHO : RV3D_PERSP;
                else if(rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
 
-               smooth_view(C, NULL, NULL, NULL, new_quat, NULL, NULL);
+               smooth_view(C, v3d, ar, NULL, NULL, NULL, new_quat, NULL, NULL);
        }
 
 }
@@ -2218,7 +2220,8 @@ static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, s
 static int viewnumpad_exec(bContext *C, wmOperator *op)
 {
        View3D *v3d = CTX_wm_view3d(C);
-       RegionView3D *rv3d= CTX_wm_region_view3d(C);
+       ARegion *ar= ED_view3d_context_region_unlock(C);
+       RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */
        Scene *scene= CTX_data_scene(C);
        static int perspo=RV3D_PERSP;
        int viewnum, align_active, nextperspo;
@@ -2240,27 +2243,27 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
 
        switch (viewnum) {
                case RV3D_VIEW_BOTTOM :
-                       axis_set_view(C, 0.0, -1.0, 0.0, 0.0, viewnum, nextperspo, align_active);
+                       axis_set_view(C, v3d, ar, 0.0, -1.0, 0.0, 0.0, viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_BACK:
-                       axis_set_view(C, 0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0), viewnum, nextperspo, align_active);
+                       axis_set_view(C, v3d, ar, 0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0), viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_LEFT:
-                       axis_set_view(C, 0.5, -0.5, 0.5, 0.5, viewnum, nextperspo, align_active);
+                       axis_set_view(C, v3d, ar, 0.5, -0.5, 0.5, 0.5, viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_TOP:
-                       axis_set_view(C, 1.0, 0.0, 0.0, 0.0, viewnum, nextperspo, align_active);
+                       axis_set_view(C, v3d, ar, 1.0, 0.0, 0.0, 0.0, viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_FRONT:
-                       axis_set_view(C, (float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0, viewnum, nextperspo, align_active);
+                       axis_set_view(C, v3d, ar, (float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0, viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_RIGHT:
-                       axis_set_view(C, 0.5, -0.5, -0.5, -0.5, viewnum, nextperspo, align_active);
+                       axis_set_view(C, v3d, ar, 0.5, -0.5, -0.5, -0.5, viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_CAMERA:
@@ -2316,13 +2319,13 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
 
                                        /* finally do snazzy view zooming */
                                        rv3d->persp= RV3D_CAMOB;
-                                       smooth_view(C, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
+                                       smooth_view(C, v3d, ar, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
 
                                }
                                else{
                                        /* return to settings of last view */
                                        /* does smooth_view too */
-                                       axis_set_view(C, rv3d->lviewquat[0], rv3d->lviewquat[1], rv3d->lviewquat[2], rv3d->lviewquat[3], rv3d->lview, rv3d->lpersp, 0);
+                                       axis_set_view(C, v3d, ar, rv3d->lviewquat[0], rv3d->lviewquat[1], rv3d->lviewquat[2], rv3d->lviewquat[3], rv3d->lview, rv3d->lpersp, 0);
                                }
                        }
                        break;
@@ -2346,7 +2349,7 @@ void VIEW3D_OT_viewnumpad(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec= viewnumpad_exec;
-       ot->poll= ED_operator_region_view3d_active;
+       ot->poll= ED_operator_rv3d_unlock_poll;
 
        /* flags */
        ot->flag= 0;
@@ -2364,7 +2367,8 @@ static EnumPropertyItem prop_view_orbit_items[] = {
 
 static int vieworbit_exec(bContext *C, wmOperator *op)
 {
-       RegionView3D *rv3d= CTX_wm_region_view3d(C);
+       ARegion *ar= ED_view3d_context_region_unlock(C);
+       RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */
        float phi, q1[4], new_quat[4];
        int orbitdir;
 
@@ -2398,7 +2402,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
                                rv3d->view= 0;
                        }
 
-                       smooth_view(C, NULL, NULL, NULL, new_quat, NULL, NULL);
+                       smooth_view(C, CTX_wm_view3d(C), ar, NULL, NULL, NULL, new_quat, NULL, NULL);
                }
        }
 
@@ -2414,7 +2418,7 @@ void VIEW3D_OT_view_orbit(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec= vieworbit_exec;
-       ot->poll= ED_operator_region_view3d_active;
+       ot->poll= ED_operator_rv3d_unlock_poll;
 
        /* flags */
        ot->flag= 0;
@@ -2470,8 +2474,8 @@ void VIEW3D_OT_view_pan(wmOperatorType *ot)
 
 static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op))
 {
-       ARegion *ar= CTX_wm_region(C);
-       RegionView3D *rv3d= CTX_wm_region_view3d(C);
+       ARegion *ar= ED_view3d_context_region_unlock(C);
+       RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */
 
        if(rv3d->viewlock==0) {
                if(rv3d->persp!=RV3D_ORTHO)
@@ -2493,12 +2497,13 @@ void VIEW3D_OT_view_persportho(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec= viewpersportho_exec;
-       ot->poll= ED_operator_region_view3d_active;
+       ot->poll= ED_operator_rv3d_unlock_poll;
 
        /* flags */
        ot->flag= 0;
 }
 
+
 /* ******************** add background image operator **************** */
 
 static BGpic *background_image_add(bContext *C)
index ce770aaae6a2f72d85bbcd0876897fa7a4351123..32deee50fb29bbb83da6e9d013a34f319c7a08c3 100644 (file)
@@ -540,7 +540,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
 {
 
 #define FLY_ROTATE_FAC 2.5f /* more is faster */
-#define FLY_ZUP_CORRECT_FAC 0.1f /* ammount to correct per step */
+#define FLY_ZUP_CORRECT_FAC 0.1f /* amount to correct per step */
 #define FLY_ZUP_CORRECT_ACCEL 0.05f /* increase upright momentum each step */
 
        /*
index 12ad01e3977c9a11f8511256d6ab6416d7d59bb0..717e46800b1f1c9b67d800cef0e5f57a7a14206c 100644 (file)
@@ -147,10 +147,6 @@ void VIEW3D_OT_select_circle(struct wmOperatorType *ot);
 void VIEW3D_OT_select_border(struct wmOperatorType *ot);
 void VIEW3D_OT_select_lasso(struct wmOperatorType *ot);
 
-/* view3d_view.c */
-void view3d_settings_from_ob(struct Object *ob, float *ofs, float *quat, float *dist, float *lens);
-int view3d_is_ortho(View3D *v3d, RegionView3D *rv3d);
-
 void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
 void VIEW3D_OT_setcameratoview(struct wmOperatorType *ot);
 void VIEW3D_OT_object_as_camera(struct wmOperatorType *ot);
@@ -162,7 +158,7 @@ int boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb);
 
 void centerview(struct ARegion *ar, View3D *v3d);
 
-void smooth_view(struct bContext *C, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens);
+void smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens);
 
 void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect); /* rect: for picking */
 void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d);
index 6dae0938f5460e3cd46e4ef36668175ca0a8202a..8a975eec40f1b088d353102c703c665f2ef0f60a 100644 (file)
@@ -106,9 +106,7 @@ float *give_cursor(Scene *scene, View3D *v3d)
 
 /* Gets the lens and clipping values from a camera of lamp type object */
 static void object_lens_clip_settings(Object *ob, float *lens, float *clipsta, float *clipend)
-{      
-       if (!ob) return;
-       
+{
        if(ob->type==OB_LAMP ) {
                Lamp *la = ob->data;
                if (lens) {
@@ -137,39 +135,42 @@ static void object_lens_clip_settings(Object *ob, float *lens, float *clipsta, f
 * 
 * The dist is not modified for this function, if NULL its assimed zero
 * */
-void view3d_settings_from_ob(Object *ob, float *ofs, float *quat, float *dist, float *lens)
+void view3d_apply_mat4(float mat[][4], float *ofs, float *quat, float *dist)
 {
-       if (!ob) return;
-
        /* Offset */
        if (ofs)
-               negate_v3_v3(ofs, ob->obmat[3]);
+               negate_v3_v3(ofs, mat[3]);
 
        /* Quat */
        if (quat) {
                float imat[4][4];
-               invert_m4_m4(imat, ob->obmat);
+               invert_m4_m4(imat, mat);
                mat4_to_quat(quat, imat);
        }
 
        if (dist) {
-               float tquat[4];
+               float nmat[3][3];
                float vec[3];
 
                vec[0]= 0.0f;
                vec[1]= 0.0f;
                vec[2]= -(*dist);
 
-               mat4_to_quat(tquat, ob->obmat);
-
-               mul_qt_v3(tquat, vec);
+               copy_m3_m4(nmat, mat);
+               normalize_m3(nmat);
 
+               mul_m3_v3(nmat, vec);;
                sub_v3_v3(ofs, vec);
        }
+}
 
-       /* Lens */
-       if (lens)
+void view3d_apply_ob(Object *ob, float *ofs, float *quat, float *dist, float *lens)
+{
+       view3d_apply_mat4(ob->obmat, ofs, quat, dist);
+
+       if (lens) {
                object_lens_clip_settings(ob, lens, NULL, NULL);
+       }
 }
 
 
@@ -189,10 +190,13 @@ struct SmoothViewStore {
 
 /* will start timer if appropriate */
 /* the arguments are the desired situation */
-void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, float *quat, float *dist, float *lens)
+void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Object *camera, float *ofs, float *quat, float *dist, float *lens)
 {
-       View3D *v3d = CTX_wm_view3d(C);
-       RegionView3D *rv3d= CTX_wm_region_view3d(C);
+       wmWindowManager *wm= CTX_wm_manager(C);
+       wmWindow *win= CTX_wm_window(C);
+       ScrArea *sa= CTX_wm_area(C);
+
+       RegionView3D *rv3d= ar->regiondata;
        struct SmoothViewStore sms= {0};
        short ok= FALSE;
        
@@ -210,7 +214,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
        if(lens) sms.new_lens= *lens;
 
        if (camera) {
-               view3d_settings_from_ob(camera, sms.new_ofs, sms.new_quat, &sms.new_dist, &sms.new_lens);
+               view3d_apply_ob(camera, sms.new_ofs, sms.new_quat, &sms.new_dist, &sms.new_lens);
                sms.to_camera= 1; /* restore view3d values in end */
        }
        
@@ -235,7 +239,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
                        /* original values */
                        if (oldcamera) {
                                sms.orig_dist= rv3d->dist; // below function does weird stuff with it...
-                               view3d_settings_from_ob(oldcamera, sms.orig_ofs, sms.orig_quat, &sms.orig_dist, &sms.orig_lens);
+                               view3d_apply_ob(oldcamera, sms.orig_ofs, sms.orig_quat, &sms.orig_dist, &sms.orig_lens);
                        }
                        else {
                                copy_v3_v3(sms.orig_ofs, rv3d->ofs);
@@ -280,9 +284,9 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
                                rv3d->sms= MEM_mallocN(sizeof(struct SmoothViewStore), "smoothview v3d");
                        *rv3d->sms= sms;
                        if(rv3d->smooth_timer)
-                               WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), rv3d->smooth_timer);
+                               WM_event_remove_timer(wm, win, rv3d->smooth_timer);
                        /* TIMER1 is hardcoded in keymap */
-                       rv3d->smooth_timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER1, 1.0/100.0); /* max 30 frs/sec */
+                       rv3d->smooth_timer= WM_event_add_timer(wm, win, TIMER1, 1.0/100.0);     /* max 30 frs/sec */
                        
                        ok= TRUE;
                }
@@ -290,8 +294,6 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
        
        /* if we get here nothing happens */
        if(ok == FALSE) {
-               ARegion *ar= CTX_wm_region(C);
-
                if(sms.to_camera==0) {
                        copy_v3_v3(rv3d->ofs, sms.new_ofs);
                        copy_qt_qt(rv3d->viewquat, sms.new_quat);
@@ -300,7 +302,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
                }
 
                if(rv3d->viewlock & RV3D_BOXVIEW)
-                       view3d_boxview_copy(CTX_wm_area(C), ar);
+                       view3d_boxview_copy(sa, ar);
 
                ED_region_tag_redraw(ar);
        }
@@ -464,19 +466,20 @@ void VIEW3D_OT_setcameratoview(wmOperatorType *ot)
 static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op))
 {
        View3D *v3d = CTX_wm_view3d(C);
-       RegionView3D *rv3d= CTX_wm_region_view3d(C);
+       ARegion *ar= ED_view3d_context_region_unlock(C);
+       RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */
        Scene *scene= CTX_data_scene(C);
        Object *ob = CTX_data_active_object(C);
 
        if(ob) {
-               Object *camera_old= (rv3d->persp == RV3D_CAMOB && scene->camera) ? scene->camera : NULL;
+               Object *camera_old= (rv3d->persp == RV3D_CAMOB) ? V3D_CAMERA_SCENE(scene, v3d) : NULL;
                rv3d->persp= RV3D_CAMOB;
                v3d->camera= ob;
                if(v3d->scenelock)
                        scene->camera= ob;
 
                if(camera_old != ob) /* unlikely but looks like a glitch when set to the same */
-                       smooth_view(C, camera_old, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
+                       smooth_view(C, v3d, ar, camera_old, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
 
                WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, CTX_data_scene(C));
        }
@@ -484,13 +487,11 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op))
        return OPERATOR_FINISHED;
 }
 
-static int region3d_unlocked_poll(bContext *C)
+int ED_operator_rv3d_unlock_poll(bContext *C)
 {
-       RegionView3D *rv3d= CTX_wm_region_view3d(C);
-       return (rv3d && rv3d->viewlock==0);
+       return ED_view3d_context_region_unlock(C) != NULL;
 }
 
-
 void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
 {
        
@@ -501,7 +502,7 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec= view3d_setobjectascamera_exec;        
-       ot->poll= region3d_unlocked_poll;
+       ot->poll= ED_operator_rv3d_unlock_poll;
        
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1187,14 +1188,14 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
                        rv3d->persp=RV3D_PERSP;
                        rv3d->dist= 0.0;
                        
-                       view3d_settings_from_ob(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
-                       smooth_view(NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
+                       view3d_apply_ob(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
+                       smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
                        
                        rv3d->persp=RV3D_CAMOB; /* just to be polite, not needed */
                        
                } else {
                        mat3_to_quat( new_quat,tmat);
-                       smooth_view(NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
+                       smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
                }
        } else {
                mat3_to_quat( rv3d->viewquat,tmat);
@@ -1930,11 +1931,11 @@ void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, f
                copy_v3_v3(orig_ofs, rv3d->ofs);
                rv3d->persp= RV3D_PERSP;
                rv3d->dist= 0.0;
-               view3d_settings_from_ob(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
-               smooth_view(NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
+               view3d_apply_ob(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
+               smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
        } else {
                if (rv3d->persp==RV3D_CAMOB) rv3d->persp= RV3D_PERSP; /* switch out of camera mode */
-               smooth_view(NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
+               smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
        }
 }
 
index 4475ce2019933de7b105147d5028a7bb66a28a27..206c8fc03506d729a56f8c96da1ddff59c812582 100644 (file)
@@ -3151,7 +3151,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
 
 int Rotation(TransInfo *t, const short UNUSED(mval[2]))
 {
-       char str[128];
+       char str[128], *spos= str;
        
        float final;
 
@@ -3177,18 +3177,20 @@ int Rotation(TransInfo *t, const short UNUSED(mval[2]))
                
                outputNumInput(&(t->num), c);
                
-               sprintf(str, "Rot: %s %s %s", &c[0], t->con.text, t->proptext);
+               spos+= sprintf(spos, "Rot: %s %s %s", &c[0], t->con.text, t->proptext);
 
                /* Clamp between -180 and 180 */
                final= angle_wrap_rad(DEG2RADF(final));
        }
        else {
-               sprintf(str, "Rot: %.2f%s %s", RAD2DEGF(final), t->con.text, t->proptext);
+               spos += sprintf(spos, "Rot: %.2f%s %s", RAD2DEGF(final), t->con.text, t->proptext);
        }
        
-       if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED))
-               sprintf(str, "%s Proportional size: %.2f", str, t->prop_size);
-       
+       if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
+               spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
+       }
+       (void)spos;
+
        t->values[0] = final;
        
        applyRotation(t, final, t->axis);
@@ -3257,7 +3259,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
 
 int Trackball(TransInfo *t, const short UNUSED(mval[2]))
 {
-       char str[128];
+       char str[128], *spos= str;
        float axis1[3], axis2[3];
        float mat[3][3], totmat[3][3], smat[3][3];
        float phi[2];
@@ -3281,14 +3283,19 @@ int Trackball(TransInfo *t, const short UNUSED(mval[2]))
 
                outputNumInput(&(t->num), c);
 
-               sprintf(str, "Trackball: %s %s %s", &c[0], &c[20], t->proptext);
+               spos += sprintf(spos, "Trackball: %s %s %s", &c[0], &c[20], t->proptext);
 
                phi[0] = DEG2RADF(phi[0]);
                phi[1] = DEG2RADF(phi[1]);
        }
        else {
-               sprintf(str, "Trackball: %.2f %.2f %s", RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext);
+               spos += sprintf(spos, "Trackball: %.2f %.2f %s", RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext);
+       }
+
+       if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
+               spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
        }
+       (void)spos;
 
        vec_rot_to_mat3( smat,axis1, phi[0]);
        vec_rot_to_mat3( totmat,axis2, phi[1]);
@@ -3345,6 +3352,7 @@ void initTranslation(TransInfo *t)
 }
 
 static void headerTranslation(TransInfo *t, float vec[3], char *str) {
+       char *spos= str;
        char tvec[60];
        char distvec[20];
        char autoik[20];
@@ -3395,24 +3403,26 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
        if (t->con.mode & CON_APPLY) {
                switch(t->num.idx_max) {
                case 0:
-                       sprintf(str, "D: %s (%s)%s %s  %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]);
+                       spos += sprintf(spos, "D: %s (%s)%s %s  %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]);
                        break;
                case 1:
-                       sprintf(str, "D: %s   D: %s (%s)%s %s  %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext, &autoik[0]);
+                       spos += sprintf(spos, "D: %s   D: %s (%s)%s %s  %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext, &autoik[0]);
                        break;
                case 2:
-                       sprintf(str, "D: %s   D: %s  D: %s (%s)%s %s  %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
+                       spos += sprintf(spos, "D: %s   D: %s  D: %s (%s)%s %s  %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
                }
        }
        else {
                if(t->flag & T_2D_EDIT)
-                       sprintf(str, "Dx: %s   Dy: %s (%s)%s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext);
+                       spos += sprintf(spos, "Dx: %s   Dy: %s (%s)%s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext);
                else
-                       sprintf(str, "Dx: %s   Dy: %s  Dz: %s (%s)%s %s  %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
+                       spos += sprintf(spos, "Dx: %s   Dy: %s  Dz: %s (%s)%s %s  %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
        }
        
-       if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED))
-               sprintf(str, "%s Proportional size: %.2f", str, t->prop_size);
+       if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
+               spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
+       }
+       (void)spos;
 }
 
 static void applyTranslation(TransInfo *t, float vec[3]) {
index 5793b1c65790e7c91fb64b290569f86ee32eee48..16a943baabe1c1f6375742ad103823772b901935 100644 (file)
@@ -185,12 +185,44 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) {
        mul_m3_v3(t->con.mtx, vec);
 }
 
+static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3])
+{
+       if(t->spacetype == SPACE_VIEW3D) {
+               // View3D *v3d = t->sa->spacedata.first;
+               const float min_dist= 1.0f; // v3d->near;
+               float dir[3];
+               float l;
+
+               sub_v3_v3v3(dir, t_con_center, t->viewinv[3]);
+               if(dot_v3v3(dir, t->viewinv[2]) < 0.0f) {
+                       negate_v3(dir);
+               }
+               project_v3_v3v3(dir, dir, t->viewinv[2]);
+
+               l= len_v3(dir);
+
+               if(l < min_dist) {
+                       float diff[3];
+                       normalize_v3_v3(diff, t->viewinv[2]);
+                       mul_v3_fl(diff, min_dist - l);
+
+                       sub_v3_v3(t_con_center, diff);
+               }
+       }
+}
+
 static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) {
        float norm[3], vec[3], factor, angle;
+       float t_con_center[3];
 
        if(in[0]==0.0f && in[1]==0.0f && in[2]==0.0f)
                return;
 
+       copy_v3_v3(t_con_center, t->con.center);
+
+       /* checks for center being too close to the view center */
+       viewAxisCorrectCenter(t, t_con_center);
+       
        angle = fabsf(angle_v3v3(axis, t->viewinv[2]));
        if (angle > (float)M_PI / 2.0f) {
                angle = (float)M_PI - angle;
@@ -217,13 +249,13 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
                float norm_center[3];
                float plane[3];
 
-               getViewVector(t, t->con.center, norm_center);
+               getViewVector(t, t_con_center, norm_center);
                cross_v3_v3v3(plane, norm_center, axis);
 
                project_v3_v3v3(vec, in, plane);
                sub_v3_v3v3(vec, in, vec);
                
-               add_v3_v3v3(v, vec, t->con.center);
+               add_v3_v3v3(v, vec, t_con_center);
                getViewVector(t, v, norm);
 
                /* give arbitrary large value if projection is impossible */
@@ -236,14 +268,14 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
                                mul_v3_fl(out, -1000000000.0f);
                        }
                } else {
-                       add_v3_v3v3(v2, t->con.center, axis);
+                       add_v3_v3v3(v2, t_con_center, axis);
                        add_v3_v3v3(v4, v, norm);
                        
-                       isect_line_line_v3(t->con.center, v2, v, v4, i1, i2);
+                       isect_line_line_v3(t_con_center, v2, v, v4, i1, i2);
                        
                        sub_v3_v3v3(v, i2, v);
        
-                       sub_v3_v3v3(out, i1,  t->con.center);
+                       sub_v3_v3v3(out, i1, t_con_center);
 
                        /* possible some values become nan when
                         * viewpoint and object are both zero */
index 022e09b3da401bd5121768bf3a9eebbaf02fbf98..789a262f0755aba45d00fe685a184c034eb022dd 100644 (file)
@@ -1670,7 +1670,7 @@ static void removeDoublesPeel(ListBase *depth_peels)
        {
                DepthPeel *next_peel = peel->next;
                
-               if (peel && next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f)
+               if (next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f)
                {
                        peel->next = next_peel->next;
                        
index 494cf7dee8365bb0f3d4afe4ca3da8d55c149639..eee7a3d7f69580421b860c2a56ef9f2acdcfe64d 100644 (file)
@@ -1308,59 +1308,6 @@ static void UV_OT_stitch(wmOperatorType *ot)
 
 /* ******************** (de)select all operator **************** */
 
-static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
-{
-       Scene *scene;
-       ToolSettings *ts;
-       Object *obedit;
-       EditMesh *em;
-       EditFace *efa;
-       Image *ima;
-       MTFace *tf;
-       
-       scene= CTX_data_scene(C);
-       ts= CTX_data_tool_settings(C);
-       obedit= CTX_data_edit_object(C);
-       em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-       ima= CTX_data_edit_image(C);
-
-       if(ts->uv_flag & UV_SYNC_SELECTION) {
-               EM_select_swap(em);
-       }
-       else {
-               for(efa= em->faces.first; efa; efa= efa->next) {
-                       tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-                       if(uvedit_face_visible(scene, ima, efa, tf)) {
-                               tf->flag ^= TF_SEL1;
-                               tf->flag ^= TF_SEL2;
-                               tf->flag ^= TF_SEL3;
-                               if(efa->v4) tf->flag ^= TF_SEL4;
-                       }
-               }
-       }
-
-       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-       BKE_mesh_end_editmesh(obedit->data, em);
-       return OPERATOR_FINISHED;
-}
-
-static void UV_OT_select_inverse(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Select Inverse";
-       ot->description= "Select inverse of (un)selected UV vertices";
-       ot->idname= "UV_OT_select_inverse";
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-       
-       /* api callbacks */
-       ot->exec= select_inverse_exec;
-       ot->poll= ED_operator_uvedit;
-}
-
-/* ******************** (de)select all operator **************** */
-
 static int select_all_exec(bContext *C, wmOperator *op)
 {
        Scene *scene;
@@ -1425,11 +1372,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
                                        tf->flag &= ~select_flag;
                                        break;
                                case SEL_INVERT:
-                                       if ((tf->flag & select_flag) == select_flag) {
-                                               tf->flag &= ~select_flag;
-                                       } else {
-                                               tf->flag &= ~select_flag;
-                                       }
+                                       tf->flag ^= select_flag;
                                        break;
                                }
                        }
@@ -3196,7 +3139,6 @@ static void UV_OT_tile_set(wmOperatorType *ot)
 void ED_operatortypes_uvedit(void)
 {
        WM_operatortype_append(UV_OT_select_all);
-       WM_operatortype_append(UV_OT_select_inverse);
        WM_operatortype_append(UV_OT_select);
        WM_operatortype_append(UV_OT_select_loop);
        WM_operatortype_append(UV_OT_select_linked);
@@ -3258,7 +3200,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
 
        WM_keymap_add_item(keymap, "UV_OT_unlink_selected", LKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "UV_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       WM_keymap_add_item(keymap, "UV_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
+       RNA_enum_set(WM_keymap_add_item(keymap, "UV_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT);
        WM_keymap_add_item(keymap, "UV_OT_select_pinned", PKEY, KM_PRESS, KM_SHIFT, 0);
 
        WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_weldalign", WKEY, KM_PRESS, 0, 0);
index eece7fba91c62ba8c1d82d752c2bb61f2f106e75..e1eab55b434c4277c73c904fbf6b2cf43e56628a 100644 (file)
@@ -170,8 +170,16 @@ static ParamHandle *construct_param_handle(Scene *scene, EditMesh *em, short imp
                float *uv[4];
                int nverts;
                
-               if((efa->h) || (sel && (efa->f & SELECT)==0)) 
-                       continue;
+               if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+                       if(efa->h) {
+                               continue;
+                       }
+               }
+               else {
+                       if((efa->h) || (sel && (efa->f & SELECT)==0)) {
+                               continue;
+                       }
+               }
 
                tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
                
index 9bc4ba6776cc0e59f409b705e3981233d83f36ed..f6a6a6449772f37ae09f9811a5c7277acc3a8d4b 100644 (file)
@@ -952,6 +952,7 @@ static struct ImBuf *scaledownx(struct ImBuf *ibuf, int newx)
                ibuf->mall |= IB_rectfloat;
                ibuf->rect_float = _newrectf;
        }
+       (void)rect_size; /* UNUSED in release builds */
        
        ibuf->x = newx;
        return(ibuf);
@@ -1082,6 +1083,7 @@ static struct ImBuf *scaledowny(struct ImBuf *ibuf, int newy)
                ibuf->mall |= IB_rectfloat;
                ibuf->rect_float = (float *) _newrectf;
        }
+       (void)rect_size; /* UNUSED in release builds */
        
        ibuf->y = newy;
        return(ibuf);
index 0014e5f3ccd4aebade6e720c4a73c292e264c7ad..a72f6d46c9724f13ffb7129c6420c9e8bde2df96 100644 (file)
@@ -1059,6 +1059,9 @@ typedef struct Scene {
 #define BASACT                 (scene->basact)
 #define OBACT                  (BASACT? BASACT->object: NULL)
 
+#define V3D_CAMERA_LOCAL(v3d) ((!(v3d)->scenelock && (v3d)->camera) ? (v3d)->camera : NULL)
+#define V3D_CAMERA_SCENE(scene, v3d) ((!(v3d)->scenelock && (v3d)->camera) ? (v3d)->camera : (scene)->camera)
+
 #define ID_NEW(a)              if( (a) && (a)->id.newid ) (a)= (void *)(a)->id.newid
 #define ID_NEW_US(a)   if( (a)->id.newid) {(a)= (void *)(a)->id.newid; (a)->id.us++;}
 #define ID_NEW_US2(a)  if( ((ID *)a)->newid) {(a)= ((ID *)a)->newid; ((ID *)a)->us++;}
index 572a2282d45e77c3657d984d9a4928c551141b37..e81a9979c12864de15b881cdc4021199e86beccf 100644 (file)
@@ -52,6 +52,7 @@ struct Tex;
 struct Image;
 struct PreviewImage;
 struct ImBuf;
+struct CurveMapping;
 
 typedef struct MTex {
 
@@ -181,9 +182,10 @@ typedef struct PointDensity {
        short pdpad3[3];
        float noise_fac;
        
-       float speed_scale;
+       float speed_scale, falloff_speed_scale, pdpad2;
        struct ColorBand *coba; /* for time -> color */
        
+       struct CurveMapping *falloff_curve; /* falloff density curve */ 
 } PointDensity;
 
 typedef struct VoxelData {
@@ -517,6 +519,8 @@ typedef struct TexMapping {
 #define TEX_PD_FALLOFF_SOFT            2
 #define TEX_PD_FALLOFF_CONSTANT        3
 #define TEX_PD_FALLOFF_ROOT            4
+#define TEX_PD_FALLOFF_PARTICLE_AGE 5
+#define TEX_PD_FALLOFF_PARTICLE_VEL 6
 
 /* psys_cache_space */
 #define TEX_PD_OBJECTLOC       0
@@ -524,8 +528,8 @@ typedef struct TexMapping {
 #define TEX_PD_WORLDSPACE      2
 
 /* flag */
-#define TEX_PD_TURBULENCE      1
-
+#define TEX_PD_TURBULENCE              1
+#define TEX_PD_FALLOFF_CURVE   2
 
 /* noise_influence */
 #define TEX_PD_NOISE_STATIC            0
index 8e210a7a4cb6a6d2899c301dcfa606994d603ac5..106c51865fdd3c1df4a9419612f18b30ea60a15d 100644 (file)
@@ -55,6 +55,7 @@ EnumPropertyItem keyingset_path_grouping_items[] = {
 #ifdef RNA_RUNTIME
 
 #include "BKE_animsys.h"
+#include "BKE_fcurve.h"
 #include "BKE_nla.h"
 
 #include "WM_api.h"
@@ -457,6 +458,24 @@ static void rna_NlaTrack_active_set(PointerRNA *ptr, PointerRNA value)
        BKE_nlatrack_set_active(&adt->nla_tracks, track);
 }
 
+
+static FCurve *rna_Driver_from_existing(AnimData *adt, bContext *C, FCurve *src_driver)
+{
+       /* verify that we've got a driver to duplicate */
+       if (ELEM(NULL, src_driver, src_driver->driver)) {
+               BKE_reportf(CTX_wm_reports(C), RPT_ERROR, "No valid driver data to create copy of");
+               return NULL;
+       }
+       else {
+               /* just make a copy of the existing one and add to self */
+               FCurve *new_fcu = copy_fcurve(src_driver);
+               
+               // XXX: if we impose any ordering on these someday, this will be problematic
+               BLI_addtail(&adt->drivers, new_fcu);
+               return new_fcu;
+       }
+}
+
 #else
 
 /* helper function for Keying Set -> keying settings */
@@ -724,7 +743,7 @@ static void rna_api_animdata_nla_tracks(BlenderRNA *brna, PropertyRNA *cprop)
        
        func = RNA_def_function(srna, "new", "rna_NlaTrack_new");
        RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-       RNA_def_function_ui_description(func, "Add a new NLA Tracks");
+       RNA_def_function_ui_description(func, "Add a new NLA Track");
        RNA_def_pointer(func, "prev", "NlaTrack", "", "NLA Track to add the new one after.");
        /* return type */
        parm = RNA_def_pointer(func, "track", "NlaTrack", "", "New NLA Track.");
@@ -745,6 +764,28 @@ static void rna_api_animdata_nla_tracks(BlenderRNA *brna, PropertyRNA *cprop)
        RNA_def_property_update(prop, NC_ANIMATION|ND_NLA|NA_SELECTED, NULL);
 }
 
+static void rna_api_animdata_drivers(BlenderRNA *brna, PropertyRNA *cprop)
+{
+       StructRNA *srna;
+       PropertyRNA *parm;
+       FunctionRNA *func;
+
+       // PropertyRNA *prop;
+       
+       RNA_def_property_srna(cprop, "AnimDataDrivers");
+       srna= RNA_def_struct(brna, "AnimDataDrivers", NULL);
+       RNA_def_struct_sdna(srna, "AnimData");
+       RNA_def_struct_ui_text(srna, "Drivers", "Collection of Driver F-Curves");
+       
+       func = RNA_def_function(srna, "from_existing", "rna_Driver_from_existing");
+       RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+       RNA_def_function_ui_description(func, "Add a new driver given an existing one");
+       RNA_def_pointer(func, "src_driver", "FCurve", "", "Existing Driver F-Curve to use as template for a new one");
+       /* return type */
+       parm = RNA_def_pointer(func, "driver", "FCurve", "", "New Driver F-Curve.");
+       RNA_def_function_return(func, parm);
+}
+
 void rna_def_animdata_common(StructRNA *srna)
 {
        PropertyRNA *prop;
@@ -774,7 +815,7 @@ void rna_def_animdata(BlenderRNA *brna)
        /* Active Action */
        prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_EDITABLE); /* this flag as well as the dynamic test must be defined for this to be editable... */
-       RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll");
+       RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll");
        RNA_def_property_editable_func(prop, "rna_AnimData_action_editable");
        RNA_def_property_ui_text(prop, "Action", "Active Action for this datablock");
        RNA_def_property_update(prop, NC_ANIMATION, NULL); /* this will do? */
@@ -805,6 +846,8 @@ void rna_def_animdata(BlenderRNA *brna)
        RNA_def_property_struct_type(prop, "FCurve");
        RNA_def_property_ui_text(prop, "Drivers", "The Drivers/Expressions for this datablock");
        
+       rna_api_animdata_drivers(brna, prop);
+       
        /* General Settings */
        prop= RNA_def_property(srna, "use_nla", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADT_NLA_EVAL_OFF);
diff --git