1
$\begingroup$

Let's say I've created a scene property named a:

bpy.types.Scene.a = bpy.props.IntVectorProperty(
    name='a',
    description="Frequencies",
    size=2,
    default=[1, 2]
)

And now I would like to update it's size to something else.

  • How can I do that?
  • Do I have to override the property? What if instead of a single property I have a PropertyGroup and I want to update an IntVectorProperty that belongs to the group?
$\endgroup$
0
$\begingroup$

Have you seen Property Definitions? IntVectorProperty have other parameters to define, among which no "size"!

You can create a Custom property from PropertyGroup:

class CustomProperty(bpy.types.PropertyGroup):
    name: bpy.props.StringProperty(name="Name", default="Some name")
    description: bpy.props.StringProperty(name="Description", default="Frequencies")
    size: bpy.props.IntProperty(name="Size", default=2)

To update any property just assign some value:

bpy.types.Scene.a = 3
$\endgroup$
  • $\begingroup$ RUben: I don't think you read the question. Also your first statement is wrong, IntVectorProperty's do have size, which defaults to 3. Read carefully the link you shared :) Also I don't see how the rest of your answer addresses my question, I know how to create IntVectorProperty's, I just don't know how to change them dynamically to have different sizes. I want to have the same experience we have with list's in Python. Anyway, I appreciate the time you took to try and answer, but please fix your answer, that would be great :) $\endgroup$ – gmagno Sep 11 at 17:21
  • $\begingroup$ my mistake - part of the parameters in manual is hidden behind the scroll $\endgroup$ – RUben Sep 12 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.