Deprecated: Function set_magic_quotes_runtime() is deprecated in /storage/content/76/1004576/wiki.jpatch3d.org/public_html/inc/common.php on line 33 Deprecated: Function split() is deprecated in /storage/content/76/1004576/wiki.jpatch3d.org/public_html/inc/auth.php on line 95 Deprecated: Function split() is deprecated in /storage/content/76/1004576/wiki.jpatch3d.org/public_html/inc/common.php on line 743 dev:edit [DokuWiki]
 
Table of Contents

Undoable Edits

All Edits will do their manipulations upon creation. They provide an undo() method that restores the previous state and a redo() method to redo the edit. Atomic edits are the most simple form - these are edits that can do their task at once. Most of them are meant to be used in compound edits, which perform more complex tasks. Compound edits contain a list of child edits (either atomic or compound). Their undo() method will call undo() on all child edits in reverse order. Root edits (wheter atomic or compound) are ment to be created by user actions (and can be added to the UndoManager). All other edits are meant to be used in compound-edits (and thus can not be added to the UndoManager).

Atomic

AtomicAddCurve(Curve curve, Model model)

Adds the curve to the model

AtomicAppendControlPoints(ControlPoint A, ControlPoint B)

Appends A to B. After the edit, the fileds will look like this:

cpNext cpPrev
A (unchanged) B
B A (unchanged)

AtomicAttachControlPoints(ControlPoint A, ControlPoint B)

Attaches A to B. After the edit, the fileds will look like this:

cpNextAttached cpPrevAttached
A B (unchanged)
B (unchanged) A

AtomicChangeControlPoint

Each nested class changes a single property of a ControlPoint object:

  • AtomicChangeControlPoint.ChildHook(ControlPoint cp, ControlPoint childHook)
  • AtomicChangeControlPoint.Curve(ControlPoint cp, jpatch.entity.Curve curve)
  • AtomicChangeControlPoint.HookPos(ControlPoint cp, float hookPos)
  • AtomicChangeControlPoint.Loop(ControlPoint cp)
  • AtomicChangeControlPoint.Magnitude(ControlPoint cp, float magnitude)
  • AtomicChangeControlPoint.ParentHook(ControlPoint cp, ControlPoint parentHook)
  • AtomicChangeControlPoint.Position(ControlPoint cp, Point3f position)
  • AtomicChangeControlPoint.TangentMode(ControlPoint cp, int tangentMode)

AtomicChangeCurveStart(Curve curve, ControlPoint start)

Changes the curve’s cpStart field.

AtomicChangePatchMaterial(Patch patch, JPatchMaterial material)

Changes the material of a patch.

AtomicChangeTool(JPatchTool tool)

Changes the currently active tool.

AtomicDeleteControlPointFromCurve(ControlPoint cp)

Deletes a ControlPoint from its curve. The curve is left open (i.e. split in two if it was not closed). Neither curve start is modified, nor is a new curve added to the model! After the edit the fields will look like this:

ControlPoint curve cpNext cpPrev
cp null (unchanged) (unchanged)
cp.cpPrev (unchanged) null (unchanged)
cp.cpNext (unchanged) (unchanged) null

AtomicDetatchControlPoint(ControlPoint cp)

Detaches a ControlPoint. After the edit the fields will look like this:

ControlPoint cpNextAttached cpPrevAttached
cp.cpNextAttached (unchanged) null
cp.cpPrevAttached* null (unchanged)

*Additionally, if the ControlPoint was a Head, it sets the position of the prevAttached ControlPoint (which will be the new Head) to the current position.

AtomicExchangeControlPointInSelections(ControlPoint cpOld, ControlPoint cpNew)

Loops through all selections of the model (found by calling cpOld.getCurve().getModel() - so be sure that the edit is created before the cp is actually removed, otherwise it’s curve field would be null) and exchanges cpOld with cpNew in all selections containing cpOld.

AtomicRemoveControlPointFromCurve(ControlPoint cp)

Removes a ControlPoint from its curve. The curve is closed again (be appending the next cp to the previous cp). This edit takes care of closed (loopped) curves. After the edit, the fields will look like this:

ControlPoint curve cpNext cpPrev
cp null (unchanged) (unchanged)
cp.cpPrev (unchanged) cp.cpNext (unchanged)
cp.cpNext* (unchanged) (unchanged) cp.cpPrev

*If the loop flag of cp was set, the edit sets the loop flag of cp.cpNext.

AtomicRemoveControlPointFromSelections(ControlPoint cp)

Loops through all selections of the model (found by calling cpgetCurve().getModel() - so be sure that the edit is created before the cp is actually removed, otherwise it’s curve field would be null) and removes cpfrom all selections containing it.

AtomicRemoveCurve(Curve curve)

Removes a curve from its model.

AtomicReverseCurve(Curve curve)

Reverses a curve (by reversing the order of its ControlPoints). cpStart will be set to the former end of the curve, cpNext and cpPrev fields of all ControlPoints will be swapped. If a segment of the curve has a hook-curve attached, the childHook and parentHook fields of those ControlPoints will be currected and the hook-curve reversed too. This edit must not be used on closed (looped) curves - doing so will throw a runtime-exception.

Compound

CompoundRemoveHookCurve(Curve curve)

Removes a hook-curve (throws a RuntimeException if the specified curve is not a hook-curve). It adds a CompoundDeleteControlPointStack edit for each ControlPoint on the hook-curve and finally a AtomicRemoveCurve edit.

Uses:

  • CompoundDeleteControlPointStack(ControlPoint head)
  • AtomicRemoveCurve(curve)
 
  dev/edit.txt · Last modified: 2005/11/22 10:45