diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 98449e9d810..aaf040d2435 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -2628,6 +2628,10 @@ static int bpy_prop_arg_parse_tag_defines(PyObject *o, void *p) " :arg description: Text used for the tooltip and api documentation.\n" \ " :type description: string\n" +#define BPY_PROPDEF_CTXT_DOC \ + " :arg translation_context: Text used as context to disambiguate translations.\n" \ + " :type translation_context: string\n" + #define BPY_PROPDEF_UNIT_DOC \ " :arg unit: Enumerator in :ref:`rna_enum_property_unit_items`.\n" \ " :type unit: string\n" @@ -2746,6 +2750,7 @@ static int bpy_struct_id_used(StructRNA *srna, char *identifier) PyDoc_STRVAR(BPy_BoolProperty_doc, ".. function:: BoolProperty(name=\"\", " "description=\"\", " + "translation_context=\"*\", " "default=False, " "options={'ANIMATABLE'}, " "override=set(), " @@ -2756,8 +2761,8 @@ PyDoc_STRVAR(BPy_BoolProperty_doc, "set=None)\n" "\n" " Returns a new boolean property definition.\n" - "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_OPTIONS_DOC - BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC + "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC + BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC); static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) @@ -2775,6 +2780,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) .srna = srna, }; const char *name = NULL, *description = ""; + const char *translation_context = NULL; bool default_value = false; PropertyRNA *prop; struct BPy_EnumProperty_Parse options_enum = { @@ -2801,6 +2807,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) "attr", "name", "description", + "translation_context", "default", "options", "override", @@ -2816,6 +2823,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) "|$" /* Optional, keyword only arguments. */ "s" /* `name` */ "s" /* `description` */ + "s" /* `translation_context` */ "O&" /* `default` */ "O&" /* `options` */ "O&" /* `override` */ @@ -2835,6 +2843,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) &id_data, &name, &description, + &translation_context, PyC_ParseBool, &default_value, pyrna_enum_bitfield_parse_set, @@ -2869,6 +2878,9 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) RNA_def_property_boolean_default(prop, default_value); RNA_def_property_ui_text(prop, name ? name : id_data.value, description); + if (translation_context) { + RNA_def_property_translation_context(prop, translation_context); + } if (tags_enum.base.is_set) { RNA_def_property_tags(prop, tags_enum.base.value); @@ -2890,6 +2902,7 @@ PyDoc_STRVAR( BPy_BoolVectorProperty_doc, ".. function:: BoolVectorProperty(name=\"\", " "description=\"\", " + "translation_context=\"*\", " "default=(False, False, False), " "options={'ANIMATABLE'}, " "override=set(), " @@ -2901,7 +2914,7 @@ PyDoc_STRVAR( "set=None)\n" "\n" " Returns a new vector boolean property definition.\n" - "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC + "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC " :arg default: sequence of booleans the length of *size*.\n" " :type default: sequence\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC BPY_PROPDEF_VECSIZE_DOC @@ -2922,6 +2935,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject .srna = srna, }; const char *name = NULL, *description = ""; + const char *translation_context = NULL; bool default_value[RNA_MAX_ARRAY_DIMENSION][PYRNA_STACK_ARRAY] = {{false}}; struct BPyPropArrayLength array_len_info = {.len_total = 3}; PropertyRNA *prop; @@ -2949,6 +2963,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject "attr", "name", "description", + "translation_context", "default", "options", "override", @@ -2965,6 +2980,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject "|$" /* Optional, keyword only arguments. */ "s" /* `name` */ "s" /* `description` */ + "s" /* `translation_context` */ "O" /* `default` */ "O&" /* `options` */ "O&" /* `override` */ @@ -2985,6 +3001,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject &id_data, &name, &description, + &translation_context, &default_py, pyrna_enum_bitfield_parse_set, &options_enum, @@ -3044,6 +3061,9 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject } RNA_def_property_ui_text(prop, name ? name : id_data.value, description); + if (translation_context) { + RNA_def_property_translation_context(prop, translation_context); + } if (tags_enum.base.is_set) { RNA_def_property_tags(prop, tags_enum.base.value); @@ -3065,6 +3085,7 @@ PyDoc_STRVAR( BPy_IntProperty_doc, ".. function:: IntProperty(name=\"\", " "description=\"\", " + "translation_context=\"*\", " "default=0, " "min=-2**31, max=2**31-1, " "soft_min=-2**31, soft_max=2**31-1, " @@ -3078,7 +3099,7 @@ PyDoc_STRVAR( "set=None)\n" "\n" " Returns a new int property definition.\n" - "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_NUM_MIN_DOC + "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC BPY_PROPDEF_NUM_MIN_DOC " :type min: int\n" BPY_PROPDEF_NUM_MAX_DOC " :type max: int\n" BPY_PROPDEF_NUM_SOFTMAX_DOC " :type soft_min: int\n" BPY_PROPDEF_NUM_SOFTMIN_DOC " :type soft_max: int\n" BPY_PROPDEF_INT_STEP_DOC BPY_PROPDEF_OPTIONS_DOC @@ -3099,6 +3120,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) .srna = srna, }; const char *name = NULL, *description = ""; + const char *translation_context = NULL; int min = INT_MIN, max = INT_MAX, soft_min = INT_MIN, soft_max = INT_MAX; int step = 1; int default_value = 0; @@ -3127,6 +3149,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) "attr", "name", "description", + "translation_context", "default", "min", "max", @@ -3147,6 +3170,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) "|$" /* Optional, keyword only arguments. */ "s" /* `name` */ "s" /* `description` */ + "s" /* `translation_context` */ "i" /* `default` */ "i" /* `min` */ "i" /* `max` */ @@ -3171,6 +3195,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) &id_data, &name, &description, + &translation_context, &default_value, &min, &max, @@ -3209,6 +3234,9 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) RNA_def_property_int_default(prop, default_value); RNA_def_property_ui_text(prop, name ? name : id_data.value, description); + if (translation_context) { + RNA_def_property_translation_context(prop, translation_context); + } RNA_def_property_range(prop, min, max); RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3); @@ -3231,6 +3259,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) PyDoc_STRVAR(BPy_IntVectorProperty_doc, ".. function:: IntVectorProperty(name=\"\", " "description=\"\", " + "translation_context=\"*\", " "default=(0, 0, 0), min=-2**31, max=2**31-1, " "soft_min=-2**31, " "soft_max=2**31-1, " @@ -3245,7 +3274,7 @@ PyDoc_STRVAR(BPy_IntVectorProperty_doc, "set=None)\n" "\n" " Returns a new vector int property definition.\n" - "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC + "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC " :arg default: sequence of ints the length of *size*.\n" " :type default: sequence\n" BPY_PROPDEF_NUM_MIN_DOC " :type min: int\n" BPY_PROPDEF_NUM_MAX_DOC @@ -3271,6 +3300,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject .srna = srna, }; const char *name = NULL, *description = ""; + const char *translation_context = NULL; int min = INT_MIN, max = INT_MAX, soft_min = INT_MIN, soft_max = INT_MAX; int step = 1; int default_value[RNA_MAX_ARRAY_DIMENSION][PYRNA_STACK_ARRAY] = {0}; @@ -3298,30 +3328,18 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject PyObject *set_fn = NULL; static const char *_keywords[] = { - "attr", - "name", - "description", - "default", - "min", - "max", - "soft_min", - "soft_max", - "step", - "options", - "override", - "tags", - "subtype", - "size", - "update", - "get", - "set", - NULL, + "attr", "name", "description", "translation_context", + "default", "min", "max", "soft_min", + "soft_max", "step", "options", "override", + "tags", "subtype", "size", "update", + "get", "set", NULL, }; static _PyArg_Parser _parser = { "O&" /* `attr` */ "|$" /* Optional, keyword only arguments. */ "s" /* `name` */ "s" /* `description` */ + "s" /* `translation_context` */ "O" /* `default` */ "i" /* `min` */ "i" /* `max` */ @@ -3347,6 +3365,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject &id_data, &name, &description, + &translation_context, &default_py, &min, &max, @@ -3412,6 +3431,9 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject RNA_def_property_range(prop, min, max); RNA_def_property_ui_text(prop, name ? name : id_data.value, description); + if (translation_context) { + RNA_def_property_translation_context(prop, translation_context); + } RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3); if (tags_enum.base.is_set) { @@ -3433,6 +3455,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject PyDoc_STRVAR(BPy_FloatProperty_doc, ".. function:: FloatProperty(name=\"\", " "description=\"\", " + "translation_context=\"*\", " "default=0.0, " "min=-3.402823e+38, max=3.402823e+38, " "soft_min=-3.402823e+38, soft_max=3.402823e+38, " @@ -3448,8 +3471,8 @@ PyDoc_STRVAR(BPy_FloatProperty_doc, "set=None)\n" "\n" " Returns a new float (single precision) property definition.\n" - "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_NUM_MIN_DOC - " :type min: float\n" BPY_PROPDEF_NUM_MAX_DOC + "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC + BPY_PROPDEF_NUM_MIN_DOC " :type min: float\n" BPY_PROPDEF_NUM_MAX_DOC " :type max: float\n" BPY_PROPDEF_NUM_SOFTMIN_DOC " :type soft_min: float\n" BPY_PROPDEF_NUM_SOFTMAX_DOC " :type soft_max: float\n" BPY_PROPDEF_FLOAT_STEP_DOC BPY_PROPDEF_FLOAT_PREC_DOC @@ -3471,6 +3494,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) .srna = srna, }; const char *name = NULL, *description = ""; + const char *translation_context = NULL; float min = -FLT_MAX, max = FLT_MAX, soft_min = -FLT_MAX, soft_max = FLT_MAX; float step = 3; float default_value = 0.0f; @@ -3502,15 +3526,18 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) PyObject *set_fn = NULL; static const char *_keywords[] = { - "attr", "name", "description", "default", "min", "max", "soft_min", - "soft_max", "step", "precision", "options", "override", "tags", "subtype", - "unit", "update", "get", "set", NULL, + "attr", "name", "description", "translation_context", + "default", "min", "max", "soft_min", + "soft_max", "step", "precision", "options", + "override", "tags", "subtype", "unit", + "update", "get", "set", NULL, }; static _PyArg_Parser _parser = { "O&" /* `attr` */ "|$" /* Optional, keyword only arguments. */ "s" /* `name` */ "s" /* `description` */ + "s" /* `translation_context` */ "f" /* `default` */ "f" /* `min` */ "f" /* `max` */ @@ -3537,6 +3564,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) &id_data, &name, &description, + &translation_context, &default_value, &min, &max, @@ -3579,6 +3607,9 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) RNA_def_property_float_default(prop, default_value); RNA_def_property_range(prop, min, max); RNA_def_property_ui_text(prop, name ? name : id_data.value, description); + if (translation_context) { + RNA_def_property_translation_context(prop, translation_context); + } RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision); if (tags_enum.base.is_set) { @@ -3600,6 +3631,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) PyDoc_STRVAR(BPy_FloatVectorProperty_doc, ".. function:: FloatVectorProperty(name=\"\", " "description=\"\", " + "translation_context=\"*\", " "default=(0.0, 0.0, 0.0), " "min=sys.float_info.min, max=sys.float_info.max, " "soft_min=sys.float_info.min, soft_max=sys.float_info.max, " @@ -3616,7 +3648,7 @@ PyDoc_STRVAR(BPy_FloatVectorProperty_doc, "set=None)\n" "\n" " Returns a new vector float property definition.\n" - "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC + "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC " :arg default: sequence of floats the length of *size*.\n" " :type default: sequence\n" BPY_PROPDEF_NUM_MIN_DOC " :type min: float\n" BPY_PROPDEF_NUM_MAX_DOC @@ -3643,6 +3675,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec .srna = srna, }; const char *name = NULL, *description = ""; + const char *translation_context = NULL; float min = -FLT_MAX, max = FLT_MAX, soft_min = -FLT_MAX, soft_max = FLT_MAX; float step = 3; float default_value[RNA_MAX_ARRAY_DIMENSION][PYRNA_STACK_ARRAY] = {{0.0f}}; @@ -3676,15 +3709,19 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec PyObject *set_fn = NULL; static const char *_keywords[] = { - "attr", "name", "description", "default", "min", "max", "soft_min", - "soft_max", "step", "precision", "options", "override", "tags", "subtype", - "unit", "size", "update", "get", "set", NULL, + "attr", "name", "description", "translation_context", + "default", "min", "max", "soft_min", + "soft_max", "step", "precision", "options", + "override", "tags", "subtype", "unit", + "size", "update", "get", "set", + NULL, }; static _PyArg_Parser _parser = { "O&" /* `attr` */ "|$" /* Optional, keyword only arguments. */ "s" /* `name` */ "s" /* `description` */ + "s" /* `translation_context` */ "O" /* `default` */ "f" /* `min` */ "f" /* `max` */ @@ -3712,6 +3749,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec &id_data, &name, &description, + &translation_context, &default_py, &min, &max, @@ -3783,6 +3821,9 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec RNA_def_property_range(prop, min, max); RNA_def_property_ui_text(prop, name ? name : id_data.value, description); + if (translation_context) { + RNA_def_property_translation_context(prop, translation_context); + } RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision); if (tags_enum.base.is_set) { @@ -3804,6 +3845,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec PyDoc_STRVAR(BPy_StringProperty_doc, ".. function:: StringProperty(name=\"\", " "description=\"\", " + "translation_context=\"*\", " "default=\"\", " "maxlen=0, " "options={'ANIMATABLE'}, " @@ -3817,7 +3859,7 @@ PyDoc_STRVAR(BPy_StringProperty_doc, "search_options={'SUGGESTION'})\n" "\n" " Returns a new string property definition.\n" - "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC + "\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC " :arg default: initializer string.\n" " :type default: string\n" " :arg maxlen: maximum length of the string.\n" @@ -3838,7 +3880,8 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw struct BPy_PropIDParse id_data = { .srna = srna, }; - const char *name = NULL, *description = "", *default_value = ""; + const char *name = NULL, *description = ""; + const char *translation_context = NULL, *default_value = ""; int maxlen = 0; PropertyRNA *prop; @@ -3870,6 +3913,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw "attr", "name", "description", + "translation_context", "default", "maxlen", "options", @@ -3888,6 +3932,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw "|$" /* Optional, keyword only arguments. */ "s" /* `name` */ "s" /* `description` */ + "s" /* `translation_context` */ "s" /* `default` */ "i" /* `maxlen` */ "O&" /* `options` */ @@ -3910,6 +3955,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw &id_data, &name, &description, + &translation_context, &default_value, &maxlen, pyrna_enum_bitfield_parse_set, @@ -3956,6 +4002,9 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw RNA_def_property_string_default(prop, default_value); } RNA_def_property_ui_text(prop, name ? name : id_data.value, description); + if (translation_context) { + RNA_def_property_translation_context(prop, translation_context); + } if (tags_enum.base.is_set) { RNA_def_property_tags(prop, tags_enum.base.value); @@ -3978,6 +4027,7 @@ PyDoc_STRVAR( ".. function:: EnumProperty(items, " "name=\"\", " "description=\"\", " + "translation_context=\"*\", " "default=None, " "options={'ANIMATABLE'}, " "override=set(), " @@ -4018,7 +4068,7 @@ PyDoc_STRVAR( " will misbehave or even crash." "\n" " :type items: sequence of string tuples or a function\n" BPY_PROPDEF_NAME_DOC - BPY_PROPDEF_DESC_DOC + BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC " :arg default: The default value for this enum, a string from the identifiers used in " "*items*, or integer matching an item number.\n" " If the *ENUM_FLAG* option is used this must be a set of such string identifiers " @@ -4043,6 +4093,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) .srna = srna, }; const char *name = NULL, *description = ""; + const char *translation_context = NULL; PyObject *default_py = NULL; int default_value = 0; PyObject *items, *items_fast; @@ -4070,6 +4121,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) "items", "name", "description", + "translation_context", "default", "options", "override", @@ -4085,6 +4137,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) "|$" /* Optional, keyword only arguments. */ "s" /* `name` */ "s" /* `description` */ + "s" /* `translation_context` */ "O" /* `default` */ "O&" /* `options` */ "O&" /* `override` */ @@ -4104,6 +4157,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) &items, &name, &description, + &translation_context, &default_py, pyrna_enum_bitfield_parse_set, &options_enum, @@ -4188,6 +4242,9 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) prop = RNA_def_enum( srna, id_data.value, eitems, default_value, name ? name : id_data.value, description); } + if (translation_context) { + RNA_def_property_translation_context(prop, translation_context); + } if (tags_enum.base.is_set) { RNA_def_property_tags(prop, tags_enum.base.value); @@ -4244,6 +4301,7 @@ PyDoc_STRVAR(BPy_PointerProperty_doc, ".. function:: PointerProperty(type=None, " "name=\"\", " "description=\"\", " + "translation_context=\"*\", " "options={'ANIMATABLE'}, " "override=set(), " "tags=set(), " @@ -4252,8 +4310,8 @@ PyDoc_STRVAR(BPy_PointerProperty_doc, "\n" " Returns a new pointer property definition.\n" "\n" BPY_PROPDEF_POINTER_TYPE_DOC BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC - BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC - BPY_PROPDEF_POLL_DOC BPY_PROPDEF_UPDATE_DOC); + BPY_PROPDEF_CTXT_DOC BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC + BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_POLL_DOC BPY_PROPDEF_UPDATE_DOC); PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -4270,6 +4328,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) .srna = srna, }; const char *name = NULL, *description = ""; + const char *translation_context = NULL; PropertyRNA *prop; StructRNA *ptype; PyObject *type = Py_None; @@ -4292,6 +4351,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) "type", "name", "description", + "translation_context", "options", "override", "tags", @@ -4305,6 +4365,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) "|$" /* Optional, keyword only arguments. */ "s" /* `name` */ "s" /* `description` */ + "s" /* `translation_context` */ "O&" /* `options` */ "O&" /* `override` */ "O&" /* `tags` */ @@ -4322,6 +4383,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) &type, &name, &description, + &translation_context, pyrna_enum_bitfield_parse_set, &options_enum, pyrna_enum_bitfield_parse_set, @@ -4357,6 +4419,9 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) } prop = RNA_def_pointer_runtime( srna, id_data.value, ptype, name ? name : id_data.value, description); + if (translation_context) { + RNA_def_property_translation_context(prop, translation_context); + } if (tags_enum.base.is_set) { RNA_def_property_tags(prop, tags_enum.base.value); @@ -4384,14 +4449,15 @@ PyDoc_STRVAR(BPy_CollectionProperty_doc, ".. function:: CollectionProperty(type=None, " "name=\"\", " "description=\"\", " + "translation_context=\"*\", " "options={'ANIMATABLE'}, " "override=set(), " "tags=set())\n" "\n" " Returns a new collection property definition.\n" "\n" BPY_PROPDEF_COLLECTION_TYPE_DOC BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC - BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_COLLECTION_DOC - BPY_PROPDEF_TAGS_DOC); + BPY_PROPDEF_CTXT_DOC BPY_PROPDEF_OPTIONS_DOC + BPY_PROPDEF_OPTIONS_OVERRIDE_COLLECTION_DOC BPY_PROPDEF_TAGS_DOC); PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) { StructRNA *srna; @@ -4408,6 +4474,7 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) .srna = srna, }; const char *name = NULL, *description = ""; + const char *translation_context = NULL; PropertyRNA *prop; StructRNA *ptype; PyObject *type = Py_None; @@ -4429,6 +4496,7 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) "type", "name", "description", + "translation_context", "options", "override", "tags", @@ -4440,6 +4508,7 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) "|$" /* Optional, keyword only arguments. */ "s" /* `name` */ "s" /* `description` */ + "s" /* `translation_context` */ "O&" /* `options` */ "O&" /* `override` */ "O&" /* `tags` */ @@ -4455,6 +4524,7 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) &type, &name, &description, + &translation_context, pyrna_enum_bitfield_parse_set, &options_enum, pyrna_enum_bitfield_parse_set, @@ -4482,6 +4552,9 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw) } prop = RNA_def_collection_runtime( srna, id_data.value, ptype, name ? name : id_data.value, description); + if (translation_context) { + RNA_def_property_translation_context(prop, translation_context); + } if (tags_enum.base.is_set) { RNA_def_property_tags(prop, tags_enum.base.value);