Files
test/source/blender/editors/include/ED_geometry.hh
Hans Goudey 31ec00895f Curves: Add edit mode operator to set attribute values
Similar to #104426, this adds a simple operator to set attribute values
for curves edit mode. The operator is very basic and is only meant to
be a first step for more attribute editing features. Some of the
functionality could be achieved with node tools, but without dynamic
socket types or access to the active attribute, it would be incomplete.

Some of the RNA property registration, retrieval, and setting is reused
from the mesh edit mode operator. The rest of the logic is similar but
harder to de-duplicate.

Pull Request: https://projects.blender.org/blender/blender/pulls/105076
2023-10-17 12:35:40 +02:00

75 lines
2.2 KiB
C++

/* SPDX-FileCopyrightText: 2020 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup editors
*/
#pragma once
#include "BLI_string_ref.hh"
#include "DNA_customdata_types.h"
#include "BKE_attribute.h"
#include "BKE_screen.hh"
struct Mesh;
struct ReportList;
#include "BLI_generic_pointer.hh"
#include "BLI_string_ref.hh"
struct PointerRNA;
struct PropertyRNA;
namespace blender::ed::geometry {
/* -------------------------------------------------------------------- */
/** \name 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(eCustomDataType type);
PropertyRNA *rna_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, GPointer value);
/** \} */
} // namespace blender::ed::geometry
void ED_operatortypes_geometry();
/**
* Convert an attribute with the given name to a new type and domain.
* The attribute must already exist.
*
* \note Does not support meshes in edit mode.
*/
bool ED_geometry_attribute_convert(Mesh *mesh,
const char *name,
eCustomDataType dst_type,
eAttrDomain dst_domain,
ReportList *reports);
namespace blender::ed::geometry {
MenuType node_group_operator_assets_menu();
MenuType node_group_operator_assets_menu_unassigned();
void clear_operator_asset_trees();
void ui_template_node_operator_asset_menu_items(uiLayout &layout,
const bContext &C,
StringRef catalog_path);
void ui_template_node_operator_asset_root_items(uiLayout &layout, const bContext &C);
} // namespace blender::ed::geometry