1
$\begingroup$

I want to create a field where the user can select a modifier, usually I would use a pointer for this. I can easily create a pointer to collections or objects like this:

bpy.types.Scene.chvi_dummy_obj = bpy.props.PointerProperty(type = bpy.types.Object)

But if I try to do the same with modifier like this:

bpy.types.Scene.chvi_dummy_mod = bpy.props.PointerProperty(type = bpy.types.Modifier)

I get this error:

TypeError: PointerProperty(...) expected an RNA type derived from ID or ID Property Group

Is there a way to have a pointer to a modifier or it's just impossible?

$\endgroup$
3
  • 1
    $\begingroup$ Right now you're still trying to set the property on the bpy.types.Scene object. You would need to go the types docs and find the type of object you want to set the property for. In this case it looks like it would be bpy.types.Modifier. $\endgroup$
    – Jakemoyo
    Commented Sep 20, 2022 at 20:41
  • $\begingroup$ Yes, it let me initialize the pointer on types.Modifier, but like this I have a pointer to a modifier on each modifier, and it's not what I want. I want this pointer to be on the scene, or on the object, or everywhere but in the modifier itself. Can you explain better why it's not possible to have the pointer anywhere and where (in the documentation) I can deduce what you told me? $\endgroup$
    – Lucho
    Commented Sep 21, 2022 at 6:03
  • $\begingroup$ I just noticed another issue with your code. You need to be using a property group, not setting the type to bpy.types.Modifier. $\endgroup$
    – Jakemoyo
    Commented Sep 23, 2022 at 13:33

0

You must log in to answer this question.

Browse other questions tagged .