partial fix [#23265] matrix_world rna path is visible but returns 0 to drivers withou...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 1 Dec 2010 10:17:31 +0000 (10:17 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 1 Dec 2010 10:17:31 +0000 (10:17 +0000)
this report raised a number of problems with rna paths, while we still dont have multi-dimensional array access, invalid paths were being accepted which confused things.

rna path resolving code was accepting all sorts of invalid input because atoi() just returns 0 for non numeric input.
now check if 0 number == '0' character.

source/blender/makesrna/intern/rna_access.c

index d8c4c67c68abd5f9fc8cf41d9c1772ae9155c32d..9ec21b136957df18ea182471f501621c1f64ff91 100644 (file)
@@ -3047,6 +3047,9 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
                                        else {
                                                /* otherwise do int lookup */
                                                intkey= atoi(token);
                                        else {
                                                /* otherwise do int lookup */
                                                intkey= atoi(token);
+                                               if(intkey==0 && (token[0] != '0' || token[1] != '\0')) {
+                                                       return 0; /* we can be sure the fixedbuf was used in this case */
+                                               }
                                                RNA_property_collection_lookup_int(&curptr, prop, intkey, &nextptr);
                                        }
 
                                                RNA_property_collection_lookup_int(&curptr, prop, intkey, &nextptr);
                                        }
 
@@ -3096,6 +3099,9 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
                                        else {
                                                /* otherwise do int lookup */
                                                *index= atoi(token);
                                        else {
                                                /* otherwise do int lookup */
                                                *index= atoi(token);
+                                               if(intkey==0 && (token[0] != '0' || token[1] != '\0')) {
+                                                       return 0; /* we can be sure the fixedbuf was used in this case */
+                                               }
                                        }
                                }
                                else {
                                        }
                                }
                                else {