More fixes for renderer material detection

This commit is contained in:
Antonis Ryakiotakis 2014-08-27 18:52:17 +02:00
parent a77b46fbe6
commit be585a2594
3 changed files with 12 additions and 6 deletions

View File

@ -1902,7 +1902,7 @@ bool BKE_scene_use_new_shading_nodes(Scene *scene)
bool BKE_scene_uses_blender_internal(struct Scene *scene)
{
return strcmp("BLENDER_INTERNAL", scene->r.engine);
return strcmp("BLENDER_RENDER", scene->r.engine) == 0;
}

View File

@ -1363,6 +1363,7 @@ void paint_proj_mesh_data_ensure(bContext *C, Object *ob, wmOperator *op)
Mesh *me;
int layernum;
ImagePaintSettings *imapaint = &(CTX_data_tool_settings(C)->imapaint);
Scene *scene = CTX_data_scene(C);
Brush *br = BKE_paint_brush(&imapaint->paint);
/* no material, add one */
@ -1380,7 +1381,12 @@ void paint_proj_mesh_data_ensure(bContext *C, Object *ob, wmOperator *op)
Material *ma = give_current_material(ob, i);
if (ma) {
if (!ma->texpaintslot) {
proj_paint_add_slot(C, ma, NULL);
/* refresh here just in case */
BKE_texpaint_slot_refresh_cache(scene, ma);
/* if still no slots, we have to add */
if (!ma->texpaintslot)
proj_paint_add_slot(C, ma, NULL);
}
}
else {

View File

@ -4826,7 +4826,7 @@ bool proj_paint_add_slot(bContext *C, Material *ma, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
Scene *scene = CTX_data_scene(C);
bool is_blender_internal = BKE_scene_uses_blender_internal(scene);
bool is_bi = BKE_scene_uses_blender_internal(scene);
if (!ob)
return false;
@ -4836,7 +4836,7 @@ bool proj_paint_add_slot(bContext *C, Material *ma, wmOperator *op)
if (ma) {
if (!is_blender_internal || ma->use_nodes) {
if (!is_bi || ma->use_nodes) {
/* not supported for now */
}
else {
@ -4970,12 +4970,12 @@ static int texture_paint_delete_texture_paint_slot_exec(bContext *C, wmOperator
Object *ob = CTX_data_active_object(C);
Scene *scene = CTX_data_scene(C);
Material *ma;
bool is_blender_internal = BKE_scene_uses_blender_internal(scene);
bool is_bi = BKE_scene_uses_blender_internal(scene);
TexPaintSlot *slot;
int i;
/* not supported for node-based engines */
if (!ob || !is_blender_internal)
if (!ob || !is_bi)
return OPERATOR_CANCELLED;
ma = give_current_material(ob, ob->actcol);