Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/makesrna.c
| Show First 20 Lines • Show All 4,692 Lines • ▼ Show 20 Lines | static const char *cpp_classes = | ||||
| " } \\\n" | " } \\\n" | ||||
| " sname##_##identifier##_end(&iter); \\\n" | " sname##_##identifier##_end(&iter); \\\n" | ||||
| " return length; \\\n" | " return length; \\\n" | ||||
| " } \n" | " } \n" | ||||
| "#define COLLECTION_PROPERTY_LENGTH_true(sname, identifier) \\\n" | "#define COLLECTION_PROPERTY_LENGTH_true(sname, identifier) \\\n" | ||||
| " inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n" | " inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n" | ||||
| " { return sname##_##identifier##_length(ptr); } \n" | " { return sname##_##identifier##_length(ptr); } \n" | ||||
| "\n" | "\n" | ||||
| "#define COLLECTION_PROPERTY_EMPTY_false(sname, identifier) \\\n" | |||||
| " inline static bool sname##_##identifier##_empty_wrap(PointerRNA *ptr) \\\n" | |||||
| " { \\\n" | |||||
| " CollectionPropertyIterator iter; \\\n" | |||||
| " sname##_##identifier##_begin(&iter, ptr); \\\n" | |||||
| " bool empty = !iter.valid; \\\n" | |||||
| " sname##_##identifier##_end(&iter); \\\n" | |||||
| " return empty; \\\n" | |||||
| " } \n" | |||||
| "#define COLLECTION_PROPERTY_EMPTY_true(sname, identifier) \\\n" | |||||
| " inline static bool sname##_##identifier##_empty_wrap(PointerRNA *ptr) \\\n" | |||||
| " { return sname##_##identifier##_length(ptr) == 0; } \n" | |||||
| "\n" | |||||
| "#define COLLECTION_PROPERTY_LOOKUP_INT_false(sname, identifier) \\\n" | "#define COLLECTION_PROPERTY_LOOKUP_INT_false(sname, identifier) \\\n" | ||||
| " inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, " | " inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, " | ||||
| "PointerRNA *r_ptr) \\\n" | "PointerRNA *r_ptr) \\\n" | ||||
| " { \\\n" | " { \\\n" | ||||
| " CollectionPropertyIterator iter; \\\n" | " CollectionPropertyIterator iter; \\\n" | ||||
| " int i = 0, found = 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" | ||||
| ▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | static const char *cpp_classes = | ||||
| " } \\\n" | " } \\\n" | ||||
| " return found; \\\n" | " return found; \\\n" | ||||
| " } \n" | " } \n" | ||||
| "#define COLLECTION_PROPERTY(collection_funcs, type, sname, identifier, has_length, " | "#define COLLECTION_PROPERTY(collection_funcs, type, sname, identifier, has_length, " | ||||
| "has_lookup_int, has_lookup_string) \\\n" | "has_lookup_int, has_lookup_string) \\\n" | ||||
| " typedef CollectionIterator<type, sname##_##identifier##_begin, \\\n" | " typedef CollectionIterator<type, sname##_##identifier##_begin, \\\n" | ||||
| " sname##_##identifier##_next, sname##_##identifier##_end> identifier##_iterator; \\\n" | " sname##_##identifier##_next, sname##_##identifier##_end> identifier##_iterator; \\\n" | ||||
| " COLLECTION_PROPERTY_LENGTH_##has_length(sname, identifier) \\\n" | " COLLECTION_PROPERTY_LENGTH_##has_length(sname, identifier) \\\n" | ||||
| " COLLECTION_PROPERTY_EMPTY_##has_length(sname, identifier) \\\n" | |||||
| " COLLECTION_PROPERTY_LOOKUP_INT_##has_lookup_int(sname, identifier) \\\n" | " COLLECTION_PROPERTY_LOOKUP_INT_##has_lookup_int(sname, identifier) \\\n" | ||||
| " COLLECTION_PROPERTY_LOOKUP_STRING_##has_lookup_string(sname, identifier) \\\n" | " COLLECTION_PROPERTY_LOOKUP_STRING_##has_lookup_string(sname, identifier) \\\n" | ||||
| " CollectionRef<sname, type, sname##_##identifier##_begin, \\\n" | " CollectionRef<sname, type, sname##_##identifier##_begin, \\\n" | ||||
| " sname##_##identifier##_next, sname##_##identifier##_end, \\\n" | " sname##_##identifier##_next, sname##_##identifier##_end, \\\n" | ||||
| " sname##_##identifier##_length_wrap, \\\n" | " sname##_##identifier##_length_wrap, \\\n" | ||||
| " sname##_##identifier##_empty_wrap, \\\n" | |||||
| " sname##_##identifier##_lookup_int_wrap, sname##_##identifier##_lookup_string_wrap, " | " sname##_##identifier##_lookup_int_wrap, sname##_##identifier##_lookup_string_wrap, " | ||||
| "collection_funcs> identifier;\n" | "collection_funcs> identifier;\n" | ||||
| "\n" | "\n" | ||||
| "class Pointer {\n" | "class Pointer {\n" | ||||
| "public:\n" | "public:\n" | ||||
| " Pointer(const PointerRNA &p) : ptr(p) { }\n" | " Pointer(const PointerRNA &p) : ptr(p) { }\n" | ||||
| " operator const PointerRNA&() { return ptr; }\n" | " operator const PointerRNA&() { return ptr; }\n" | ||||
| " bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type) ? true: false; }\n" | " bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type) ? true: false; }\n" | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | static const char *cpp_classes = | ||||
| " length = other.length;\n" | " length = other.length;\n" | ||||
| " }\n" | " }\n" | ||||
| "};\n" | "};\n" | ||||
| "\n" | "\n" | ||||
| "typedef void (*TBeginFunc)(CollectionPropertyIterator *iter, PointerRNA *ptr);\n" | "typedef void (*TBeginFunc)(CollectionPropertyIterator *iter, PointerRNA *ptr);\n" | ||||
| "typedef void (*TNextFunc)(CollectionPropertyIterator *iter);\n" | "typedef void (*TNextFunc)(CollectionPropertyIterator *iter);\n" | ||||
| "typedef void (*TEndFunc)(CollectionPropertyIterator *iter);\n" | "typedef void (*TEndFunc)(CollectionPropertyIterator *iter);\n" | ||||
| "typedef int (*TLengthFunc)(PointerRNA *ptr);\n" | "typedef int (*TLengthFunc)(PointerRNA *ptr);\n" | ||||
| "typedef bool (*TEmptyFunc)(PointerRNA *ptr);\n" | |||||
| "typedef int (*TLookupIntFunc)(PointerRNA *ptr, int key, PointerRNA *r_ptr);\n" | "typedef int (*TLookupIntFunc)(PointerRNA *ptr, int key, PointerRNA *r_ptr);\n" | ||||
| "typedef int (*TLookupStringFunc)(PointerRNA *ptr, const char *key, PointerRNA *r_ptr);\n" | "typedef int (*TLookupStringFunc)(PointerRNA *ptr, const char *key, PointerRNA *r_ptr);\n" | ||||
| "\n" | "\n" | ||||
| "template<typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend>\n" | "template<typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend>\n" | ||||
| "class CollectionIterator {\n" | "class CollectionIterator {\n" | ||||
| "public:\n" | "public:\n" | ||||
| " CollectionIterator() : iter(), t(iter.ptr), init(false) { iter.valid = false; }\n" | " CollectionIterator() : iter(), t(iter.ptr), init(false) { iter.valid = false; }\n" | ||||
| " CollectionIterator(const PointerRNA &ptr) : CollectionIterator() { this->begin(ptr); }\n" | " CollectionIterator(const PointerRNA &ptr) : CollectionIterator() { this->begin(ptr); }\n" | ||||
| Show All 22 Lines | static const char *cpp_classes = | ||||
| "\n" | "\n" | ||||
| "private:\n" | "private:\n" | ||||
| " CollectionPropertyIterator iter;\n" | " CollectionPropertyIterator iter;\n" | ||||
| " T t;\n" | " T t;\n" | ||||
| " bool init;\n" | " bool init;\n" | ||||
| "};\n" | "};\n" | ||||
| "\n" | "\n" | ||||
| "template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend,\n" | "template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend,\n" | ||||
| " TLengthFunc Tlength, TLookupIntFunc Tlookup_int, TLookupStringFunc Tlookup_string,\n" | " TLengthFunc Tlength, TEmptyFunc Tempty, TLookupIntFunc Tlookup_int,\n" | ||||
| " typename Tcollection_funcs>\n" | " TLookupStringFunc Tlookup_string, typename Tcollection_funcs>\n" | ||||
| "class CollectionRef : public Tcollection_funcs {\n" | "class CollectionRef : public Tcollection_funcs {\n" | ||||
| "public:\n" | "public:\n" | ||||
| " CollectionRef(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n" | " CollectionRef(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n" | ||||
| "\n" | "\n" | ||||
| " void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n" | " void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n" | ||||
| " { iter.begin(ptr); }\n" | " { iter.begin(ptr); }\n" | ||||
| " CollectionIterator<T, Tbegin, Tnext, Tend> begin()\n" | " CollectionIterator<T, Tbegin, Tnext, Tend> begin()\n" | ||||
| " { return CollectionIterator<T, Tbegin, Tnext, Tend>(ptr); }\n" | " { return CollectionIterator<T, Tbegin, Tnext, Tend>(ptr); }\n" | ||||
| " CollectionIterator<T, Tbegin, Tnext, Tend> end()\n" | " CollectionIterator<T, Tbegin, Tnext, Tend> end()\n" | ||||
| " { return CollectionIterator<T, Tbegin, Tnext, Tend>(); } /* test */ \n" | " { return CollectionIterator<T, Tbegin, Tnext, Tend>(); } /* test */ \n" | ||||
| "" | "" | ||||
| " int length()\n" | " int length()\n" | ||||
| " { return Tlength(&ptr); }\n" | " { return Tlength(&ptr); }\n" | ||||
| " bool empty()\n" | |||||
| " { return Tempty(&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); }\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); }\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" | ||||
| "};\n" | "};\n" | ||||
| ▲ Show 20 Lines • Show All 375 Lines • Show Last 20 Lines | |||||