To help see properties of the snappers in the drawing the Inspector can be used. This can be opened in multiple ways.
Video
This video is from the CET Developer Conference about the Inspector.
Opening the Inspector
Open by Clicking the Snapper
Alt-Click on any snapper will open a drown down and from here the inspector can be opened by clicking the small arrow next to the snapper you want to inspect. This works both in 2D and 3D.
This will open the inspector. The dialog will show the different properties and fields of the snapper. One can see the materials used, the graph of the snapper or the snappers PropDefs for instance.
Inspect an Animation
If an animation wants to be inspected, pressing Alt-i when the animation is running will open the inspector with the current animation in it. The example below is taken from the InsertAnimation()
of Snowman.
From Code
The inspector can also be opened from code by adding the line inspect()
. Below is an example from snowman.cm where inspect is added to clickAnimation()
. This means that every time you click the snowman, the inspector of that snapper will be opened.
/** * Return desired click animation. */ public Animation clickAnimation(StartClickAnimationEnv env) { inspect(); if (space and this in env.snappers) { return SnapperClickAnimationStarter(env); } return null; }
The inspect function can also take another Object to inspect, by sending the Object into the function.
/** * Show inspector for 'object', open to openLevel. */ public void inspect(Object object, int openLevel=1) { lazy_call(function(Object, int, bool, Object[], Object[]) custom.developer.tools.inspector.showInspector(object, openLevel, false, null, null)); }
Tools Inside CM Inspector
Inside the inspector, there are a few very useful tools.
Show PropDefs
By clicking Show PropDefs, a dialog of the inspected item will show.
Show Connectors
Clicking Show Connectors will toggle and show the Connectors of the chosen item.
Show Mesh
Toggling Show Mesh will highlight the mesh of the model.
Show Center
Pressing Show Center will show the origin of the object along with its axes.
Debug Visibility
Clicking Debug Visibility will run a snapper visibility debug and also dump the results in emacs.
Dump UV
Pressing Dump UV will dump the vertices of all the models in the snapper selected along with its UV-coordinates.
Cache Check
Pressing Cache Check will check whether or not your snapper has been cached and will dump info about it in your emacs buffer.
Diff Tool
The Inspector has a useful tool to help you see the difference of things in the drawing that might not be that obvious.
Diffing Two Different Snappers
Here we have the example of two different snappers in a drawing.
By opening the Inspector, you can click the Recent tab in the top and there you will see the two snappers you have inspected.
Selecting both of them and clicking DIFF Selected will open a dialog where the difference between the two snappers are highlighted.
Here you can see that for instance, the position of the snappers are different, the id is different and because of the different poses, the rightSnap
and leftSnap
are different.
From Code
The diff tool can also be used straight from code. Here is an example where a Snowman is moved a bit to the side.
Snowman s(); inspectRecord(s, #snapper); s.move((3, 0, 0)); inspectRecord(s, #snapper); inspectDiff(#snapper, clear=true);
Running this will open the diff dialog and highlight the difference, i.e. the position of the snapper:
Diff Yourself
Sometimes you may want to diff the way a Snapper with a previous state of itself. You can easily do this by clicking Record a snapshot of the current state of your snapper will be saved. Manipulating the snapper and then clicking Record again will create another snapshot.
Selecting both of these snapshots and then clicking DIFF Selected will open up the Diff Dialog.
Comments
0 comments
Please sign in to leave a comment.