Cleanup: happily remove no-more-used PY_TRANSLATE RNA prop flag, and related code (just realized that flag value was wrong, probably own typo in a previous commit :/ ).
That "trick" was nice when introduced, but it became kind of a pita since we added translation contexts...
This commit is contained in:
@@ -46,8 +46,8 @@
|
||||
typedef bool _BLI_Bool;
|
||||
# else
|
||||
/* using char here may cause nasty tricky bugs, e.g.
|
||||
* bool do_translate = RNA_property_flag(prop) & PROP_STRING_PY_TRANSLATE;
|
||||
* as PROP_STRING_PY_TRANSLATE is farther than 8th bit, do_translate would be always false!
|
||||
* bool is_bit_flag = RNA_property_flag(prop) & PROP_ENUM_FLAG;
|
||||
* as PROP_ENUM_FLAG is farther than 8th bit, do_translate would be always false!
|
||||
*/
|
||||
# define _BLI_Bool unsigned int
|
||||
# endif
|
||||
|
||||
@@ -88,7 +88,6 @@ PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont, const char *identifier, c
|
||||
PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
|
||||
PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
|
||||
PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
|
||||
PropertyRNA *RNA_def_string_py_translate(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
|
||||
|
||||
PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description);
|
||||
PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description);
|
||||
|
||||
@@ -143,7 +143,7 @@ typedef enum PropertySubType {
|
||||
} PropertySubType;
|
||||
|
||||
/* Make sure enums are updated with thses */
|
||||
/* HIGHEST FLAG IN USE: 1 << 29 */
|
||||
/* HIGHEST FLAG IN USE: 1 << 28 */
|
||||
typedef enum PropertyFlag {
|
||||
/* editable means the property is editable in the user
|
||||
* interface, properties are editable by default except
|
||||
@@ -200,11 +200,6 @@ typedef enum PropertyFlag {
|
||||
*/
|
||||
PROP_ENUM_FLAG = (1 << 21),
|
||||
|
||||
/* A string which should be translated when converting from py string to RNA prop.
|
||||
* Should only be used in some functions' properties (currently only "text" one of funcs in UI API).
|
||||
*/
|
||||
PROP_STRING_PY_TRANSLATE = (1 << 28),
|
||||
|
||||
/* need context for update function */
|
||||
PROP_CONTEXT_UPDATE = (1 << 22),
|
||||
PROP_CONTEXT_PROPERTY_UPDATE = (1 << 22) | (1 << 27),
|
||||
|
||||
@@ -2574,21 +2574,6 @@ PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *id
|
||||
return prop;
|
||||
}
|
||||
|
||||
PropertyRNA *RNA_def_string_py_translate(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
|
||||
int maxlen, const char *ui_name, const char *ui_description)
|
||||
{
|
||||
ContainerRNA *cont = cont_;
|
||||
PropertyRNA *prop;
|
||||
|
||||
prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_STRING_PY_TRANSLATE);
|
||||
if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
|
||||
if (default_value) RNA_def_property_string_default(prop, default_value);
|
||||
RNA_def_property_ui_text(prop, ui_name, ui_description);
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items,
|
||||
int default_value, const char *ui_name, const char *ui_description)
|
||||
{
|
||||
|
||||
@@ -1624,10 +1624,6 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
|
||||
}
|
||||
else {
|
||||
/* Unicode String */
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
bool do_translate = RNA_property_flag(prop) & PROP_STRING_PY_TRANSLATE;
|
||||
#endif /* WITH_INTERNATIONAL */
|
||||
|
||||
#ifdef USE_STRING_COERCE
|
||||
PyObject *value_coerce = NULL;
|
||||
if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
|
||||
@@ -1641,13 +1637,6 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
|
||||
param = _PyUnicode_AsString(value);
|
||||
#endif /* USE_STRING_COERCE */
|
||||
|
||||
/* Any half-brained compiler should be able to optimize this out when WITH_INTERNATIONAL is off */
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
if (do_translate) {
|
||||
param = IFACE_(param);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (param == NULL) {
|
||||
if (PyUnicode_Check(value)) {
|
||||
/* there was an error assigning a string type,
|
||||
|
||||
Reference in New Issue
Block a user