Say I want to add a list of the UVLayers on a selected object in my UI Panel. Noted that
PointerProperty only supports types with an ID or PropertyGroup subclass.
I tried instead passing the list of UV Layers as an EnumProperty in this way:
class PropGroup(PropertyGroup): def get_uvs(self): uvs =  for uvMap in self.seed_object.data.uv_layers: uvs.append(uvMap) return uvs seed_object: PointerProperty( name="Base Object", description="Object to duplicate", type=bpy.types.Object ) seed_object_uvs: EnumProperty( name="Uvs", items=get_uvs() ) ...
But I am getting an error that
get_uvs is missing the parameter 'self'. When I pass 'self' literally in the line
items=getuvs(self) it assumes this is a named argument. Declaring the function outside the class fixes the above issue of needing 'self', but throws an error where the
seed_object parameter isn't defined. I understand this is because
seed_object is being referenced before it is actually assigned, but still leaves me without a solution.
The clear workaround is to not declare the UVs as a property, and in the necessary operator(s) use something like object.uv_layers.active(), or whatever to get the layer. In general though, I'd like to know if there is a way to store this sort of object data in a Property Group or at least through the UI.