[#11456] New datablock type(s) added to Oops Schematic

patch from Shawn Zilbert (enigmatic)

This patch adds the camera data block type to the oops schematic view of the outliner. It also includes a little bit of code cleanup in the oops files.
This commit is contained in:
Campbell Barton
2008-06-16 19:54:43 +00:00
parent bb539ce1b5
commit 6be46f9ee3
5 changed files with 117 additions and 19 deletions

View File

@@ -39,6 +39,10 @@ struct Mesh;
struct MetaBall;
struct Object;
struct Lamp;
struct Camera;
struct Texture;
struct Lattice;
struct bArmature;
void add_curve_oopslinks(struct Curve *cu, struct Oops *oops, short flag);
void add_from_link(struct Oops *from, struct Oops *oops);
void add_material_oopslinks(struct Material *ma, struct Oops *oops, short flag);
@@ -46,6 +50,9 @@ void add_mball_oopslinks(struct MetaBall *mb, struct Oops *oops, short flag);
void add_mesh_oopslinks(struct Mesh *me, struct Oops *oops, short flag);
void add_object_oopslinks(struct Object *ob, struct Oops *oops, short flag);
void add_lamp_oopslinks(struct Lamp *la, struct Oops *oops, short flag);
void add_camera_oopslinks(struct Camera *ca, struct Oops *oops, short flag);
void add_texture_oopslinks(struct Tex *tex, struct Oops *oops, short flag);
void add_lattice_oopslinks(struct Lattice *lt, struct Oops *oops, short flag);
struct Oops *add_oops(void *id);
struct OopsLink *add_oopslink(char *name, struct Oops *oops, short type, void *from, float xof, float yof);
struct Oops *add_test_oops(void *id); /* incl links */
@@ -66,3 +73,4 @@ void test_oopslinko(struct OopsLink *ol);
#endif

View File

@@ -559,6 +559,7 @@ typedef struct SpaceImaSel {
#define OOPS_IM 4096
#define OOPS_AR 8192
#define OOPS_GR 16384
#define OOPS_CA 32768
/* SpaceOops->outlinevis */
#define SO_ALL_SCENES 0

View File

@@ -229,6 +229,8 @@ void draw_icon_oops(float *co, short type)
case ID_LI: icon= ICON_LIBRARY_HLT; break;
case ID_IM: icon= ICON_IMAGE_HLT; break;
case ID_GR: icon= ICON_CIRCLE_DEHLT; break;
case ID_CA: icon= ICON_CAMERA_DEHLT; break;
case ID_AR: icon= ICON_ARMATURE; break;
}
glEnable(GL_BLEND);
@@ -282,6 +284,12 @@ unsigned int give_oops_color(short type, short sel, unsigned int *border)
body= 0x35659F; break;
case ID_GR:
body= 0x507050; break;
case ID_CA:
body= 0x7570A0; break;
case ID_LT:
body= 0xA08090; break;
case ID_AR:
body= 0x70B0C0; break;
default:
body= 0x606070; break;
}
@@ -516,3 +524,4 @@ void drawoopsspace(ScrArea *sa, void *spacedata)

View File

@@ -509,8 +509,9 @@ void oops_buttons(void)
uiDefIconButBitS(block, TOG, OOPS_IM, B_NEWOOPS, ICON_IMAGE_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Image datablocks");
uiDefIconButBitS(block, TOG, OOPS_GR, B_NEWOOPS, ICON_CIRCLE_DEHLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Group datablocks");
uiDefIconButBitS(block, TOG, OOPS_LI, B_NEWOOPS, ICON_LIBRARY_HLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Library datablocks");
uiDefIconButBitS(block, TOG, OOPS_CA, B_NEWOOPS, ICON_CAMERA_DEHLT, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Camera datablocks");
uiDefIconButBitS(block, TOG, OOPS_AR, B_NEWOOPS, ICON_ARMATURE, (short)(xco+=XIC),0,XIC,YIC, &soops->visiflag, 0, 0, 0, 0, "Displays Armature datablocks");
uiBlockEndAlign(block);
/* name */
@@ -576,3 +577,4 @@ void oops_buttons(void)
uiDrawBlock(block);
}

View File

@@ -48,6 +48,9 @@
#include "DNA_texture_types.h"
#include "DNA_key_types.h"
#include "DNA_group_types.h"
#include "DNA_camera_types.h"
#include "DNA_lattice_types.h"
#include "DNA_armature_types.h"
#include "BKE_utildefines.h"
#include "BKE_global.h"
@@ -661,7 +664,6 @@ void add_material_oopslinks(Material *ma, Oops *oops, short flag)
add_oopslink("group", oops, ID_GR, &(ma->group), OOPSX, (float)(0.5*OOPSY));
}
void add_group_oopslinks(Group *gp, Oops *oops, short flag)
{
GroupObject *gob;
@@ -672,7 +674,6 @@ void add_group_oopslinks(Group *gp, Oops *oops, short flag)
}
}
void add_object_oopslinks(Object *ob, Oops *oops, short flag)
{
ID *id;
@@ -698,6 +699,12 @@ void add_object_oopslinks(Object *ob, Oops *oops, short flag)
case ID_LA:
if(flag & OOPS_LA) add_oopslink("data", oops, ID_LA, &ob->data, (float)(.5*OOPSX), (float)OOPSY);
break;
case ID_CA:
if(flag & OOPS_CA) add_oopslink("data", oops, ID_CA, &ob->data, (float)(.5*OOPSX), (float)OOPSY);
break;
case ID_AR:
if(flag & OOPS_AR) add_oopslink("data", oops, ID_AR, &ob->data, (float)(.5*OOPSX), (float)OOPSY);
break;
}
}
@@ -748,7 +755,6 @@ void add_curve_oopslinks(Curve *cu, Oops *oops, short flag)
add_oopslink("speed", oops, ID_IP, &cu->ipo, OOPSX, (float)(0.5*OOPSY));
if(cu->key) add_oopslink("ipo", oops, ID_IP, &cu->key->ipo, OOPSX, (float)(0.5*OOPSY));
}
}
void add_mball_oopslinks(MetaBall *mb, Oops *oops, short flag)
@@ -775,15 +781,36 @@ void add_lamp_oopslinks(Lamp *la, Oops *oops, short flag)
}
}
}
if(flag & OOPS_IP) {
add_oopslink("ipo", oops, ID_IP, &la->ipo, OOPSX, (float)(0.5*OOPSY));
}
}
void add_camera_oopslinks(Camera *ca, Oops *oops, short flag)
{
if(flag & OOPS_IP) {
add_oopslink("ipo", oops, ID_IP, &ca->ipo, OOPSX, (float)(0.5*OOPSY));
}
}
void add_texture_oopslinks(Tex *tex, Oops *oops, short flag)
{
if(flag & OOPS_IM) {
add_oopslink("image", oops, ID_IM, &tex->ima, OOPSX, (float)(0.5*OOPSY));
}
}
void add_lattice_oopslinks(Lattice *lt, Oops *oops, short flag)
{
if(flag & OOPS_IP) {
if(lt->key) add_oopslink("ipo", oops, ID_IP, &lt->key->ipo, OOPSX, (float)(0.5*OOPSY));
}
}
Oops *add_test_oops(void *id) /* incl links */
{
Oops *oops;
Object *ob;
Lamp *la;
Tex *tex;
if(id==0) return NULL;
@@ -821,9 +848,10 @@ Oops *add_test_oops(void *id) /* incl links */
add_mball_oopslinks((MetaBall *)id, oops, G.soops->visiflag);
break;
case ID_LA:
la= (Lamp *)id;
add_lamp_oopslinks(la, oops, G.soops->visiflag);
if(la->ipo) if(G.soops->visiflag & OOPS_IP) add_oopslink("ipo", oops, ID_IP, &la->ipo, OOPSX, (float)(0.3*OOPSY));
add_lamp_oopslinks((Lamp *)id, oops, G.soops->visiflag);
break;
case ID_CA:
add_camera_oopslinks((Camera *)id, oops, G.soops->visiflag);
break;
case ID_IP:
@@ -835,8 +863,14 @@ Oops *add_test_oops(void *id) /* incl links */
add_group_oopslinks((Group *)id, oops, G.soops->visiflag);
break;
case ID_TE:
tex= (Tex *)id;
if(tex->ima) if(G.soops->visiflag & OOPS_IM) add_oopslink("image", oops, ID_IM, &tex->ima, OOPSX, (float)(0.3*OOPSY));
add_texture_oopslinks((Tex *)id, oops, G.soops->visiflag);
break;
case ID_LT:
add_lattice_oopslinks((Lattice *)id, oops, G.soops->visiflag);
break;
case ID_AR:
break;
}
return oops;
@@ -897,7 +931,7 @@ void build_oops()
while(sce) {
oops= add_test_oops(sce);
if(G.soops->visiflag & OOPS_OB) {
base= sce->base.first;
while(base) {
@@ -912,12 +946,13 @@ void build_oops()
if(G.soops->visiflag & OOPS_OB) {
Object *ob= G.main->object.first;
while(ob) {
oops= add_test_oops(ob);
ob= ob->id.next;
}
}
if(G.soops->visiflag & OOPS_ME) {
Mesh *me= G.main->mesh.first;
while(me) {
@@ -925,7 +960,7 @@ void build_oops()
me= me->id.next;
}
}
if(G.soops->visiflag & OOPS_CU) {
Curve *cu= G.main->curve.first;
while(cu) {
@@ -933,7 +968,7 @@ void build_oops()
cu= cu->id.next;
}
}
if(G.soops->visiflag & OOPS_MB) {
MetaBall *mb= G.main->mball.first;
while(mb) {
@@ -941,7 +976,7 @@ void build_oops()
mb= mb->id.next;
}
}
if(G.soops->visiflag & OOPS_LA) {
Lamp *la= G.main->lamp.first;
while(la) {
@@ -950,6 +985,14 @@ void build_oops()
}
}
if(G.soops->visiflag & OOPS_CA) {
Camera *ca= G.main->camera.first;
while(ca) {
oops= add_test_oops(ca);
ca= ca->id.next;
}
}
if(G.soops->visiflag & OOPS_IP) {
Ipo *ipo= G.main->ipo.first;
while(ipo) {
@@ -972,6 +1015,7 @@ void build_oops()
tex= tex->id.next;
}
}
if(G.soops->visiflag & OOPS_IM) {
Image *ima= G.main->image.first;
while(ima) {
@@ -979,6 +1023,7 @@ void build_oops()
ima= ima->id.next;
}
}
if(G.soops->visiflag & OOPS_GR) {
Group *gp= G.main->group.first;
while(gp) {
@@ -986,6 +1031,23 @@ void build_oops()
gp= gp->id.next;
}
}
if(G.soops->visiflag & OOPS_LT) {
Lattice *lt= G.main->latt.first;
while(lt) {
oops= add_test_oops(lt);
lt= lt->id.next;
}
}
if(G.soops->visiflag & OOPS_AR) {
bArmature *ar= G.main->armature.first;
while(ar) {
oops= add_test_oops(ar);
ar= ar->id.next;
}
}
}
else {
@@ -1068,6 +1130,7 @@ void build_oops()
else if(type==ID_LA && G.soops->visiflag & OOPS_LA) {
Lamp *la= ob->data;
oops= add_test_oops(ob->data);
if(G.soops->visiflag & OOPS_IP) add_test_oops(la->ipo);
if(G.soops->visiflag & OOPS_TE) {
for(a=0; a<MAX_MTEX; a++) {
@@ -1075,14 +1138,29 @@ void build_oops()
}
}
}
else if(type==ID_CA && G.soops->visiflag & OOPS_CA) {
Camera *ca= ob->data;
oops= add_test_oops(ob->data);
if(G.soops->visiflag & OOPS_IP) add_test_oops(ca->ipo);
}
else if(type==ID_LT && G.soops->visiflag & OOPS_LT) {
Lattice *lt= ob->data;
oops= add_test_oops(ob->data);
if(G.soops->visiflag & OOPS_IP) {
if(lt->key) oops= add_test_oops(lt->key->ipo);
}
}
else if(type==ID_AR && G.soops->visiflag & OOPS_AR) {
bArmature *ar= ob->data;
oops= add_test_oops(ob->data);
}
}
}
base= base->next;
}
}
/* test links */
oops= G.soops->oops.first;