Merging r47382 through r47398 from trunk into soc-2011-tomato

This commit is contained in:
Sergey Sharybin
2012-06-04 10:55:05 +00:00
30 changed files with 503 additions and 165 deletions

View File

@@ -41,8 +41,16 @@ class CONSOLE_MT_console(Menu):
def draw(self, context):
layout = self.layout
layout.operator("console.indent")
layout.operator("console.unindent")
layout.separator()
layout.operator("console.clear")
layout.operator("console.clear_line")
layout.separator()
layout.operator("console.copy")
layout.operator("console.paste")
layout.menu("CONSOLE_MT_language")

View File

@@ -44,6 +44,7 @@ struct anim;
struct Scene;
struct Object;
struct ImageFormatData;
struct Main;
/* call from library */
void BKE_image_free(struct Image *me);
@@ -143,6 +144,9 @@ struct Image *BKE_image_add_from_imbuf(struct ImBuf *ibuf);
/* for reload, refresh, pack */
void BKE_image_signal(struct Image *ima, struct ImageUser *iuser, int signal);
void BKE_image_walk_all_users(const struct Main *mainp, void *customdata,
void callback(struct Image *ima, struct ImageUser *iuser, void *customdata));
/* ensures an Image exists for viewing nodes or render */
struct Image *BKE_image_verify_viewer(int type, const char *name);
@@ -151,6 +155,7 @@ void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf);
/* called on frame change or before render */
void BKE_image_user_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr);
void BKE_image_user_check_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr);
int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, int fieldnr);
/* sets index offset for multilayer files */

View File

@@ -32,6 +32,7 @@
* \ingroup bke
*/
struct bContext;
struct Brush;
struct MDisps;
struct MeshElemMap;
@@ -55,6 +56,7 @@ void free_paint(struct Paint *p);
void copy_paint(struct Paint *src, struct Paint *tar);
struct Paint *paint_get_active(struct Scene *sce);
struct Paint *paint_get_active_from_context(const struct bContext *C);
struct Brush *paint_brush(struct Paint *paint);
void paint_brush_set(struct Paint *paint, struct Brush *br);

View File

@@ -91,6 +91,14 @@
#include "BLO_sys_types.h" // for intptr_t support
/* for image user iteration */
#include "DNA_node_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "WM_api.h"
/* max int, to indicate we don't store sequences in ibuf */
#define IMA_NO_INDEX 0x7FEFEFEF
@@ -1814,6 +1822,65 @@ void BKE_image_assign_ibuf(Image *ima, ImBuf *ibuf)
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
}
void BKE_image_walk_all_users(const Main *mainp, void *customdata,
void callback(Image *ima, ImageUser *iuser, void *customdata))
{
wmWindowManager *wm;
wmWindow *win;
Tex *tex;
/* texture users */
for (tex = mainp->tex.first; tex; tex = tex->id.next) {
if (tex->type == TEX_IMAGE && tex->ima) {
if (ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
callback(tex->ima, &tex->iuser, customdata);
}
}
}
/* image window, compo node users */
for (wm = mainp->wm.first; wm; wm = wm->id.next) { /* only 1 wm */
for (win = wm->windows.first; win; win = win->next) {
ScrArea *sa;
for (sa = win->screen->areabase.first; sa; sa = sa->next) {
if (sa->spacetype == SPACE_VIEW3D) {
View3D *v3d = sa->spacedata.first;
BGpic *bgpic;
for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) {
callback(bgpic->ima, &bgpic->iuser, customdata);
}
}
else if (sa->spacetype == SPACE_IMAGE) {
SpaceImage *sima = sa->spacedata.first;
callback(sima->image, &sima->iuser, customdata);
}
else if (sa->spacetype == SPACE_NODE) {
SpaceNode *snode = sa->spacedata.first;
if ((snode->treetype == NTREE_COMPOSIT) && (snode->nodetree)) {
bNode *node;
for (node = snode->nodetree->nodes.first; node; node = node->next) {
if (node->id && node->type == CMP_NODE_IMAGE) {
Image *ima = (Image *)node->id;
ImageUser *iuser = node->storage;
callback(ima, iuser, customdata);
}
}
}
}
}
}
}
}
static void image_tag_frame_recalc(Image *ima, ImageUser *iuser, void *customdata)
{
Image *changed_image = customdata;
if (ima == changed_image) {
iuser->flag |= IMA_NEED_FRAME_RECALC;
}
}
void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
{
if (ima == NULL)
@@ -1847,6 +1914,9 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
ima->ok = 1;
if (iuser)
iuser->ok = 1;
BKE_image_walk_all_users(G.main, ima, image_tag_frame_recalc);
break;
case IMA_SIGNAL_RELOAD:
@@ -2669,6 +2739,15 @@ void BKE_image_user_frame_calc(ImageUser *iuser, int cfra, int fieldnr)
if (iuser->ok == 0) iuser->ok = 1;
}
void BKE_image_user_check_frame_calc(ImageUser *iuser, int cfra, int fieldnr)
{
if ((iuser->flag & IMA_ANIM_ALWAYS) || (iuser->flag & IMA_NEED_FRAME_RECALC)) {
BKE_image_user_frame_calc(iuser, cfra, fieldnr);
iuser->flag &= ~IMA_NEED_FRAME_RECALC;
}
}
int BKE_image_has_alpha(struct Image *image)
{
ImBuf *ibuf;
@@ -2684,4 +2763,3 @@ int BKE_image_has_alpha(struct Image *image)
else
return 0;
}

View File

@@ -41,6 +41,7 @@
#include "BLI_utildefines.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_library.h"
#include "BKE_paint.h"
#include "BKE_subsurf.h"
@@ -83,6 +84,54 @@ Paint *paint_get_active(Scene *sce)
return NULL;
}
Paint *paint_get_active_from_context(const bContext *C)
{
Scene *sce = CTX_data_scene(C);
if (sce) {
ToolSettings *ts = sce->toolsettings;
Object *obact = NULL;
if (sce->basact && sce->basact->object)
obact = sce->basact->object;
if (CTX_wm_space_image(C) != NULL) {
if (obact->mode == OB_MODE_EDIT) {
if (ts->use_uv_sculpt)
return &ts->uvsculpt->paint;
else
return &ts->imapaint.paint;
}
else {
return &ts->imapaint.paint;
}
}
else if (obact) {
switch (obact->mode) {
case OB_MODE_SCULPT:
return &ts->sculpt->paint;
case OB_MODE_VERTEX_PAINT:
return &ts->vpaint->paint;
case OB_MODE_WEIGHT_PAINT:
return &ts->wpaint->paint;
case OB_MODE_TEXTURE_PAINT:
return &ts->imapaint.paint;
case OB_MODE_EDIT:
if (ts->use_uv_sculpt)
return &ts->uvsculpt->paint;
else
return &ts->imapaint.paint;
}
}
else {
/* default to image paint */
return &ts->imapaint.paint;
}
}
return NULL;
}
Brush *paint_brush(Paint *p)
{
return p ? p->brush : NULL;

View File

@@ -43,6 +43,8 @@ void *GaussianBokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **
void GaussianBokehBlurOperation::initExecution()
{
BlurBaseOperation::initExecution();
if (this->sizeavailable) {
updateGauss(NULL);
}

View File

@@ -45,6 +45,8 @@ void *GaussianXBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memo
void GaussianXBlurOperation::initExecution()
{
BlurBaseOperation::initExecution();
if (this->sizeavailable) {
float rad = size*this->data->sizex;
if (rad<1)

View File

@@ -395,11 +395,8 @@ static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListEle
/* get backdrop color for summary widget */
static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
{
// FIXME: hardcoded color - same as the 'action' line in NLA
// reddish color
r_color[0] = 0.8f;
r_color[1] = 0.2f;
r_color[2] = 0.0f;
/* reddish color - same as the 'action' line in NLA */
UI_GetThemeColor3fv(TH_ANIM_ACTIVE, r_color);
}
/* backdrop for summary widget */

View File

@@ -200,7 +200,20 @@ enum {
TH_MATCH, /* highlight color for search matches */
TH_SELECT_HIGHLIGHT, /* highlight color for selected outliner item */
TH_SKIN_ROOT
TH_SKIN_ROOT,
TH_ANIM_ACTIVE, /* active action */
TH_ANIM_INACTIVE, /* no active action */
TH_NLA_TWEAK, /* 'tweaking' track in NLA */
TH_NLA_TWEAK_DUPLI, /* error/warning flag for other strips referencing dupli strip */
TH_NLA_TRANSITION,
TH_NLA_TRANSITION_SEL,
TH_NLA_META,
TH_NLA_META_SEL,
TH_NLA_SOUND,
TH_NLA_SOUND_SEL
};
/* XXX WARNING: previous is saved in file, so do not change order! */
@@ -239,6 +252,9 @@ void UI_GetThemeColor3fv(int colorid, float col[3]);
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]);
void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]);
// get four color values, scaled to 0.0-1.0 range
void UI_GetThemeColor4fv(int colorid, float col[4]);
// get the 3 or 4 byte values
void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]);
void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]);

View File

@@ -473,6 +473,39 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case TH_SKIN_ROOT:
cp = ts->skin_root;
break;
case TH_ANIM_ACTIVE:
cp = ts->anim_active;
break;
case TH_ANIM_INACTIVE:
cp = ts->anim_non_active;
break;
case TH_NLA_TWEAK:
cp = ts->nla_tweaking;
break;
case TH_NLA_TWEAK_DUPLI:
cp = ts->nla_tweakdupli;
break;
case TH_NLA_TRANSITION:
cp = ts->nla_transition;
break;
case TH_NLA_TRANSITION_SEL:
cp = ts->nla_transition_sel;
break;
case TH_NLA_META:
cp = ts->nla_meta;
break;
case TH_NLA_META_SEL:
cp = ts->nla_meta_sel;
break;
case TH_NLA_SOUND:
cp = ts->nla_sound;
break;
case TH_NLA_SOUND_SEL:
cp = ts->nla_sound_sel;
break;
}
}
}
@@ -735,19 +768,34 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
btheme->tipo.handle_vertex_size = 4;
rgba_char_args_set(btheme->tipo.ds_channel, 82, 96, 110, 255);
rgba_char_args_set(btheme->tipo.ds_channel, 82, 96, 110, 255);
rgba_char_args_set(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
rgba_char_args_set(btheme->tipo.group, 79, 101, 73, 255);
rgba_char_args_set(btheme->tipo.group_active, 135, 177, 125, 255);
rgba_char_args_set(btheme->tipo.group, 79, 101, 73, 255);
rgba_char_args_set(btheme->tipo.group_active, 135, 177, 125, 255);
/* dopesheet */
btheme->tact = btheme->tipo;
rgba_char_args_set(btheme->tact.strip, 12, 10, 10, 128);
rgba_char_args_set(btheme->tact.strip_select, 255, 140, 0, 255);
rgba_char_args_set(btheme->tact.anim_active, 204, 112, 26, 102);
/* space nla */
btheme->tnla = btheme->tact;
rgba_char_args_set(btheme->tnla.anim_active, 204, 112, 26, 102); /* same as for dopesheet; duplicate here for easier reference */
rgba_char_args_set(btheme->tnla.anim_non_active,153, 135, 97, 77);
rgba_char_args_set(btheme->tnla.nla_tweaking, 77, 243, 26, 77);
rgba_char_args_set(btheme->tnla.nla_tweakdupli, 217, 0, 0, 255);
rgba_char_args_set(btheme->tnla.nla_transition, 28, 38, 48, 255);
rgba_char_args_set(btheme->tnla.nla_transition_sel, 46, 117, 219, 255);
rgba_char_args_set(btheme->tnla.nla_meta, 51, 38, 66, 255);
rgba_char_args_set(btheme->tnla.nla_meta_sel, 105, 33, 150, 255);
rgba_char_args_set(btheme->tnla.nla_sound, 43, 61, 61, 255);
rgba_char_args_set(btheme->tnla.nla_sound_sel, 31, 122, 122, 255);
/* space file */
/* to have something initialized */
btheme->tfile = btheme->tv3d;
@@ -1043,6 +1091,17 @@ void UI_GetThemeColor3fv(int colorid, float col[3])
col[2] = ((float)cp[2]) / 255.0f;
}
void UI_GetThemeColor4fv(int colorid, float col[4])
{
const unsigned char *cp;
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
col[0] = ((float)cp[0]) / 255.0f;
col[1] = ((float)cp[1]) / 255.0f;
col[2] = ((float)cp[2]) / 255.0f;
col[3] = ((float)cp[3]) / 255.0f;
}
// get the color, range 0.0-1.0, complete with shading offset
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
{
@@ -1816,6 +1875,29 @@ void init_userdef_do_versions(void)
for (btheme = U.themes.first; btheme; btheme = btheme->next)
rgba_char_args_set(btheme->tv3d.skin_root, 180, 77, 77, 255);
}
if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 7)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
/* DopeSheet Summary */
rgba_char_args_set(btheme->tact.anim_active, 204, 112, 26, 102);
/* NLA Colors */
rgba_char_args_set(btheme->tnla.anim_active, 204, 112, 26, 102); /* same as dopesheet above */
rgba_char_args_set(btheme->tnla.anim_non_active,153, 135, 97, 77);
rgba_char_args_set(btheme->tnla.nla_tweaking, 77, 243, 26, 77);
rgba_char_args_set(btheme->tnla.nla_tweakdupli, 217, 0, 0, 255);
rgba_char_args_set(btheme->tnla.nla_transition, 28, 38, 48, 255);
rgba_char_args_set(btheme->tnla.nla_transition_sel, 46, 117, 219, 255);
rgba_char_args_set(btheme->tnla.nla_meta, 51, 38, 66, 255);
rgba_char_args_set(btheme->tnla.nla_meta_sel, 105, 33, 150, 255);
rgba_char_args_set(btheme->tnla.nla_sound, 43, 61, 61, 255);
rgba_char_args_set(btheme->tnla.nla_sound_sel, 31, 122, 122, 255);
}
}
/* GL Texture Garbage Collection (variable abused above!) */
if (U.textimeout == 0) {

View File

@@ -333,7 +333,7 @@ static int sculpt_get_brush_geometry(bContext *C, ViewContext *vc,
float location[3])
{
Scene *scene = CTX_data_scene(C);
Paint *paint = paint_get_active(scene);
Paint *paint = paint_get_active_from_context(C);
Brush *brush = paint_brush(paint);
float window[2];
int hit;
@@ -503,7 +503,7 @@ static void paint_cursor_on_hit(Sculpt *sd, Brush *brush, ViewContext *vc,
static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
{
Scene *scene = CTX_data_scene(C);
Paint *paint = paint_get_active(scene);
Paint *paint = paint_get_active_from_context(C);
Brush *brush = paint_brush(paint);
ViewContext vc;
float final_radius;
@@ -605,7 +605,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
void paint_cursor_start(bContext *C, int (*poll)(bContext *C))
{
Paint *p = paint_get_active(CTX_data_scene(C));
Paint *p = paint_get_active_from_context(C);
if (p && !p->paint_cursor)
p->paint_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), poll, paint_draw_cursor, NULL);

View File

@@ -5215,7 +5215,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
Scene *scene = CTX_data_scene(C);
//Brush *brush= image_paint_brush(C);
Paint *paint = paint_get_active(scene);
Paint *paint = paint_get_active_from_context(C);
Brush *brush = paint_brush(paint);
if (paint && brush && paint->flags & PAINT_SHOW_BRUSH) {
@@ -5420,13 +5420,12 @@ void PAINT_OT_grab_clone(wmOperatorType *ot)
static int sample_color_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Brush *brush = image_paint_brush(C);
ARegion *ar = CTX_wm_region(C);
int location[2];
RNA_int_get_array(op->ptr, "location", location);
paint_sample_color(scene, ar, location[0], location[1]);
paint_sample_color(C, ar, location[0], location[1]);
WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush);

View File

@@ -137,7 +137,7 @@ float paint_get_tex_pixel(struct Brush *br, float u, float v);
int imapaint_pick_face(struct ViewContext *vc, const int mval[2], unsigned int *index, unsigned int totface);
void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, const int xy[2], float uv[2]);
void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y);
void paint_sample_color(const struct bContext *C, struct ARegion *ar, int x, int y);
void BRUSH_OT_curve_preset(struct wmOperatorType *ot);
void PAINT_OT_face_select_linked(struct wmOperatorType *ot);

View File

@@ -60,7 +60,7 @@
static int brush_add_exec(bContext *C, wmOperator *UNUSED(op))
{
/*int type = RNA_enum_get(op->ptr, "type");*/
Paint *paint = paint_get_active(CTX_data_scene(C));
Paint *paint = paint_get_active_from_context(C);
struct Brush *br = paint_brush(paint);
if (br)
@@ -68,7 +68,7 @@ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op))
else
br = BKE_brush_add("Brush");
paint_brush_set(paint_get_active(CTX_data_scene(C)), br);
paint_brush_set(paint, br);
return OPERATOR_FINISHED;
}
@@ -91,7 +91,7 @@ static void BRUSH_OT_add(wmOperatorType *ot)
static int brush_scale_size_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Paint *paint = paint_get_active(scene);
Paint *paint = paint_get_active_from_context(C);
struct Brush *brush = paint_brush(paint);
// Object *ob= CTX_data_active_object(C);
float scalar = RNA_float_get(op->ptr, "scalar");
@@ -173,7 +173,7 @@ static void PAINT_OT_vertex_color_set(wmOperatorType *ot)
static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
{
Paint *paint = paint_get_active(CTX_data_scene(C));
Paint *paint = paint_get_active_from_context(C);
struct Brush *brush = paint_brush(paint);
Object *ob = CTX_data_active_object(C);

View File

@@ -100,10 +100,11 @@ typedef struct PaintStroke {
/*** Cursor ***/
static void paint_draw_smooth_stroke(bContext *C, int x, int y, void *customdata)
{
Brush *brush = paint_brush(paint_get_active(CTX_data_scene(C)));
Paint *paint = paint_get_active_from_context(C);
Brush *brush = paint_brush(paint);
PaintStroke *stroke = customdata;
glColor4ubv(paint_get_active(CTX_data_scene(C))->paint_cursor_col);
glColor4ubv(paint->paint_cursor_col);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
@@ -141,7 +142,7 @@ static float event_tablet_data(wmEvent *event, int *pen_flip)
static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *event, float mouse_in[2])
{
Scene *scene = CTX_data_scene(C);
Paint *paint = paint_get_active(scene);
Paint *paint = paint_get_active_from_context(C);
Brush *brush = paint_brush(paint);
PaintStroke *stroke = op->customdata;
float mouse[3];
@@ -281,7 +282,7 @@ PaintStroke *paint_stroke_new(bContext *C,
{
PaintStroke *stroke = MEM_callocN(sizeof(PaintStroke), "PaintStroke");
stroke->brush = paint_brush(paint_get_active(CTX_data_scene(C)));
stroke->brush = paint_brush(paint_get_active_from_context(C));
view3d_set_viewcontext(C, &stroke->vc);
view3d_get_transformation(stroke->vc.ar, stroke->vc.rv3d, stroke->vc.obact, &stroke->mats);
@@ -394,7 +395,7 @@ static void paint_stroke_sample_average(const PaintStroke *stroke,
int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
{
Paint *p = paint_get_active(CTX_data_scene(C));
Paint *p = paint_get_active_from_context(C);
PaintStroke *stroke = op->customdata;
PaintSample sample_average;
float mouse[2];
@@ -518,7 +519,7 @@ void paint_stroke_set_mode_data(PaintStroke *stroke, void *mode_data)
int paint_poll(bContext *C)
{
Paint *p = paint_get_active(CTX_data_scene(C));
Paint *p = paint_get_active_from_context(C);
Object *ob = CTX_data_active_object(C);
return p && ob && paint_brush(p) &&

View File

@@ -333,9 +333,9 @@ int imapaint_pick_face(ViewContext *vc, const int mval[2], unsigned int *index,
}
/* used for both 3d view and image window */
void paint_sample_color(Scene *scene, ARegion *ar, int x, int y) /* frontbuf */
void paint_sample_color(const bContext *C, ARegion *ar, int x, int y) /* frontbuf */
{
Brush *br = paint_brush(paint_get_active(scene));
Brush *br = paint_brush(paint_get_active_from_context(C));
unsigned int col;
char *cp;
@@ -357,7 +357,7 @@ void paint_sample_color(Scene *scene, ARegion *ar, int x, int y) /* frontbuf
static int brush_curve_preset_exec(bContext *C, wmOperator *op)
{
Brush *br = paint_brush(paint_get_active(CTX_data_scene(C)));
Brush *br = paint_brush(paint_get_active_from_context(C));
BKE_brush_curve_preset(br, RNA_enum_get(op->ptr, "shape"));
return OPERATOR_FINISHED;
@@ -365,7 +365,7 @@ static int brush_curve_preset_exec(bContext *C, wmOperator *op)
static int brush_curve_preset_poll(bContext *C)
{
Brush *br = paint_brush(paint_get_active(CTX_data_scene(C)));
Brush *br = paint_brush(paint_get_active_from_context(C));
return br && br->curve;
}

View File

@@ -236,8 +236,8 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
switch (ale->type) {
case ANIMTYPE_SUMMARY:
{
// FIXME: hardcoded colors - reddish color from NLA
glColor4f(0.8f, 0.2f, 0.0f, 0.4f);
/* reddish color from NLA */
UI_ThemeColor4(TH_ANIM_ACTIVE);
}
break;

View File

@@ -175,7 +175,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
if (!(pinid || pinid == &scene->id)) {
ob = (scene->basact) ? scene->basact->object : NULL;
wrld = scene->world;
brush = paint_brush(paint_get_active(scene));
brush = paint_brush(paint_get_active_from_context(C));
}
if (ob && ob->type == OB_LAMP && !la)

View File

@@ -54,6 +54,9 @@ void CONSOLE_OT_move(struct wmOperatorType *ot);
void CONSOLE_OT_delete(struct wmOperatorType *ot);
void CONSOLE_OT_insert(struct wmOperatorType *ot);
void CONSOLE_OT_indent(struct wmOperatorType *ot);
void CONSOLE_OT_unindent(struct wmOperatorType *ot);
void CONSOLE_OT_history_append(struct wmOperatorType *ot);
void CONSOLE_OT_scrollback_append(struct wmOperatorType *ot);

View File

@@ -364,9 +364,8 @@ static int console_insert_exec(bContext *C, wmOperator *op)
char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
int len;
// XXX, alligned tab key hack
if (str[0] == '\t' && str[1] == '\0') {
len = TAB_LENGTH - (ci->cursor % TAB_LENGTH);
len = TAB_LENGTH;
MEM_freeN(str);
str = MEM_mallocN(len + 1, "insert_exec");
memset(str, ' ', len);
@@ -430,6 +429,95 @@ void CONSOLE_OT_insert(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
static int console_indent_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc = CTX_wm_space_console(C);
ARegion *ar = CTX_wm_region(C);
ConsoleLine *ci = console_history_verify(C);
int spaces;
int len;
for (spaces = 0; spaces < ci->len; spaces++) {
if (ci->line[spaces] != ' ')
break;
}
len = TAB_LENGTH - spaces % TAB_LENGTH;
console_line_verify_length(ci, ci->len + len);
memmove(ci->line + len, ci->line, ci->len);
memset(ci->line, ' ', len);
ci->len += len;
console_line_cursor_set(ci, ci->cursor + len);
console_textview_update_rect(sc, ar);
ED_area_tag_redraw(CTX_wm_area(C));
console_scroll_bottom(ar);
return OPERATOR_FINISHED;
}
void CONSOLE_OT_indent(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Indent";
ot->description = "Add 4 spaces at line beginning";
ot->idname = "CONSOLE_OT_indent";
/* api callbacks */
ot->exec = console_indent_exec;
ot->poll = ED_operator_console_active;
}
static int console_unindent_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc = CTX_wm_space_console(C);
ARegion *ar = CTX_wm_region(C);
ConsoleLine *ci = console_history_verify(C);
int spaces;
int len;
for (spaces = 0; spaces < ci->len; spaces++) {
if (ci->line[spaces] != ' ')
break;
}
if (spaces == 0)
return OPERATOR_CANCELLED;
len = spaces % TAB_LENGTH;
if (len == 0)
len = TAB_LENGTH;
console_line_verify_length(ci, ci->len - len);
memmove(ci->line, ci->line + len, (ci->len - len) + 1);
ci->len -= len;
console_line_cursor_set(ci, ci->cursor - len);
//console_select_offset(sc, -4);
console_textview_update_rect(sc, ar);
ED_area_tag_redraw(CTX_wm_area(C));
console_scroll_bottom(ar);
return OPERATOR_FINISHED;
}
void CONSOLE_OT_unindent(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Unindent";
ot->description = "Delete 4 spaces from line beginning";
ot->idname = "CONSOLE_OT_unindent";
/* api callbacks */
ot->exec = console_unindent_exec;
ot->poll = ED_operator_console_active;
}
static EnumPropertyItem console_delete_type_items[] = {
{DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
@@ -757,7 +845,8 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
{CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""},
{CONSOLE_LINE_INFO, "INFO", 0, "Information", ""},
{CONSOLE_LINE_ERROR, "ERROR", 0, "Error", ""},
{0, NULL, 0, NULL, NULL}};
{0, NULL, 0, NULL, NULL}
};
/* identifiers */
ot->name = "Scrollback Append";

View File

@@ -246,6 +246,9 @@ static void console_operatortypes(void)
WM_operatortype_append(CONSOLE_OT_move);
WM_operatortype_append(CONSOLE_OT_delete);
WM_operatortype_append(CONSOLE_OT_insert);
WM_operatortype_append(CONSOLE_OT_indent);
WM_operatortype_append(CONSOLE_OT_unindent);
/* for use by python only */
WM_operatortype_append(CONSOLE_OT_history_append);
@@ -332,7 +335,11 @@ static void console_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CONSOLE_OT_select_set", LEFTMOUSE, KM_PRESS, 0, 0);
RNA_string_set(WM_keymap_add_item(keymap, "CONSOLE_OT_insert", TABKEY, KM_PRESS, 0, 0)->ptr, "text", "\t"); /* fake tabs */
RNA_string_set(WM_keymap_add_item(keymap, "CONSOLE_OT_insert", TABKEY, KM_PRESS, KM_CTRL, 0)->ptr, "text", "\t"); /* fake tabs */
WM_keymap_add_item(keymap, "CONSOLE_OT_indent", TABKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CONSOLE_OT_unindent", TABKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "CONSOLE_OT_insert", KM_TEXTINPUT, KM_ANY, KM_ANY, 0); // last!
}

View File

@@ -637,6 +637,8 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
ima = imaptr.data;
iuser = userptr->data;
BKE_image_user_check_frame_calc(iuser, (int)scene->r.cfra, 0);
cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
cb->ptr = *ptr;
cb->prop = prop;

View File

@@ -2443,56 +2443,15 @@ void IMAGE_OT_cycle_render_slot(wmOperatorType *ot)
/* goes over all ImageUsers, and sets frame numbers if auto-refresh is set */
void ED_image_update_frame(const Main *mainp, int cfra)
static void image_update_frame(struct Image *UNUSED(ima), struct ImageUser *iuser, void *customdata)
{
wmWindowManager *wm;
wmWindow *win;
Tex *tex;
/* texture users */
for (tex = mainp->tex.first; tex; tex = tex->id.next) {
if (tex->type == TEX_IMAGE && tex->ima) {
if (ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
if (tex->iuser.flag & IMA_ANIM_ALWAYS)
BKE_image_user_frame_calc(&tex->iuser, cfra, 0);
}
}
}
/* image window, compo node users */
for (wm = mainp->wm.first; wm; wm = wm->id.next) { /* only 1 wm */
for (win = wm->windows.first; win; win = win->next) {
ScrArea *sa;
for (sa = win->screen->areabase.first; sa; sa = sa->next) {
if (sa->spacetype == SPACE_VIEW3D) {
View3D *v3d = sa->spacedata.first;
BGpic *bgpic;
for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next)
if (bgpic->iuser.flag & IMA_ANIM_ALWAYS)
BKE_image_user_frame_calc(&bgpic->iuser, cfra, 0);
}
else if (sa->spacetype == SPACE_IMAGE) {
SpaceImage *sima = sa->spacedata.first;
if (sima->iuser.flag & IMA_ANIM_ALWAYS)
BKE_image_user_frame_calc(&sima->iuser, cfra, 0);
}
else if (sa->spacetype == SPACE_NODE) {
SpaceNode *snode = sa->spacedata.first;
if ((snode->treetype == NTREE_COMPOSIT) && (snode->nodetree)) {
bNode *node;
for (node = snode->nodetree->nodes.first; node; node = node->next) {
if (node->id && node->type == CMP_NODE_IMAGE) {
Image *ima = (Image *)node->id;
ImageUser *iuser = node->storage;
if (ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
if (iuser->flag & IMA_ANIM_ALWAYS)
BKE_image_user_frame_calc(iuser, cfra, 0);
}
}
}
}
}
}
}
int cfra = *(int*)customdata;
BKE_image_user_check_frame_calc(iuser, cfra, 0);
}
void ED_image_update_frame(const Main *mainp, int cfra)
{
BKE_image_walk_all_users(mainp, &cfra, image_update_frame);
}

View File

@@ -590,8 +590,7 @@ static void image_refresh(const bContext *C, ScrArea *UNUSED(sa))
ima = ED_space_image(sima);
if (sima->iuser.flag & IMA_ANIM_ALWAYS)
BKE_image_user_frame_calc(&sima->iuser, scene->r.cfra, 0);
BKE_image_user_check_frame_calc(&sima->iuser, scene->r.cfra, 0);
/* check if we have to set the image from the editmesh */
if (ima && (ima->source == IMA_SRC_VIEWER || sima->pin)) ;

View File

@@ -80,26 +80,17 @@
static void nla_action_get_color(AnimData *adt, bAction *act, float color[4])
{
if (adt && (adt->flag & ADT_NLA_EDIT_ON)) {
// greenish color (same as tweaking strip) - hardcoded for now
color[0] = 0.30f;
color[1] = 0.95f;
color[2] = 0.10f;
color[3] = 0.30f;
/* greenish color (same as tweaking strip) */
UI_GetThemeColor4fv(TH_NLA_TWEAK, color);
}
else {
if (act) {
// reddish color - hardcoded for now
color[0] = 0.8f;
color[1] = 0.2f;
color[2] = 0.0f;
color[3] = 0.4f;
/* reddish color - same as dopesheet summary */
UI_GetThemeColor4fv(TH_ANIM_ACTIVE, color);
}
else {
// greyish-red color - hardcoded for now
color[0] = 0.6f;
color[1] = 0.5f;
color[2] = 0.5f;
color[3] = 0.3f;
/* greyish-red color */
UI_GetThemeColor4fv(TH_ANIM_INACTIVE, color);
}
}
@@ -166,17 +157,11 @@ static void nla_strip_get_color_inside(AnimData *adt, NlaStrip *strip, float col
/* Transition Clip */
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* selected - use a bright blue color */
// FIXME: hardcoded temp-hack colors
color[0] = 0.18f;
color[1] = 0.46f;
color[2] = 0.86f;
UI_GetThemeColor3fv(TH_NLA_TRANSITION_SEL, color);
}
else {
/* normal, unselected strip - use (hardly noticeable) blue tinge */
// FIXME: hardcoded temp-hack colors
color[0] = 0.11f;
color[1] = 0.15f;
color[2] = 0.19f;
UI_GetThemeColor3fv(TH_NLA_TRANSITION, color);
}
}
else if (strip->type == NLASTRIP_TYPE_META) {
@@ -184,34 +169,22 @@ static void nla_strip_get_color_inside(AnimData *adt, NlaStrip *strip, float col
// TODO: should temporary metas get different colors too?
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* selected - use a bold purple color */
// FIXME: hardcoded temp-hack colors
color[0] = 0.41f;
color[1] = 0.13f;
color[2] = 0.59f;
UI_GetThemeColor3fv(TH_NLA_META_SEL, color);
}
else {
/* normal, unselected strip - use (hardly noticeable) dark purple tinge */
// FIXME: hardcoded temp-hack colors
color[0] = 0.20f;
color[1] = 0.15f;
color[2] = 0.26f;
UI_GetThemeColor3fv(TH_NLA_META, color);
}
}
else if (strip->type == NLASTRIP_TYPE_SOUND) {
/* Sound Clip */
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* selected - use a bright teal color */
// FIXME: hardcoded temp-hack colors
color[0] = 0.12f;
color[1] = 0.48f;
color[2] = 0.48f;
UI_GetThemeColor3fv(TH_NLA_SOUND_SEL, color);
}
else {
/* normal, unselected strip - use (hardly noticeable) teal tinge */
// FIXME: hardcoded temp-hack colors
color[0] = 0.17f;
color[1] = 0.24f;
color[2] = 0.24f;
UI_GetThemeColor3fv(TH_NLA_SOUND, color);
}
}
else {
@@ -220,19 +193,13 @@ static void nla_strip_get_color_inside(AnimData *adt, NlaStrip *strip, float col
/* active strip should be drawn green when it is acting as the tweaking strip.
* however, this case should be skipped for when not in EditMode...
*/
// FIXME: hardcoded temp-hack colors
color[0] = 0.3f;
color[1] = 0.95f;
color[2] = 0.1f;
UI_GetThemeColor3fv(TH_NLA_TWEAK, color);
}
else if (strip->flag & NLASTRIP_FLAG_TWEAKUSER) {
/* alert user that this strip is also used by the tweaking track (this is set when going into
* 'editmode' for that strip), since the edits made here may not be what the user anticipated
*/
// FIXME: hardcoded temp-hack colors
color[0] = 0.85f;
color[1] = 0.0f;
color[2] = 0.0f;
UI_GetThemeColor3fv(TH_NLA_TWEAK_DUPLI, color);
}
else if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* selected strip - use theme color for selected */
@@ -792,21 +759,24 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View
glEnable(GL_BLEND);
/* draw backing strip behind channel name */
// FIXME: hardcoded colors!!!
if (group == 5) {
/* Action Line */
// TODO: if tweaking some action, use the same color as for the tweaked track (quick hack done for now)
float color[4];
/* Action Line
* The alpha values action_get_color returns are only useful for drawing
* strips backgrounds but here we're doing channel list backgrounds instead
* so we ignore that and use our own when needed
*/
nla_action_get_color(adt, (bAction *)ale->data, color);
if (adt && (adt->flag & ADT_NLA_EDIT_ON)) {
// greenish color (same as tweaking strip) - hardcoded for now
glColor3f(0.3f, 0.95f, 0.1f);
/* Yes, the color vector has 4 components, BUT we only want to be using 3 of them! */
glColor3fv(color);
}
else {
/* if a track is being solo'd, action is ignored, so draw less boldly (alpha lower) */
float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3f : 1.0f;
if (ale->data)
glColor4f(0.8f, 0.2f, 0.0f, alpha); // reddish color - hardcoded for now
else
glColor4f(0.6f, 0.5f, 0.5f, alpha); // greyish-red color - hardcoded for now
float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3 : 1.0f;
glColor4f(color[0], color[1], color[2], alpha);
}
offset += 7 * indent;

View File

@@ -498,7 +498,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
static void viewops_data_free(bContext *C, wmOperator *op)
{
ARegion *ar;
Paint *p = paint_get_active(CTX_data_scene(C));
Paint *p = paint_get_active_from_context(C);
if (op->customdata) {
ViewOpsData *vod = op->customdata;

View File

@@ -65,6 +65,7 @@ typedef struct ImageUser {
#define IMA_ANIM_ALWAYS 1
#define IMA_ANIM_REFRESHED 2
/* #define IMA_DO_PREMUL 4 */
#define IMA_NEED_FRAME_RECALC 8
typedef struct Image {
ID id;

View File

@@ -263,8 +263,19 @@ typedef struct ThemeSpace {
char selected_highlight[4]; /* outliner - selected item */
char skin_root[4]; /* Skin modifier root color */
int pad4;
/* NLA */
char anim_active[4]; /* Active Action + Summary Channel */
char anim_non_active[4]; /* Active Action = NULL */
char nla_tweaking[4]; /* NLA 'Tweaking' action/strip */
char nla_tweakdupli[4]; /* NLA - warning color for duplicate instances of tweaking strip */
char nla_transition[4], nla_transition_sel[4]; /* NLA "Transition" strips */
char nla_meta[4], nla_meta_sel[4]; /* NLA "Meta" strips */
char nla_sound[4], nla_sound_sel[4]; /* NLA "Sound" strips */
} ThemeSpace;

View File

@@ -1919,6 +1919,12 @@ static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "DopeSheet Sub-Channel", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "summary", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_active");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Summary", "Color of summary channel");
RNA_def_property_update(prop, 0, "rna_userdef_update");
}
static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
@@ -1947,28 +1953,79 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "View Sliders", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "bars", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "shade2");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Bars", "");
prop = RNA_def_property(srna, "active_action", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_active");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Active Action", "Animation data block has active action");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "bars_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "hilite");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Bars Selected", "");
prop = RNA_def_property(srna, "active_action_unset", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "anim_non_active");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "No Active Action", "Animation data block doesn't have active action");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "strip");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Strips", "");
RNA_def_property_ui_text(prop, "Strips", "Action-Clip Strip - Unselected");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "strip_select");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Strips Selected", "");
RNA_def_property_ui_text(prop, "Strips Selected", "Action-Clip Strip - Selected");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "transition_strips", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_transition");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Transitions", "Transition Strip - Unselected");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "transition_strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_transition_sel");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Transitions Selected", "Transition Strip - Selected");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "meta_strips", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_meta");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Meta Strips", "Meta Strip - Unselected. For grouping related strips");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "meta_strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_meta_sel");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Meta Strips Selected", "Meta Strip - Selected. For grouping related strips");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "sound_strips", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_sound");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Sound Strips",
"Sound Strip - Unselected. For timing speaker sounds");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "sound_strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_sound_sel");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Sound Strips Selected",
"Sound Strip - Selected. For timing speaker sounds");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "tweak", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_tweaking");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Tweak", "Color for strip/action being 'tweaked' or edited");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "tweak_duplicate", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "nla_tweakdupli");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Tweak Duplicate Flag",
"Warning/error indicator color for strips referencing the strip being tweaked");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);

View File

@@ -3534,8 +3534,7 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene)
/* update image sequences and movies */
if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
if (tex->iuser.flag & IMA_ANIM_ALWAYS)
BKE_image_user_frame_calc(&tex->iuser, (int)scene->r.cfra, 0);
BKE_image_user_check_frame_calc(&tex->iuser, (int)scene->r.cfra, 0);
}
}
}