Composite Time node usablity improvement:
- now draws green 'current frame' line - when Time Node is active, hotkey I will allow inserting a value on current frame.
This commit is contained in:
@@ -68,13 +68,14 @@ typedef struct CurveMapping {
|
||||
rctf curr, clipr; /* current rect, clip rect (is default rect too) */
|
||||
|
||||
CurveMap cm[4]; /* max 4 builtin curves per mapping struct now */
|
||||
float black[3], white[3]; /* black/white point */
|
||||
float black[3], white[3]; /* black/white point (black[0] abused for current frame) */
|
||||
float bwmul[3], padf; /* black/white point multiply value, for speed */
|
||||
} CurveMapping;
|
||||
|
||||
/* cumapping->flag */
|
||||
#define CUMA_DO_CLIP 1
|
||||
#define CUMA_PREMULLED 2
|
||||
#define CUMA_DRAW_CFRA 4
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "BLI_arithb.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_color_types.h"
|
||||
#include "DNA_ipo_types.h"
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_image_types.h"
|
||||
@@ -981,8 +982,13 @@ static int node_composit_buts_map_value(uiBlock *block, bNodeTree *ntree, bNode
|
||||
static int node_composit_buts_time(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
||||
{
|
||||
if(block) {
|
||||
CurveMapping *cumap= node->storage;
|
||||
short dx= (butr->xmax-butr->xmin)/2;
|
||||
|
||||
cumap->flag |= CUMA_DRAW_CFRA;
|
||||
if(node->custom1<node->custom2)
|
||||
cumap->black[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
|
||||
|
||||
uiDefBut(block, BUT_CURVE, B_NODE_EXEC+node->nr, "",
|
||||
butr->xmin, butr->ymin+24, butr->xmax-butr->xmin, butr->ymax-butr->ymin-24,
|
||||
node->storage, 0.0f, 1.0f, 0, 0, "");
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_color_types.h"
|
||||
#include "DNA_image_types.h"
|
||||
#include "DNA_ipo_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
@@ -45,6 +46,7 @@
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_library.h"
|
||||
@@ -1674,7 +1676,30 @@ void node_hide(SpaceNode *snode)
|
||||
BIF_undo_push("Hide nodes");
|
||||
allqueue(REDRAWNODE, 1);
|
||||
}
|
||||
|
||||
void node_insert_key(SpaceNode *snode)
|
||||
{
|
||||
bNode *node= editnode_get_active(snode->edittree);
|
||||
|
||||
if(node->type==CMP_NODE_TIME) {
|
||||
if(node->custom1<node->custom2) {
|
||||
|
||||
CurveMapping *cumap= node->storage;
|
||||
float fval, curval;
|
||||
|
||||
curval= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
|
||||
fval= curvemapping_evaluateF(cumap, 0, curval);
|
||||
|
||||
if(fbutton(&fval, 0.0f, 1.0f, 10, 10, "Insert Value")) {
|
||||
curvemap_insert(cumap->cm, curval, fval);
|
||||
|
||||
BIF_undo_push("Insert key in Time node");
|
||||
allqueue(REDRAWNODE, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void node_border_link_delete(SpaceNode *snode)
|
||||
{
|
||||
@@ -1998,6 +2023,9 @@ void winqreadnodespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
case HKEY:
|
||||
node_hide(snode);
|
||||
break;
|
||||
case IKEY:
|
||||
node_insert_key(snode);
|
||||
break;
|
||||
case RKEY:
|
||||
if(okee("Read saved Render Layers"))
|
||||
node_read_renderlayers(snode);
|
||||
|
||||
@@ -2191,6 +2191,15 @@ static void ui_draw_but_CURVE(uiBut *but)
|
||||
glVertex2f(but->x1 + zoomx*(-offsx), but->y2);
|
||||
glEnd();
|
||||
|
||||
/* cfra option */
|
||||
if(cumap->flag & CUMA_DRAW_CFRA) {
|
||||
glColor3ub(0x60, 0xc0, 0x40);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(but->x1 + zoomx*(cumap->black[0]-offsx), but->y1);
|
||||
glVertex2f(but->x1 + zoomx*(cumap->black[0]-offsx), but->y2);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
/* the curve */
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
|
||||
@@ -729,7 +729,7 @@ int blenderqread(unsigned short event, short val)
|
||||
}
|
||||
break;
|
||||
case IKEY:
|
||||
if(textediting==0 && textspace==0 && curarea->spacetype!=SPACE_FILE && curarea->spacetype!=SPACE_IMASEL) {
|
||||
if(textediting==0 && textspace==0 && !ELEM3(curarea->spacetype, SPACE_FILE, SPACE_IMASEL, SPACE_NODE)) {
|
||||
if(G.qual==0) {
|
||||
common_insertkey();
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user