diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-08-23 19:08:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-08-23 19:08:54 +0400 |
commit | f6a2b8d724646ac357a0eafc2d29b345fdc1ba5f (patch) | |
tree | 2ef09a290f55ab9cd4ed642c3c050525b9d08292 /source/blender/editors/space_console | |
parent | abff0032c4dceabbd2cf5b9682f196dd4a283c76 (diff) |
BLI_strescape for a basic, python like string escaping, currently only use for drag and drop ID's into the console but should eventually be used for the animsys too.
Diffstat (limited to 'source/blender/editors/space_console')
-rw-r--r-- | source/blender/editors/space_console/space_console.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 890a6cf545a..52c5100900d 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -165,8 +165,11 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop) { char text[64]; ID *id= drag->poin; + char id_esc[(sizeof(id->name) - 2) * 2]; - snprintf(text, sizeof(text), "bpy.data.%s['%s']", BKE_idcode_to_name_plural(GS(id->name)), id->name+2); + BLI_strescape(id_esc, id->name+2, sizeof(id_esc)); + + snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc); /* copy drag path to properties */ RNA_string_set(drop->ptr, "text", text); |