Blender V4.3
blender::ed::geometry Namespace Reference

Classes

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 int geometry_attribute_add_exec (bContext *C, wmOperator *op)
 
static int geometry_attribute_add_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void GEOMETRY_OT_attribute_add (wmOperatorType *ot)
 
static int geometry_attribute_remove_exec (bContext *C, wmOperator *op)
 
void GEOMETRY_OT_attribute_remove (wmOperatorType *ot)
 
static int geometry_color_attribute_add_exec (bContext *C, wmOperator *op)
 
static int geometry_color_attribute_add_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static bool geometry_attribute_convert_poll (bContext *C)
 
static int 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 int geometry_color_attribute_set_render_exec (bContext *C, wmOperator *op)
 
void GEOMETRY_OT_color_attribute_render_set (wmOperatorType *ot)
 
static int 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 int 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 int geometry_attribute_convert_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
static void geometry_attribute_convert_ui (bContext *, wmOperator *op)
 
static bool geometry_color_attribute_convert_poll (bContext *C)
 
static int geometry_color_attribute_convert_exec (bContext *C, wmOperator *op)
 
static int 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)
 
static int geometry_randomization_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int 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 eCustomDataType type)
 
PropertyRNArna_property_for_type (PointerRNA &ptr, const eCustomDataType type)
 
void register_rna_properties_for_attribute_types (StructRNA &srna)
 
GPointer rna_property_for_attribute_type_retrieve_value (PointerRNA &ptr, const eCustomDataType 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 bke::GeometrySet get_original_geometry_eval_copy (Object &object, nodes::GeoNodesOperatorData &operator_data)
 
static void store_result_geometry (const wmOperator &op, Main &bmain, Scene &scene, Object &object, 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 int 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 int 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 add_attribute_search_or_value_buttons (uiLayout *layout, PointerRNA *md_ptr, const bNodeTreeInterfaceSocket &socket)
 
static void draw_property_for_socket (const bNodeTree &node_tree, uiLayout *layout, IDProperty *op_properties, PointerRNA *bmain_ptr, PointerRNA *op_ptr, const bNodeTreeInterfaceSocket &socket, const int socket_index)
 
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)
 

Enumeration Type Documentation

◆ ConvertAttributeMode

Enumerator
Generic 
VertexGroup 

Definition at line 437 of file geometry_attributes.cc.

Function Documentation

◆ add_attribute_search_or_value_buttons()

◆ asset_flag_for_context() [1/2]

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

Definition at line 996 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()

static 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()

void blender::ed::geometry::clear_operator_asset_trees ( )

◆ draw_property_for_socket()

◆ find_group_input_by_identifier()

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

Definition at line 305 of file node_group_operator.cc.

Referenced by gather_input_ids().

◆ find_socket_log_contexts()

static void blender::ed::geometry::find_socket_log_contexts ( const Main & bmain,
Set< ComputeContextHash > & r_socket_log_contexts )
static

◆ gather_input_ids()

static 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 351 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(), id_name(), IDP_foreach_property(), IDP_String, IDP_TYPE_FILTER_STRING, IDProperty::name, and socket_type_to_id_type().

Referenced by run_node_group_exec().

◆ gather_node_group_ids()

static 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 290 of file node_group_operator.cc.

References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blender::nodes::find_node_tree_dependencies(), node_tree, 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_poll()

◆ geometry_attribute_convert_ui()

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

◆ geometry_attribute_domain_itemf()

static 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()

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

◆ geometry_color_attribute_add_exec()

◆ geometry_color_attribute_add_invoke()

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

◆ geometry_color_attribute_add_ui()

static 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()

static 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()

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

◆ GEOMETRY_OT_attribute_add()

◆ GEOMETRY_OT_attribute_convert()

◆ GEOMETRY_OT_attribute_remove()

◆ GEOMETRY_OT_color_attribute_add()

◆ GEOMETRY_OT_color_attribute_convert()

◆ GEOMETRY_OT_color_attribute_duplicate()

◆ GEOMETRY_OT_color_attribute_remove()

◆ GEOMETRY_OT_color_attribute_render_set()

◆ GEOMETRY_OT_execute_node_group()

◆ GEOMETRY_OT_geometry_randomization()

◆ geometry_randomization_exec()

static int blender::ed::geometry::geometry_randomization_exec ( bContext * C,
wmOperator * op )
static

◆ geometry_randomization_invoke()

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

◆ get_asset_or_local_node_group()

◆ get_builtin_menus()

static 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 1104 of file node_group_operator.cc.

References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_new(), OB_CURVES, OB_MESH, OB_MODE_EDIT, OB_MODE_OBJECT, OB_MODE_SCULPT, 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()

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

◆ get_original_geometry_eval_copy()

static bke::GeometrySet blender::ed::geometry::get_original_geometry_eval_copy ( Object & object,
nodes::GeoNodesOperatorData & operator_data )
static

Geometry nodes currently requires working on "evaluated" data-blocks (rather than "original" data-blocks that are part of a Main data-base). This could change in the future, but for now, we need to create evaluated copies of geometry before passing it to geometry nodes. Implicit sharing lets us avoid copying attribute data though.

Definition at line 175 of file node_group_operator.cc.

References blender::nodes::GeoNodesOperatorData::active_edge_index, blender::nodes::GeoNodesOperatorData::active_face_index, blender::nodes::GeoNodesOperatorData::active_point_index, BKE_curves_copy_for_eval(), BKE_id_free(), BKE_mesh_copy_for_eval(), BKE_mesh_wrapper_ensure_mdata(), BKE_mesh_wrapper_from_editmesh(), BKE_pointcloud_copy_for_eval(), BM_mesh_active_edge_index_get(), BM_mesh_active_face_index_get(), BM_mesh_active_vert_index_get(), blender::bke::GeometrySet::from_curves(), blender::bke::GeometrySet::from_mesh(), blender::bke::GeometrySet::from_pointcloud(), OB_CURVES, OB_MESH, and OB_POINTCLOUD.

Referenced by run_node_group_exec().

◆ get_static_eval_log()

static 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 128 of file node_group_operator.cc.

References log().

Referenced by node_group_operator_static_eval_log(), and run_node_group_exec().

◆ get_static_item_tree() [1/2]

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

Definition at line 1059 of file node_group_operator.cc.

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

◆ get_static_item_tree() [2/2]

◆ node_group_operator_assets_menu()

MenuType blender::ed::geometry::node_group_operator_assets_menu ( )

◆ node_group_operator_assets_menu_unassigned()

MenuType blender::ed::geometry::node_group_operator_assets_menu_unassigned ( )

◆ node_group_operator_static_eval_log()

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

◆ object_has_editable_data()

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

Definition at line 414 of file node_group_operator.cc.

References BKE_id_is_editable(), ELEM, OB_CURVES, OB_MESH, and OB_POINTCLOUD.

Referenced by gather_supported_objects().

◆ register_rna_properties_for_attribute_types()

void blender::ed::geometry::register_rna_properties_for_attribute_types ( StructRNA & srna)

◆ replace_inputs_evaluated_data_blocks()

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

◆ replace_strings_with_id_pointers()

static IDProperty * blender::ed::geometry::replace_strings_with_id_pointers ( const IDProperty & op_properties,
const Map< StringRef, ID * > & input_ids )
static

◆ 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()

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

Definition at line 466 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, BKE_report(), BLI_SCOPED_DEFER, build_extra_depsgraph(), CTX_data_active_object(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), CTX_data_scene(), DEG_get_evaluated_id(), DEG_id_is_fully_evaluated(), DEG_id_tag_update(), blender::nodes::ensure_geometry_nodes_lazy_function_graph(), blender::nodes::geo_eval_log::GeoTreeLog::ensure_node_warnings(), blender::nodes::execute_geometry_nodes_on_geometry(), 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, ID_RECALC_GEOMETRY, IDP_FreeProperty_ex(), blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::is_empty(), blender::ed::geometry::GeoOperatorLog::log, blender::nodes::GeoNodesOperatorData::mode, Object::mode, NC_GEOM, ND_DATA, blender::ed::geometry::GeoOperatorLog::node_group_name, node_tree, OPERATOR_CANCELLED, blender::nodes::GeoNodesCallData::operator_data, OPERATOR_FINISHED, wmOperator::properties, wmOperator::ptr, 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, scene, store_result_geometry(), STREQ, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::values(), and WM_event_add_notifier().

Referenced by GEOMETRY_OT_execute_node_group(), and run_node_group_invoke().

◆ run_node_group_get_description()

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

◆ run_node_group_get_name()

static 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()

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

◆ socket_type_to_id_type()

static std::optional< ID_Type > blender::ed::geometry::socket_type_to_id_type ( const eNodeSocketDatatype socket_type)
static

◆ store_input_node_values_rna_props()

static 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 600 of file node_group_operator.cc.

References blender::MatBase< T, NumCol, NumRow, Alignment >::base_ptr(), BLI_rcti_size_x(), BLI_rcti_size_y(), CTX_data_scene(), CTX_wm_region(), CTX_wm_region_view3d(), blender::MatBase< float, 4, 4 >::identity(), RegionView3D::is_persp, wmEvent::mval, wmOperator::ptr, RNA_boolean_set(), RNA_float_set_array(), RNA_int_set_array(), RegionView3D::viewmat, blender::math::QuaternionBase< T >::w, and RegionView3D::winmat.

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()

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