forked from bartvdbraak/blender
Orange: fixes in Compositor:
- Curves in Image window didn't copy alpha (when no 32 bits rect for display was made already). - Code was missing to validate grouped nodes in Compositor, didnt work at all yet - Loading new Images in a Node (using filewindow) didn't assign the image Image window now displays Alpha for float images too
This commit is contained in:
parent
771c7f3549
commit
26b718654d
@ -584,7 +584,7 @@ void curvemapping_do_image(CurveMapping *cumap, Image *ima)
|
|||||||
pixc[0]= FTOCHAR(col[0]);
|
pixc[0]= FTOCHAR(col[0]);
|
||||||
pixc[1]= FTOCHAR(col[1]);
|
pixc[1]= FTOCHAR(col[1]);
|
||||||
pixc[2]= FTOCHAR(col[2]);
|
pixc[2]= FTOCHAR(col[2]);
|
||||||
/* assume alpha was set */
|
pixc[3]= FTOCHAR(pixf[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "DNA_ID.h"
|
#include "DNA_ID.h"
|
||||||
#include "DNA_node_types.h"
|
#include "DNA_node_types.h"
|
||||||
#include "DNA_material_types.h"
|
#include "DNA_material_types.h"
|
||||||
|
#include "DNA_scene_types.h"
|
||||||
|
|
||||||
#include "BKE_blender.h"
|
#include "BKE_blender.h"
|
||||||
#include "BKE_colortools.h"
|
#include "BKE_colortools.h"
|
||||||
@ -498,12 +499,12 @@ bNode *nodeMakeGroupFromSelected(bNodeTree *ntree)
|
|||||||
/* should become callbackable... */
|
/* should become callbackable... */
|
||||||
void nodeVerifyGroup(bNodeTree *ngroup)
|
void nodeVerifyGroup(bNodeTree *ngroup)
|
||||||
{
|
{
|
||||||
Material *ma;
|
|
||||||
|
|
||||||
/* group changed, so we rebuild the type definition */
|
/* group changed, so we rebuild the type definition */
|
||||||
ntreeMakeOwnType(ngroup);
|
ntreeMakeOwnType(ngroup);
|
||||||
|
|
||||||
if(ngroup->type==NTREE_SHADER) {
|
if(ngroup->type==NTREE_SHADER) {
|
||||||
|
Material *ma;
|
||||||
for(ma= G.main->mat.first; ma; ma= ma->id.next) {
|
for(ma= G.main->mat.first; ma; ma= ma->id.next) {
|
||||||
if(ma->nodetree) {
|
if(ma->nodetree) {
|
||||||
bNode *node;
|
bNode *node;
|
||||||
@ -524,6 +525,28 @@ void nodeVerifyGroup(bNodeTree *ngroup)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(ngroup->type==NTREE_COMPOSIT) {
|
||||||
|
Scene *sce;
|
||||||
|
for(sce= G.main->scene.first; sce; sce= sce->id.next) {
|
||||||
|
if(sce->nodetree) {
|
||||||
|
bNode *node;
|
||||||
|
|
||||||
|
/* find if group is in tree */
|
||||||
|
for(node= sce->nodetree->nodes.first; node; node= node->next)
|
||||||
|
if(node->id == (ID *)ngroup)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if(node) {
|
||||||
|
/* set all type pointers OK */
|
||||||
|
ntreeInitTypes(sce->nodetree);
|
||||||
|
|
||||||
|
for(node= sce->nodetree->nodes.first; node; node= node->next)
|
||||||
|
if(node->id == (ID *)ngroup)
|
||||||
|
nodeVerifyType(sce->nodetree, node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* also to check all users of groups. Now only used in editor for hide/unhide */
|
/* also to check all users of groups. Now only used in editor for hide/unhide */
|
||||||
@ -532,7 +555,6 @@ void nodeGroupSocketUseFlags(bNodeTree *ngroup)
|
|||||||
{
|
{
|
||||||
bNode *node;
|
bNode *node;
|
||||||
bNodeSocket *sock;
|
bNodeSocket *sock;
|
||||||
Material *ma;
|
|
||||||
|
|
||||||
/* clear flags */
|
/* clear flags */
|
||||||
for(node= ngroup->nodes.first; node; node= node->next) {
|
for(node= ngroup->nodes.first; node; node= node->next) {
|
||||||
@ -544,6 +566,7 @@ void nodeGroupSocketUseFlags(bNodeTree *ngroup)
|
|||||||
|
|
||||||
/* tag all thats in use */
|
/* tag all thats in use */
|
||||||
if(ngroup->type==NTREE_SHADER) {
|
if(ngroup->type==NTREE_SHADER) {
|
||||||
|
Material *ma;
|
||||||
for(ma= G.main->mat.first; ma; ma= ma->id.next) {
|
for(ma= G.main->mat.first; ma; ma= ma->id.next) {
|
||||||
if(ma->nodetree) {
|
if(ma->nodetree) {
|
||||||
for(node= ma->nodetree->nodes.first; node; node= node->next) {
|
for(node= ma->nodetree->nodes.first; node; node= node->next) {
|
||||||
@ -561,6 +584,25 @@ void nodeGroupSocketUseFlags(bNodeTree *ngroup)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(ngroup->type==NTREE_COMPOSIT) {
|
||||||
|
Scene *sce;
|
||||||
|
for(sce= G.main->scene.first; sce; sce= sce->id.next) {
|
||||||
|
if(sce->nodetree) {
|
||||||
|
for(node= sce->nodetree->nodes.first; node; node= node->next) {
|
||||||
|
if(node->id==(ID *)ngroup) {
|
||||||
|
for(sock= node->inputs.first; sock; sock= sock->next)
|
||||||
|
if(sock->link)
|
||||||
|
if(sock->tosock)
|
||||||
|
sock->tosock->flag |= SOCK_IN_USE;
|
||||||
|
for(sock= node->outputs.first; sock; sock= sock->next)
|
||||||
|
if(nodeCountSocketLinks(sce->nodetree, sock))
|
||||||
|
if(sock->tosock)
|
||||||
|
sock->tosock->flag |= SOCK_IN_USE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void find_node_with_socket(bNodeTree *ntree, bNodeSocket *sock, bNode **nodep, int *sockindex)
|
static void find_node_with_socket(bNodeTree *ntree, bNodeSocket *sock, bNode **nodep, int *sockindex)
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include "BLI_arithb.h"
|
#include "BLI_arithb.h"
|
||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
|
|
||||||
|
#include "IMB_imbuf.h"
|
||||||
#include "IMB_imbuf_types.h"
|
#include "IMB_imbuf_types.h"
|
||||||
|
|
||||||
#include "DNA_camera_types.h"
|
#include "DNA_camera_types.h"
|
||||||
@ -1125,6 +1126,26 @@ static void sima_draw_alpha_pixels(float x1, float y1, int rectx, int recty, uns
|
|||||||
glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
|
glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, float *rectf)
|
||||||
|
{
|
||||||
|
float *trectf= MEM_mallocN(rectx*recty*4, "temp");
|
||||||
|
int a, b;
|
||||||
|
|
||||||
|
for(a= rectx*recty -1, b= 4*a+3; a>=0; a--, b-=4)
|
||||||
|
trectf[a]= rectf[b];
|
||||||
|
|
||||||
|
glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_FLOAT, trectf);
|
||||||
|
MEM_freeN(trectf);
|
||||||
|
/* ogl trick below is slower... (on ATI 9600) */
|
||||||
|
// glColorMask(1, 0, 0, 0);
|
||||||
|
// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf+3);
|
||||||
|
// glColorMask(0, 1, 0, 0);
|
||||||
|
// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf+2);
|
||||||
|
// glColorMask(0, 0, 1, 0);
|
||||||
|
// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf+1);
|
||||||
|
// glColorMask(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int *recti)
|
static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int *recti)
|
||||||
{
|
{
|
||||||
if(recti==NULL)
|
if(recti==NULL)
|
||||||
@ -1288,6 +1309,8 @@ void drawimagespace(ScrArea *sa, void *spacedata)
|
|||||||
if(sima->flag & SI_SHOW_ALPHA) {
|
if(sima->flag & SI_SHOW_ALPHA) {
|
||||||
if(ibuf->rect)
|
if(ibuf->rect)
|
||||||
sima_draw_alpha_pixels(x1, y1, ibuf->x, ibuf->y, ibuf->rect);
|
sima_draw_alpha_pixels(x1, y1, ibuf->x, ibuf->y, ibuf->rect);
|
||||||
|
else if(ibuf->rect_float)
|
||||||
|
sima_draw_alpha_pixelsf(x1, y1, ibuf->x, ibuf->y, ibuf->rect_float);
|
||||||
}
|
}
|
||||||
else if(sima->flag & SI_SHOW_ZBUF) {
|
else if(sima->flag & SI_SHOW_ZBUF) {
|
||||||
if(ibuf->zbuf)
|
if(ibuf->zbuf)
|
||||||
|
@ -167,10 +167,10 @@ static void load_node_image(char *str) /* called from fileselect */
|
|||||||
if(ima) {
|
if(ima) {
|
||||||
if(node->id)
|
if(node->id)
|
||||||
node->id->us--;
|
node->id->us--;
|
||||||
else {
|
|
||||||
node->id= &ima->id;
|
node->id= &ima->id;
|
||||||
ima->id.us++;
|
ima->id.us++;
|
||||||
}
|
|
||||||
free_image_buffers(ima); /* force read again */
|
free_image_buffers(ima); /* force read again */
|
||||||
ima->ok= 1;
|
ima->ok= 1;
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ static void composit_node_event(SpaceNode *snode, short event)
|
|||||||
strcpy(name, ((Image *)node->id)->name);
|
strcpy(name, ((Image *)node->id)->name);
|
||||||
else strcpy(name, U.textudir);
|
else strcpy(name, U.textudir);
|
||||||
|
|
||||||
/* we make store node->block pointers, and filesel frees it, so we need to clear them */
|
/* node->block pointers are stored, but filesel frees it, so we need to clear them */
|
||||||
for(node= snode->edittree->nodes.first; node; node= node->next)
|
for(node= snode->edittree->nodes.first; node; node= node->next)
|
||||||
node->block= NULL;
|
node->block= NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user