diff options
-rw-r--r-- | release/scripts/startup/bl_ui/properties_data_curves.py | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curves.cc | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_query.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_curves_types.h | 9 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_curves.c | 9 |
5 files changed, 34 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_curves.py b/release/scripts/startup/bl_ui/properties_data_curves.py index 3e350575bc8..1bb5fc9afbe 100644 --- a/release/scripts/startup/bl_ui/properties_data_curves.py +++ b/release/scripts/startup/bl_ui/properties_data_curves.py @@ -35,6 +35,17 @@ class DATA_PT_context_curves(DataButtonsPanel, Panel): layout.template_ID(space, "pin_id") +class DATA_PT_curves_surface(DataButtonsPanel, Panel): + bl_label = "Surface" + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} + + def draw(self, context): + layout = self.layout + ob = context.object + + layout.prop(ob.data, "surface") + + class CURVES_MT_add_attribute(Menu): bl_label = "Add Attribute" @@ -115,6 +126,7 @@ class DATA_PT_custom_props_curves(DataButtonsPanel, PropertyPanel, Panel): classes = ( DATA_PT_context_curves, DATA_PT_CURVES_attributes, + DATA_PT_curves_surface, DATA_PT_custom_props_curves, CURVES_MT_add_attribute, CURVES_UL_attributes, 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); |