Having built a few interfaces for the Dark Room project, I've been coming across a small issue in the way they work that needs addressing. The issue arises when I have more than one interface tool open. Occasionally, the tools would use IDs in the windows that are the same. IDs are just a number you give to an element, like giving a button a number so when you press it, that number is used to identify the button that was pressed. Each element must therefore be uniquely identifiable, otherwise you risk the same command being run from multiple buttons.
However, different interfaces may use the same ID for a button (or any window element). This conflict meant when two tools had windows open that also had elements in the windows with the same ID, the command/button would simply stop working until I closed one of the windows.
While I'm building and testing things, it didn't matter too much. You work around it by just testing one interface tool at a time. But eventually, a longer term solution is needed, otherwise the software might be awkward to use in a production environment.
So, I've had to update my interface system so that windows from different interfaces could still use the same IDs. How I did it, was to let each interfae under-the-hood have it's own drawing context. By having it's own draw context, it meant I can keep the IDs separated between tools - because the IDs were not kept within a drawing context and didn't clash with IDs in another context.
But having multiple contexts has made the program more complicated underneath. It was quite the frustration to get this to work. It sounds straight forward, but in the coding environment of Cinema4D, I found it rather difficult to get to work.
After much re-design - and crashes - the system seems to be working with multiple contexts now, with no ID conflicts between the tool interfaces. The IDs still need to be unique for that tool, but that's fine. What's good about the way I've built it, is that if someone were to build their own plugin in the future, they won't need to do anything on their side for it to work. It all seems to work out of the box and is taken care of by the Dark Room engine itself. Neat!
With this issue finally resolved, I can now go back to the structure builder interface to try add some functionality that will let me edit the 3D triangulation results.
And after that, we're just about ready to attempt our first tracking project!