Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_context.c
| Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | if (CTX_data_dir(member)) { | ||||
| CTX_data_dir_set(result, screen_context_dir); | CTX_data_dir_set(result, screen_context_dir); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else if (CTX_data_equals(member, "scene")) { | else if (CTX_data_equals(member, "scene")) { | ||||
| CTX_data_id_pointer_set(result, &scene->id); | CTX_data_id_pointer_set(result, &scene->id); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else if (CTX_data_equals(member, "visible_objects")) { | else if (CTX_data_equals(member, "visible_objects")) { | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { | ||||
| if (BASE_VISIBLE(v3d, base)) { | if (BASE_VISIBLE(v3d, base)) { | ||||
| CTX_data_id_list_add(result, &base->object->id); | CTX_data_id_list_add(result, &base->object->id); | ||||
| } | } | ||||
| } | } | ||||
| CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); | CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else if (CTX_data_equals(member, "selectable_objects")) { | else if (CTX_data_equals(member, "selectable_objects")) { | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { | ||||
| if (BASE_SELECTABLE(v3d, base)) { | if (BASE_SELECTABLE(v3d, base)) { | ||||
| CTX_data_id_list_add(result, &base->object->id); | CTX_data_id_list_add(result, &base->object->id); | ||||
| } | } | ||||
| } | } | ||||
| CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); | CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else if (CTX_data_equals(member, "selected_objects")) { | else if (CTX_data_equals(member, "selected_objects")) { | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { | ||||
| if (BASE_SELECTED(v3d, base)) { | if (BASE_SELECTED(v3d, base)) { | ||||
| CTX_data_id_list_add(result, &base->object->id); | CTX_data_id_list_add(result, &base->object->id); | ||||
| } | } | ||||
| } | } | ||||
| CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); | CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else if (CTX_data_equals(member, "selected_editable_objects")) { | else if (CTX_data_equals(member, "selected_editable_objects")) { | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { | ||||
| if (BASE_SELECTED_EDITABLE(v3d, base)) { | if (BASE_SELECTED_EDITABLE(v3d, base)) { | ||||
| CTX_data_id_list_add(result, &base->object->id); | CTX_data_id_list_add(result, &base->object->id); | ||||
| } | } | ||||
| } | } | ||||
| CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); | CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else if (CTX_data_equals(member, "editable_objects")) { | else if (CTX_data_equals(member, "editable_objects")) { | ||||
| /* Visible + Editable, but not necessarily selected */ | /* Visible + Editable, but not necessarily selected */ | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { | ||||
| if (BASE_EDITABLE(v3d, base)) { | if (BASE_EDITABLE(v3d, base)) { | ||||
| CTX_data_id_list_add(result, &base->object->id); | CTX_data_id_list_add(result, &base->object->id); | ||||
| } | } | ||||
| } | } | ||||
| CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); | CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else if (CTX_data_equals(member, "objects_in_mode")) { | else if (CTX_data_equals(member, "objects_in_mode")) { | ||||
| ▲ Show 20 Lines • Show All 542 Lines • ▼ Show 20 Lines | if (ANIM_animdata_get_context(C, &ac) && ELEM(ac.spacetype, SPACE_ACTION, SPACE_GRAPH)) { | ||||
| filter |= ANIMFILTER_FOREDIT; | filter |= ANIMFILTER_FOREDIT; | ||||
| } | } | ||||
| if (STRPREFIX(member, "selected_")) { | if (STRPREFIX(member, "selected_")) { | ||||
| filter |= ANIMFILTER_SEL; | filter |= ANIMFILTER_SEL; | ||||
| } | } | ||||
| ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); | ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); | ||||
| for (bAnimListElem *ale = anim_data.first; ale; ale = ale->next) { | LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) { | ||||
| if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) { | if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) { | ||||
| CTX_data_list_add(result, ale->fcurve_owner_id, &RNA_FCurve, ale->data); | CTX_data_list_add(result, ale->fcurve_owner_id, &RNA_FCurve, ale->data); | ||||
| } | } | ||||
| } | } | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); | CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| } | } | ||||
| else if (CTX_data_equals(member, "active_editable_fcurve")) { | else if (CTX_data_equals(member, "active_editable_fcurve")) { | ||||
| bAnimContext ac; | bAnimContext ac; | ||||
| if (ANIM_animdata_get_context(C, &ac) && ELEM(ac.spacetype, SPACE_GRAPH)) { | if (ANIM_animdata_get_context(C, &ac) && ELEM(ac.spacetype, SPACE_GRAPH)) { | ||||
| ListBase anim_data = {NULL, NULL}; | ListBase anim_data = {NULL, NULL}; | ||||
| int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_FOREDIT | | int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_FOREDIT | | ||||
| ANIMFILTER_CURVE_VISIBLE); | ANIMFILTER_CURVE_VISIBLE); | ||||
| ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); | ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); | ||||
| for (bAnimListElem *ale = anim_data.first; ale; ale = ale->next) { | LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) { | ||||
| if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) { | if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) { | ||||
| CTX_data_pointer_set(result, ale->fcurve_owner_id, &RNA_FCurve, ale->data); | CTX_data_pointer_set(result, ale->fcurve_owner_id, &RNA_FCurve, ale->data); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| ANIM_animdata_freelist(&anim_data); | ANIM_animdata_freelist(&anim_data); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| return 0; /* not found */ | return 0; /* not found */ | ||||
| } | } | ||||
| return -1; /* found but not available */ | return -1; /* found but not available */ | ||||
| } | } | ||||