Add the possibility to define the translation context for py rna classes (operators, panels and menus).

Thanks to Campell and Brecht for the reviews!
This commit is contained in:
2013-03-15 14:32:29 +00:00
parent 87919be4f6
commit 284e59d608
11 changed files with 92 additions and 15 deletions

View File

@@ -127,6 +127,11 @@ void operator_wrapper(wmOperatorType *ot, void *userdata)
*ot = *((wmOperatorType *)userdata);
ot->srna = srna; /* restore */
/* Use i18n context from ext.srna if possible (py operators). */
if (ot->ext.srna) {
RNA_def_struct_translation_context(ot->srna, RNA_struct_translation_context(ot->ext.srna));
}
operator_properties_init(ot);
}
@@ -143,6 +148,11 @@ void macro_wrapper(wmOperatorType *ot, void *userdata)
ot->ui = data->ui;
ot->ext = data->ext;
/* Use i18n context from ext.srna if possible (py operators). */
if (ot->ext.srna) {
RNA_def_struct_translation_context(ot->srna, RNA_struct_translation_context(ot->ext.srna));
}
operator_properties_init(ot);
}

View File

@@ -6950,7 +6950,7 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
} \
} \
Py_XDECREF(item); \
} /* intendionally allow else here */
} /* intentionally allow else here */
if BPY_REPLACEMENT_STRING("bl_idname", bpy_intern_str___name__)
else if BPY_REPLACEMENT_STRING("bl_description", bpy_intern_str___doc__)