* New feature on compo scale node: "Scene Size %"
This option sets the relative scaling factor to the amount set in the scene "100%/75%/50%/25%" buttons. It's useful when you've got a fixed background image, and want to do preview renders at a lesser percentage, so you don't have to go and change the scale node each time you change the %. Also removed unnecessary use of a global from texture node.
This commit is contained in:
@@ -325,8 +325,9 @@ void set_node_shader_lamp_loop(void (*lamp_loop_func)(struct ShadeInput *, str
|
||||
#define CMP_FILT_SHADOW 6
|
||||
|
||||
/* scale node type, in custom1 */
|
||||
#define CMP_SCALE_RELATIVE 0
|
||||
#define CMP_SCALE_ABSOLUTE 1
|
||||
#define CMP_SCALE_RELATIVE 0
|
||||
#define CMP_SCALE_ABSOLUTE 1
|
||||
#define CMP_SCALE_SCENEPERCENT 2
|
||||
|
||||
|
||||
/* the type definitions array */
|
||||
|
@@ -411,7 +411,7 @@ void default_tex(Tex *tex)
|
||||
|
||||
tex->stype= 0;
|
||||
tex->flag= TEX_CHECKER_ODD;
|
||||
tex->imaflag= TEX_INTERPOL+TEX_MIPMAP;
|
||||
tex->imaflag= TEX_INTERPOL+TEX_MIPMAP+TEX_USEALPHA;
|
||||
tex->extend= TEX_REPEAT;
|
||||
tex->cropxmin= tex->cropymin= 0.0;
|
||||
tex->cropxmax= tex->cropymax= 1.0;
|
||||
@@ -425,7 +425,8 @@ void default_tex(Tex *tex)
|
||||
tex->turbul= 5.0;
|
||||
tex->nabla= 0.025; // also in do_versions
|
||||
tex->bright= 1.0;
|
||||
tex->contrast= tex->filtersize= 1.0;
|
||||
tex->contrast= 1.0;
|
||||
tex->filtersize= 1.0;
|
||||
tex->rfac= 1.0;
|
||||
tex->gfac= 1.0;
|
||||
tex->bfac= 1.0;
|
||||
|
@@ -52,6 +52,7 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
|
||||
return;
|
||||
|
||||
if(in[0]->data) {
|
||||
RenderData *rd= data;
|
||||
CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
|
||||
ImBuf *ibuf;
|
||||
int newx, newy;
|
||||
@@ -60,7 +61,10 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
|
||||
newx= MAX2((int)(in[1]->vec[0]*cbuf->x), 1);
|
||||
newy= MAX2((int)(in[2]->vec[0]*cbuf->y), 1);
|
||||
}
|
||||
else { /* CMP_SCALE_ABSOLUTE */
|
||||
else if(node->custom1==CMP_SCALE_SCENEPERCENT) {
|
||||
newx = cbuf->x * (rd->size / 100.0f);
|
||||
newy = cbuf->y * (rd->size / 100.0f);
|
||||
} else { /* CMP_SCALE_ABSOLUTE */
|
||||
newx= (int)in[1]->vec[0];
|
||||
newy= (int)in[2]->vec[0];
|
||||
}
|
||||
|
@@ -89,6 +89,7 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
|
||||
/* outputs: value, color, normal */
|
||||
|
||||
if(node->id) {
|
||||
RenderData *rd= data;
|
||||
RenderResult *rr= RE_GetResult(RE_GetRender(G.scene->id.name)); /* G.scene is WEAK! */
|
||||
short sizex, sizey;
|
||||
|
||||
@@ -99,8 +100,8 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
|
||||
sizex = rr->rectx;
|
||||
sizey = rr->recty;
|
||||
} else {
|
||||
sizex = G.scene->r.xsch;
|
||||
sizey = G.scene->r.ysch;
|
||||
sizex = rd->xsch;
|
||||
sizey = rd->ysch;
|
||||
}
|
||||
|
||||
prevbuf->rect_procedural= texture_procedural;
|
||||
|
@@ -1726,7 +1726,7 @@ static void node_scale_cb(void *node_v, void *unused_v)
|
||||
|
||||
/* check the 2 inputs, and set them to reasonable values */
|
||||
for(nsock= node->inputs.first; nsock; nsock= nsock->next) {
|
||||
if(node->custom1==CMP_SCALE_RELATIVE)
|
||||
if(ELEM(node->custom1, CMP_SCALE_RELATIVE, CMP_SCALE_SCENEPERCENT))
|
||||
nsock->ns.vec[0]= 1.0;
|
||||
else {
|
||||
if(nsock->next==NULL)
|
||||
@@ -1740,9 +1740,9 @@ static void node_scale_cb(void *node_v, void *unused_v)
|
||||
static int node_composit_buts_scale(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
||||
{
|
||||
if(block) {
|
||||
uiBut *bt= uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Absolute",
|
||||
uiBut *bt= uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Relative %x0|Absolute %x1|Scene Size % %x2|",
|
||||
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
|
||||
&node->custom1, 0, 0, 0, 0, "");
|
||||
&node->custom1, 0, 0, 0, 0, "Scale new image to absolute pixel size, size relative to the incoming image, or using the 'percent' size of the scene");
|
||||
uiButSetFunc(bt, node_scale_cb, node, NULL);
|
||||
}
|
||||
return 20;
|
||||
|
Reference in New Issue
Block a user