Commit: a474125893bc5db227b1b5f90233bc51c89b5c68
Author: Bastien Montagne
Date:   Fri Jul 18 21:35:50 2014 +0200
https://developer.blender.org/rBa474125893bc5db227b1b5f90233bc51c89b5c68

MBall cleanup: remove unused F_ERROR references, als fix/enhance 
BKE_mball_basis_find()

BKE_mball_basis_find() was making a bunch of string manipulations for all MBall 
objects
(including duplis), and then making a (broken!) check to do nothing in case of 
duplis mball!

Now it makes correct check in early stage.

===================================================================

M       source/blender/blenkernel/intern/mball.c
M       source/blender/makesdna/DNA_scene_types.h

===================================================================

diff --git a/source/blender/blenkernel/intern/mball.c 
b/source/blender/blenkernel/intern/mball.c
index 43b19f0..5a04560 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -491,10 +491,7 @@ void BKE_mball_properties_copy(Scene *scene, Object 
*active_object)
 
        BLI_split_name_num(basisname, &basisnr, active_object->id.name + 2, 
'.');
 
-       /* XXX recursion check, see scene.c, just too simple code this 
BKE_scene_base_iter_next() */
-       if (F_ERROR == BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 0, 
NULL, NULL))
-               return;
-       
+       BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 0, NULL, NULL);
        while (BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 1, &base, 
&ob)) {
                if (ob->type == OB_MBALL) {
                        if (ob != active_object) {
@@ -537,23 +534,17 @@ Object *BKE_mball_basis_find(Scene *scene, Object *basis)
 
        BLI_split_name_num(basisname, &basisnr, basis->id.name + 2, '.');
 
-       /* XXX recursion check, see scene.c, just too simple code this 
BKE_scene_base_iter_next() */
-       if (F_ERROR == BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 0, 
NULL, NULL))
-               return NULL;
-
+       BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 0, NULL, NULL);
        while (BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 1, &base, 
&ob)) {
-               if (ob->type == OB_MBALL) {
+               if ((ob->type == OB_MBALL) && !(base->flag & OB_FROMDUPLI)) {
                        if (ob != bob) {
                                BLI_split_name_num(obname, &obnr, ob->id.name + 
2, '.');
 
-                               /* object ob has to be in same "group" ... it 
means, that it has to have
-                                * same base of its name */
+                               /* object ob has to be in same "group" ... it 
means, that it has to have same base of its name */
                                if (strcmp(obname, basisname) == 0) {
                                        if (obnr < basisnr) {
-                                               if (!(ob->flag & OB_FROMDUPLI)) 
{
-                                                       basis = ob;
-                                                       basisnr = obnr;
-                                               }
+                                               basis = ob;
+                                               basisnr = obnr;
                                        }
                                }
                        }
@@ -2227,10 +2218,7 @@ static void mball_count(EvaluationContext *eval_ctx, 
PROCESS *process, Scene *sc
        BLI_split_name_num(basisname, &basisnr, basis->id.name + 2, '.');
        process->totelem = 0;
 
-       /* XXX recursion check, see scene.c, just too simple code this 
BKE_scene_base_iter_next() */
-       if (F_ERROR == BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 0, 
NULL, NULL))
-               return;
-
+       BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 0, NULL, NULL);
        while (BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 1, &base, 
&ob)) {
                if (ob->type == OB_MBALL) {
                        if (ob == bob) {
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index 6cf2b33..c4c1736 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1620,8 +1620,8 @@ typedef enum eVGroupSelect {
 #define SCE_FRAME_DROP                 (1<<3)
 
 
-       /* return flag BKE_scene_base_iter_next function */
-#define F_ERROR                        -1
+       /* return flag BKE_scene_base_iter_next functions */
+/* #define F_ERROR                     -1 */  /* UNUSED */
 #define F_START                        0
 #define F_SCENE                        1
 #define F_DUPLI                        3

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to