- RNA_main_pointer_create(main, &mainptr);
- texts = RNA_struct_find_property(&mainptr, "texts");
- char *python_code = NULL;
- int ok = RNA_property_collection_lookup_string(&mainptr, texts, python_main, &txtptr);
- if (ok) {
- Text *text = (Text *) txtptr.data;
- python_code = txt_to_buf(text);
- }
- return python_code;
-}
+ if ((text = (Text *)BLI_findstring(&bmain->text, python_main, offsetof(ID, name) + 2))) {
+ return txt_to_buf(text);
+ }