There are two existing mirror animations in core, the MirrorFlipAnimation
and MirrorLineAnimation
. The code for these can be found in base/cm/abstract/draw/...
In the FIKA and InstantPlannerPro extensions you may find these icons in the toolbox:
These are the MirrorFlipAnimation
(Horizontal and Vertical) and MirrorLineAnimation
mentioned above respectively.
MirrorFlipAnimation
This animation flips the Snapper
s across the horizontal/vertical axis (absolute, not relative to the snapper).
- An x/y-axis is shown in 2D while a "mirror" is shown in 3D. This is the vertical type, the type is changed through quick properties.
This is the horizontal type. These two types are represented by their own icon as seen in the previous section. - Hovering over a
Snapper
will highlight it and frame it blue. - Clicking then flips/mirrors the
Snapper
over the horizontal/vertical axis shown.
If the selected snapper doesn't support mirroring, a tooltip will appear.
This also occurs if the snappers have been locked in place, it will then display a different message.
A message will appear if the snapper resides in a different level.
If there is a selection in Space
, hovering over the selection will highlight/mirror all Snapper
s if they are mirrorable. If any snapper(s) in the selection cannot be mirrored for various reasons, it can be ignored. To do that, ensure the Ignore Incompatible checkbox is ticked before clicking the left-mouse button. The animation will instead mirror snappers that can be mirrored.
MirrorLineAnimation
Mirrors a SpaceSelection
of Snapper
s across a line drawn in the Animation
.
It will spawn a SpaceSelection
if you do not already have one when the Animation
starts. You can hold the ctrl-key down to continue selecting.
- If there are no
Snapper
s selected beforeMirrorLineAnimation
starts, the animation starts off with a rectangle select. You may click or draw a rectangle for selection. Holding the ctrl-key down allows you to make multiple selections. Clicking with a selection or making a selection without the ctrl-key down brings us to the next step. - A line is shown in the 2D window and a translucent wall is shown in the 3D window. This marks the line we are mirroring across. The quick property will determine if we are going to keep the original snapper after the mirror. If we do, there will be two snappers at the end of this operation.
- Clicking turns the first point solid and allows you to start drawing the "mirror line". The animation shows a preview for the mirror result using the
Snapper
's bound (for performance reasons). Moving the cursor around shows the mirror line and preview (A plane is shown in 3D). - Clicking again completes the mirror.
If mirror-incompatibleSnapper
s are selected, they will be highlighted red and shown in the toolbox. As of version 12.0, mirror-incompatible Snapper
s can be skipped during both the mirror-select and mirror-line animations. To do that, ensure the Ignore Incompatible checkbox is ticked before clicking the left-mouse button. Mirroring will proceed for available snappers.
Properties: You can change the animation properties to keep the original object after mirroring and setting the angle of the line.
Using Mirror Tools for Your Own Extension
You can simply add the mirror tools to your extension toolbox using an AnimationLimb
like this:
// Within a container: str->Object m(); m.put("ft", alignmentType.vertical); limb AnimationLimb mHor(pkg=#"cm.abstract.draw", "MirrorFlipAnimation", toolTipText=getRs("MirrorHorizontalAnimationTip", #"cm.abstract.draw"), image=icon("draw3D/mirrorHorizontal")); limb AnimationLimb mVer(pkg=#"cm.abstract.draw", "MirrorFlipAnimation", applyProps=m, toolTipText=getRs("MirrorVerticalAnimationTip", #"cm.abstract.draw"), image=icon("draw3D/mirrorVertical")); limb AnimationLimb mLine(pkg=#"cm.abstract.draw", "MirrorSelectionAnimation", image=icon("draw3D/mirrorLine"));
To make it so your Snapper
s can be mirrored, you have to overwrite allowMirror()
in Snapper
and implement the necessary interfaces as necessary for an accurate mirror.
See here for more information on how to implement mirror for your own Snapper
s.
Comments
0 comments
Please sign in to leave a comment.