A new feature has been added that enables users to add extra categories to snappers during insert. In code the feature is called AutoCategorization
. In general, the new functionality should work out of the box for all animations that inherit either InsertAnimation or InsertAnimationG2. Other insert animations may need some adjustments to fully support it.
There are two parts to the feature. One is that all snappers inserted when the feature is enabled should append the categories specified by the user. And secondly, while an insert animation is active there is an information toolbar in the active view showing a preview of all categories that the snapper will receive when inserted.
In order to support the adding of extra categories your animation needs to do one of the following:
Space::undoableInsert(Snapper z, bool putInBsp=true)
if (isAutoCategorizationEnabled()) applyAutoCategories(snapper);
when inserting snappers.To support the information toolbar showing what categories are about to be added to the snapper your animation is required to:
public bool supportsAutoCategorization()
. This will ensure that the toolbar gets displayed during the animation.private SnapperSelection getAnimationSelection(Animation a) {
in cm/core/visibility/categorize/contextualCategoryInfoToolbar.cm
for all the all the ways this can be achieved. The toolbar will still work without returning a valid selection, but a selection is required in order to correctly display what categories will be applied by the snapper and the view mode.Here is a minimal code example of a custom insert animation that supports auto categorization
/** * My custom insert animation. */ public class MyCustomInsertAnimation extends Animation { /** * Supports auto categorization. */ public bool supportsAutoCategorization() { return true; } /** * Return all the snappers in this animation. */ public AnimationSelection getSelection() { return AnimationSelection(snappersToInsert); } /** * End. */ public PropObj end() { super(); // Insert snappers... // Append auto categories to inserted snappers if (isAutoCategorizationEnabled()) { applyAutoCategories(insertedSnappers); } } }