svn merge ^/trunk/blender -r49757:49763
authorCampbell Barton <ideasman42@gmail.com>
Fri, 10 Aug 2012 10:37:31 +0000 (10:37 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 10 Aug 2012 10:37:31 +0000 (10:37 +0000)
intern/cycles/blender/blender_object.cpp
intern/cycles/blender/blender_particles.cpp
intern/cycles/blender/blender_sync.h
intern/smoke/intern/WAVELET_NOISE.h
release/scripts/presets/interaction/blender.py
release/scripts/startup/bl_ui/properties_object_constraint.py
release/scripts/startup/bl_ui/space_userpref.py
source/blender/compositor/operations/COM_BokehBlurOperation.cpp
source/blender/editors/space_view3d/view3d_edit.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_userdef.c

index 6575cc84814ba48e93e73b0941d9b09d2797a471..813314f67a6a0582787bb5bb5baa2855500732da 100644 (file)
@@ -247,8 +247,11 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
                scene->object_manager->tag_update(scene);
        }
 
+       /* updated dupli objects require particle sync */
+       bool need_particle_update = object_need_particle_update(b_ob);
+
        /* object sync */
-       if(object_updated || (object->mesh && object->mesh->need_update)) {
+       if(object_updated || (object->mesh && object->mesh->need_update) || need_particle_update) {
                object->name = b_ob.name().c_str();
                object->pass_id = b_ob.pass_index();
                object->tfm = tfm;
@@ -275,7 +278,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
                object->particle_id = particle_id;
 
                /* particle sync */
-               if (object_use_particles(b_ob))
+               if (need_particle_update)
                        sync_particles(object, b_ob);
        
                object->tag_update(scene);
index d669aa34a68621dce99304bf2582c589fcd8c4b1..e32c80a51b5e17b867aa3d47ebae4fcfc2117a36 100644 (file)
@@ -31,7 +31,7 @@ CCL_NAMESPACE_BEGIN
 
 /* Particles Sync */
 
-bool BlenderSync::object_use_particles(BL::Object b_ob)
+bool BlenderSync::object_need_particle_update(BL::Object b_ob)
 {
        /* Particle data is only needed for
         * a) Billboard render mode if object's own material uses particle info
@@ -39,7 +39,7 @@ bool BlenderSync::object_use_particles(BL::Object b_ob)
         *
         * Note: Meshes have to be synced at this point!
         */
-       bool use_particles = false;
+       bool need_update = false;
        
        BL::Object::particle_systems_iterator b_psys;
        for (b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys) {
@@ -54,7 +54,7 @@ bool BlenderSync::object_use_particles(BL::Object b_ob)
                        BL::ID key = (BKE_object_is_modified(b_ob))? b_ob: b_ob.data();
                        Mesh *mesh = mesh_map.find(key);
                        if (mesh) {
-                               use_particles |= mesh->need_attribute(scene, ATTR_STD_PARTICLE);
+                               need_update |= mesh->need_attribute(scene, ATTR_STD_PARTICLE) && mesh->need_update;
                        }
                        break;
                }
@@ -66,7 +66,7 @@ bool BlenderSync::object_use_particles(BL::Object b_ob)
                                BL::ID key = (BKE_object_is_modified(b_dupli_ob))? b_dupli_ob: b_dupli_ob.data();
                                Mesh *mesh = mesh_map.find(key);
                                if (mesh) {
-                                       use_particles |= mesh->need_attribute(scene, ATTR_STD_PARTICLE);
+                                       need_update |= mesh->need_attribute(scene, ATTR_STD_PARTICLE) && mesh->need_update;
                                }
                        }
                        break;
@@ -80,7 +80,7 @@ bool BlenderSync::object_use_particles(BL::Object b_ob)
                                        BL::ID key = (BKE_object_is_modified(*b_gob))? *b_gob: b_gob->data();
                                        Mesh *mesh = mesh_map.find(key);
                                        if (mesh) {
-                                               use_particles |= mesh->need_attribute(scene, ATTR_STD_PARTICLE);
+                                               need_update |= mesh->need_attribute(scene, ATTR_STD_PARTICLE) && mesh->need_update;
                                        }
                                }
                        }
@@ -93,7 +93,7 @@ bool BlenderSync::object_use_particles(BL::Object b_ob)
                }
        }
        
-       return use_particles;
+       return need_update;
 }
 
 static bool use_particle_system(BL::ParticleSystem b_psys)
index c7cc3fe42b18af50a16116ca0b69b7cf3e4b1934..ac1fed060ee6a3f74368faf1134a8f7347343e9d 100644 (file)
@@ -92,7 +92,7 @@ private:
        bool BKE_object_is_modified(BL::Object b_ob);
        bool object_is_mesh(BL::Object b_ob);
        bool object_is_light(BL::Object b_ob);
-       bool object_use_particles(BL::Object b_ob);
+       bool object_need_particle_update(BL::Object b_ob);
        int object_count_particles(BL::Object b_ob);
 
        /* variables */
index 4806c6a9fc1ece89b24ea385f7e4800634a905f5..fce901b68aafff5f000ce90d83c0e89df5fad52f 100644 (file)
@@ -107,7 +107,7 @@ static void downsampleNeumann(const float *from, float *to, int n, int stride)
   // if these values are not local incorrect results are generated
   float downCoeffs[32] = { DOWNCOEFFS };
   const float *const aCoCenter= &downCoeffs[16];
-       for (int i = 0; i < ceil((float)n / 2); i++) {
+       for (int i = 0; i <= n / 2; i++) {
                to[i * stride] = 0;
                for (int k = 2 * i - 16; k < 2 * i + 16; k++) { 
                        // handle boundary
index c5454e479a30a0924f7e818d5197d3c287df508b..0c79a3fc909266657859ec6f1fef5e42cc8f960d 100644 (file)
@@ -1,7 +1,8 @@
 # Configuration Blender
 import bpy
 
-bpy.context.user_preferences.view.use_mouse_auto_depth = False
+bpy.context.user_preferences.view.use_mouse_depth_cursor = False
+bpy.context.user_preferences.view.use_mouse_depth_navigate = False
 bpy.context.user_preferences.view.use_zoom_to_mouse = False
 bpy.context.user_preferences.view.use_rotate_around_active = False
 bpy.context.user_preferences.edit.use_drag_immediately = False
index 5057209c97a55c0c8ab12b84d9c85ceacb61e584..3d671a0d1b7e11795b31686ac378358b2ac38950 100644 (file)
@@ -782,12 +782,11 @@ class ConstraintButtonsPanel():
         row.prop(con, "frame_method", expand=True)
 
         if clip:
-            col.prop_search(con, "object", clip.tracking, "objects", icon='OBJECT_DATA')
+            tracking = clip.tracking
 
-            if con.object in clip.tracking.objects:
-                tracking_object = clip.tracking.objects[con.object]
-            else:
-                tracking_object = clip.tracking
+            col.prop_search(con, "object", tracking, "objects", icon='OBJECT_DATA')
+
+            tracking_object = tracking.objects.get(con.object, tracking.objects[0])
 
             col.prop_search(con, "track", tracking_object, "tracks", icon='ANIM_DATA')
 
index e443c7804a61caaa7c7b00492f974b11a11adaa6..e7dd9fb47515ccf306b3a17cc2e235ab76c7257f 100644 (file)
@@ -197,7 +197,8 @@ class USERPREF_PT_interface(Panel):
 
         col = row.column()
         col.label(text="View Manipulation:")
-        col.prop(view, "use_mouse_auto_depth")
+        col.prop(view, "use_mouse_depth_cursor")
+        col.prop(view, "use_mouse_depth_navigate")
         col.prop(view, "use_zoom_to_mouse")
         col.prop(view, "use_rotate_around_active")
         col.prop(view, "use_global_pivot")
index 46c27496e9a320929bd80925530cf91110dd4ed4..7d126eb0539bf2c9565671985e2e1dcb6437b8f9 100644 (file)
@@ -66,13 +66,8 @@ void BokehBlurOperation::initExecution()
        int width = this->m_inputBokehProgram->getWidth();
        int height = this->m_inputBokehProgram->getHeight();
 
-       float dimension;
-       if (width < height) {
-               dimension = width;
-       }
-       else {
-               dimension = height;
-       }
+       float dimension = min(width, height);
+
        this->m_bokehMidX = width / 2.0f;
        this->m_bokehMidY = height / 2.0f;
        this->m_bokehDimension = dimension / 2.0f;
@@ -93,7 +88,8 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, void *data)
                int bufferwidth = inputBuffer->getWidth();
                int bufferstartx = inputBuffer->getRect()->xmin;
                int bufferstarty = inputBuffer->getRect()->ymin;
-               int pixelSize = this->m_size * this->getWidth() / 100.0f;
+               const float max_dim = max(this->getWidth(), this->getHeight());
+               int pixelSize = this->m_size * max_dim / 100.0f;
                zero_v4(color_accum);
 
                if (pixelSize<2) {
@@ -150,18 +146,19 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
 {
        rcti newInput;
        rcti bokehInput;
+       const float max_dim = max(this->getWidth(), this->getHeight());
 
        if (this->m_sizeavailable) {
-               newInput.xmax = input->xmax + (this->m_size * this->getWidth() / 100.0f);
-               newInput.xmin = input->xmin - (this->m_size * this->getWidth() / 100.0f);
-               newInput.ymax = input->ymax + (this->m_size * this->getWidth() / 100.0f);
-               newInput.ymin = input->ymin - (this->m_size * this->getWidth() / 100.0f);
+               newInput.xmax = input->xmax + (this->m_size * max_dim / 100.0f);
+               newInput.xmin = input->xmin - (this->m_size * max_dim / 100.0f);
+               newInput.ymax = input->ymax + (this->m_size * max_dim / 100.0f);
+               newInput.ymin = input->ymin - (this->m_size * max_dim / 100.0f);
        }
        else {
-               newInput.xmax = input->xmax + (10.0f * this->getWidth() / 100.0f);
-               newInput.xmin = input->xmin - (10.0f * this->getWidth() / 100.0f);
-               newInput.ymax = input->ymax + (10.0f * this->getWidth() / 100.0f);
-               newInput.ymin = input->ymin - (10.0f * this->getWidth() / 100.0f);
+               newInput.xmax = input->xmax + (10.0f * max_dim / 100.0f);
+               newInput.xmin = input->xmin - (10.0f * max_dim / 100.0f);
+               newInput.ymax = input->ymax + (10.0f * max_dim / 100.0f);
+               newInput.ymin = input->ymin - (10.0f * max_dim / 100.0f);
        }
 
        NodeOperation *operation = getInputOperation(1);
@@ -203,7 +200,8 @@ void BokehBlurOperation::executeOpenCL(OpenCLDevice *device,
        if (!this->m_sizeavailable) {
                updateSize();
        }
-       cl_int radius = this->getWidth() * this->m_size / 100.0f;
+       const float max_dim = max(this->getWidth(), this->getHeight());
+       cl_int radius = this->m_size * max_dim / 100.0f;
        cl_int step = this->getStep();
        
        device->COM_clAttachMemoryBufferToKernelParameter(kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBoundingBoxReader);
index 20afe42763d1fd560032b6a89eb0103e82c89e12..47d6bf62c9117126788b8e0e3a6d4b45c5f0f982 100644 (file)
@@ -434,7 +434,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
                calculateTransformCenter(C, V3D_CENTROID, lastofs, NULL);
                negate_v3_v3(vod->dyn_ofs, lastofs);
        }
-       else if (U.uiflag & USER_ORBIT_ZBUF) {
+       else if (U.uiflag & USER_ZBUF_ORBIT) {
 
                view3d_operator_needs_opengl(C); /* needed for zbuf drawing */
 
@@ -3402,7 +3402,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
        if (mval[0] != IS_CLIPPED) {
                short depth_used = 0;
 
-               if (U.uiflag & USER_ORBIT_ZBUF) {  /* maybe this should be accessed some other way */
+               if (U.uiflag & USER_ZBUF_CURSOR) {  /* maybe this should be accessed some other way */
                        view3d_operator_needs_opengl(C);
                        if (ED_view3d_autodist(scene, ar, v3d, event->mval, fp))
                                depth_used = 1;
index 01b189c2260bd53fd3944643fe9773668ff481fc..8b62f58212b84ffa244d1dfa06489598c9d79649 100644 (file)
@@ -503,13 +503,12 @@ extern UserDef U; /* from blenkernel blender.c */
 /*#define USER_FLIPFULLSCREEN          (1 << 7)*/ /* deprecated */
 #define USER_ALLWINCODECS              (1 << 8)
 #define USER_MENUOPENAUTO              (1 << 9)
-/*#define USER_PANELPINNED             (1 << 10)               deprecated */
+#define USER_ZBUF_CURSOR               (1 << 10)
 #define USER_AUTOPERSP                 (1 << 11)
 #define USER_LOCKAROUND        (1 << 12)
 #define USER_GLOBALUNDO        (1 << 13)
 #define USER_ORBIT_SELECTION   (1 << 14)
-// old flag for #define USER_KEYINSERTAVAI             (1 << 15)
-#define USER_ORBIT_ZBUF                        (1 << 15)
+#define USER_ZBUF_ORBIT                        (1 << 15)
 #define USER_HIDE_DOT                  (1 << 16)
 #define USER_SHOW_ROTVIEWICON  (1 << 17)
 #define USER_SHOW_VIEWPORTNAME (1 << 18)
index 0ffdd15df5a67fe1162b7e9df5aa87741030c270..e3cd236a8e339f623bf093ff4854c301f43acde6 100644 (file)
@@ -2542,11 +2542,16 @@ static void rna_def_userdef_view(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_LOCKAROUND);
        RNA_def_property_ui_text(prop, "Global Pivot", "Lock the same rotation/scaling pivot in all 3D Views");
 
-       prop = RNA_def_property(srna, "use_mouse_auto_depth", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_ZBUF);
+       prop = RNA_def_property(srna, "use_mouse_depth_navigate", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZBUF_ORBIT);
        RNA_def_property_ui_text(prop, "Auto Depth",
                                 "Use the depth under the mouse to improve view pan/rotate/zoom functionality");
 
+       prop = RNA_def_property(srna, "use_mouse_depth_cursor", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZBUF_CURSOR);
+       RNA_def_property_ui_text(prop, "Cursor Depth",
+                                "Use the depth under the mouse when placing the cursor");
+
        prop = RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_CAM_LOCK_NO_PARENT);
        RNA_def_property_ui_text(prop, "Camera Parent Lock",