Why light.setColor() only takes VBase4()?

It seems like other functions accept objects such as Vec, VBase, etc. and individual numbers, while setColor only accepts VBase4(), so light.setColor(r, g, b, a) wont work, only setColor(VBase4(r, g, b, a)) will.

It should take VBase4 and anything that inherits from it, so you could give it a Vec4 also.

You can also use tuples for them.

What I meant was that some functions don’t require you to use tuple, or objects such as Vec or Base. An example are setPos(x,y,z), setHpr(x,y,z)…
Why isn’t it the case with setColor()?

Probably because setPos is a NodePath method, and NodePath was designed to be a flexible and user-friendly interface to nodes. In my opinion, the x,y,z variant is unnecessary.

It’s trivial to add a set of parentheses:

light.setColor((0, 1, 0, 1))

I know.
Its jsut that other methods also allow each value to be passed as separate argument. So it feels like the devs forgot to add that to setColor.
This is not an issue at all, purely aesthetically.

There’s a slippery slope. I’m not opposed to adding the individual components to Light.setColor(), but then you’ll ask about the next relatively obscure method. We can add it to that one, too, and keep this process going until every method that accepts a Vec4 also accepts four individual components.

But that will add a significant heft to the size of the Python code. So we made a conscious decision to reduce the size of the code by defining these convenience methods only for the 90% most-used methods. For the less-used methods, we thought it would be reasonable to ask the developer to add the parentheses.

David