Cleanup: avoid using G.main.

This commit is contained in:
Kévin Dietrich 2016-10-28 18:26:34 +02:00
parent 216dec7eb1
commit 8a1b38f071
1 changed files with 3 additions and 1 deletions

View File

@ -59,7 +59,9 @@ static int cachefile_open_invoke(bContext *C, wmOperator *op, const wmEvent *eve
{
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
char filepath[FILE_MAX];
BLI_strncpy(filepath, G.main->name, sizeof(filepath));
Main *bmain = CTX_data_main(C);
BLI_strncpy(filepath, bmain->name, sizeof(filepath));
BLI_replace_extension(filepath, sizeof(filepath), ".abc");
RNA_string_set(op->ptr, "filepath", filepath);
}