Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-02-25 15:22:42 +0300
committerJacques Lucke <jacques@blender.org>2022-02-25 15:22:42 +0300
commit6e11cfc56af4e1594972d134e4e0c5d256d1fcce (patch)
treea020bf157f20008b85a551ce94f3576acc0b4f47 /source
parent1a853a9e90e9f1a8a5028bd1ce37785e1b2ce6d5 (diff)
Curves: add surface object pointer
Ref T95776. Differential Revision: https://developer.blender.org/D14182
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/curves.cc3
-rw-r--r--source/blender/blenkernel/intern/lib_query.c2
-rw-r--r--source/blender/makesdna/DNA_curves_types.h9
-rw-r--r--source/blender/makesrna/intern/rna_curves.c9
4 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/curves.cc b/source/blender/blenkernel/intern/curves.cc
index 9935166f874..d7783c76f65 100644
--- a/source/blender/blenkernel/intern/curves.cc
+++ b/source/blender/blenkernel/intern/curves.cc
@@ -114,6 +114,7 @@ static void curves_foreach_id(ID *id, LibraryForeachIDData *data)
for (int i = 0; i < curves->totcol; i++) {
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, curves->mat[i], IDWALK_CB_USER);
}
+ BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, curves->surface, IDWALK_CB_NOP);
}
static void curves_blend_write(BlendWriter *writer, ID *id, const void *id_address)
@@ -186,6 +187,7 @@ static void curves_blend_read_lib(BlendLibReader *reader, ID *id)
for (int a = 0; a < curves->totcol; a++) {
BLO_read_id_address(reader, curves->id.lib, &curves->mat[a]);
}
+ BLO_read_id_address(reader, curves->id.lib, &curves->surface);
}
static void curves_blend_read_expand(BlendExpander *expander, ID *id)
@@ -194,6 +196,7 @@ static void curves_blend_read_expand(BlendExpander *expander, ID *id)
for (int a = 0; a < curves->totcol; a++) {
BLO_expand(expander, curves->mat[a]);
}
+ BLO_expand(expander, curves->surface);
}
IDTypeInfo IDType_ID_CV = {
diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index 0103e40e90d..5de8704e13b 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -448,7 +448,7 @@ uint64_t BKE_library_id_can_use_filter_id(const ID *id_owner)
case ID_WS:
return FILTER_ID_SCE;
case ID_CV:
- return FILTER_ID_MA;
+ return FILTER_ID_MA | FILTER_ID_OB;
case ID_PT:
return FILTER_ID_MA;
case ID_VO:
diff --git a/source/blender/makesdna/DNA_curves_types.h b/source/blender/makesdna/DNA_curves_types.h
index c45de832e3c..98d2aa4b295 100644
--- a/source/blender/makesdna/DNA_curves_types.h
+++ b/source/blender/makesdna/DNA_curves_types.h
@@ -115,6 +115,15 @@ typedef struct Curves {
short totcol;
short _pad2[3];
+ /**
+ * Used as base mesh when curves represent e.g. hair or fur. This surface is used in edit modes.
+ * When set, the curves will have attributes that indicate a position on this surface. This is
+ * used for deforming the curves when the surface is deformed dynamically.
+ *
+ * This is expected to be a mesh object.
+ */
+ struct Object *surface;
+
/* Draw Cache. */
void *batch_cache;
} Curves;
diff --git a/source/blender/makesrna/intern/rna_curves.c b/source/blender/makesrna/intern/rna_curves.c
index 1552a7ddbfb..7a1a368551f 100644
--- a/source/blender/makesrna/intern/rna_curves.c
+++ b/source/blender/makesrna/intern/rna_curves.c
@@ -16,6 +16,8 @@
#include "BLI_math_base.h"
#include "BLI_string.h"
+#include "WM_types.h"
+
#ifdef RNA_RUNTIME
# include "BLI_math_vector.h"
@@ -265,6 +267,13 @@ static void rna_def_curves(BlenderRNA *brna)
RNA_def_property_collection_funcs(
prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+ prop = RNA_def_property(srna, "surface", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
+ RNA_def_property_ui_text(prop, "Surface", "Mesh object that the curves can be attached to");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
/* attributes */
rna_def_attributes_common(srna);