diff --git a/release/scripts/startup/bl_ui/properties_data_metaball.py b/release/scripts/startup/bl_ui/properties_data_metaball.py index 25974068ed0..d7089e271a5 100644 --- a/release/scripts/startup/bl_ui/properties_data_metaball.py +++ b/release/scripts/startup/bl_ui/properties_data_metaball.py @@ -57,6 +57,10 @@ class DATA_PT_metaball(DataButtonsPanel, Panel): layout.use_property_split = True mball = context.meta_ball + if not context.space_data.use_pin_id: + ob = context.object.find_metaball_basis(context.scene) + if ob is not None: + mball = ob.data col = layout.column(align=True) col.prop(mball, "resolution", text="Resolution Viewport") diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index fc065279aa3..13658fad880 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -49,8 +49,6 @@ void BKE_mball_texspace_calc(struct Object *ob); struct BoundBox *BKE_mball_boundbox_get(struct Object *ob); float *BKE_mball_make_orco(struct Object *ob, struct ListBase *dispbase); -void BKE_mball_properties_copy(struct Scene *scene, struct Object *active_object); - bool BKE_mball_minmax_ex( const struct MetaBall *mb, float min[3], float max[3], const float obmat[4][4], const short flag); diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index ae5cbcc4f49..1dd5787a1a2 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -353,50 +353,6 @@ bool BKE_mball_is_any_unselected(const MetaBall *mb) return false; } -/* \brief copy some properties from object to other metaball object with same base name - * - * When some properties (wiresize, threshold, update flags) of metaball are changed, then this properties - * are copied to all metaballs in same "group" (metaballs with same base name: MBall, - * MBall.001, MBall.002, etc). The most important is to copy properties to the base metaball, - * because this metaball influence polygonisation of metaballs. */ -void BKE_mball_properties_copy(Scene *scene, Object *active_object) -{ - Scene *sce_iter = scene; - Base *base; - Object *ob; - MetaBall *active_mball = (MetaBall *)active_object->data; - int basisnr, obnr; - char basisname[MAX_ID_NAME], obname[MAX_ID_NAME]; - SceneBaseIter iter; - - BLI_split_name_num(basisname, &basisnr, active_object->id.name + 2, '.'); - - /* Pass depsgraph as NULL, which means we will not expand into - * duplis unlike when we generate the mball. Expanding duplis - * would not be compatible when editing multiple view layers. */ - BKE_scene_base_iter_next(NULL, &iter, &sce_iter, 0, NULL, NULL); - while (BKE_scene_base_iter_next(NULL, &iter, &sce_iter, 1, &base, &ob)) { - if (ob->type == OB_MBALL) { - if (ob != active_object) { - BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.'); - - /* Object ob has to be in same "group" ... it means, that it has to have - * same base of its name */ - if (STREQ(obname, basisname)) { - MetaBall *mb = ob->data; - - /* Copy properties from selected/edited metaball */ - mb->wiresize = active_mball->wiresize; - mb->rendersize = active_mball->rendersize; - mb->thresh = active_mball->thresh; - mb->flag = active_mball->flag; - DEG_id_tag_update(&mb->id, 0); - } - } - } - } -} - /** \brief This function finds basic MetaBall. * * Basic MetaBall doesn't include any number at the end of diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index 246a9c4beb5..51c43270bac 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -88,17 +88,11 @@ static void rna_Meta_texspace_size_set(PointerRNA *ptr, const float *values) } -static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_MetaBall_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { MetaBall *mb = ptr->id.data; - Object *ob; - /* cheating way for importers to avoid slow updates */ if (mb->id.us > 0) { - for (ob = bmain->object.first; ob; ob = ob->id.next) - if (ob->data == mb) - BKE_mball_properties_copy(scene, ob); - DEG_id_tag_update(&mb->id, 0); WM_main_add_notifier(NC_GEOM | ND_DATA, mb); } diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 6ec631014d0..9f01e18d645 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -221,6 +221,11 @@ static Mesh *rna_Object_to_mesh( return rna_Main_meshes_new_from_object(bmain, reports, depsgraph, ob, apply_modifiers, calc_undeformed); } +static Object *rna_Object_bmall_basis_find(Object *ob, Scene *scene) +{ + return BKE_mball_basis_find(scene, ob); +} + static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports, const char *name, bool from_mix) { @@ -611,6 +616,14 @@ void RNA_api_object(StructRNA *srna) parm = RNA_def_pointer(func, "ob_arm", "Object", "", "Armature object influencing this object or NULL"); RNA_def_function_return(func, parm); + /* Meta-ball */ + func = RNA_def_function(srna, "find_metaball_basis", "rna_Object_bmall_basis_find"); + RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier"); + parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); + parm = RNA_def_pointer(func, "result", "Object", "", "Armature object influencing this object or NULL"); + RNA_def_function_return(func, parm); + /* Shape key */ func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add"); RNA_def_function_ui_description(func, "Add shape key to this object");