Status: Alpha release
Last Updated: 27 October 2017
cgmSnap is a new tool that refactors some functions we had around the toolbox as well as a fresh push of new features in November 2017. You can access features by our marking menu, a standalone ui and the top cgm menu.
Until we get embeded video sorted. Please use this link: https://vimeo.com/205492894 to see the marking menu implementation.
What can I do with it?
- Do basic snapping with a myriad of pivot targets
- Raycast snapping and aiming
- Match snapping tools for updating items on the fly
- Use various pivot options for snapping without affecting object's pivot
In general, positional snapping works by rotatePivot(rp) as that is the main pivot an animator uses in maya. A pivot is a point in space. There are tools for changing pivots on the fly when animating (see DynParenTool for our implemenation of that). These tools allow you to access a lot more options while not changing the underlying pivots. Let's first talk about the kinds of pivots we'll be working with.
The main pivot maya uses. When you translate or rotate in general in maya you're working with this point. This is the default pivot for any snapping and querying functions.
In maya you have the ability to change the scale pivot of an object separate from its rotation pivot. An example of this we use is for scaling the foot for example where the rp is at the ankle and the sp is at on the ground to scaling the foot doesn't push it into the floor.
This is one the first of our special positions we use. Given a object to snap and a group of targets, it will find the closest point on all shapes of the target objects. These calls support shapes of the following types: nurbsCurve, nurbsSurface and poly
Maya's bounding box call is a world centric box encompassing the shapes of the target objects or components. Commonly this is a part of resetting pivot points to the center of the object's shapes for example.
In addition we have some additional mode calls for this:
center- Default mode with bounding box queries. The center of the box
front/z+- Directionally speaking we consider z+ forward and y+ as up
A new concept we're experimenting with. This is a local space bounding box where the box follows the local rotational data of the target. The initial reason for this was for getting certain positions with nurbs controls which don't work with rayCasting. Supports the same mode calls as boundingBox.
The z/x clamped value of the target's rp.
Casts utilize our rayCasting calls. For pivots we're using those casts to get new point information.
castCenter- Given a point to cast from. Cast two opposing vectors to figure out the mid point of that cast.
castNear- Closest hit from targeted surfaces
castFar- Furthest hit from targeted surfaces
castAllNear- Closest hit from all surfaces (except self)
castAllFar- Furthest ...
UI - Standalone
- Top cgm menu -
CGM > Snap > Snap UI
- Marking menu (several of them) -
- Top cgm menu -
UI - Nested
- You can find most of the tools nested in the cgmToolbox
import cgm cgm.core.tools.lib.tool_calls.cgmSnapTools()
If you open the stand alone ui, you should see something like this image below. When seen from the cgmToolbox it'll just look like the fly out sections in that ui.
Functions for snapping items around. In general, they function on a selection basis with all targeting the last.
Point- To the last selected object
Point - Closest- To the closest point on the last surface,curve,shape
Parent- Position and orientation
Orient- rotation only
RayCast- Uses the rayCast options to detect a point in space
Options for how matching matches.
point- Position only
orient- Orientation only
If an object is tagged to a cgmMatchTarget, will match the object to the match target. For example, if it is an updatable object, it will update.
Self- Update the selected object to their respective match targets
Target- Updates the selected's match targets to the selected
Buffer- Update utilizing the match buffer
Along Line (Even)- Arrange selected along line from frist to last evenly
Along Line (Spaced)- Arrange selected along a line snapping middle objects to their nearest point on the line
Functions for aiming items around. In general, they function on a selection basis with all targeting the last.
Aim- Currently uses object defaults from Menu. Will take into account object tagging in future.
Sel Order- Aim all selected objects in selection order with the last aiming back at the previous one
First to Mid- First object aims at the midpoint of the rest of the selection
AimCast- Uses rayCasting to aim selected objects in real time at a point of intersection
local- Use local vector based on object defaults OR stored aiming options
world- Use world vector
matrix- IN DEVELOPMENT Bokser is playing around
Because assumptions are often wrong.
Obj Aim- Aim axis
Obj Up- Up axis
Obj Out- The local out axis for vector work. Out is rarely used and may be deprecated.
Tag Selected for Aim - Adds attributes to selected objects to make them aimable on their own axis regardless of defaults
Until we get embeded video sorted. Please use this link: https://vimeo.com/244879615
Advanced snapping functions to access more pivotal data options.
In general with advanced snapping we have our object which is what we want to snap and any targets there after in our selection which are where we will get or target position from.
These functions don't modify the rp of the object to snap unless specified. Instead we use a vector from our rp to the requested obj pivot point and that distance to offset the rp from the target position
Obj Pivot- What pivot of our object to snap we want to work with.
Obj Mode- Which mode. See breakdown in bb for more details. Applies to
Target Pivot- What target position we want
Target Mode- What mode for the target queries
We also have flags to specify what we want to do with the data.
pos- Snap to the position of the queried data
rot- Snap to the rotation of the first target
ra- RotateAxis ...
ro- RotateOrder ...
sp- Move the scalePivot
rp- Move the rotatePivot
Finally, do something with the data.
Snap- Actually do the snapping
Seq- Perform snapping in a sequence of one to the next in reverse order to account for dependencies. For example
obj1,obj2,obj3will be done as
Query- Query mode. Just report to the scirpt editor
For example if you want to snap the bottom of the object you could use the
axisBox objPivot and