62 std::optional<Library *> ,
67 Curves *curves_dst = id_cast<Curves *>(id_dst);
68 const Curves *curves_src = id_cast<const Curves *>(id_src);
69 curves_dst->mat = MEM_dupalloc(curves_src->mat);
73 if (curves_src->surface_uv_map !=
nullptr) {
74 curves_dst->surface_uv_map =
BLI_strdup(curves_src->surface_uv_map);
77 curves_dst->batch_cache =
nullptr;
85 curves->geometry.wrap().~CurvesGeometry();
89 MEM_SAFE_DELETE(
curves->mat);
90 MEM_SAFE_DELETE(
curves->surface_uv_map);
96 for (
int i = 0; i <
curves->totcol; i++) {
106 curves->geometry.wrap().attribute_storage.wrap().foreach_working_space_color(
fn);
114 curves->attributes_active_index_legacy =
curves->geometry.attributes_active_index;
118 curves->geometry.wrap().blend_write_prepare(write_data, !writer->
is_undo());
127 curves->geometry.wrap().blend_write(*writer,
curves->id, write_data);
139 curves->geometry.wrap().blend_read(*reader);
148 .id_code = Curves::id_type,
152 .struct_size =
sizeof(
Curves),
154 .name_plural =
N_(
"hair_curves"),
157 .asset_type_info =
nullptr,
162 .make_local =
nullptr,
164 .foreach_cache =
nullptr,
165 .foreach_path =
nullptr,
167 .foreach_asset_weak_reference =
nullptr,
168 .owner_pointer_get =
nullptr,
172 .blend_read_after_liblink =
nullptr,
174 .blend_read_undo_preserve =
nullptr,
176 .lib_override_apply_post =
nullptr,
194 curves_id->geometry.wrap().attributes_for_write(), remap, remap_num);
199 return reinterpret_cast<Curves *
>(
225 for (; md; md = md->
next) {
262 if (curves_eval ==
nullptr) {
269 object->runtime->geometry_set_eval =
new GeometrySet(std::move(geometry_set));
279 if (
curves->batch_cache) {
286 if (
curves->batch_cache) {
299 curves.resize(points_num, curves_num);
307 curves.offsets_for_write().last() = points_num;
308 curves.fill_curve_types(type);
315 curves_id->geometry.wrap() = std::move(
curves);
322 MEM_SAFE_DELETE(dst.mat);
324 dst.totcol = src.totcol;
326 dst.symmetry = src.symmetry;
327 dst.selection_domain = src.selection_domain;
328 dst.surface = src.surface;
329 MEM_SAFE_DELETE(dst.surface_uv_map);
330 if (src.surface_uv_map !=
nullptr) {
331 dst.surface_uv_map =
BLI_strdup(src.surface_uv_map);
333 dst.surface_collision_distance = src.surface_collision_distance;
340 if (!curves_id.surface) {
343 if (!curves_id.surface_uv_map) {
350 std::string(curves_id.surface_uv_map));
358 if (surface_ob !=
nullptr) {
371 if (this->
positions()->size() != point_num) {
388 const int points_num = this->
curves_id_orig.geometry.wrap().points_num();
398 const int points_num = this->
curves_id_orig.geometry.wrap().points_num();
400 if (
data.sharing_info->is_mutable()) {
401 data.sharing_info->tag_ensured_mutable();
406 data.data = new_sharing_info->data.data();
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
#define BLT_I18NCONTEXT_ID_CURVES
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define INIT_DEFAULT_STRUCT_AFTER(struct_dst, member)
void generated_ptr(int64_t offset)
friend class ImplicitSharingPtr
constexpr MutableSpan()=default
const Curves & curves_id_orig
std::optional< MutableSpan< float3 > > positions_for_write()
ImplicitSharingPtrAndData positions_data
std::optional< Span< float3 > > positions() const
std::optional< Array< float3x3 > > deform_mats
std::unique_ptr< CurvesEditHints > curves_edit_hints_
int add_with_destination(GField field, GVMutableArray dst)
static std::optional< BundleKey > from_ustr(UString key)
bool add(BundleKey key, const BundleItemValue &value)
void curves_copy_parameters(const Curves &src, Curves &dst)
void curves_store_surface_in_geometry_bundle(const Depsgraph &depsgraph, const Curves &curves, GeometrySet &geometry)
Curves * curves_new_nomain_single(int points_num, CurveType type)
Curves * curves_new_nomain(int points_num, int curves_num)
void curves_normals_point_domain_calc(const CurvesGeometry &curves, MutableSpan< float3 > normals)
MatBase< T, NumCol, NumRow > transpose(const MatBase< T, NumRow, NumCol > &mat)
CartesianBasis invert(const CartesianBasis &basis)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
struct Curves * BKE_curves_add(struct Main *bmain, const char *name)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void BLO_read_pointer_array_and_validate_size(BlendDataReader *reader, T **ptr_p, SizeT *array_size)
struct Curves * BKE_curves_copy_for_eval(const struct Curves *curves_src)
void(*) BKE_curves_batch_cache_free_cb(struct Curves *curves)
void BKE_object_eval_assign_data(Object *object, ID *data, bool is_owned)
void BKE_curves_material_remap(struct Curves *curves, const unsigned int *remap, int remap_num)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
static void curves_foreach_working_space_color(ID *id, const IDTypeForeachColorFunctionCallback &fn)
void BKE_curves_batch_cache_free(struct Curves *curves)
static void curves_init_data(ID *id)
void(*) BKE_curves_batch_cache_dirty_tag_cb(struct Curves *curves, int mode)
void BKE_object_free_derived_caches(Object *ob)
static void curves_evaluate_modifiers(Depsgraph *depsgraph, Scene *scene, Object *object, bke::GeometrySet &geometry_set)
BMesh const char void * data
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
void BKE_animdata_free(ID *id, bool do_id_user)
void BKE_curves_data_update(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *object)
ModifierData * BKE_modifiers_get_virtual_modifierlist(const Object *ob, VirtualModifierData *data)
void BKE_modifiers_clear_errors(Object *ob)
bool BKE_curves_attribute_required(const struct Curves *curves, StringRef name)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
static void curves_blend_write(BlendWriter *writer, ID *id, const void *id_address)
bool BKE_object_is_in_editmode(const Object *ob)
void * BKE_id_new_nomain(short type, const char *name)
T * DEG_get_original(T *id)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
static void curves_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
void BKE_material_attr_indices_remap(bke::MutableAttributeAccessor attributes, const unsigned int *remap, int remap_num)
static const char * ATTR_POSITION
ID * BKE_id_copy_ex(Main *bmain, const ID *id, ID **new_id_p, int flag)
VecBase< float, 3 > float3
void BKE_curves_batch_cache_dirty_tag(struct Curves *curves, int mode)
bool BKE_modifier_is_enabled(const Scene *scene, ModifierData *md, int required_mode)
static void curves_free_data(ID *id)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
void * BKE_id_new(Main *bmain, short type, const char *name)
static void curves_blend_read_data(BlendDataReader *reader, ID *id)
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
static void curves_foreach_id(ID *id, LibraryForeachIDData *data)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
void write_pointer_array(int64_t num, const void *data)
void write_string(const char *data)
void write_id_struct(const void *id_address, const T *id, BlendStructWriterTypedFn< T > fn=nullptr)
static GeometrySet from_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
struct ModifierData * next
void(*) modify_geometry_set(ModifierData *md, const ModifierEvalContext *ctx, bke::GeometrySet *geometry_set)
GeometryComponent & get_component_for_write(GeometryComponent::Type component_type)
nodes::Bundle & bundle_for_write()
const Curves * get_curves() const