Ejemplo n.º 1
0
/* add the relevant text to the cache of text-strings to draw in pixelspace */
static void nla_draw_strip_text (NlaTrack *nlt, NlaStrip *strip, int index, View2D *v2d, float yminc, float ymaxc)
{
	char str[256], dir[3];
	rctf rect;
	
	/* 'dir' - direction that strip is played in */
	if (strip->flag & NLASTRIP_FLAG_REVERSE)
		sprintf(dir, "<-");
	else
		sprintf(dir, "->");
	
	/* just print the name and the range */
	if (strip->flag & NLASTRIP_FLAG_TEMP_META)
		sprintf(str, "Temp-Meta | %.2f %s %.2f", strip->start, dir, strip->end);
	else
		sprintf(str, "%s | %.2f %s %.2f", strip->name, strip->start, dir, strip->end);
	
	/* set text colour - if colours (see above) are light, draw black text, otherwise draw white */
	if (strip->flag & (NLASTRIP_FLAG_ACTIVE|NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_TWEAKUSER))
		glColor3f(0.0f, 0.0f, 0.0f);
	else
		glColor3f(1.0f, 1.0f, 1.0f);
	
	/* set bounding-box for text 
	 *	- padding of 2 'units' on either side
	 */
	// TODO: make this centered?
	rect.xmin= strip->start + 0.5f;
	rect.ymin= yminc;
	rect.xmax= strip->end - 0.5f;
	rect.ymax= ymaxc;
	
	/* add this string to the cache of texts to draw*/
	UI_view2d_text_cache_rectf(v2d, &rect, str);
}
Ejemplo n.º 2
0
/* add the relevant text to the cache of text-strings to draw in pixelspace */
static void nla_draw_strip_text(AnimData *adt, NlaTrack *nlt, NlaStrip *strip, int index, View2D *v2d, float yminc, float ymaxc)
{
	short notSolo = ((adt && (adt->flag & ADT_NLA_SOLO_TRACK)) && (nlt->flag & NLATRACK_SOLO) == 0);
	char str[256];
	char col[4];
	float xofs;
	rctf rect;
	
	/* just print the name and the range */
	if (strip->flag & NLASTRIP_FLAG_TEMP_META) {
		BLI_snprintf(str, sizeof(str), "%d) Temp-Meta", index);
	}
	else {
		BLI_strncpy(str, strip->name, sizeof(str));
	}
	
	/* set text color - if colors (see above) are light, draw black text, otherwise draw white */
	if (strip->flag & (NLASTRIP_FLAG_ACTIVE | NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_TWEAKUSER)) {
		col[0] = col[1] = col[2] = 0;
	}
	else {
		col[0] = col[1] = col[2] = 255;
	}
	
	/* text opacity depends on whether if there's a solo'd track, this isn't it */
	if (notSolo == 0)
		col[3] = 255;
	else
		col[3] = 128;
	
	/* determine the amount of padding required - cannot be constant otherwise looks weird in some cases */
	if ((strip->end - strip->start) <= 5.0f)
		xofs = 0.5f;
	else
		xofs = 1.0f;
	
	/* set bounding-box for text 
	 *	- padding of 2 'units' on either side
	 */
	// TODO: make this centered?
	rect.xmin = strip->start + xofs;
	rect.ymin = yminc;
	rect.xmax = strip->end - xofs;
	rect.ymax = ymaxc;
	
	/* add this string to the cache of texts to draw */
	UI_view2d_text_cache_rectf(v2d, &rect, str, col);
}
Ejemplo n.º 3
0
/* draw info text on a sequence strip */
static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float y1, float y2, const unsigned char background_col[3])
{
	rctf rect;
	char str[32 + FILE_MAX];
	const char *name = seq->name + 2;
	char col[4];

	/* note, all strings should include 'name' */
	if (name[0] == '\0')
		name = BKE_sequence_give_name(seq);

	if (seq->type == SEQ_TYPE_META || seq->type == SEQ_TYPE_ADJUSTMENT) {
		BLI_snprintf(str, sizeof(str), "%s | %d", name, seq->len);
	}
	else if (seq->type == SEQ_TYPE_SCENE) {
		if (seq->scene) {
			if (seq->scene_camera) {
				BLI_snprintf(str, sizeof(str), "%s: %s (%s) | %d",
				             name, seq->scene->id.name + 2, ((ID *)seq->scene_camera)->name + 2, seq->len);
			}
			else {
				BLI_snprintf(str, sizeof(str), "%s: %s | %d",
				             name, seq->scene->id.name + 2, seq->len);
			}
		}
		else {
			BLI_snprintf(str, sizeof(str), "%s | %d",
			             name, seq->len);
		}
	}
	else if (seq->type == SEQ_TYPE_MOVIECLIP) {
		if (seq->clip && strcmp(name, seq->clip->id.name + 2) != 0) {
			BLI_snprintf(str, sizeof(str), "%s: %s | %d",
			             name, seq->clip->id.name + 2, seq->len);
		}
		else {
			BLI_snprintf(str, sizeof(str), "%s | %d",
			             name, seq->len);
		}
	}
	else if (seq->type == SEQ_TYPE_MASK) {
		if (seq->mask && strcmp(name, seq->mask->id.name + 2) != 0) {
			BLI_snprintf(str, sizeof(str), "%s: %s | %d",
			             name, seq->mask->id.name + 2, seq->len);
		}
		else {
			BLI_snprintf(str, sizeof(str), "%s | %d",
			             name, seq->len);
		}
	}
	else if (seq->type == SEQ_TYPE_MULTICAM) {
		BLI_snprintf(str, sizeof(str), "Cam %s: %d",
		             name, seq->multicam_source);
	}
	else if (seq->type == SEQ_TYPE_IMAGE) {
		BLI_snprintf(str, sizeof(str), "%s: %s%s | %d",
		             name, seq->strip->dir, seq->strip->stripdata->name, seq->len);
	}
	else if (seq->type & SEQ_TYPE_EFFECT) {
		BLI_snprintf(str, sizeof(str), "%s | %d",
			             name, seq->len);
	}
	else if (seq->type == SEQ_TYPE_SOUND_RAM) {
		if (seq->sound)
			BLI_snprintf(str, sizeof(str), "%s: %s | %d",
			             name, seq->sound->name, seq->len);
		else
			BLI_snprintf(str, sizeof(str), "%s | %d",
			             name, seq->len);
	}
	else if (seq->type == SEQ_TYPE_MOVIE) {
		BLI_snprintf(str, sizeof(str), "%s: %s%s | %d",
		             name, seq->strip->dir, seq->strip->stripdata->name, seq->len);
	}
	
	if (seq->flag & SELECT) {
		col[0] = col[1] = col[2] = 255;
	}
	else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50) {
		col[0] = col[1] = col[2] = 80; /* use lighter text color for dark background */
	}
	else {
		col[0] = col[1] = col[2] = 0;
	}
	col[3] = 255;

	rect.xmin = x1;
	rect.ymin = y1;
	rect.xmax = x2;
	rect.ymax = y2;
	UI_view2d_text_cache_rectf(v2d, &rect, str, col);
}
Ejemplo n.º 4
0
/* draw info text on a sequence strip */
static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float y1, float y2, const unsigned char background_col[3])
{
    rctf rect;
    char str[32 + FILE_MAX];
    const char *name= seq->name+2;
    char col[4];

    /* note, all strings should include 'name' */
    if(name[0]=='\0')
        name= give_seqname(seq);

    if(seq->type == SEQ_META || seq->type == SEQ_ADJUSTMENT) {
        BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
    }
    else if(seq->type == SEQ_SCENE) {
        if(seq->scene) {
            if(seq->scene_camera) {
                BLI_snprintf(str, sizeof(str), "%d | %s: %s (%s)", seq->len, name, seq->scene->id.name+2, ((ID *)seq->scene_camera)->name+2);
            } else {
                BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->scene->id.name+2);
            }
        }
        else {
            BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
        }
    }
    else if(seq->type == SEQ_MULTICAM) {
        BLI_snprintf(str, sizeof(str), "Cam | %s: %d", name, seq->multicam_source);
    }
    else if(seq->type == SEQ_IMAGE) {
        BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
    }
    else if(seq->type & SEQ_EFFECT) {
        int can_float = (seq->type != SEQ_PLUGIN)
                        || (seq->plugin && seq->plugin->version >= 4);

        if(seq->seq3!=seq->seq2 && seq->seq1!=seq->seq3)
            BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d (use %d)%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine, can_float ? "" : " No float, upgrade plugin!");
        else if (seq->seq1 && seq->seq2)
            BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, can_float ? "" : " No float, upgrade plugin!");
        else
            BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
    }
    else if (seq->type == SEQ_SOUND) {
        BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->sound->name);
    }
    else if (seq->type == SEQ_MOVIE) {
        BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
    }

    if(seq->flag & SELECT) {
        col[0]= col[1]= col[2]= 255;
    } else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50) {
        col[0]= col[1]= col[2]= 80; /* use lighter text color for dark background */
    } else {
        col[0]= col[1]= col[2]= 0;
    }
    col[3]= 255;

    rect.xmin= x1;
    rect.ymin= y1;
    rect.xmax= x2;
    rect.ymax= y2;
    UI_view2d_text_cache_rectf(v2d, &rect, str, col);
}