0
$\begingroup$

Property, alongside having several subclasses (like BoolProperty), has a number of property definitions, such as is_library_editable. According to my understanding of class inheritance, children of a class inherit all properties of the parent. Indeed, the subclasses all include a list of Inherited Properties that show all property definitions from Property.

However, when attempting to define a property using one of these Inherited Properties, it results in an 'invalid keyword argument' error.

beans: BoolProperty(
    is_library_editable=True,
    default=False)

#  TypeError: 'is_library_editable' is an invalid keyword argument for BoolProperty()

This issue arises despite Property.icon being listed as one of the Inherited Properties of BoolProperty. Am I overlooking something or are the Docs misleading?

$\endgroup$

1 Answer 1

2
$\begingroup$

First, there is a difference between the class bpy.types.BoolProperty (docs) and the function bpy.props.BoolProperty (docs).

There is no reason to expect the keyword arguments you can pass to bpy.props.BoolProperty to correspond exactly to the properties on the class bpy.types.BoolProperty. bpy.props.BoolProperty is a regular function and can take whatever arguments it wants. You can read its docs if you want to know what arguments you can pass.

$\endgroup$
5
  • $\begingroup$ I read the docs, it told me BoolProperty Inherits Property.is_library_editable. That's why I call it misleading. You can't say there's 'no reason' to expect this to work when it's shown in the docs. If you can't use is_library_editable in a BoolProperty then it has no place being in the BoolProp's docs. $\endgroup$
    – Candle
    Commented Feb 16 at 2:25
  • 1
    $\begingroup$ bpy.types.BoolProperty does inherit is_library_editable. This has zero effect on what arguments you can pass to the unrelated function bpy.props.BoolFunction. $\endgroup$
    – scurest
    Commented Feb 16 at 2:40
  • $\begingroup$ Ohh, I see. Thank you for clearing this up for me. You can see where I got confused. Is it possible to set a BoolProp to be library_editible in an addon or is types.Bool really just for internal stuff? $\endgroup$
    – Candle
    Commented Feb 16 at 2:58
  • 1
    $\begingroup$ Try passing options={'LIBRARY_EDITABLE'} to bpy.prop.BoolProperty. $\endgroup$
    – scurest
    Commented Feb 16 at 3:05
  • 1
    $\begingroup$ To iterate the options parameter is supposed to be a set of strings which you can find in docs.blender.org/api/current/bpy_types_enum_items/… $\endgroup$
    – Gorgious
    Commented Feb 16 at 8:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .