diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-11-02 17:36:20 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-11-02 17:36:20 +0400 |
commit | 40b3c3a4e68f853284fc4fa5e58694f85e1e07db (patch) | |
tree | cfbc0ebc4ba8424c45a2c4c80dcaf6cc339d59a7 /source/blender/makesrna | |
parent | 87bc16a9a0d76eca88dbb6ac677d18a3208fba28 (diff) |
RNA C++: fixes for lookup_int/lookup_string which were not working in some cases,
and don't use ReportList for function arguments.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 31a6e82648a..aa24dcb8b65 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1730,9 +1730,6 @@ static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *srna, Func if (func->flag & FUNC_USE_CONTEXT) WRITE_PARAM("Context C"); - if (func->flag & FUNC_USE_REPORTS) - WRITE_PARAM("void *reports"); - for (dp = dfunc->cont.properties.first; dp; dp = dp->next) { int type, flag, pout; const char *ptrstr; @@ -1907,7 +1904,7 @@ static void rna_def_struct_function_call_impl_cpp(FILE *f, StructRNA *srna, Func WRITE_PARAM("(::bContext *) C.ptr.data"); if (func->flag & FUNC_USE_REPORTS) - WRITE_PARAM("(::ReportList *) reports"); + WRITE_PARAM("NULL"); dp = dfunc->cont.properties.first; for (; dp; dp = dp->next) { @@ -3384,20 +3381,21 @@ static const char *cpp_classes = "" " inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, PointerRNA *r_ptr) \\\n" " { \\\n" " CollectionPropertyIterator iter; \\\n" -" int i = 0; \\\n" +" int i = 0, found = 0; \\\n" " sname##_##identifier##_begin(&iter, ptr); \\\n" " while (iter.valid) { \\\n" " if (i == key) { \\\n" " *r_ptr = iter.ptr; \\\n" +" found = 1; \\\n" " break; \\\n" " } \\\n" " sname##_##identifier##_next(&iter); \\\n" " ++i; \\\n" " } \\\n" " sname##_##identifier##_end(&iter); \\\n" -" if (!iter.valid) \\\n" +" if (!found) \\\n" " memset(r_ptr, 0, sizeof(*r_ptr)); \\\n" -" return iter.valid; \\\n" +" return found; \\\n" " } \n" "#define COLLECTION_PROPERTY_LOOKUP_INT_TRUE(sname, identifier) \\\n" " inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, PointerRNA *r_ptr) \\\n" @@ -3522,10 +3520,10 @@ static const char *cpp_classes = "" "" " int length()\n" " { return Tlength(&ptr); }\n" -" T& operator[](int key)\n" -" { PointerRNA r_ptr; Tlookup_int(&ptr, key, &r_ptr); return *(T*)r_ptr.data; }\n" -" T& operator[](const std::string &key)\n" -" { PointerRNA r_ptr; Tlookup_string(&ptr, key.c_str(), &r_ptr); return *(T*)r_ptr.data; }\n" +" T operator[](int key)\n" +" { PointerRNA r_ptr; Tlookup_int(&ptr, key, &r_ptr); return T(r_ptr); }\n" +" T operator[](const std::string &key)\n" +" { PointerRNA r_ptr; Tlookup_string(&ptr, key.c_str(), &r_ptr); return T(r_ptr); }\n" "\n" "private:\n" " PointerRNA ptr;\n" |