diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2012-05-17 16:49:33 +0400 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2012-05-17 16:49:33 +0400 |
commit | 044e818cf89ab8587c8acb7927edd740db3a164d (patch) | |
tree | 52611bf4cfd0d8cde1d4d80352987737a4cfa559 /source/blender/editors | |
parent | eb57856a19127f8867974470dfbfb7524740cd70 (diff) |
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
merge to TRUNK!
* The old compositor is still available (Debug Menu: 200)
This commit was brought to you by:
Developers:
* Monique Dewanchand
* Jeroen Bakker
* Dalai Felinto
* Lukas Tönne
Review:
* Brecht van Lommel
Testers:
* Nate Wiebe
* Wolfgang Faehnle
* Carlo Andreacchio
* Daniel Salazar
* Artur Mag
* Christian Krupa
* Francesco Siddi
* Dan McGrath
* Bassam Kurdali
But mostly by the community:
Gold:
Joshua Faulkner
Michael Tiemann
Francesco Paglia
Blender Guru
Blender Developers Fund
Silver:
Pablo Vazquez
Joel Heethaar
Amrein Olivier
Ilias Karasavvidis
Thomas Kumlehn
Sebastian Koenig
Hannu Hoffrén
Benjamin Dansie
Fred M'ule
Michel Vilain
Bradley Cathey
Gianmichele Mariani
Gottfried Hofmann
Bjørnar Frøyse
Valentijn Bruning
Paul Holmes
Clemens Rudolph
Juris Graphix
David Strebel
Ronan Zeegers
François Tarlier
Felipe Andres Esquivel Reed
Olaf Beckman
Jesus Alberto Olmos Linares
Kajimba
Maria Figueiredo
Alexandr Galperin
Francesco Siddi
Julio Iglesias Lopez
Kjartan Tysdal
Thomas Torfs
Film Works
Teruyuki Nakamura
Roger Luethi
Benoit Bolsee
Stefan Abrahamsen
Andreas Mattijat
Xavier Bouchoux
Blender 3D Graphics and Animation
Henk Vostermans
Daniel Blanco Delgado
BlenderDay/2011
Bradley Cathey
Matthieu Dupont de Dinechin
Gianmichele Mariani
Jérôme Scaillet
Bronze (Ivo Grigull, Dylan Urquidi, Philippe Derungs, Phil Beauchamp, Bruce Parrott, Mathieu Quiblier, Daniel Martinez, Leandro Inocencio, Lluc Romaní Brasó,
Jonathan Williamson, Michael Ehlen, Karlis Stigis, Dreamsteep, Martin Lindelöf, Filippo Saracino, Douwe van der Veen, Olli Äkräs, Bruno D'Arcangeli,
Francisco Sedrez Warmling, Watchmike.ca, peter lener, Matteo Novellino, Martin Kirsch, Austars Schnore, KC Elliott, Massimiliano Puliero, Karl Stein,
Wood Design Studios, Omer Khan, Jyrki Kanto, Michał Krupa, Lars Brubaker, Neil Richmond, Adam Kalisz, Robert Garlington, Ian Wilson, Carlo Andreacchio,
Jeremias Boos, Robert Holcomb, Gabriel Zöller, Robert Cude, Natibel de Leon, Nathan Turnage, Nicolas Vergnes, Philipp Kleinhenz, Norman Hartig, Louis Kreusel,
Christopher Taylor, Giovanni Remondini, Daniel Rentzsch, Nico Partipilo, Thomas Ventresco, Johannes Schwarz, Александр Коротеев, Brendon Harvey,
Marcelo G. Malheiros, Marius Giurgi, Richard Burns, Perttu Iso-Metsälä, Steve Bazin, Radoslav Borisov, Yoshiyuki Shida, Julien Guigner, Andrew Hunter,
Philipp Oeser, Daniel Thul, Thobias Johansson, Mauro Bonecchi, Georg Piorczynski, Sebastian Michailidis, L M Weedy, Gen X, Stefan Hinze, Nicolò Zubbini,
Erik Pusch, Rob Scott, Florian Koch, Charles Razack, Adrian Baker, Oliver Villar Diz, David Revoy, Julio Iglesias Lopez, Coen Spoor, Carlos Folch,
Joseph Christie, Victor Hernández García, David Mcsween, James Finnerty, Cory Kruckenberg, Giacomo Graziosi, Olivier Saraja, Lars Brubaker, Eric Hudson,
Johannes Schwarz, David Elguea, Marcus Schulderinsky, Karel De Bruijn, Lucas van Wijngaarden, Stefano Ciarrocchi, Mehmet Eribol, Thomas Berglund, Zuofei Song,
Dylan Urquidi )
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 287 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 8 |
3 files changed, 294 insertions, 3 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 58fbceb999d..e2ab5ea64e4 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2210,7 +2210,7 @@ static int image_record_composite_apply(bContext *C, wmOperator *op) BKE_image_all_free_anim_ibufs(scene->r.cfra); ntreeCompositTagAnimated(scene->nodetree); - ntreeCompositExecTree(scene->nodetree, &scene->r, scene->r.cfra != rcd->old_cfra); /* 1 is no previews */ + ntreeCompositExecTree(scene->nodetree, &scene->r, 0, scene->r.cfra != rcd->old_cfra); /* 1 is no previews */ ED_area_tag_redraw(CTX_wm_area(C)); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 205202a0658..0a64c102150 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1967,6 +1967,256 @@ static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, Po uiItemR(layout, ptr, "distortion_type", 0, "", 0); } +static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *row; + + row = uiLayoutRow(layout, 0); + uiItemR(row, ptr, "red", 0, NULL, ICON_NONE); + uiItemR(row, ptr, "green", 0, NULL, ICON_NONE); + uiItemR(row, ptr, "blue", 0, NULL, ICON_NONE); + + row = uiLayoutRow(layout, 0); + uiItemR(row, ptr, "midtones_start", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_end", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + row = uiLayoutRow(layout, 0); + uiItemR(row, ptr, "master_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "master_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "master_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "master_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "master_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + row = uiLayoutRow(layout, 0); + uiItemL(row, "Saturation", 0); + uiItemL(row, "Contrast", 0); + uiItemL(row, "Gamma", 0); + uiItemL(row, "Gain", 0); + uiItemL(row, "Lift", 0); + + row = uiLayoutRow(layout, 0); + uiItemR(row, ptr, "highlights_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "highlights_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "highlights_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "highlights_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "highlights_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + row = uiLayoutRow(layout, 0); + uiItemR(row, ptr, "midtones_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + row = uiLayoutRow(layout, 0); + uiItemR(row, ptr, "shadows_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "shadows_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "shadows_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "shadows_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "shadows_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE); +} +static void node_composit_buts_colorcorrection_but(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { + uiLayout *row; + + row = uiLayoutRow(layout, 0); + uiItemR(row, ptr, "red", 0, NULL, ICON_NONE); + uiItemR(row, ptr, "green", 0, NULL, ICON_NONE); + uiItemR(row, ptr, "blue", 0, NULL, ICON_NONE); + row = layout; + uiItemL(row, "Saturation", 0); + uiItemR(row, ptr, "master_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "highlights_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "shadows_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + uiItemL(row, "Contrast", 0); + uiItemR(row, ptr, "master_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "highlights_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "shadows_contrast", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + uiItemL(row, "Gamma", 0); + uiItemR(row, ptr, "master_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "highlights_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "shadows_gamma", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + uiItemL(row, "Gain", 0); + uiItemR(row, ptr, "master_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "highlights_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "shadows_gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + uiItemL(row, "Lift", 0); + uiItemR(row, ptr, "master_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "highlights_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "shadows_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + row = uiLayoutRow(layout, 0); + uiItemR(row, ptr, "midtones_start", 0, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_end", 0, NULL, ICON_NONE); +} + +static void node_composit_buts_switch(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "check", 0, NULL, ICON_NONE); +} + +static void node_composit_buts_boxmask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *row; + + row= uiLayoutRow(layout, 1); + uiItemR(row, ptr, "x", 0, NULL, ICON_NONE); + uiItemR(row, ptr, "y", 0, NULL, ICON_NONE); + + row= uiLayoutRow(layout, 1); + uiItemR(row, ptr, "width", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "height", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + uiItemR(layout, ptr, "rotation", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "mask_type", 0, NULL, ICON_NONE); +} + +static void node_composit_buts_bokehimage(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "flaps", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "angle", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "rounding", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(layout, ptr, "catadioptric", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(layout, ptr, "shift", UI_ITEM_R_SLIDER, NULL, ICON_NONE); +} + +void node_composit_backdrop_viewer(SpaceNode* snode, ImBuf* backdrop, bNode* node, int x, int y) +{ +// node_composit_backdrop_canvas(snode, backdrop, node, x, y); + if (node->custom1 == 0) { /// @todo: why did we need this one? + const float backdropWidth = backdrop->x; + const float backdropHeight = backdrop->y; + const float cx = x+snode->zoom*backdropWidth*node->custom3; + const float cy = y+snode->zoom*backdropHeight*node->custom4; + + glColor3f(1.0, 1.0, 1.0); + + glBegin(GL_LINES); + glVertex2f(cx-25, cy-25); + glVertex2f(cx+25, cy+25); + glVertex2f(cx+25, cy-25); + glVertex2f(cx-25, cy+25); + glEnd(); + } +} + +void node_composit_backdrop_boxmask(SpaceNode* snode, ImBuf* backdrop, bNode* node, int x, int y) +{ + NodeBoxMask * boxmask = node->storage; + const float backdropWidth = backdrop->x; + const float backdropHeight = backdrop->y; + const float aspect = backdropWidth/backdropHeight; + const float rad = DEG2RAD(-boxmask->rotation); + const float cosine = cos(rad); + const float sine = sin(rad); + const float halveBoxWidth = backdropWidth*(boxmask->width/2.0f); + const float halveBoxHeight = backdropHeight*(boxmask->height/2.0f)*aspect; + + float cx, cy, x1, x2, x3, x4; + float y1, y2, y3, y4; + + + /* keep this, saves us from a version patch */ + if(snode->zoom==0.0f) snode->zoom= 1.0f; + + glColor3f(1.0, 1.0, 1.0); + + cx = x+snode->zoom*backdropWidth*boxmask->x; + cy = y+snode->zoom*backdropHeight*boxmask->y; + + x1 = cx - (cosine*halveBoxWidth+sine*halveBoxHeight)*snode->zoom; + x2 = cx - (cosine*-halveBoxWidth+sine*halveBoxHeight)*snode->zoom; + x3 = cx - (cosine*-halveBoxWidth+sine*-halveBoxHeight)*snode->zoom; + x4 = cx - (cosine*halveBoxWidth+sine*-halveBoxHeight)*snode->zoom; + y1 = cy - (-sine*halveBoxWidth + cosine*halveBoxHeight)*snode->zoom; + y2 = cy - (-sine*-halveBoxWidth + cosine*halveBoxHeight)*snode->zoom; + y3 = cy - (-sine*-halveBoxWidth + cosine*-halveBoxHeight)*snode->zoom; + y4 = cy - (-sine*halveBoxWidth + cosine*-halveBoxHeight)*snode->zoom; + + glBegin(GL_LINE_LOOP); + glVertex2f(x1, y1); + glVertex2f(x2, y2); + glVertex2f(x3, y3); + glVertex2f(x4, y4); + glEnd(); +} + +void node_composit_backdrop_ellipsemask(SpaceNode* snode, ImBuf* backdrop, bNode* node, int x, int y) +{ + NodeEllipseMask * ellipsemask = node->storage; + const float backdropWidth = backdrop->x; + const float backdropHeight = backdrop->y; + const float aspect = backdropWidth/backdropHeight; + const float rad = DEG2RAD(-ellipsemask->rotation); + const float cosine = cos(rad); + const float sine = sin(rad); + const float halveBoxWidth = backdropWidth*(ellipsemask->width/2.0f); + const float halveBoxHeight = backdropHeight*(ellipsemask->height/2.0f)*aspect; + + float cx, cy, x1, x2, x3, x4; + float y1, y2, y3, y4; + + + /* keep this, saves us from a version patch */ + if(snode->zoom==0.0f) snode->zoom= 1.0f; + + glColor3f(1.0, 1.0, 1.0); + + cx = x+snode->zoom*backdropWidth*ellipsemask->x; + cy = y+snode->zoom*backdropHeight*ellipsemask->y; + + x1 = cx - (cosine*halveBoxWidth+sine*halveBoxHeight)*snode->zoom; + x2 = cx - (cosine*-halveBoxWidth+sine*halveBoxHeight)*snode->zoom; + x3 = cx - (cosine*-halveBoxWidth+sine*-halveBoxHeight)*snode->zoom; + x4 = cx - (cosine*halveBoxWidth+sine*-halveBoxHeight)*snode->zoom; + y1 = cy - (-sine*halveBoxWidth + cosine*halveBoxHeight)*snode->zoom; + y2 = cy - (-sine*-halveBoxWidth + cosine*halveBoxHeight)*snode->zoom; + y3 = cy - (-sine*-halveBoxWidth + cosine*-halveBoxHeight)*snode->zoom; + y4 = cy - (-sine*halveBoxWidth + cosine*-halveBoxHeight)*snode->zoom; + + glBegin(GL_LINE_LOOP); + + glVertex2f(x1, y1); + glVertex2f(x2, y2); + glVertex2f(x3, y3); + glVertex2f(x4, y4); + glEnd(); +} + +static void node_composit_buts_ellipsemask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *row; + row= uiLayoutRow(layout, 1); + uiItemR(row, ptr, "x", 0, NULL, ICON_NONE); + uiItemR(row, ptr, "y", 0, NULL, ICON_NONE); + row= uiLayoutRow(layout, 1); + uiItemR(row, ptr, "width", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "height", UI_ITEM_R_SLIDER, NULL, ICON_NONE); + + uiItemR(layout, ptr, "rotation", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "mask_type", 0, NULL, ICON_NONE); +} + +static void node_composit_buts_viewer_but(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + uiItemR(layout, ptr, "tile_order", 0, NULL, ICON_NONE); + if (RNA_enum_get(ptr, "tile_order")==0) { + col= uiLayoutColumn(layout, 1); + uiItemR(col, ptr, "center_x", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "center_y", 0, NULL, ICON_NONE); + } +} + /* only once called */ static void node_composit_set_butfunc(bNodeType *ntype) { @@ -2134,6 +2384,30 @@ static void node_composit_set_butfunc(bNodeType *ntype) case CMP_NODE_MOVIEDISTORTION: ntype->uifunc= node_composit_buts_moviedistortion; break; + case CMP_NODE_COLORCORRECTION: + ntype->uifunc=node_composit_buts_colorcorrection; + ntype->uifuncbut=node_composit_buts_colorcorrection_but; + break; + case CMP_NODE_SWITCH: + ntype->uifunc= node_composit_buts_switch; + break; + case CMP_NODE_MASK_BOX: + ntype->uifunc= node_composit_buts_boxmask; + ntype->uibackdropfunc = node_composit_backdrop_boxmask; + break; + case CMP_NODE_MASK_ELLIPSE: + ntype->uifunc= node_composit_buts_ellipsemask; + ntype->uibackdropfunc = node_composit_backdrop_ellipsemask; + break; + case CMP_NODE_BOKEHIMAGE: + ntype->uifunc= node_composit_buts_bokehimage; + break; + case CMP_NODE_VIEWER: + ntype->uifunc = NULL; + ntype->uifuncbut= node_composit_buts_viewer_but; + ntype->uibackdropfunc = node_composit_backdrop_viewer; + break; + default: ntype->uifunc= NULL; } @@ -2432,6 +2706,19 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage) glPixelZoom(1.0f, 1.0f); } } + + /// @note draw selected info on backdrop + if (snode->edittree) { + bNode *node = snode->edittree->nodes.first; + while (node) { + if (node->flag & NODE_SELECT) { + if (node->typeinfo->uibackdropfunc) { + node->typeinfo->uibackdropfunc(snode, ibuf, node, x, y); + } + } + node = node->next; + } + } glMatrixMode(GL_PROJECTION); glPopMatrix(); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index c23f6c76650..f71ce3f960c 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -185,8 +185,8 @@ static void compo_startjob(void *cjv, short *stop, short *do_update, float *prog // XXX BIF_store_spare(); - ntreeCompositExecTree(ntree, &cj->scene->r, 1); /* 1 is do_previews */ - + ntreeCompositExecTree(ntree, &cj->scene->r, 0, 1); /* 1 is do_previews */ + ntree->test_break= NULL; ntree->stats_draw= NULL; ntree->progress= NULL; @@ -405,6 +405,10 @@ void ED_node_composit_default(Scene *sce) } sce->nodetree= ntreeAddTree("Compositing Nodetree", NTREE_COMPOSIT, 0); + + sce->nodetree->chunksize = 256; + sce->nodetree->edit_quality = NTREE_QUALITY_HIGH; + sce->nodetree->render_quality = NTREE_QUALITY_HIGH; ntemp.type = CMP_NODE_COMPOSITE; out= nodeAddNode(sce->nodetree, &ntemp); |