class MAGES::MeshDeformations::Editor::CutActionVolumeSelectionTool¶
Overview¶
Scene tool for authoring the volume constraints of a TearActionData’s cuts. More…
class CutActionVolumeSelectionTool: public EditorTool
{
public:
// structs
struct TetrahedronInfo;
// properties
override GUIContent toolbarIcon;
// methods
override bool IsAvailable();
override void OnActivated();
override void OnWillBeDeactivated();
override void OnToolGUI(EditorWindow window);
static void EditGroup(TearActionData cutActionData, int groupIndex);
static VolumeConstraintsDestructionDetector ResolveDetector(TearActionData cutActionData);
};
Detailed Documentation¶
Scene tool for authoring the volume constraints of a TearActionData’s cuts.
Copied and retargeted from VolumeConstraintsDestructionDetectorSelectionTool : instead of editing the detector component’s groups, it edits the action’s TearActionData.whatToCut list. The detector is only resolved off the target to obtain the simulation mesh for rendering/raycasting.
The tool is an EditorTool of VolumeConstraintsDestructionDetector, not of TearActionData: the action data is a SceneGraph sub-asset that is never surfaced as a scene selection, so an EditorTool keyed to it would never activate. Instead, EditGroup (driven by CutActionEditor ‘s group drawer) selects the detector’s GameObject and stashes the action to edit.
Methods¶
override bool IsAvailable()
Gates whether the tool can be activated. It is available only while there is an editing context: a pending request set up by EditGroup, or an action currently being edited. Outside of that it returns false, which keeps the tool out of the scene-view Tools overlay so it can never be activated by hand (a manual activation would have no cutAction and be meaningless).
ToolManager.SetActiveTool<T>() consults this before activating, so it must return true at the moment EditGroup requests activation — hence the pendingCutAction check. It must also stay true for the duration the tool is active (Unity polls it), hence the cutAction check; cutAction is cleared in OnWillBeDeactivated so the tool becomes unavailable again once editing ends.
static void EditGroup(TearActionData cutActionData, int groupIndex)
Activates the tool for the given action and pre-selects the group at groupIndex for editing. Invoked by the CutGroupPropertyDrawer’s Edit button.
Parameters:
cutActionData |
The action being edited. |
groupIndex |
The group index to edit. |