Collection of Selection Scripts for Cinema 4D

$0+
5 ratings

In the Cinema 4D Object Manager you can use the arrow keys to move the selection from one object to another. This works only in the OM though.

The various Python scripts in this collection can be assigned to the arrow keys in the viewport (or other windows) to move the selection by keyboard without going to the OM, scrolling, opening branches, scrolling some more...

Tested under R23 on Windows, but since these are Python scripts, they will work under MacOS and other C4D releases too.


Detailed notes / manual

These are scripts to move, expand, or reduce the selection in the object tree. They are intended for assignment to a keyboard shortcut so they have no special icon.

Wait, but the Object Manager already allows you to move the selection with the arrow keys, and to expand the selection too!?

Yes - but those keyboard shortcuts are only available in the OM and work in a peculiar way - they consider only the visible objects, skipping folded branches and objects made invisible through the layer settings. They also use the visible sequence of objects (which may be different in the potentially open Object Managers), whether the "next" object is a child or a neighbor of the "previous" one. This is all very OM-specific.

The selection scripts here are working differently, with the raw object tree in mind. They can be assigned to keyboard shortcuts to work in the viewport alongside the click-selection of objects. There are 26 scripts with various behaviors, so you can install whatever you find missing, on whatever key/qualifier combination you find appropriate. You do not need to utilize them all, but can choose what you find most useful.

Object_Select_Top -- Selects (only) the very first object of the object tree.

Object_Select_Parent -- For a selected object, this script moves the selection to the object's parent. If there is no parent, the object itself stays selected. The script works with multiselections.

Object_Select_Root -- For a selected object, this script moves the selection to the topmost parent/ancestor available (on the first level of the tree). The script works with multiselections.

Object_Select_Child -- For a selected object, this script moves the selection to the first child of the object. If there are no children, the object itself stays selected. The script works with multiselections.

Object_Select_Next and Object_Select_Prev -- These scripts move the selection down or up in the tree. They work mostly like the OM's cursor keys (if the whole tree is visible and all branches open), moving to the child if there is any, or to the neighbor if there is no child, or to a parent's successor if there is no neighbor either, until the last/first tree object has been reached. If more than one object has been selected, the scripts move only the chronologically last selection and deselects all other objects.

Object_Select_Next_Wraparound and Object_Select_Prev_Wraparound -- These scripts work like the previous ones, but when the last object in the tree is reached, they do not stop but start at the beginning; or vice versa. If there was no selection to begin with, the scripts select the very first/last tree element.


The next scripts work only on one single selected object; if there is more than one object selected, they will not do anything.

Object_Select_Next_SameLevel and Object_Select_Prev_SameLevel -- These two scripts go to the next or previous sibling on the same level. They will ignore children and not jump to a "cousin". When the last/first child of the same parent has been reached, they stop.

Object_Select_Next_SameLevelWraparound and Object_Select_Prev_SameLevelWraparound -- These scripts work the same, but when they reach the last/first child of the same parent, they continue with the first/last child, so they cycle through all siblings.


The following scripts select multiple related objects. They allow multiselections.

Object_Select_Siblings -- For each selected object, this script selects all siblings (child objects of the same parent). If there is no parent (object is on the top level), all other objects on the top level are considered siblings. The object itself stays selected as well.

Object_Select_Cousins -- For each selected object, this script selects all "cousins" (child objects of the same parent or of the parent's siblings; or in other words, all objects on the same level that have the same grandparent). If there is no grandparent or parent, the script behaves exactly like Object_Select_Siblings.

Object_Select_Children -- For each selected object, the script selects all children. If there is no child, the object itself stays selected. This is different than C4D's own "select children" function, as it only selects the direct next level, while the C4D method recursively selects all elements below the current.


These scripts deselect objects, taking the selection sequence into account:

Object_Select_OnlyFirstSelected -- Deselects all currently selected objects, with the exception of the chronologically first selected.

Object_Select_OnlyLastSelected -- Deselects all currently selected objects, with the exception of the chronologically last selected.

Object_Select_DeselectFirstSelected -- Deselects the chronologically first selected object. Using the script several times will deselect the objects in the same sequence as they were selected, until only one is left. The last object stays selected.

Object_Select_DeselectLastSelected -- Deselects the chronologically last selected object. Using the script several times will deselect the objects in the inverse sequence as they were selected, until only one is left. The last object stays selected.


The next group reduces or expands a selection of siblings, using the physical sequence in the tree (not taking the chronological selection into account). Only direct siblings must be selected. The reducing scripts always leave the final selected object untouched, so the selection is never completely cleared.

Object_Select_ReduceStart -- Deselects the first sibling in the tree sequence.

Object_Select_ReduceEnd -- Deselects the last sibling in the tree sequence.

Object_Select_ExpandStart -- Selects the predecessor of the first sibling, expanding the selection "upward".

Object_Select_ExpandEnd -- Selects the successor of the last sibling, expanding the selection "downward".

These scripts have a slightly different behavior from the built-in Shift-Arrow key functions of the Object Manager. They do not select any children during expansion, and never leave the sibling sequence.


Finally, some additional random scripts:

Object_Select_DeselectRandomly -- Of the current selection, this script deselects a number of objects (a dialog for the percentage will be opened).

Object_Select_InvertSiblings -- This script inverts the selection state of a number of siblings. If you have selected objects which are not siblings, the chronologically first selected defines siblinghood, all others outside of this level are ignored.

Object_Select_Similar -- Selects all objects that are of the same type as any of the currently selected ones. E.g. if you select a light and a null and then trigger this script, all lights and all nulls in the whole tree are selected.


Limitation / warning

The original arrow-key shortcuts from the Object Manager cannot be overwritten (not even with a different qualifier, like Ctrl / Alt), they cannot be deleted, and they don't even appear in the Customize Command window. Cinema 4D has them "hardcoded", with no option to modify them.

In other words, these scripts will only work with the arrow keys if you are in the viewport; in the OM, you get the native arrow key behavior. Unless you sacrifice several other keys for this functionality - on the German keyboard, üöä# would be possible... -, this cannot be avoided.


Installation

Unpack the .zip file and put the scripts into your designated library/scripts folder. Do not put them into the plugins folder. It does not matter whether you keep the folder in the file, or use the scripts directly.

Open C4D and use the Customize Command window to assign a keyboard shortcut to the scripts as you like.

$
I want this!

The Python scripts in this collection can be assigned to the arrow keys in the viewport (or other windows) to move the selection from one object to another, or to expand the selection.

Size
12.3 KB
Copy product URL

Ratings

5.0
(5 ratings)
5 stars
100%
4 stars
0%
3 stars
0%
2 stars
0%
1 star
0%
$0+

Collection of Selection Scripts for Cinema 4D

5 ratings
I want this!