Change multiview to use a camera reference, instead of a name suffix

There’s this interesting tidbit in the blender python API documentation:

A common mistake is to assume newly created data is given the requested name

Data names may not match the assigned values if they exceed the maximum length, are already used or an empty string.

The maximum length isn’t documented (and maybe shouldn’t be), but this causes a - theoretical, as far as I’m aware - problem with multiview setup via python: you have no way to guarantee the names of cameras.
In any way.

  • You can’t guarantee that they share a common prefix, which would cause multiview to error. The documentation just says “may not match”, not “truncated”, and even if there is one you don’t know what it is.
  • Because the camera name gets adjusted by blender, there’s no way to know what the suffix needs to actually be. Was it truncated? Did it get .008 appended to it? Something else? Have fun finding out!
  • Also, you can have multiple camera sets with the same suffix. You can control this by setting scene.camera… but what happens if that’s unset? Which camera set is going to get picked? :man_shrugging: It’s not alphabetical (which would be a problem, in its own way), which implies that it’s based on collection iteration order. Have fun with that if the collection gets reallocated.
  • The error messages around missing cameras are confusing. If I have a suffix set up, and a camera with a matching suffix… it complains that the camera I have “isn’t a multiview camera”:
    image
    … instead of saying something about the fact that some other views don’t have cameras with matching suffix/prefixes. For that matter, the fact that cameras for multiview need the same prefix isn’t even documented.