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

Classes

class  MeshState
struct  GeoOperatorLog

Enumerations

enum class  ConvertAttributeMode { Generic = 0 , VertexGroup = 1 }

Functions

static bool geometry_attributes_poll (bContext *C)
static bool geometry_attributes_remove_poll (bContext *C)
static const EnumPropertyItemgeometry_attribute_domain_itemf (bContext *C, PointerRNA *, PropertyRNA *, bool *r_free)
static wmOperatorStatus geometry_attribute_add_exec (bContext *C, wmOperator *op)
static wmOperatorStatus geometry_attribute_add_invoke (bContext *C, wmOperator *op, const wmEvent *event)
void GEOMETRY_OT_attribute_add (wmOperatorType *ot)
static wmOperatorStatus geometry_attribute_remove_exec (bContext *C, wmOperator *op)
void GEOMETRY_OT_attribute_remove (wmOperatorType *ot)
static wmOperatorStatus geometry_color_attribute_add_exec (bContext *C, wmOperator *op)
static wmOperatorStatus geometry_color_attribute_add_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static bool geometry_attribute_convert_poll (bContext *C)
bool convert_attribute (AttributeOwner &owner, bke::MutableAttributeAccessor attributes, const StringRef name, const bke::AttrDomain dst_domain, const bke::AttrType dst_type, ReportList *reports)
static wmOperatorStatus geometry_attribute_convert_exec (bContext *C, wmOperator *op)
static void geometry_color_attribute_add_ui (bContext *, wmOperator *op)
void GEOMETRY_OT_color_attribute_add (wmOperatorType *ot)
static wmOperatorStatus geometry_color_attribute_set_render_exec (bContext *C, wmOperator *op)
void GEOMETRY_OT_color_attribute_render_set (wmOperatorType *ot)
static wmOperatorStatus geometry_color_attribute_remove_exec (bContext *C, wmOperator *op)
static bool geometry_color_attributes_remove_poll (bContext *C)
void GEOMETRY_OT_color_attribute_remove (wmOperatorType *ot)
static wmOperatorStatus geometry_color_attribute_duplicate_exec (bContext *C, wmOperator *op)
static bool geometry_color_attributes_duplicate_poll (bContext *C)
void GEOMETRY_OT_color_attribute_duplicate (wmOperatorType *ot)
static wmOperatorStatus geometry_attribute_convert_invoke (bContext *C, wmOperator *op, const wmEvent *)
static void geometry_attribute_convert_ui (bContext *C, wmOperator *op)
static const EnumPropertyItemgeometry_attribute_convert_mode_itemf (bContext *C, PointerRNA *, PropertyRNA *, bool *r_free)
static bool geometry_color_attribute_convert_poll (bContext *C)
static wmOperatorStatus geometry_color_attribute_convert_exec (bContext *C, wmOperator *op)
static wmOperatorStatus geometry_color_attribute_convert_invoke (bContext *C, wmOperator *op, const wmEvent *)
static void geometry_color_attribute_convert_ui (bContext *, wmOperator *op)
void GEOMETRY_OT_color_attribute_convert (wmOperatorType *ot)
void GEOMETRY_OT_attribute_convert (wmOperatorType *ot)
void GEOMETRY_OT_geometry_randomization (wmOperatorType *ot)
void operatortypes_geometry ()
static wmOperatorStatus geometry_randomization_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus geometry_randomization_exec (bContext *C, wmOperator *op)
Attribute Value RNA Property Helpers

Functions to make it easier to register RNA properties for the various attribute types and retrieve/set their values.

StringRefNull rna_property_name_for_type (const bke::AttrType type)
PropertyRNArna_property_for_type (PointerRNA &ptr, const bke::AttrType type)
void register_rna_properties_for_attribute_types (StructRNA &srna)
GPointer rna_property_for_attribute_type_retrieve_value (PointerRNA &ptr, const bke::AttrType type, void *buffer)
void rna_property_for_attribute_type_set_value (PointerRNA &ptr, PropertyRNA &prop, const GPointer value)
bool attribute_set_poll (bContext &C, const ID &object_data)
Operator
void GEOMETRY_OT_execute_node_group (wmOperatorType *ot)
static const bNodeTreeget_asset_or_local_node_group (const bContext &C, PointerRNA &ptr, ReportList *reports)
static const bNodeTreeget_node_group (const bContext &C, PointerRNA &ptr, ReportList *reports)
static GeoOperatorLogget_static_eval_log ()
const GeoOperatorLognode_group_operator_static_eval_log ()
static void find_socket_log_contexts (const Main &bmain, Set< ComputeContextHash > &r_socket_log_contexts)
static const ImplicitSharingInfoget_vertex_group_sharing_info (const Mesh &mesh)
static std::string shape_key_attribute_name (const KeyBlock &kb)
static void add_shape_keys_as_attributes (Mesh &mesh, const Key &key)
static void store_attributes_to_shape_keys (const Mesh &mesh, Key &key)
static void remove_shape_key_attributes (Mesh &mesh, const Key &key)
static bke::GeometrySet get_original_geometry_eval_copy (Depsgraph &depsgraph, Object &object, nodes::GeoNodesOperatorData &operator_data, Vector< MeshState > &orig_mesh_states)
static void store_result_geometry (const bContext &C, const wmOperator &op, const Depsgraph &depsgraph, Main &bmain, Scene &scene, Object &object, const RegionView3D *rv3d, bke::GeometrySet geometry)
static void gather_node_group_ids (const bNodeTree &node_tree, Set< ID * > &ids)
static const bNodeTreeInterfaceSocketfind_group_input_by_identifier (const bNodeTree &node_group, const StringRef identifier)
static std::optional< ID_Typesocket_type_to_id_type (const eNodeSocketDatatype socket_type)
static Map< StringRef, ID * > gather_input_ids (const Main &bmain, const bNodeTree &node_group, const IDProperty &properties)
static Depsgraph * build_extra_depsgraph (const Depsgraph &depsgraph_active, const Set< ID * > &ids)
static IDPropertyreplace_strings_with_id_pointers (const IDProperty &op_properties, const Map< StringRef, ID * > &input_ids)
static void replace_inputs_evaluated_data_blocks (IDProperty &properties, const nodes::GeoNodesOperatorDepsgraphs &depsgraphs)
static bool object_has_editable_data (const Main &bmain, const Object &object)
static Vector< Object * > gather_supported_objects (const bContext &C, const Main &bmain, const eObjectMode mode)
static wmOperatorStatus run_node_group_exec (bContext *C, wmOperator *op)
static void store_input_node_values_rna_props (const bContext &C, wmOperator &op, const wmEvent &event)
static wmOperatorStatus run_node_group_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static std::string run_node_group_get_description (bContext *C, wmOperatorType *, PointerRNA *ptr)
static void run_node_group_ui (bContext *C, wmOperator *op)
static bool run_node_ui_poll (wmOperatorType *, PointerRNA *ptr)
static std::string run_node_group_get_name (wmOperatorType *, PointerRNA *ptr)
static bool run_node_group_depends_on_cursor (bContext &C, wmOperatorType &, PointerRNA *ptr)
Menu
static bool asset_menu_poll (const bContext *C, MenuType *)
static GeometryNodeAssetTraitFlag asset_flag_for_context (const ObjectType type, const eObjectMode mode)
static GeometryNodeAssetTraitFlag asset_flag_for_context (const Object &active_object)
static asset::AssetItemTreeget_static_item_tree (const ObjectType type, const eObjectMode mode)
static asset::AssetItemTreeget_static_item_tree (const Object &active_object)
void clear_operator_asset_trees ()
static asset::AssetItemTree build_catalog_tree (const bContext &C, const Object &active_object)
static Set< std::string > get_builtin_menus (const ObjectType object_type, const eObjectMode mode)
static void catalog_assets_draw (const bContext *C, Menu *menu)
MenuType node_group_operator_assets_menu ()
static bool unassigned_local_poll (const bContext &C)
static void catalog_assets_draw_unassigned (const bContext *C, Menu *menu)
MenuType node_group_operator_assets_menu_unassigned ()
void ui_template_node_operator_asset_menu_items (uiLayout &layout, const bContext &C, const StringRef catalog_path)
void ui_template_node_operator_asset_root_items (uiLayout &layout, const bContext &C)

Variables

static EnumPropertyItem convert_attribute_mode_items []

Enumeration Type Documentation

◆ ConvertAttributeMode

Enumerator
Generic 
VertexGroup 

Definition at line 499 of file geometry_attributes.cc.

Function Documentation

◆ add_shape_keys_as_attributes()

void blender::ed::geometry::add_shape_keys_as_attributes ( Mesh & mesh,
const Key & key )
static

Support shape keys by propagating them through geometry nodes as attributes.

Definition at line 232 of file node_group_operator.cc.

References blender::bke::MutableAttributeAccessor::add(), Key::block, blender::VArray< T >::from_span(), LISTBASE_FOREACH, blender::bke::Point, Key::refkey, and shape_key_attribute_name().

Referenced by get_original_geometry_eval_copy().

◆ asset_flag_for_context() [1/2]

GeometryNodeAssetTraitFlag blender::ed::geometry::asset_flag_for_context ( const Object & active_object)
static

Definition at line 1108 of file node_group_operator.cc.

References asset_flag_for_context(), Object::mode, and Object::type.

◆ asset_flag_for_context() [2/2]

◆ asset_menu_poll()

bool blender::ed::geometry::asset_menu_poll ( const bContext * C,
MenuType *  )
static

◆ attribute_set_poll()

◆ build_catalog_tree()

◆ build_extra_depsgraph()

◆ catalog_assets_draw()

◆ catalog_assets_draw_unassigned()

◆ clear_operator_asset_trees()

◆ convert_attribute()

◆ find_group_input_by_identifier()

const bNodeTreeInterfaceSocket * blender::ed::geometry::find_group_input_by_identifier ( const bNodeTree & node_group,
const StringRef identifier )
static

Definition at line 511 of file node_group_operator.cc.

References input.

Referenced by gather_input_ids().

◆ find_socket_log_contexts()

◆ gather_input_ids()

Map< StringRef, ID * > blender::ed::geometry::gather_input_ids ( const Main & bmain,
const bNodeTree & node_group,
const IDProperty & properties )
static

Gather IDs referenced from node group input properties (the redo panel). In the end, the group input properties will be copied to contain evaluated data-blocks from the active and/or an extra depsgraph.

Definition at line 559 of file node_group_operator.cc.

References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BKE_libblock_find_name(), find_group_input_by_identifier(), IDP_foreach_property(), IDP_string_get, IDP_TYPE_FILTER_STRING, input, IDProperty::name, and socket_type_to_id_type().

Referenced by run_node_group_exec().

◆ gather_node_group_ids()

void blender::ed::geometry::gather_node_group_ids ( const bNodeTree & node_tree,
Set< ID * > & ids )
static

Gather IDs used by the node group, and the node group itself if there are any. We need to use all IDs because the only mechanism we have to replace the socket ID pointers with their evaluated counterparts is evaluating the node group data-block itself.

Definition at line 497 of file node_group_operator.cc.

References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BLI_assert, bNodeTree::id, bNodeTree::runtime, and blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size().

Referenced by run_node_group_exec().

◆ gather_supported_objects()

◆ geometry_attribute_add_exec()

◆ geometry_attribute_add_invoke()

◆ geometry_attribute_convert_exec()

◆ geometry_attribute_convert_invoke()

◆ geometry_attribute_convert_mode_itemf()

const EnumPropertyItem * blender::ed::geometry::geometry_attribute_convert_mode_itemf ( bContext * C,
PointerRNA * ,
PropertyRNA * ,
bool * r_free )
static

◆ geometry_attribute_convert_poll()

◆ geometry_attribute_convert_ui()

◆ geometry_attribute_domain_itemf()

const EnumPropertyItem * blender::ed::geometry::geometry_attribute_domain_itemf ( bContext * C,
PointerRNA * ,
PropertyRNA * ,
bool * r_free )
static

◆ geometry_attribute_remove_exec()

◆ geometry_attributes_poll()

◆ geometry_attributes_remove_poll()

bool blender::ed::geometry::geometry_attributes_remove_poll ( bContext * C)
static

◆ geometry_color_attribute_add_exec()

◆ geometry_color_attribute_add_invoke()

◆ geometry_color_attribute_add_ui()

void blender::ed::geometry::geometry_color_attribute_add_ui ( bContext * ,
wmOperator * op )
static

◆ geometry_color_attribute_convert_exec()

◆ geometry_color_attribute_convert_invoke()

◆ geometry_color_attribute_convert_poll()

◆ geometry_color_attribute_convert_ui()

void blender::ed::geometry::geometry_color_attribute_convert_ui ( bContext * ,
wmOperator * op )
static

◆ geometry_color_attribute_duplicate_exec()

◆ geometry_color_attribute_remove_exec()

◆ geometry_color_attribute_set_render_exec()

◆ geometry_color_attributes_duplicate_poll()

◆ geometry_color_attributes_remove_poll()

bool blender::ed::geometry::geometry_color_attributes_remove_poll ( bContext * C)
static

◆ GEOMETRY_OT_attribute_add()

◆ GEOMETRY_OT_attribute_convert()

◆ GEOMETRY_OT_attribute_remove()

void blender::ed::geometry::GEOMETRY_OT_attribute_remove ( wmOperatorType * ot)

◆ GEOMETRY_OT_color_attribute_add()

◆ GEOMETRY_OT_color_attribute_convert()

◆ GEOMETRY_OT_color_attribute_duplicate()

void blender::ed::geometry::GEOMETRY_OT_color_attribute_duplicate ( wmOperatorType * ot)

◆ GEOMETRY_OT_color_attribute_remove()

void blender::ed::geometry::GEOMETRY_OT_color_attribute_remove ( wmOperatorType * ot)

◆ GEOMETRY_OT_color_attribute_render_set()

void blender::ed::geometry::GEOMETRY_OT_color_attribute_render_set ( wmOperatorType * ot)

◆ GEOMETRY_OT_execute_node_group()

◆ GEOMETRY_OT_geometry_randomization()

void blender::ed::geometry::GEOMETRY_OT_geometry_randomization ( wmOperatorType * ot)

◆ geometry_randomization_exec()

◆ geometry_randomization_invoke()

wmOperatorStatus blender::ed::geometry::geometry_randomization_invoke ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

◆ get_asset_or_local_node_group()

◆ get_builtin_menus()

Set< std::string > blender::ed::geometry::get_builtin_menus ( const ObjectType object_type,
const eObjectMode mode )
static

Avoid adding a separate root catalog when the assets have already been added to one of the builtin menus. The need to define the builtin menu labels here is non-ideal. We don't have any UI introspection that can do this though.

Definition at line 1242 of file node_group_operator.cc.

References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_new(), OB_CURVES, OB_GREASE_PENCIL, OB_MESH, OB_MODE_EDIT, OB_MODE_OBJECT, OB_MODE_PAINT_GREASE_PENCIL, OB_MODE_SCULPT, OB_MODE_SCULPT_GREASE_PENCIL, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT, and OB_POINTCLOUD.

Referenced by catalog_assets_draw(), and ui_template_node_operator_asset_root_items().

◆ get_node_group()

const bNodeTree * blender::ed::geometry::get_node_group ( const bContext & C,
PointerRNA & ptr,
ReportList * reports )
static

◆ get_original_geometry_eval_copy()

bke::GeometrySet blender::ed::geometry::get_original_geometry_eval_copy ( Depsgraph & depsgraph,
Object & object,
nodes::GeoNodesOperatorData & operator_data,
Vector< MeshState > & orig_mesh_states )
static

◆ get_static_eval_log()

GeoOperatorLog & blender::ed::geometry::get_static_eval_log ( )
static

The socket value log is stored statically so it can be used in the node editor. A fancier storage system shouldn't be necessary, since the goal is just to be able to debug intermediate values when building a tool.

Definition at line 138 of file node_group_operator.cc.

References log.

Referenced by node_group_operator_static_eval_log(), run_node_group_exec(), and run_node_group_ui().

◆ get_static_item_tree() [1/2]

asset::AssetItemTree * blender::ed::geometry::get_static_item_tree ( const Object & active_object)
static

Definition at line 1193 of file node_group_operator.cc.

References get_static_item_tree(), Object::mode, and Object::type.

◆ get_static_item_tree() [2/2]

◆ get_vertex_group_sharing_info()

const ImplicitSharingInfo * blender::ed::geometry::get_vertex_group_sharing_info ( const Mesh & mesh)
static

◆ node_group_operator_assets_menu()

◆ node_group_operator_assets_menu_unassigned()

◆ node_group_operator_static_eval_log()

const GeoOperatorLog & blender::ed::geometry::node_group_operator_static_eval_log ( )

Definition at line 144 of file node_group_operator.cc.

References get_static_eval_log().

Referenced by blender::nodes::geo_eval_log::get_root_log().

◆ object_has_editable_data()

bool blender::ed::geometry::object_has_editable_data ( const Main & bmain,
const Object & object )
static

◆ operatortypes_geometry()

◆ register_rna_properties_for_attribute_types()

◆ remove_shape_key_attributes()

void blender::ed::geometry::remove_shape_key_attributes ( Mesh & mesh,
const Key & key )
static

◆ replace_inputs_evaluated_data_blocks()

void blender::ed::geometry::replace_inputs_evaluated_data_blocks ( IDProperty & properties,
const nodes::GeoNodesOperatorDepsgraphs & depsgraphs )
static

◆ replace_strings_with_id_pointers()

◆ rna_property_for_attribute_type_retrieve_value()

◆ rna_property_for_attribute_type_set_value()

◆ rna_property_for_type()

◆ rna_property_name_for_type()

◆ run_node_group_depends_on_cursor()

◆ run_node_group_exec()

wmOperatorStatus blender::ed::geometry::run_node_group_exec ( bContext * C,
wmOperator * op )
static

Definition at line 676 of file node_group_operator.cc.

References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blender::nodes::geo_eval_log::GeoTreeLog::all_warnings, blender::MatBase< T, NumCol, NumRow, Alignment >::base_ptr(), BKE_report(), BLI_SCOPED_DEFER, build_extra_depsgraph(), C, CTX_data_active_object(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), CTX_data_scene(), CTX_wm_region_view3d(), blender::nodes::GeoNodesOperatorData::cursor_position, blender::nodes::GeoNodesOperatorData::cursor_rotation, DEG_get_evaluated(), DEG_id_is_fully_evaluated(), blender::nodes::GeoNodesOperatorData::depsgraphs, blender::nodes::ensure_geometry_nodes_lazy_function_graph(), blender::nodes::geo_eval_log::GeoTreeLog::ensure_node_warnings(), blender::nodes::GeoNodesCallData::eval_log, blender::nodes::execute_geometry_nodes_on_geometry(), blender::nodes::GeoNodesOperatorDepsgraphs::extra, find_socket_log_contexts(), gather_input_ids(), gather_node_group_ids(), gather_supported_objects(), get_node_group(), get_original_geometry_eval_copy(), get_static_eval_log(), blender::ComputeContext::hash(), bNodeTree::id, IDP_FreeProperty_ex(), blender::nodes::Info, blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::is_empty(), blender::ed::geometry::GeoOperatorLog::log, blender::nodes::geo_eval_log::NodeWarning::message, blender::nodes::GeoNodesOperatorData::mode, Object::mode, blender::nodes::GeoNodesOperatorData::mouse_position, ID::name, NC_GEOM, ND_DATA, blender::ed::geometry::GeoOperatorLog::node_group_name, nullptr, OPERATOR_CANCELLED, blender::nodes::GeoNodesCallData::operator_data, OPERATOR_FINISHED, wmOperator::properties, wmOperator::ptr, blender::nodes::GeoNodesOperatorData::region_size, replace_inputs_evaluated_data_blocks(), replace_strings_with_id_pointers(), wmOperator::reports, RNA_boolean_get(), RNA_float_get_array(), RNA_int_get_array(), RPT_ERROR, RPT_INFO, RPT_WARNING, blender::nodes::GeoNodesOperatorData::scene_orig, blender::nodes::GeoNodesOperatorData::self_object_orig, blender::nodes::GeoNodesCallData::socket_log_contexts, store_result_geometry(), STREQ, blender::nodes::geo_eval_log::NodeWarning::type, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::values(), blender::nodes::GeoNodesOperatorData::viewport_is_perspective, blender::nodes::GeoNodesOperatorData::viewport_viewmat, blender::nodes::GeoNodesOperatorData::viewport_winmat, blender::math::QuaternionBase< T >::w, and WM_event_add_notifier().

Referenced by GEOMETRY_OT_execute_node_group(), and run_node_group_invoke().

◆ run_node_group_get_description()

std::string blender::ed::geometry::run_node_group_get_description ( bContext * C,
wmOperatorType * ,
PointerRNA * ptr )
static

◆ run_node_group_get_name()

std::string blender::ed::geometry::run_node_group_get_name ( wmOperatorType * ,
PointerRNA * ptr )
static

◆ run_node_group_invoke()

◆ run_node_group_ui()

◆ run_node_ui_poll()

bool blender::ed::geometry::run_node_ui_poll ( wmOperatorType * ,
PointerRNA * ptr )
static

◆ shape_key_attribute_name()

std::string blender::ed::geometry::shape_key_attribute_name ( const KeyBlock & kb)
static

◆ socket_type_to_id_type()

◆ store_attributes_to_shape_keys()

◆ store_input_node_values_rna_props()

void blender::ed::geometry::store_input_node_values_rna_props ( const bContext & C,
wmOperator & op,
const wmEvent & event )
static

Input node values are stored as operator properties in order to support redoing from the redo panel for a few reasons:

  1. Some data (like the mouse position) cannot be retrieved from the exec callback used for operator redo. Redo is meant to just call the operator again with the exact same properties.
  2. While adjusting an input in the redo panel, the user doesn't expect anything else to change. If we retrieve other data like the viewport transform on every execution, that won't be the case. We use operator RNA properties instead of operator custom data because the custom data struct isn't maintained for the redo exec call.

Definition at line 813 of file node_group_operator.cc.

References BLI_rcti_size_x(), BLI_rcti_size_y(), C, CTX_data_scene(), CTX_wm_region(), CTX_wm_region_view3d(), Scene::cursor, blender::MatBase< float, 4, 4 >::identity(), RegionView3D::is_persp, View3DCursor::location, wmEvent::mval, wmOperator::ptr, RNA_boolean_set(), RNA_float_set_array(), RNA_int_set_array(), RegionView3D::viewmat, blender::math::QuaternionBase< T >::w, RegionView3D::winmat, and ARegion::winrct.

Referenced by run_node_group_invoke().

◆ store_result_geometry()

◆ ui_template_node_operator_asset_menu_items()

◆ ui_template_node_operator_asset_root_items()

◆ unassigned_local_poll()

bool blender::ed::geometry::unassigned_local_poll ( const bContext & C)
static

Variable Documentation

◆ convert_attribute_mode_items

EnumPropertyItem blender::ed::geometry::convert_attribute_mode_items[]
static
Initial value:
= {
{int(ConvertAttributeMode::Generic), "GENERIC", 0, "Generic", ""},
{int(ConvertAttributeMode::VertexGroup), "VERTEX_GROUP", 0, "Vertex Group", ""},
{0, nullptr, 0, nullptr, nullptr},
}

Definition at line 910 of file geometry_attributes.cc.

Referenced by geometry_attribute_convert_mode_itemf(), and GEOMETRY_OT_attribute_convert().