Ipo Editor would not allow access to either World or Lamp texture Ipos. Now it does. Fixes bug #17379.

This commit is contained in:
Roland Hess 2008-08-01 12:56:29 +00:00
parent cb0aa467cd
commit 115dfb22cc
4 changed files with 26 additions and 3 deletions

@ -62,6 +62,7 @@ struct Tex *copy_texture(struct Tex *tex);
void make_local_texture(struct Tex *tex);
void autotexname(struct Tex *tex);
struct Tex *give_current_texture(struct Object *ob, int act);
struct Tex *give_current_world_texture(void);
struct TexMapping *add_mapping(void);
void init_mapping(struct TexMapping *texmap);

@ -53,6 +53,7 @@
#include "DNA_world_types.h"
#include "DNA_brush_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@ -731,7 +732,7 @@ Tex *give_current_texture(Object *ob, int act)
bNode *node;
if(ob==0) return 0;
if(ob->totcol==0) return 0;
if(ob->totcol==0 && !(ob->type==OB_LAMP)) return 0;
if(ob->type==OB_LAMP) {
la=(Lamp *)ob->data;
@ -775,6 +776,18 @@ Tex *give_current_texture(Object *ob, int act)
return tex;
}
Tex *give_current_world_texture(void)
{
MTex *mtex = 0;
Tex *tex = 0;
if(!(G.scene->world)) return 0;
mtex= G.scene->world->mtex[(int)(G.scene->world->texact)];
if(mtex) tex= mtex->tex;
return tex;
}
/* ------------------------------------------------------------------------- */

@ -82,6 +82,7 @@
#include "BKE_group.h"
#include "BKE_ipo.h"
#include "BKE_key.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_particle.h"
#include "BKE_texture.h"
@ -933,6 +934,9 @@ static void make_editipo(void)
ob->ipowin= ID_TE;
make_texture_editipo(G.sipo);
}
else if(G.scene->world && give_current_world_texture()) {
make_texture_editipo(G.sipo);
}
}
else if(G.sipo->blocktype==ID_CA) {
if (ob) {
@ -1120,6 +1124,11 @@ static void get_ipo_context(short blocktype, ID **from, Ipo **ipo, char *actname
*from= (ID *)tex;
if(tex) *ipo= tex->ipo;
}
else if(G.scene->world) {
Tex *tex= give_current_world_texture();
*from= (ID *)tex;
if(tex) *ipo= tex->ipo;
}
}
else if(blocktype==ID_MA) {
if(ob) {

@ -970,7 +970,7 @@ static char *ipo_modeselect_pup(void)
if(ob && ob->type==OB_LAMP)
str += sprintf(str,formatstring, "Lamp",ID_LA, ICON_LAMP);
if(ob && give_current_texture(ob, ob->actcol))
if((ob && give_current_texture(ob, ob->actcol))||(give_current_world_texture()))
str += sprintf(str,formatstring, "Texture",ID_TE, ICON_TEXTURE);
if(ob){