Plugin: Collie Project Button Bar ($5 Patrons and up)

Note: This plugin has been developed to serve as a sample for the Python: Spoonfed tutorial series. Since the code is a bit more advanced than the tutorials, I'm publishing it separately as an appetizer. If the tutorials find enough support to get there, we will examine the code in detail.

For now, you can use the plugin independently of the tutorials; no need to know anything about programming ;-) 

The actual installation directory comes with the next Patrons-only post; the manual is contained in this post so you can read it before deciding on becoming a Patron.

The plugin has been written in Python for R21 (and higher) and should work on PC and Mac with no further installations; just copy the plugin's own directory into your preferred plugins directory (not into the script directory), and it will run. I do not guarantee for versions below R21, and have not tested them.


############

MANUAL

############


LAYOUT


When invoked from the Extensions menu, the plugin opens a resizeable horizontal dialog that lists the currently open projects.

The Collie Project Button Bar

The dialog can be embedded in your layout to be always open at program start. This is the preferred mode, but you can use it as hovering dialog as well if you like. Use the standard C4D functionality to drag the Collie Project Button Bar into the layout and hide the title.

The Bar embedded in the layout

If the dialog shows too many projects for the horizontal space, there will be a scrollbar to allow you to move through the projects.

The scrollbar

There are three types of buttons in the bar. The large ones with the project names will activate that project on click. The first button which shows an A (for Automatic) or an M (for Manual) opens a global menu on click. The buttons that are marked with a star * refer to the project left of them, and open a project-specific menu on click.

Global menu

Project-specific menu

When invoked first, the bar is in Automatic mode. It will check every three seconds whether the button list is still equal to the loaded projects, and adapt the buttons if that is not the case.


NAME AND PATH DISPLAY


The projects will initially be shown only by their name.

If you have projects with the same name open, you may elect to expand the display. In the global menu, you will find the option Show Paths. Select this menu item, and the bar will show the full path of the project behind the project name.

(Note: the markers (ON) and (OFF) tell you the current state of these switches.)

Showing the full pathes

The pathes may easily become too long for comfortable handling. Therefore, another option is available in the global menu: Short Relative Paths. This will try to shorten the path display to an easily understood and distinguishable form.

If one path is a subpath of the other, the short path will be abbreviated (...), and the longer path will show only the different subdirectories:

Partially equal pathes

If there is no subpath relationship (pathes are "somehow different"), the Collie Project Button Bar splits the pathes into their component and shows only those parts that are mutually different. This should make it easy for the user to distinguish between the files and tell what file is from what source:

Parallel directories

Note that files that do not have duplicate names will not show their pathes in this mode!

Duplicate and non-duplicate project names


MANUAL MODE


There are cases when the automatic mode is not helpful enough. You may, for example, have a dozen projects open but currently are working only on three of them. Or you may not want to have the projects listed in the sequence that they have been loaded in. Or you may want to put a note in the button itself.

You can switch to Manual mode by selecting Toggle Automatic from the global menu. The global menu button will change to an M. The current buttons and path displays will remain, but they will no longer be updated regularly.

Instead, you can now use the projects' menus to move the buttons to the right and left, and to remove the button to make the Collie Project Button Bar show only the desired projects in the desired sequence.

In addition, you can use the global menu's items Add All - to manually refresh the button list according to the currently loaded projects -, Remove All - to remove all buttons at once -, or Add Current - to add a new button for a project that you just loaded, or whose button you previously removed (use C4D's Window menu to access projects that are no longer shown in the bar).

In some cases, you may want to annotate a button directly, for example if you copy parts from one project to another, which can be confusing if the projects are named the same or just alike. Use the Rename Button item from the project menu to get a Rename dialog:

Rename dialog for a button

Once you have chosen proper button labels, duplicate project names are no longer an issue even if the pathes are not shown.

Renamed buttons

As final helper for handling multiple projects at once, the project menus feature the item Close Project. For safety, this will only close the project if it has not been modified, otherwise the Bar will refuse to kill it.


RESTRICTIONS


The following restrictions apply to the Collie Project Button Bar:

1. When loading more than two projects with the same name, the path shortening algorithm may not produce the best results. You can always use the full path display, however, or rename the buttons in Manual mode.

2. Cinema 4D allows the user to load the exact same file twice. This is a situation the Button Bar cannot handle, as it identifies the projects by name and path. The Bar will not crash, but the buttons for this file will always select the latest loaded version only. You will rarely need double-loading though; I had to test whether that even works...

3. When in Manual mode, and you save a project to a new path or under a new name, its button disconnects from the project (since name and/or path have been changed). In that case, you need to remove the old button and re-add the project to the Button Bar. This happens easily when you save incrementally. Use the Automatic mode in this case.

4. The settings are not permanent. When you close the program, the Button Bar will revert to the defaults, and any manually entered button texts are gone.


NOTES


This plugin has been developed as sample for the tutorials after the original xsTab disappeared (I never owned that plugin but it was mentioned on various forums so I guess there is some interest for this functionality), so my main focus here was on simple and manageable source code, not on originality. There may be other plugins with similar functions around.

In fact, Cinema 4D has an icon command called "Projects" which opens a dropdown menu with the current project list. Also, there are commands "Next Project" and "Previous Project" that you can use to switch through the open projects. Look them up under Customize Commands, they may serve your needs and require less space than the Collie Project Button Bar.

Nevertheless, the built-in functionality does not come with a path display (not even as tooltip or mouse-over) or a manual mode, so the Button Bar may still fill a niche in your personal workflow.

If you have issues running the plugin, or ideas on how to improve it, feel free to leave a note.

By becoming a patron, you'll instantly unlock access to 114 exclusive posts
114
Writings
By becoming a patron, you'll instantly unlock access to 114 exclusive posts
114
Writings