Vector directly into prop() function without using property "workaround"

Continuing the discussion from Variable amount of properties determined at runtime:

Hello!

As @nezumi.blend stated in an answer of the above linked previous topic, it is possible to put e.g. shader nodes directly into the prop() function without using an additional property:

bsdf = mat.node_tree.nodes.get("Principled BSDF")
row = col.row(align=True)
row.prop(bsdf.inputs['Base Color'], "default_value", text=mat.name)

I’m wondering if it is also possible to put e.g. a position vector of an object into the prop() function.
But if I do something like this

row.prop(bpy.data.objects["Cube"].location)

I get an TypeError: UILayout.prop(): error with argument 1, "data" - Function.data expected a AnyType type, not Vector error.
Is this possible without doing the “workaround” of using a VectorProperty with an update function that updates the location of my object?

i’m confused- does row.prop(bpy.data.objects["Cube"], "location") not work?

1 Like

Sorry for the late reply.
Yeah, this works. Don’t know why I tried to put the location in the first prop parameter…
Thank you for your help :slight_smile: