2
$\begingroup$

I try to create some properties for custom primitives in property group classes and I want to access them from an operator in another .py file to create primitives, but I get the following error:

AttributeError: 'tuple' object has no attribute 'base'

I'm trying to follow this advice:

class MyProps(PropertyGroup):
        ... # properties and stuff

class ParentProps(PropertyGroup):
        # THIS WILL NOT WORK! MyProps _has_ to be registered at this point
        #foo = PointerProperty(type=MyProps)


def register():
        # 1) register property class
        bpy.utils.register_class(MyProps)

        # 2) add property (now it works)
        ParentProps.foo = PointerProperty(type=MyProps)

        # 3) register parent class
        bpy.utils.register_class(ParentProps)

Unfortunately I get another error:

ValueError: register_class(...): expected a class argument, not 'tuple'

The WIP code looks like this: http://www.pasteall.org/60602/python (line 1260).

The design idea is that operators should create primitives and set up their properties, but these properties should still be there to change it later.

$\endgroup$
1
  • $\begingroup$ It would help if the example that has issues was self-contained. Currently it wont do anything - missing imports and call to register. $\endgroup$
    – ideasman42
    Aug 21, 2015 at 8:14

1 Answer 1

1
$\begingroup$
bpy.types.Object.povcone = PointerProperty(type=RenderPovSettingsCone_add)
bpy.utils.register_class(bpy.types.Object.povcone)

you do not need to register a property from bpy.props like this

the property is there after the assignment and blender will use it as a wrapper for

obj.["povcone"]

so simply drop the second line

$\endgroup$
1
  • $\begingroup$ I had noticed, but this does not solve my problem: When I try to use the base property with bpy.types.Object.povcone['base'] I get an error: " base = bpy.types.Object.povcone['base'] TypeError: tuple indices must be integers, not str $\endgroup$
    – Ray
    Aug 20, 2015 at 15:00

You must log in to answer this question.

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