Fix T60982: don't allow editing group properties in linked actions.
authorAlexander Gavrilov <angavrilov@gmail.com>
Wed, 17 Apr 2019 11:43:02 +0000 (14:43 +0300)
committerAlexander Gavrilov <angavrilov@gmail.com>
Wed, 17 Apr 2019 11:43:27 +0000 (14:43 +0300)
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/animation/anim_filter.c

index a4fc022..67d0e96 100644 (file)
@@ -4630,12 +4630,14 @@ static void draw_setting_widget(bAnimContext *ac,
           UI_but_func_set(but, achannel_setting_widget_cb, NULL, NULL);
           break;
       }
-    }
-  }
 
-  if ((ale->fcurve_owner_id != NULL && ID_IS_LINKED(ale->fcurve_owner_id)) ||
-      (ale->id != NULL && ID_IS_LINKED(ale->id))) {
-    UI_but_flag_enable(but, UI_BUT_DISABLED);
+      if ((ale->fcurve_owner_id != NULL && ID_IS_LINKED(ale->fcurve_owner_id)) ||
+          (ale->id != NULL && ID_IS_LINKED(ale->id))) {
+        if (setting != ACHANNEL_SETTING_EXPAND) {
+          UI_but_flag_enable(but, UI_BUT_DISABLED);
+        }
+      }
+    }
   }
 }
 
index c2878a6..67ec5a9 100644 (file)
@@ -2586,6 +2586,13 @@ static bool rename_anim_channels(bAnimContext *ac, int channel_index)
     return false;
   }
 
+  /* don't allow renaming linked channels */
+  if ((ale->fcurve_owner_id != NULL && ID_IS_LINKED(ale->fcurve_owner_id)) ||
+      (ale->id != NULL && ID_IS_LINKED(ale->id))) {
+    ANIM_animdata_freelist(&anim_data);
+    return false;
+  }
+
   /* check that channel can be renamed */
   acf = ANIM_channel_get_typeinfo(ale);
   if (acf && acf->name_prop) {
index 2687183..b5891a0 100644 (file)
@@ -1344,7 +1344,7 @@ static size_t animfilter_act_group(bAnimContext *ac,
       /* filter selection of channel specially here again,
        * since may be open and not subject to previous test */
       if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp))) {
-        ANIMCHANNEL_NEW_CHANNEL(agrp, ANIMTYPE_GROUP, owner_id, NULL);
+        ANIMCHANNEL_NEW_CHANNEL(agrp, ANIMTYPE_GROUP, owner_id, &act->id);
       }
     }