Blender V5.0
blender::ed::pointcloud Namespace Reference

Namespaces

namespace  pointcloud_delete
namespace  undo

Classes

struct  FindClosestData

Functions

void operatortypes_pointcloud ()
void operatormacros_pointcloud ()
void keymap_pointcloud (wmKeyConfig *keyconf)
void undosys_type_register (UndoType *ut)
VectorSet< PointCloud * > get_unique_editable_pointclouds (const bContext &C)
static bool active_attribute_poll (bContext *C)
static void validate_value (const bke::AttributeAccessor attributes, const StringRef name, const CPPType &type, void *buffer)
static wmOperatorStatus set_attribute_exec (bContext *C, wmOperator *op)
static wmOperatorStatus set_attribute_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static void set_attribute_ui (bContext *C, wmOperator *op)
static void duplicate_points (PointCloud &pointcloud, const IndexMask &mask)
static wmOperatorStatus duplicate_exec (bContext *C, wmOperator *)
static bool object_has_editable_pointcloud (const Main &bmain, const Object &object)
static bool pointcloud_poll_impl (bContext *C, const bool check_editable, const bool check_edit_mode)
static bool editable_pointcloud_poll (bContext *C)
static bool has_anything_selected (const Span< PointCloud * > pointclouds)
static wmOperatorStatus select_all_exec (bContext *C, wmOperator *op)
static void POINTCLOUD_OT_select_all (wmOperatorType *ot)
static wmOperatorStatus select_random_exec (bContext *C, wmOperator *op)
static void select_random_ui (bContext *, wmOperator *op)
static void POINTCLOUD_OT_select_random (wmOperatorType *ot)
static void POINTCLOUD_OT_delete (wmOperatorType *ot)
static void invert_selection (MutableSpan< float > selection, const IndexMask &mask)
static void invert_selection (GMutableSpan selection, const IndexMask &mask)
static void select_all (PointCloud &pointcloud, const IndexMask &mask, int action)
static bool apply_selection_operation (PointCloud &pointcloud, const IndexMask &mask, eSelectOp sel_op)
static FindClosestData closer_elem (const FindClosestData &a, const FindClosestData &b)
static wmOperatorStatus separate_exec (bContext *C, wmOperator *)
Selection

Selection on point cloud are stored per-point. It can be stored with a float or boolean data-type. The boolean data-type is faster, smaller, and corresponds better to edit-mode selections, but the float data type is useful for soft selection (like masking) in sculpt mode.

The attribute API is used to do the necessary type and domain conversions when necessary, and can handle most interaction with the selection attribute, but these functions implement some helpful utilities on top of that.

void fill_selection_true (GMutableSpan span)
void fill_selection_false (GMutableSpan selection, const IndexMask &mask)
void fill_selection_true (GMutableSpan selection, const IndexMask &mask)
bool has_anything_selected (const PointCloud &pointcloud)
void select_all (PointCloud &pointcloud, int action)
bke::GSpanAttributeWriter ensure_selection_attribute (PointCloud &pointcloud, bke::AttrType create_type)
bool select_box (PointCloud &pointcloud, const ARegion &region, const float4x4 &projection, const rcti &rect, const eSelectOp sel_op)
bool select_lasso (PointCloud &pointcloud, const ARegion &region, const float4x4 &projection, const Span< int2 > lasso_coords, const eSelectOp sel_op)
bool select_circle (PointCloud &pointcloud, const ARegion &region, const float4x4 &projection, const int2 coord, const float radius, const eSelectOp sel_op)
std::optional< FindClosestDatafind_closest_point_to_screen_co (const ARegion &region, const Span< float3 > positions, const float4x4 &projection, const IndexMask &points_mask, const float2 mouse_pos, const float radius, const FindClosestData &initial_closest)
IndexMask retrieve_selected_points (const PointCloud &pointcloud, IndexMaskMemory &memory)
Editing
bool remove_selection (PointCloud &pointcloud)
PointCloudcopy_selection (const PointCloud &src, const IndexMask &mask)
Poll Functions
bool editable_pointcloud_in_edit_mode_poll (bContext *C)
Operators
void POINTCLOUD_OT_attribute_set (wmOperatorType *ot)
void POINTCLOUD_OT_duplicate (wmOperatorType *ot)
void POINTCLOUD_OT_separate (wmOperatorType *ot)
wmOperatorStatus join_objects_exec (bContext *C, wmOperator *op)

Function Documentation

◆ active_attribute_poll()

bool blender::ed::pointcloud::active_attribute_poll ( bContext * C)
static

◆ apply_selection_operation()

◆ closer_elem()

FindClosestData blender::ed::pointcloud::closer_elem ( const FindClosestData & a,
const FindClosestData & b )
static

Definition at line 233 of file selection.cc.

References b, and blender::ed::pointcloud::FindClosestData::distance_sq.

◆ copy_selection()

◆ duplicate_exec()

◆ duplicate_points()

◆ editable_pointcloud_in_edit_mode_poll()

bool blender::ed::pointcloud::editable_pointcloud_in_edit_mode_poll ( bContext * C)

◆ editable_pointcloud_poll()

bool blender::ed::pointcloud::editable_pointcloud_poll ( bContext * C)
static

Definition at line 68 of file operators.cc.

References C, and pointcloud_poll_impl().

Referenced by POINTCLOUD_OT_select_all(), and POINTCLOUD_OT_select_random().

◆ ensure_selection_attribute()

bke::GSpanAttributeWriter blender::ed::pointcloud::ensure_selection_attribute ( PointCloud & pointcloud,
bke::AttrType create_type )

◆ fill_selection_false()

void blender::ed::pointcloud::fill_selection_false ( GMutableSpan selection,
const IndexMask & mask )

◆ fill_selection_true() [1/2]

void blender::ed::pointcloud::fill_selection_true ( GMutableSpan selection,
const IndexMask & mask )

◆ fill_selection_true() [2/2]

void blender::ed::pointcloud::fill_selection_true ( GMutableSpan span)

◆ find_closest_point_to_screen_co()

std::optional< FindClosestData > blender::ed::pointcloud::find_closest_point_to_screen_co ( const ARegion & region,
const Span< float3 > positions,
const float4x4 & projection,
const IndexMask & points_mask,
const float2 mouse_pos,
const float radius,
const FindClosestData & initial_closest )

◆ get_unique_editable_pointclouds()

◆ has_anything_selected() [1/2]

bool blender::ed::pointcloud::has_anything_selected ( const PointCloud & pointcloud)

Return true if any element is selected, on either domain with either type.

Definition at line 25 of file selection.cc.

References blender::array_utils::contains(), and blender::VArrayCommon< T >::index_range().

Referenced by select_all_exec(), and select_random_exec().

◆ has_anything_selected() [2/2]

bool blender::ed::pointcloud::has_anything_selected ( const Span< PointCloud * > pointclouds)
static

Definition at line 99 of file operators.cc.

References blender::Span< T >::begin(), and blender::Span< T >::end().

◆ invert_selection() [1/2]

void blender::ed::pointcloud::invert_selection ( GMutableSpan selection,
const IndexMask & mask )
static

◆ invert_selection() [2/2]

void blender::ed::pointcloud::invert_selection ( MutableSpan< float > selection,
const IndexMask & mask )
static

Definition at line 86 of file selection.cc.

References i, and mask().

Referenced by apply_selection_operation(), invert_selection(), and select_all().

◆ join_objects_exec()

wmOperatorStatus blender::ed::pointcloud::join_objects_exec ( bContext * C,
wmOperator * op )

Definition at line 27 of file pointcloud/intern/join.cc.

References blender::bke::Instances::add_new_reference(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Vector< T, InlineBufferCapacity, Allocator >::as_span(), blender::ed::object::base_free_and_unlink(), BKE_pointcloud_copy_for_eval(), BKE_pointcloud_nomain_to_pointcloud(), BKE_report(), BLI_assert, C, CTX_data_active_object(), CTX_DATA_BEGIN, CTX_DATA_END, CTX_data_main(), CTX_data_scene(), blender::Vector< T, InlineBufferCapacity, Allocator >::data(), Object::data, DEG_id_tag_update(), DEG_relations_tag_update(), blender::bke::GeometrySet::from_instances(), blender::bke::GeometrySet::from_pointcloud(), blender::geometry::RealizeInstancesResult::geometry, blender::bke::GeometrySet::get_component_for_write(), blender::bke::GeometrySet::has_pointcloud(), i, Object::id, Scene::id, ID_RECALC_GEOMETRY, ID_RECALC_SELECT, ID_RECALC_TRANSFORM, blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_or_add_cb(), NC_SCENE, ND_LAYER_CONTENT, ND_OB_ACTIVE, OB_POINTCLOUD, OPERATOR_CANCELLED, OPERATOR_FINISHED, blender::bke::ReadOnly, blender::geometry::realize_instances(), blender::bke::Instances::reference_handles_for_write(), wmOperator::reports, blender::bke::Instances::resize(), RPT_WARNING, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::bke::Instances::transforms_for_write(), Object::type, and WM_event_add_notifier().

Referenced by blender::ed::object::object_join_exec().

◆ keymap_pointcloud()

void blender::ed::pointcloud::keymap_pointcloud ( wmKeyConfig * keyconf)

◆ object_has_editable_pointcloud()

bool blender::ed::pointcloud::object_has_editable_pointcloud ( const Main & bmain,
const Object & object )
static

Definition at line 33 of file operators.cc.

References BKE_id_is_editable(), data, OB_MODE_EDIT, and OB_POINTCLOUD.

Referenced by get_unique_editable_pointclouds().

◆ operatormacros_pointcloud()

void blender::ed::pointcloud::operatormacros_pointcloud ( )

◆ operatortypes_pointcloud()

◆ POINTCLOUD_OT_attribute_set()

◆ POINTCLOUD_OT_delete()

void blender::ed::pointcloud::POINTCLOUD_OT_delete ( wmOperatorType * ot)
static

◆ POINTCLOUD_OT_duplicate()

void blender::ed::pointcloud::POINTCLOUD_OT_duplicate ( wmOperatorType * ot)

◆ POINTCLOUD_OT_select_all()

void blender::ed::pointcloud::POINTCLOUD_OT_select_all ( wmOperatorType * ot)
static

◆ POINTCLOUD_OT_select_random()

void blender::ed::pointcloud::POINTCLOUD_OT_select_random ( wmOperatorType * ot)
static

◆ POINTCLOUD_OT_separate()

void blender::ed::pointcloud::POINTCLOUD_OT_separate ( wmOperatorType * ot)

◆ pointcloud_poll_impl()

bool blender::ed::pointcloud::pointcloud_poll_impl ( bContext * C,
const bool check_editable,
const bool check_edit_mode )
static

◆ remove_selection()

bool blender::ed::pointcloud::remove_selection ( PointCloud & pointcloud)

Remove selected points based on the ".selection" attribute.

Returns
true if any point was removed.

Definition at line 32 of file edit.cc.

References BKE_pointcloud_nomain_to_pointcloud(), copy_selection(), blender::IndexMask::from_bools_inverse(), blender::bke::AttributeAccessor::lookup_or_default(), mask(), and blender::bke::Point.

Referenced by blender::ed::pointcloud::pointcloud_delete::delete_exec().

◆ retrieve_selected_points()

◆ select_all() [1/2]

◆ select_all() [2/2]

void blender::ed::pointcloud::select_all ( PointCloud & pointcloud,
int action )

(De)select all the points.

Parameters
actionOne of SEL_TOGGLE, SEL_SELECT, SEL_DESELECT, or SEL_INVERT. See ED_select_utils.hh.

Definition at line 128 of file selection.cc.

References select_all().

Referenced by select_all(), and select_all_exec().

◆ select_all_exec()

◆ select_box()

bool blender::ed::pointcloud::select_box ( PointCloud & pointcloud,
const ARegion & region,
const float4x4 & projection,
const rcti & rect,
const eSelectOp sel_op )

◆ select_circle()

bool blender::ed::pointcloud::select_circle ( PointCloud & pointcloud,
const ARegion & region,
const float4x4 & projection,
const int2 coord,
const float radius,
const eSelectOp sel_op )

◆ select_lasso()

bool blender::ed::pointcloud::select_lasso ( PointCloud & pointcloud,
const ARegion & region,
const float4x4 & projection,
const Span< int2 > lasso_coords,
const eSelectOp sel_op )

◆ select_random_exec()

◆ select_random_ui()

void blender::ed::pointcloud::select_random_ui ( bContext * ,
wmOperator * op )
static

◆ separate_exec()

◆ set_attribute_exec()

◆ set_attribute_invoke()

◆ set_attribute_ui()

◆ undosys_type_register()

◆ validate_value()