User:Barche/TweakPoints

From K-3D

Jump to: navigation, search

The TweakPoints plugin is capable of assigning a different translation to each point in a mesh. As such, it is used by the interactive transform tools to accumulate edits, thus avoiding the need to create a new modifier each time a transform tool is used on selected components.

Current implementation

The legacy TweakPoints plugin just had one property, containing a vector with a tweak for every point. The current implementation was a first attempt to use hints, and adds some properties:

  • matrix: A transformation matrix, encapsulating the latest transformation
  • center: The center of the transformation, in case of scale or rotation
  • selected_points: the list of points to apply the transformation to

These properties allow the TweakPoints plugin to update its own tweaks array, and the basic idea was that in the future, this data would be passed along in hints and allow the GPU to recalculate the tweaks, minimizing the information transfer to the GPU. The system was never used in this way, however, and in retrospect it is overly complex. A much better approach to minimizing GPU data transfer is to implement parts of the pipeline (such as a TweakPoints plugin) in i.e. CUDA.

Proposed implementation

The additional properties mentioned above will be removed again, retaining only a tweaks property. This will be a map between a point index and a translation vector, avoiding the need to store lots of zero vectors for points that are not affected. Calculating the tweaks will once again be the responsibility of the caller, in this case transform_tool.cpp.

Hints to use

  • The TweakPoints plugin will emit a geometry_changed hint, containing a list of point indices that changed.
  • When setting the tweaks, clients can add a hint indicating what tweaks were changed or added, so the TweakPoints plugin only needs to apply the most recent changes instead of the (potentially large) complete tweaks map.