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:
		@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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__)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user