SurfacePaintManipulator.kl¶
Interfaces¶
ISurfacePaintManipulator (interface)¶
バージョン 1.12.0 で追加.
An interface for paint manipulator that defines the virtual methods that can be overridden in specialized painting tools.
注釈
when the ‘virtual’ keyword is introduced into KL, we can eliminate this interface and simply decorate the methods in SurfacePaintManipulator with the virtual keyword.
Functions¶
onPaint ! ( io MouseEvent mouseEvent, in SurfacePaintManipulator_PointCollection collectedPoints ) | |
onStrokeBegin ! ( io MouseEvent mouseEvent ) | |
onStrokeEnd ! ( io MouseEvent mouseEvent ) | |
setGraph ! ( in String graphName ) | |
setPortToDrive ! ( in String portName ) |
Functions in detail¶
ISurfacePaintManipulator.onPaint! ( io MouseEvent mouseEvent, in SurfacePaintManipulator_PointCollection collectedPoints )
Invoked by the SurfacePaintManipulator during painting for each mouse move event. the collectedPoints struct contains the points, distances and weights of the points in the geometry that are within the volume of the paint brush.
ISurfacePaintManipulator.onStrokeBegin! ( io MouseEvent mouseEvent )
Invoked by the SurfacePaintManipulator when the paint stroke begins. The event passed in is the mouse down event.
ISurfacePaintManipulator.onStrokeEnd! ( io MouseEvent mouseEvent )
Invoked by the SurfacePaintManipulator when the paint stroke ends. The event passed in is the mouse up event.
ISurfacePaintManipulator.setGraph! ( in String graphName )
Sets the graph name within the DCC
ISurfacePaintManipulator.setPortToDrive! ( in String portName )
Sets the port to drive. This by default is set to the evalID, which forces a refresh of the execution of the DCC node, so for example a deformer will be reexecuted.
Types¶
SurfacePaintManipulator_PointCollection (struct)¶
バージョン 1.12.0 で追加.
A collection of points gathered during a single event. The collected points are then passed to the onPaint method implemented in the sepcliazed PaintManipulator.
Members¶
PolygonMesh | mesh | the mesh being painted. |
Ray | ray | The ray generated from the mouse event. |
Integer[] | pointIds | point ids of the points inside the paint brush during this update. |
Scalar[] | distances | the distances of the points from the center of the brush. |
Scalar[] | weights | weights computed based on a cosine falloff of the points, multiplied by the brush strength. |
SurfacePaintManipulator_StrokePoint (object)¶
バージョン 1.12.0 で追加.
A struct representing a single point in a paint stroke path. This structure is use to gather data from the geometry being painted. Used in the ‘collectPointsProduce’ and ‘collectPointsReduce’ MapReduce call. during painting.
注釈
The SurfacePaintManipulator generates an array of these structs
Members¶
InlineInstance | instance | |
GeometryLocation | location | |
Vec3 | objectSpacePoint | |
Vec3 | worldSpacePoint |
Methods¶
SurfacePaintManipulator_StrokePoint ( in InlineInstance instance, in GeometryLocation location, in Vec3 objectSpacePoint, in Vec3 worldSpacePoint ) | |
SurfacePaintManipulator_StrokePoint ( in SurfacePaintManipulator_StrokePoint other ) | |
SurfacePaintManipulator_StrokePoint () | |
SurfacePaintManipulator_StrokePoint | clone ? () |
SurfacePaintManipulator (object)¶
バージョン 1.12.0 で追加.
The SurfacePaintManipulator provides base services for a wide range of paint based manipulators. You can use the SurfacePaintManipulator as the basis for your own custom paint manipulators.
The SurfacePaintManipulator provides the following services.
- It manages an array of target geometries.
- It manages the processing of events to generate a paint stroke.
- It raycasts the target geometries and collects the points within the brush volume into a data structure called SurfacePaintManipulator_PointCollection
- It invokes the virtual methods defined in ISurfacePaintManipulator to enable derived manipulators to apply the paint data to the scene.
The SurfacePaintManipulator supports painting tools that can paint multiple geometries in a single point stroke.
Derived paint manipulators overide the ‘onStrokeBegin’, ‘onPaint’ and ‘onStrokeEnd’ methods to compute a change in the scene.
Usage¶
- A Click and drag with a mouse button generates a paint stroke
- At the start of the paint stroke the ‘onStrokeBegin’ function to be invoked
- Each update of the paint stroke causes ‘onPaint’ function to be invoked
- At the end of the paint stroke the ‘onStrokeEnd’ function to be invoked
- The mouse wheel can be used to resize the paint brush, except on platforms that do not support the mouse wheel.
- The ‘Ctrl’ modifier key can be held during a mouse drag to resize the brush on these platforms.
Members¶
InlineInstance[] | targetGeometries | |
SurfacePaintManipulator_StrokePoint[] | strokePath | The stroke points making up the current paint stroke. |
SurfacePaintManipulator_State | state | |
Scalar | brushSize | |
Scalar | brushStrength | |
Scalar | brushScaleSpeed | |
Scalar | mouseDownBrushSize | |
Vec2 | mouseDownScreenPos | |
InlineMaterial | paintBrushMaterial | |
InlineInstance | paintBrush | |
String | portToDrive | |
String | hostName | |
String | graphName | |
UInt32 | evalID |
Methods¶
SurfacePaintManipulator ( in SurfacePaintManipulator other ) | |
SurfacePaintManipulator () | |
addTargetGeometry ! ( in InlineInstance instance ) | |
SurfacePaintManipulator | clone ? () |
Boolean | hasTargetGeometry ! ( in InlineInstance instance ) |
init ! () | |
onDisable ! () | |
onEnable ! () | |
onEvent ! ( io Event event ) | |
onPaint ! ( io MouseEvent mouseEvent, in SurfacePaintManipulator_PointCollection collectedPoints ) | |
onStrokeBegin ! ( io MouseEvent mouseEvent ) | |
onStrokeEnd ! ( io MouseEvent mouseEvent ) | |
setGraph ! ( in String graphName ) | |
setPortToDrive ! ( in String portName ) | |
updateBrush ! ( io Event event, in Vec2 mousePos ) |