Rumba C++ SDK
maquina::BrushPlugin Class Reference

#include <BrushPlugin.h>

Inheritance diagram for maquina::BrushPlugin:
maquina::ToolPlugin maquina::NodePlugin maquina::BrushSculptPlugin

Classes

class  GeometryData
 

Public Types

enum  BrushType { BrushType::surface = 0, BrushType::geodesic, BrushType::volume }
 The different brush types. More...
 

Public Member Functions

 BrushPlugin (Node *node)
 
BrushPlugin operator= (const BrushPlugin &)=delete
 
void activate () override
 From ToolPlugin. More...
 
void deactivate () override
 
void on_mouse_press (const CameraContext &camera, const InteractionContext &interaction) override
 
void on_mouse_move (const CameraContext &camera, const InteractionContext &interaction) override
 
void on_mouse_release (const CameraContext &camera, const InteractionContext &interaction) override
 
bool override_selection () override
 
bool track_mouse () override
 
bool manipulates () override
 
virtual void stroke_begin (int modifiers)
 Called when the stroke is beginning. More...
 
virtual void stroke_update (bool first, bool finished)
 Called when the brush moves or have been released. More...
 
virtual void update_weights (bool first, const Imath::M44f &previous_brush_matrix)
 Update the brush weights. More...
 
virtual bool do_update_weights ()
 Does the weights have to be updated at every stroke_update() ? More...
 
virtual float weight (float)
 Convert a distance in weight. More...
 
virtual void update_brush_matrix (const CameraContext &camera, const InteractionContext &interaction, bool &visible, Imath::M44f &brush_matrix, bool on_press)
 Update the brush position and visibility. More...
 
virtual float radius ()
 Get the brush radius. More...
 
void set_radius (float radius)
 Set the brush radius. More...
 
virtual float flow ()
 Get the brush accumulation flow. More...
 
virtual bool multi_objects ()
 Get the multi objects state. More...
 
virtual bool fast_geodesic ()
 Get the geodesic state. More...
 
virtual SceneConst scene ()
 Get the displayed scene. More...
 
virtual BrushType brush_type ()
 Get the brush type. More...
 
gsl::span< GeometryDatageometry_data ()
 Return the brush's geometry data. More...
 
Imath::V3f hit_pos_world () const
 Return the brush position in world space. More...
 
const Imath::V3fhit_normal_world () const
 Return the brush normal in world space. More...
 
Imath::V3f hit_pos_world_orig () const
 Returns the world space brush position at the beginning of the stroke. More...
 
const Imath::V3fhit_normal_world_orig () const
 Return the brush normal in world space at the beginning of the stroke. More...
 
const Imath::M44fbrush_matrix () const
 Return the brush matrix which transforms from the brush local space to the world space. More...
 
const Imath::M44fbrush_matrix_orig () const
 Return the brush matrix which transforms from the brush local space to the world space at the beginning of the stroke. More...
 
bool is_brush_visible () const
 Returns true is the brush is visible. More...
 
bool is_pressed () const
 Returns true is the brush is pressed by the user. More...
 
- Public Member Functions inherited from maquina::ToolPlugin
 ToolPlugin (Node *node)
 
virtual bool on_key_press (int32_t key, int32_t modifiers)
 Called when a key is pressed while the tool is active. More...
 
virtual bool on_key_release (int32_t key, int32_t modifiers)
 Called when a key is released while the tool is active. More...
 
virtual Array get_help (const char *tool)
 
virtual Array get_status (const char *tool)
 
- Public Member Functions inherited from maquina::NodePlugin
 NodePlugin (Node *node)
 
virtual ~NodePlugin ()
 
virtual void on_first_init (bool)
 Perform the one shot initialization tasks for this node. More...
 
virtual void on_delete (bool)
 Prepare the node to be deleted. More...
 
virtual void on_add_to_document ()
 Callback called when the node is added to the document. More...
 
virtual void on_remove_from_document ()
 Callback called when the node is removed from the document. More...
 
virtual void on_input_connection (const Plug &, const Plug &, bool)
 Callback called when an a connection has been done between an output plug and a plug of this node as input. More...
 
virtual void on_output_connection (const Plug &, const Plug &, bool)
 Callback called when an a connection has been done between a plug of this node as output and an input plug. More...
 
virtual void on_input_disconnection (const Plug &, const Plug &)
 Callback called when an a connection has been broken between an output plug and a plug of this node as input. More...
 
virtual void on_output_disconnection (const Plug &, const Plug &)
 Callback called when an a connection has been broken between a plug of this node as output and an input plug. More...
 
virtual void relationship (NodeSet &set) const
 Return the node relationships. More...
 
virtual std::shared_ptr< NodeDelegatenode_delegate () const
 Return a node delegate for this node. More...
 
Node node () const
 Returns the Node interface for this object. More...
 
virtual std::string selection_path () const
 Returns the node delegate path to use to select that node. More...
 

Member Enumeration Documentation

◆ BrushType

The different brush types.

Enumerator
surface 

The brush is oriented using the hit surface normal and paints only the vertices closer to the surface than radius/2. The weight is computed using the 2d distance in the surface tangent plane.

geodesic 

The brush selects all the vertices around the brush position using the geodesic distance. The weight is computed using the geodesic distance.

volume 

The brush selects all the vertices around the brush position using the radius. The weight is computed using the 3d distance to the brush.

Constructor & Destructor Documentation

◆ BrushPlugin()

maquina::BrushPlugin::BrushPlugin ( Node node)

Member Function Documentation

◆ activate()

void maquina::BrushPlugin::activate ( )
overridevirtual

From ToolPlugin.

Reimplemented from maquina::ToolPlugin.

◆ brush_matrix()

const Imath::M44f & maquina::BrushPlugin::brush_matrix ( ) const
inline

Return the brush matrix which transforms from the brush local space to the world space.

◆ brush_matrix_orig()

const Imath::M44f & maquina::BrushPlugin::brush_matrix_orig ( ) const
inline

Return the brush matrix which transforms from the brush local space to the world space at the beginning of the stroke.

◆ brush_type()

virtual BrushType maquina::BrushPlugin::brush_type ( )
virtual

Get the brush type.

Return the editable scene as it appears in the viewport.

The default implementation returns the value of the brush_type plug.

Called by BrushPlugin. To be implemented by the plug-in.

◆ deactivate()

void maquina::BrushPlugin::deactivate ( )
overridevirtual

Reimplemented from maquina::ToolPlugin.

Reimplemented in maquina::BrushSculptPlugin.

◆ do_update_weights()

virtual bool maquina::BrushPlugin::do_update_weights ( )
inlinevirtual

Does the weights have to be updated at every stroke_update() ?

Return true if update_weights() must be called to update the weights at every stroke updates, or false if the weights have to be computed only at the beginning of the stroke.

The default implementation returns true.

Called by BrushPlugin. To be implemented by the plug-in.

◆ fast_geodesic()

virtual bool maquina::BrushPlugin::fast_geodesic ( )
virtual

Get the geodesic state.

Return true if the bursh uses fast geodesic computation, false otherwise.

The default implementation returns the value of the fast_geodesic plug.

Called by BrushPlugin. To be implemented by the plug-in.

◆ flow()

virtual float maquina::BrushPlugin::flow ( )
virtual

Get the brush accumulation flow.

The flow value must be between ]0, 1].

The flow control how fast the accumulation buffer saturates to one along the strokes. A value of 1 fill the accumulation buffer after a single stroke.

A value close to 0 fill the accumulation buffer slowly.

The default implementation returns the value of the flow plug.

Called by BrushPlugin. To be implemented by the plug-in.

◆ geometry_data()

gsl::span< BrushPlugin::GeometryData > maquina::BrushPlugin::geometry_data ( )
inline

Return the brush's geometry data.

Every geometry which may be painted by the brush have a geometry data.

◆ hit_normal_world()

const Imath::V3f & maquina::BrushPlugin::hit_normal_world ( ) const
inline

Return the brush normal in world space.

◆ hit_normal_world_orig()

const Imath::V3f & maquina::BrushPlugin::hit_normal_world_orig ( ) const
inline

Return the brush normal in world space at the beginning of the stroke.

◆ hit_pos_world()

Imath::V3f maquina::BrushPlugin::hit_pos_world ( ) const
inline

Return the brush position in world space.

◆ hit_pos_world_orig()

Imath::V3f maquina::BrushPlugin::hit_pos_world_orig ( ) const
inline

Returns the world space brush position at the beginning of the stroke.

◆ is_brush_visible()

bool maquina::BrushPlugin::is_brush_visible ( ) const
inline

Returns true is the brush is visible.

◆ is_pressed()

bool maquina::BrushPlugin::is_pressed ( ) const
inline

Returns true is the brush is pressed by the user.

◆ manipulates()

bool maquina::BrushPlugin::manipulates ( )
overridevirtual

Reimplemented from maquina::ToolPlugin.

◆ multi_objects()

virtual bool maquina::BrushPlugin::multi_objects ( )
virtual

Get the multi objects state.

Return true if the bursh can paint over multiple geometry at once, false otherwise.

The default implementation returns the value of the multi_object plug.

Called by BrushPlugin. To be implemented by the plug-in.

◆ on_mouse_move()

void maquina::BrushPlugin::on_mouse_move ( const CameraContext camera,
const InteractionContext interaction 
)
overridevirtual

Reimplemented from maquina::ToolPlugin.

◆ on_mouse_press()

void maquina::BrushPlugin::on_mouse_press ( const CameraContext camera,
const InteractionContext interaction 
)
overridevirtual

Reimplemented from maquina::ToolPlugin.

◆ on_mouse_release()

void maquina::BrushPlugin::on_mouse_release ( const CameraContext camera,
const InteractionContext interaction 
)
overridevirtual

Reimplemented from maquina::ToolPlugin.

◆ operator=()

BrushPlugin maquina::BrushPlugin::operator= ( const BrushPlugin )
delete

◆ override_selection()

bool maquina::BrushPlugin::override_selection ( )
overridevirtual

Reimplemented from maquina::ToolPlugin.

◆ radius()

virtual float maquina::BrushPlugin::radius ( )
virtual

Get the brush radius.

Return the brush radius in world space. Only the vertices whom the distance from the brush is smaller than this radius have a chance to be stroked by the brush.

The default implementation returns the value of the radius plug.

Called by BrushPlugin. To be implemented by the plug-in.

◆ scene()

virtual SceneConst maquina::BrushPlugin::scene ( )
virtual

Get the displayed scene.

Return the editable scene as it appears in the viewport.

The default implementation returns the value of the scene plug.

Called by BrushPlugin. To be implemented by the plug-in.

◆ set_radius()

void maquina::BrushPlugin::set_radius ( float  radius)

Set the brush radius.

◆ stroke_begin()

virtual void maquina::BrushPlugin::stroke_begin ( int  modifiers)
virtual

Called when the stroke is beginning.

Called by BrushPlugin::on_mouse_move. To be implemented by the plug-in.

Reimplemented in maquina::BrushSculptPlugin.

◆ stroke_update()

virtual void maquina::BrushPlugin::stroke_update ( bool  first,
bool  finished 
)
virtual

Called when the brush moves or have been released.

finished is true if the stroke is over.

Called by BrushPlugin::on_mouse_press and BrushPlugin::on_mouse_move. To be implemented by the plug-in.

Parameters
firsttrue if this is the first stroke update
finishedtrue if this is the last stroke update (after a mouse release)

Reimplemented in maquina::BrushSculptPlugin.

◆ track_mouse()

bool maquina::BrushPlugin::track_mouse ( )
overridevirtual

Reimplemented from maquina::ToolPlugin.

◆ update_brush_matrix()

virtual void maquina::BrushPlugin::update_brush_matrix ( const CameraContext camera,
const InteractionContext interaction,
bool &  visible,
Imath::M44f brush_matrix,
bool  on_press 
)
virtual

Update the brush position and visibility.

The plug-in can override the default behavior to specify custom brush matrix and visibility state.

The default implementation computes a brush matrix by intersecting the editable geometries. Visible is set to true in case an intersection has been found, false otherwise.

Called by BrushPlugin. To be implemented by the plug-in.

◆ update_weights()

virtual void maquina::BrushPlugin::update_weights ( bool  first,
const Imath::M44f previous_brush_matrix 
)
virtual

Update the brush weights.

A plug-in can override this call to pre-compute data before the weight() calls.

Called by BrushPlugin::on_mouse_press and BrushPlugin::on_mouse_move. To be implemented by the plug-in.

Parameters
firsttrue if this is the first stroke update
previous_brush_matrixThe previous brush matrix, if first is true, this is the current brush_matrix.

◆ weight()

virtual float maquina::BrushPlugin::weight ( float  )
inlinevirtual

Convert a distance in weight.

The distance is in the same units than the radius. The plug-in can override the default behavior to propose complex weight functions to the user.

The default implementation returns 1.

Called by BrushPlugin::update_weights. To be implemented by the plug-in.


The documentation for this class was generated from the following file: