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
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2021-01-18 17:02:24 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-01-18 17:02:24 +0300
commit023ebb890b760f4d6e7bcaa4848e5f5339ac1321 (patch)
tree0b37923cc2103894b7d60900e7b577dfff0343df /source/blender/makesrna
parenta1fb3dc7aeb939eed084aa998193536ac2198f6a (diff)
parent1c2b2037956bf1d46a10842a4b503d20714bdcf2 (diff)
Merge branch 'blender-v2.92-release'
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_pose.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 7f98ae47c6f..cd3e4a09fc3 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -138,8 +138,22 @@ static char *rna_PoseBone_path(PointerRNA *ptr)
/* Bone groups only. */
-static bActionGroup *rna_bone_group_new(ID *id, bPose *pose, const char *name)
+static bool rna_bone_group_poll(Object *ob, ReportList *reports)
{
+ if ((ob->proxy != NULL) || (ob->proxy_group != NULL) || ID_IS_OVERRIDE_LIBRARY(ob)) {
+ BKE_report(reports, RPT_ERROR, "Cannot edit bonegroups for proxies or library overrides");
+ return false;
+ }
+
+ return true;
+}
+
+static bActionGroup *rna_bone_group_new(ID *id, bPose *pose, ReportList *reports, const char *name)
+{
+ if (!rna_bone_group_poll((Object *)id, reports)) {
+ return NULL;
+ }
+
bActionGroup *grp = BKE_pose_add_group(pose, name);
WM_main_add_notifier(NC_OBJECT | ND_POSE | NA_ADDED, id);
return grp;
@@ -147,6 +161,10 @@ static bActionGroup *rna_bone_group_new(ID *id, bPose *pose, const char *name)
static void rna_bone_group_remove(ID *id, bPose *pose, ReportList *reports, PointerRNA *grp_ptr)
{
+ if (!rna_bone_group_poll((Object *)id, reports)) {
+ return;
+ }
+
bActionGroup *grp = grp_ptr->data;
const int grp_idx = BLI_findindex(&pose->agroups, grp);
@@ -163,6 +181,11 @@ static void rna_bone_group_remove(ID *id, bPose *pose, ReportList *reports, Poin
void rna_ActionGroup_colorset_set(PointerRNA *ptr, int value)
{
+ Object *ob = (Object *)ptr->owner_id;
+ if (!rna_bone_group_poll(ob, NULL)) {
+ return;
+ }
+
bActionGroup *grp = ptr->data;
/* ensure only valid values get set */
@@ -184,6 +207,10 @@ bool rna_ActionGroup_is_custom_colorset_get(PointerRNA *ptr)
static void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value)
{
Object *ob = (Object *)ptr->owner_id;
+ if (!rna_bone_group_poll(ob, NULL)) {
+ return;
+ }
+
bActionGroup *agrp = ptr->data;
/* copy the new name into the name slot */
@@ -1619,7 +1646,7 @@ static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "new", "rna_bone_group_new");
RNA_def_function_ui_description(func, "Add a new bone group to the object");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID); /* ID needed for refresh */
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); /* ID needed for refresh */
RNA_def_string(func, "name", "Group", MAX_NAME, "", "Name of the new group");
/* return type */
parm = RNA_def_pointer(func, "group", "BoneGroup", "", "New bone group");