Fix blend node out color inverted vs inputs

This commit is contained in:
Peter Schulman 2023-05-31 12:45:43 +03:00
parent 25e2a0b8e4
commit 7b637bcc71
1 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ static void node_blend_display(struct nk_context *ctx, struct node *node) {
int i;
nk_layout_row_dynamic(ctx, 25, 1);
for (i = 0; i < (int)NK_LEN(blend_node->input_val); i++){
for (i = 0; i < 2; i++){
if(node->inputs[i].is_connected) {
blend_node->input_val[i] = *(struct nk_colorf*)node_editor_eval_connected(node, i);
}
@ -38,10 +38,10 @@ static void node_blend_display(struct nk_context *ctx, struct node *node) {
if(node->inputs[0].is_connected && node->inputs[1].is_connected) {
blend_node->output_val.r = blend_node->input_val[0].r * blend_amnt + blend_node->input_val[1].r * (1.0f-blend_amnt);
blend_node->output_val.g = blend_node->input_val[0].g * blend_amnt + blend_node->input_val[1].g * (1.0f-blend_amnt);
blend_node->output_val.b = blend_node->input_val[0].b * blend_amnt + blend_node->input_val[1].b * (1.0f-blend_amnt);
blend_node->output_val.a = blend_node->input_val[0].a * blend_amnt + blend_node->input_val[1].a * (1.0f-blend_amnt);
blend_node->output_val.r = blend_node->input_val[0].r * (1.0f-blend_amnt) + blend_node->input_val[1].r * blend_amnt;
blend_node->output_val.g = blend_node->input_val[0].g * (1.0f-blend_amnt) + blend_node->input_val[1].g * blend_amnt;
blend_node->output_val.b = blend_node->input_val[0].b * (1.0f-blend_amnt) + blend_node->input_val[1].b * blend_amnt;
blend_node->output_val.a = blend_node->input_val[0].a * (1.0f-blend_amnt) + blend_node->input_val[1].a * blend_amnt;
}
else {
blend_node->output_val = blank;