forked from bartvdbraak/blender
RNA C++: fixes for lookup_int/lookup_string which were not working in some cases,
and don't use ReportList for function arguments.
This commit is contained in:
parent
87bc16a9a0
commit
40b3c3a4e6
@ -39,7 +39,7 @@ CCL_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
static inline BL::Mesh object_to_mesh(BL::Object self, BL::Scene scene, bool apply_modifiers, bool render)
|
static inline BL::Mesh object_to_mesh(BL::Object self, BL::Scene scene, bool apply_modifiers, bool render)
|
||||||
{
|
{
|
||||||
return self.to_mesh(NULL, scene, apply_modifiers, (render)? 2: 1);
|
return self.to_mesh(scene, apply_modifiers, (render)? 2: 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size)
|
static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size)
|
||||||
@ -57,12 +57,12 @@ static inline void object_remove_mesh(BL::BlendData data, BL::Mesh mesh)
|
|||||||
/* TODO: BlendData.meshes ideally should be also a subclass of BlendDataMeshes */
|
/* TODO: BlendData.meshes ideally should be also a subclass of BlendDataMeshes */
|
||||||
BL::BlendDataMeshes mesh_data(data.ptr);
|
BL::BlendDataMeshes mesh_data(data.ptr);
|
||||||
|
|
||||||
mesh_data.remove(NULL, mesh);
|
mesh_data.remove(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void object_create_duplilist(BL::Object self, BL::Scene scene)
|
static inline void object_create_duplilist(BL::Object self, BL::Scene scene)
|
||||||
{
|
{
|
||||||
self.dupli_list_create(NULL, scene, 2);
|
self.dupli_list_create(scene, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void object_free_duplilist(BL::Object self)
|
static inline void object_free_duplilist(BL::Object self)
|
||||||
|
@ -1730,9 +1730,6 @@ static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *srna, Func
|
|||||||
if (func->flag & FUNC_USE_CONTEXT)
|
if (func->flag & FUNC_USE_CONTEXT)
|
||||||
WRITE_PARAM("Context C");
|
WRITE_PARAM("Context C");
|
||||||
|
|
||||||
if (func->flag & FUNC_USE_REPORTS)
|
|
||||||
WRITE_PARAM("void *reports");
|
|
||||||
|
|
||||||
for (dp = dfunc->cont.properties.first; dp; dp = dp->next) {
|
for (dp = dfunc->cont.properties.first; dp; dp = dp->next) {
|
||||||
int type, flag, pout;
|
int type, flag, pout;
|
||||||
const char *ptrstr;
|
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");
|
WRITE_PARAM("(::bContext *) C.ptr.data");
|
||||||
|
|
||||||
if (func->flag & FUNC_USE_REPORTS)
|
if (func->flag & FUNC_USE_REPORTS)
|
||||||
WRITE_PARAM("(::ReportList *) reports");
|
WRITE_PARAM("NULL");
|
||||||
|
|
||||||
dp = dfunc->cont.properties.first;
|
dp = dfunc->cont.properties.first;
|
||||||
for (; dp; dp = dp->next) {
|
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"
|
" inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, PointerRNA *r_ptr) \\\n"
|
||||||
" { \\\n"
|
" { \\\n"
|
||||||
" CollectionPropertyIterator iter; \\\n"
|
" CollectionPropertyIterator iter; \\\n"
|
||||||
" int i = 0; \\\n"
|
" int i = 0, found = 0; \\\n"
|
||||||
" sname##_##identifier##_begin(&iter, ptr); \\\n"
|
" sname##_##identifier##_begin(&iter, ptr); \\\n"
|
||||||
" while (iter.valid) { \\\n"
|
" while (iter.valid) { \\\n"
|
||||||
" if (i == key) { \\\n"
|
" if (i == key) { \\\n"
|
||||||
" *r_ptr = iter.ptr; \\\n"
|
" *r_ptr = iter.ptr; \\\n"
|
||||||
|
" found = 1; \\\n"
|
||||||
" break; \\\n"
|
" break; \\\n"
|
||||||
" } \\\n"
|
" } \\\n"
|
||||||
" sname##_##identifier##_next(&iter); \\\n"
|
" sname##_##identifier##_next(&iter); \\\n"
|
||||||
" ++i; \\\n"
|
" ++i; \\\n"
|
||||||
" } \\\n"
|
" } \\\n"
|
||||||
" sname##_##identifier##_end(&iter); \\\n"
|
" sname##_##identifier##_end(&iter); \\\n"
|
||||||
" if (!iter.valid) \\\n"
|
" if (!found) \\\n"
|
||||||
" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
|
" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
|
||||||
" return iter.valid; \\\n"
|
" return found; \\\n"
|
||||||
" } \n"
|
" } \n"
|
||||||
"#define COLLECTION_PROPERTY_LOOKUP_INT_TRUE(sname, identifier) \\\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"
|
" 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"
|
" int length()\n"
|
||||||
" { return Tlength(&ptr); }\n"
|
" { return Tlength(&ptr); }\n"
|
||||||
" T& operator[](int key)\n"
|
" T operator[](int key)\n"
|
||||||
" { PointerRNA r_ptr; Tlookup_int(&ptr, key, &r_ptr); return *(T*)r_ptr.data; }\n"
|
" { PointerRNA r_ptr; Tlookup_int(&ptr, key, &r_ptr); return T(r_ptr); }\n"
|
||||||
" T& operator[](const std::string &key)\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"
|
" { PointerRNA r_ptr; Tlookup_string(&ptr, key.c_str(), &r_ptr); return T(r_ptr); }\n"
|
||||||
"\n"
|
"\n"
|
||||||
"private:\n"
|
"private:\n"
|
||||||
" PointerRNA ptr;\n"
|
" PointerRNA ptr;\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user