[Bf-python] How to change a *VectorProperty size?

Campbell Barton ideasman42 at gmail.com
Mon Sep 16 00:52:57 CEST 2019


On Fri, Sep 13, 2019 at 03:14:56PM -0300, Goncalo Morgado wrote:
> I see.
> What would be the right path to visualise the CollectionProperty items in a
> panel? It is my understanding that adding a layout.prop() pointing to the
> CollectionProperty will only show the number of items, but not the actual
> values.

You can loop over each item in the collection and use layout.prop()
passing the item as the first argument.
These can be shown is in UILists too.

>
> Thanks again,
> Gonçalo
>
>
>
>
> On Fri, Sep 13, 2019 at 1:03 PM Cambell Barton <ideasman42 at gmail.com> wrote:
>
> > This isn't supported. The closest thing we have to this is a collection
> > property, where you can define a collection of PropertyGroup items.
> > These can be an arbitrary size.
> >
> > On 2019-09-13 23:37, Goncalo Morgado wrote:
> > > Hello,
> > >
> > > Quick question on VectorProperty's:
> > >
> > > 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 dynamically.
> > > The idea is to have a panel showing an array of integers which length
> > > and values the user would change.
> > >
> > > I can probably get away with deleting the property and creating a new
> > > one with the same name, with the new size. If that's the only solution,
> > > and since my IntVectorProperty actually belongs to a PropertyGroup, how
> > > would I be able to delete the IntVectorProperty and create a new one
> > > inside the PropertyGroup?
> > >
> > > I hope this makes sense, let me know if you find the question confusing.
> > >
> > > Thanks in advance,
> > > Gonçalo
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > Bf-python mailing list
> > > Bf-python at blender.org
> > > https://lists.blender.org/mailman/listinfo/bf-python
> > >
> > _______________________________________________
> > Bf-python mailing list
> > Bf-python at blender.org
> > https://lists.blender.org/mailman/listinfo/bf-python
> >

> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> https://lists.blender.org/mailman/listinfo/bf-python


More information about the Bf-python mailing list