Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_buttons/buttons_texture.c
| Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | bool ED_texture_context_check_particles(const bContext *C) | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| return (ob && ob->particlesystem.first); | return (ob && ob->particlesystem.first); | ||||
| } | } | ||||
| bool ED_texture_context_check_linestyle(const bContext *C) | bool ED_texture_context_check_linestyle(const bContext *C) | ||||
| { | { | ||||
| #ifdef WITH_FREESTYLE | #ifdef WITH_FREESTYLE | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| SceneLayer *active_render_layer; | ViewLayer *active_view_layer; | ||||
| FreestyleConfig *config; | FreestyleConfig *config; | ||||
| FreestyleLineSet *lineset; | FreestyleLineSet *lineset; | ||||
| FreestyleLineStyle *linestyle; | FreestyleLineStyle *linestyle; | ||||
| if (scene && (scene->r.mode & R_EDGE_FRS)) { | if (scene && (scene->r.mode & R_EDGE_FRS)) { | ||||
| active_render_layer = BLI_findlink(&scene->render_layers, scene->active_layer); | active_view_layer = BLI_findlink(&scene->view_layers, scene->active_view_layer); | ||||
| config = &active_render_layer->freestyle_config; | config = &active_view_layer->freestyle_config; | ||||
| if (config->mode == FREESTYLE_CONTROL_EDITOR_MODE) { | if (config->mode == FREESTYLE_CONTROL_EDITOR_MODE) { | ||||
| lineset = BKE_freestyle_lineset_get_active(config); | lineset = BKE_freestyle_lineset_get_active(config); | ||||
| if (lineset) { | if (lineset) { | ||||
| linestyle = lineset->linestyle; | linestyle = lineset->linestyle; | ||||
| return linestyle && (linestyle->flag & LS_TEXTURE); | return linestyle && (linestyle->flag & LS_TEXTURE); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | else if ((sbuts->mainb == BCONTEXT_MATERIAL) && valid_material) { | ||||
| sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_MATERIAL; | sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_MATERIAL; | ||||
| } | } | ||||
| else if ((sbuts->mainb == BCONTEXT_DATA) && valid_lamp) { | else if ((sbuts->mainb == BCONTEXT_DATA) && valid_lamp) { | ||||
| sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_LAMP; | sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_LAMP; | ||||
| } | } | ||||
| else if ((sbuts->mainb == BCONTEXT_PARTICLE) && valid_particles) { | else if ((sbuts->mainb == BCONTEXT_PARTICLE) && valid_particles) { | ||||
| sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_PARTICLES; | sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_PARTICLES; | ||||
| } | } | ||||
| else if ((sbuts->mainb == BCONTEXT_RENDER_LAYER) && valid_linestyle) { | else if ((sbuts->mainb == BCONTEXT_VIEW_LAYER) && valid_linestyle) { | ||||
| sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_LINESTYLE; | sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_LINESTYLE; | ||||
| } | } | ||||
| else if ((ELEM(sbuts->mainb, BCONTEXT_MODIFIER, BCONTEXT_PHYSICS)) && valid_others) { | else if ((ELEM(sbuts->mainb, BCONTEXT_MODIFIER, BCONTEXT_PHYSICS)) && valid_others) { | ||||
| sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_OTHER; | sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_OTHER; | ||||
| } | } | ||||
| /* Else, try to revive a previous "better" ctxt... */ | /* Else, try to revive a previous "better" ctxt... */ | ||||
| else if ((sbuts->texture_context_prev != sbuts->texture_context) && | else if ((sbuts->texture_context_prev != sbuts->texture_context) && | ||||
| (((sbuts->texture_context_prev == SB_TEXC_WORLD) && valid_world) || | (((sbuts->texture_context_prev == SB_TEXC_WORLD) && valid_world) || | ||||
| ▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | if (!pinid || GS(pinid->name) == ID_SCE) { | ||||
| wrld = scene->world; | wrld = scene->world; | ||||
| brush = BKE_paint_brush(BKE_paint_get_active_from_context(C)); | brush = BKE_paint_brush(BKE_paint_get_active_from_context(C)); | ||||
| linestyle = BKE_linestyle_active_from_scene(scene); | linestyle = BKE_linestyle_active_from_scene(scene); | ||||
| } | } | ||||
| else if (!pinid || GS(pinid->name) == ID_WS) { | else if (!pinid || GS(pinid->name) == ID_WS) { | ||||
| if (!workspace) { | if (!workspace) { | ||||
| workspace = CTX_wm_workspace(C); | workspace = CTX_wm_workspace(C); | ||||
| } | } | ||||
| SceneLayer *scene_layer = BKE_scene_layer_from_workspace_get(scene, workspace); | ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace); | ||||
| ob = OBACT(scene_layer); | ob = OBACT(view_layer); | ||||
| } | } | ||||
| if (ob && ob->type == OB_LAMP && !la) | if (ob && ob->type == OB_LAMP && !la) | ||||
| la = ob->data; | la = ob->data; | ||||
| if (ob && !ma) | if (ob && !ma) | ||||
| ma = give_current_material(ob, ob->actcol); | ma = give_current_material(ob, ob->actcol); | ||||
| /* fill users */ | /* fill users */ | ||||
| ▲ Show 20 Lines • Show All 325 Lines • Show Last 20 Lines | |||||