Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_buttons/buttons_context.c
| Show First 20 Lines • Show All 240 Lines • ▼ Show 20 Lines | static bool buttons_context_path_data(ButsContextPath *path, int type) | ||||
| if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (type == -1 || type == OB_GPENCIL)) { | if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (type == -1 || type == OB_GPENCIL)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| #ifdef WITH_HAIR_NODES | #ifdef WITH_HAIR_NODES | ||||
| if (RNA_struct_is_a(ptr->type, &RNA_Hair) && (type == -1 || type == OB_HAIR)) { | if (RNA_struct_is_a(ptr->type, &RNA_Hair) && (type == -1 || type == OB_HAIR)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| #endif | #endif | ||||
| #ifdef WITH_POINT_CLOUD | |||||
| if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (type == -1 || type == OB_POINTCLOUD)) { | if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (type == -1 || type == OB_POINTCLOUD)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| #endif | |||||
| if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (type == -1 || type == OB_VOLUME)) { | if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (type == -1 || type == OB_VOLUME)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| /* try to get an object in the path, no pinning supported here */ | /* try to get an object in the path, no pinning supported here */ | ||||
| if (buttons_context_path_object(path)) { | if (buttons_context_path_object(path)) { | ||||
| Object *ob = path->ptr[path->len - 1].data; | Object *ob = path->ptr[path->len - 1].data; | ||||
| if (ob && (type == -1 || type == ob->type)) { | if (ob && (type == -1 || type == ob->type)) { | ||||
| ▲ Show 20 Lines • Show All 547 Lines • ▼ Show 20 Lines | const char *buttons_context_dir[] = { | ||||
| "brush", | "brush", | ||||
| "dynamic_paint", | "dynamic_paint", | ||||
| "line_style", | "line_style", | ||||
| "collection", | "collection", | ||||
| "gpencil", | "gpencil", | ||||
| #ifdef WITH_HAIR_NODES | #ifdef WITH_HAIR_NODES | ||||
| "hair", | "hair", | ||||
| #endif | #endif | ||||
| #ifdef WITH_POINT_CLOUD | |||||
| "pointcloud", | "pointcloud", | ||||
| #endif | |||||
| "volume", | "volume", | ||||
| NULL, | NULL, | ||||
| }; | }; | ||||
| int /*eContextResult*/ buttons_context(const bContext *C, | int /*eContextResult*/ buttons_context(const bContext *C, | ||||
| const char *member, | const char *member, | ||||
| bContextDataResult *result) | bContextDataResult *result) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | if (CTX_data_equals(member, "lightprobe")) { | ||||
| return CTX_RESULT_OK; | return CTX_RESULT_OK; | ||||
| } | } | ||||
| #ifdef WITH_HAIR_NODES | #ifdef WITH_HAIR_NODES | ||||
| if (CTX_data_equals(member, "hair")) { | if (CTX_data_equals(member, "hair")) { | ||||
| set_pointer_type(path, result, &RNA_Hair); | set_pointer_type(path, result, &RNA_Hair); | ||||
| return CTX_RESULT_OK; | return CTX_RESULT_OK; | ||||
| } | } | ||||
| #endif | #endif | ||||
| #ifdef WITH_POINT_CLOUD | |||||
| if (CTX_data_equals(member, "pointcloud")) { | if (CTX_data_equals(member, "pointcloud")) { | ||||
| set_pointer_type(path, result, &RNA_PointCloud); | set_pointer_type(path, result, &RNA_PointCloud); | ||||
| return CTX_RESULT_OK; | return CTX_RESULT_OK; | ||||
| } | } | ||||
| #endif | |||||
| if (CTX_data_equals(member, "volume")) { | if (CTX_data_equals(member, "volume")) { | ||||
| set_pointer_type(path, result, &RNA_Volume); | set_pointer_type(path, result, &RNA_Volume); | ||||
| return CTX_RESULT_OK; | return CTX_RESULT_OK; | ||||
| } | } | ||||
| if (CTX_data_equals(member, "material")) { | if (CTX_data_equals(member, "material")) { | ||||
| set_pointer_type(path, result, &RNA_Material); | set_pointer_type(path, result, &RNA_Material); | ||||
| return CTX_RESULT_OK; | return CTX_RESULT_OK; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 355 Lines • Show Last 20 Lines | |||||