replace BLI_strncpy with BLI_strncpy_utf8 where input isnt ensured to be valid.
[blender.git] / source / blender / makesrna / intern / rna_animation.c
index d523a01dc2cd5aeae67df66bed7223f6d806a637..2f5f22c52d58991cd459fdf9a2f9494b68594d60 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -74,42 +72,7 @@ static int rna_AnimData_action_editable(PointerRNA *ptr)
 static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value)
 {
        ID *ownerId = (ID *)ptr->id.data;
-       AnimData *adt = (AnimData *)ptr->data;
-       
-       /* manage usercount for current action */
-       if (adt->action)
-               id_us_min((ID*)adt->action);
-       
-       /* assume that AnimData's action can in fact be edited... */
-       if ((value.data) && (ownerId)) {
-               bAction *act = (bAction *)value.data;
-               
-               /* action must have same type as owner */
-               if (ownerId) {
-                       if (ELEM(act->idroot, 0, GS(ownerId->name))) {
-                               /* can set */
-                               adt->action = act;
-                               id_us_plus((ID*)adt->action);
-                       }
-                       else {
-                               /* cannot set */
-                               printf("ERROR: Couldn't set Action '%s' onto ID '%s', as it doesn't have suitably rooted paths for this purpose\n", 
-                                               act->id.name+2, ownerId->name);
-                       }
-               }
-               else {
-                       /* cannot tell if we can set, so let's just be generous... */
-                       printf("Warning: Set Action '%s' onto AnimData block with an unknown ID-owner. May have attached invalid data\n",
-                                       act->id.name+2);
-                               
-                       adt->action = act;
-                       id_us_plus((ID*)adt->action);
-               }
-       }
-       else {
-               /* just clearing the action... */
-               adt->action = NULL;
-       }
+       BKE_animdata_set_action(NULL, ownerId, value.data);
 }
 
 /* ****************************** */
@@ -289,7 +252,7 @@ static void rna_ksPath_RnaPath_get(PointerRNA *ptr, char *value)
        if (ksp->rna_path)
                strcpy(value, ksp->rna_path);
        else
-               strcpy(value, "");
+               value[0]= '\0';
 }
 
 static int rna_ksPath_RnaPath_length(PointerRNA *ptr)
@@ -701,7 +664,7 @@ static void rna_def_keyingset(BlenderRNA *brna)
        /* Name */
        prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
        RNA_def_property_ui_text(prop, "Name", "");
-       RNA_def_struct_ui_icon(srna, ICON_KEY_HLT); // TODO: we need a dedicated icon
+       RNA_def_struct_ui_icon(srna, ICON_KEYINGSET);
        RNA_def_struct_name_property(srna, prop);
        RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_RENAME, NULL);