static char *rna_ShapeKeyPoint_path(PointerRNA *ptr) { ID *id = (ID *)ptr->id.data; Key *key = rna_ShapeKey_find_key(ptr->id.data); KeyBlock *kb; float *point = (float *)ptr->data; /* if we can get a key block, we can construct a path */ kb = rna_ShapeKeyData_find_keyblock(key, point); if (kb) { char name_esc_kb[sizeof(kb->name) * 2]; int index; if (ptr->type == &RNA_ShapeKeyBezierPoint) index = rna_ShapeKeyBezierPoint_get_index(kb, point); else index = rna_ShapeKeyPoint_get_index(key, kb, point); BLI_strescape(name_esc_kb, kb->name, sizeof(name_esc_kb)); if (GS(id->name) == ID_KE) return BLI_sprintfN("key_blocks[\"%s\"].data[%d]", name_esc_kb, index); else return BLI_sprintfN("shape_keys.key_blocks[\"%s\"].data[%d]", name_esc_kb, index); } else return NULL; /* XXX: there's really no way to resolve this... */ }
static char *rna_ShapeKeyPoint_path(PointerRNA *ptr) { ID *id = (ID *)ptr->id.data; Key *key = rna_ShapeKey_find_key(ptr->id.data); KeyBlock *kb; float *point = (float *)ptr->data; /* if we can get a key block, we can construct a path */ kb = rna_ShapeKeyData_find_keyblock(key, point); if (kb) { int index = rna_ShapeKeyPoint_get_index(key, kb, point); if (GS(id->name) == ID_KE) return BLI_sprintfN("key_blocks[\"%s\"].data[%d]", kb->name, index); else return BLI_sprintfN("shape_keys.key_blocks[\"%s\"].data[%d]", kb->name, index); } else return NULL; // XXX: there's really no way to resolve this... }