Fix T79534: Python Operator.bl_translation_context ignored
The default value prevented it from being set on registration, now only assign the default when the class doesn't define it.
This commit is contained in:
parent
ac58663dec
commit
69c551089b
Notes:
blender-bot
2023-02-14 05:53:42 +01:00
Referenced by issue #79534, Operator bl_translation_context attribute does nothing
|
@ -1485,9 +1485,7 @@ static StructRNA *rna_Operator_register(Main *bmain,
|
|||
|
||||
/* clear in case they are left unset */
|
||||
temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] =
|
||||
temp_buffers.undo_group[0] = '\0';
|
||||
/* We have to set default op context! */
|
||||
strcpy(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
||||
temp_buffers.undo_group[0] = temp_buffers.translation_context[0] = '\0';
|
||||
|
||||
/* validate the python class */
|
||||
if (validate(&dummyotr, data, have_function) != 0) {
|
||||
|
@ -1513,6 +1511,11 @@ static StructRNA *rna_Operator_register(Main *bmain,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* We have to set default context if the class doesn't define it. */
|
||||
if (temp_buffers.translation_context[0] == '\0') {
|
||||
STRNCPY(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
||||
}
|
||||
|
||||
/* Convert foo.bar to FOO_OT_bar
|
||||
* allocate all strings at once. */
|
||||
{
|
||||
|
@ -1636,9 +1639,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
|
|||
|
||||
/* clear in case they are left unset */
|
||||
temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] =
|
||||
temp_buffers.undo_group[0] = '\0';
|
||||
/* We have to set default op context! */
|
||||
strcpy(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
||||
temp_buffers.undo_group[0] = temp_buffers.translation_context[0] = '\0';
|
||||
|
||||
/* validate the python class */
|
||||
if (validate(&dummyotr, data, have_function) != 0) {
|
||||
|
@ -1673,6 +1674,11 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* We have to set default context if the class doesn't define it. */
|
||||
if (temp_buffers.translation_context[0] == '\0') {
|
||||
STRNCPY(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
|
||||
}
|
||||
|
||||
/* Convert foo.bar to FOO_OT_bar
|
||||
* allocate all strings at once. */
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue