diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2015-09-11 02:38:08 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2015-09-11 02:38:08 +0300 |
commit | 0f06bef71307a3f5d6b25c5241fcbad7d15b3f5b (patch) | |
tree | 85534371d16cc64fe90798e86c5e7080d90df8d1 /source | |
parent | e6c5611dbced32ddbb54c2558f08a9dcc262f9d2 (diff) | |
parent | 935544671636fd679a607d380c11c4176b22bb6f (diff) |
Merge branch 'master' into wiggly-widgets
Conflicts:
source/blender/editors/transform/transform_manipulator.c
Diffstat (limited to 'source')
49 files changed, 976 insertions, 273 deletions
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 6fb27cf7577..3e784752f10 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -381,6 +381,10 @@ void CustomData_bmesh_update_active_layers(struct CustomData *fdata, struct Cust void CustomData_bmesh_do_versions_update_active_layers(struct CustomData *fdata, struct CustomData *pdata, struct CustomData *ldata); void CustomData_bmesh_init_pool(struct CustomData *data, int totelem, const char htype); +#ifndef NDEBUG +bool CustomData_from_bmeshpoly_test(CustomData *fdata, CustomData *pdata, CustomData *ldata, bool fallback); +#endif + /* External file storage */ void CustomData_external_add(struct CustomData *data, diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 6c3564167b6..d13786facce 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -593,8 +593,6 @@ void DM_generate_tangent_tessface_data(DerivedMesh *dm, bool generate) if (!polyindex) return; - CustomData_from_bmeshpoly(fdata, pdata, ldata, totface); - if (generate) { for (i = 0; i < ldata->totlayer; i++) { if (ldata->layers[i].type == CD_TANGENT) @@ -603,6 +601,8 @@ void DM_generate_tangent_tessface_data(DerivedMesh *dm, bool generate) CustomData_bmesh_update_active_layers(fdata, pdata, ldata); } + BLI_assert(CustomData_from_bmeshpoly_test(fdata, pdata, ldata, true)); + loopindex = MEM_mallocN(sizeof(*loopindex) * totface, __func__); for (mf_idx = 0, mf = mface; mf_idx < totface; mf_idx++, mf++) { diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 807ae9094fd..07ce96461e5 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -169,15 +169,15 @@ float BKE_camera_object_dof_distance(Object *ob) if (ob->type != OB_CAMERA) return 0.0f; if (cam->dof_ob) { - /* too simple, better to return the distance on the view axis only - * return len_v3v3(ob->obmat[3], cam->dof_ob->obmat[3]); */ - float mat[4][4], imat[4][4], obmat[4][4]; - - copy_m4_m4(obmat, ob->obmat); - normalize_m4(obmat); - invert_m4_m4(imat, obmat); - mul_m4_m4m4(mat, imat, cam->dof_ob->obmat); - return fabsf(mat[3][2]); +#if 0 + /* too simple, better to return the distance on the view axis only */ + return len_v3v3(ob->obmat[3], cam->dof_ob->obmat[3]); +#else + float view_dir[3], dof_dir[3]; + normalize_v3_v3(view_dir, ob->obmat[2]); + sub_v3_v3v3(dof_dir, ob->obmat[3], cam->dof_ob->obmat[3]); + return fabsf(dot_v3v3(view_dir, dof_dir)); +#endif } return cam->YF_dofdist; } @@ -959,11 +959,6 @@ void BKE_camera_to_gpu_dof(struct Object *camera, struct GPUFXSettings *r_fx_set r_fx_settings->dof = &cam->gpu_dof; r_fx_settings->dof->focal_length = cam->lens; r_fx_settings->dof->sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); - if (cam->dof_ob) { - r_fx_settings->dof->focus_distance = len_v3v3(cam->dof_ob->obmat[3], camera->obmat[3]); - } - else { - r_fx_settings->dof->focus_distance = cam->YF_dofdist; - } + r_fx_settings->dof->focus_distance = BKE_camera_object_dof_distance(camera); } } diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index aad6681fa2a..acfec306997 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -975,7 +975,6 @@ void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const ColorM { int i, x, y; const float *fp; - float rgb[3]; unsigned char *cp; int x1 = 0.5f + hist->co[0][0] * ibuf->x; @@ -1004,16 +1003,36 @@ void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const ColorM } else { if (ibuf->rect_float) { + float rgba[4]; fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x)); - copy_v3_v3(rgb, fp); - IMB_colormanagement_processor_apply_v3(cm_processor, rgb); + switch (ibuf->channels) { + case 4: + copy_v4_v4(rgba, fp); + IMB_colormanagement_processor_apply_v4(cm_processor, rgba); + break; + case 3: + copy_v3_v3(rgba, fp); + IMB_colormanagement_processor_apply_v3(cm_processor, rgba); + rgba[3] = 1.0f; + break; + case 2: + copy_v3_fl(rgba, fp[0]); + rgba[3] = fp[1]; + break; + case 1: + copy_v3_fl(rgba, fp[0]); + rgba[3] = 1.0f; + break; + default: + BLI_assert(0); + } - hist->data_luma[i] = IMB_colormanagement_get_luminance(rgb); - hist->data_r[i] = rgb[0]; - hist->data_g[i] = rgb[1]; - hist->data_b[i] = rgb[2]; - hist->data_a[i] = fp[3]; + hist->data_luma[i] = IMB_colormanagement_get_luminance(rgba); + hist->data_r[i] = rgba[0]; + hist->data_g[i] = rgba[1]; + hist->data_b[i] = rgba[2]; + hist->data_a[i] = rgba[3]; } else if (ibuf->rect) { cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x); @@ -1148,8 +1167,28 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * for (x = 0; x < ibuf->x; x++) { float rgba[4], ycc[3], luma; if (is_float) { - copy_v4_v4(rgba, rf); - IMB_colormanagement_processor_apply_v4(cm_processor, rgba); + + switch (ibuf->channels) { + case 4: + copy_v4_v4(rgba, rf); + IMB_colormanagement_processor_apply_v4(cm_processor, rgba); + break; + case 3: + copy_v3_v3(rgba, rf); + IMB_colormanagement_processor_apply_v3(cm_processor, rgba); + rgba[3] = 1.0f; + break; + case 2: + copy_v3_fl(rgba, rf[0]); + rgba[3] = rf[1]; + break; + case 1: + copy_v3_fl(rgba, rf[0]); + rgba[3] = 1.0f; + break; + default: + BLI_assert(0); + } } else { for (c = 0; c < 4; c++) diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 416125e53ad..ed50bdda744 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2501,6 +2501,10 @@ void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *l void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total) { int i; + + /* avoid accumulating extra layers */ + BLI_assert(!CustomData_from_bmeshpoly_test(fdata, pdata, ldata, false)); + for (i = 0; i < pdata->totlayer; i++) { if (pdata->layers[i].type == CD_MTEXPOLY) { CustomData_add_layer_named(fdata, CD_MTFACE, CD_CALLOC, NULL, total, pdata->layers[i].name); @@ -2527,6 +2531,41 @@ void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData CustomData_bmesh_update_active_layers(fdata, pdata, ldata); } +#ifndef NDEBUG +/** + * Debug check, used to assert when we expect layers to be in/out of sync. + * + * \param fallback: Use when there are no layers to handle, + * since callers may expect success or failure. + */ +bool CustomData_from_bmeshpoly_test(CustomData *fdata, CustomData *pdata, CustomData *ldata, bool fallback) +{ + int a_num = 0, b_num = 0; +#define LAYER_CMP(l_a, t_a, l_b, t_b) \ + ((a_num += CustomData_number_of_layers(l_a, t_a)) == (b_num += CustomData_number_of_layers(l_b, t_b))) + + if (!LAYER_CMP(pdata, CD_MTEXPOLY, fdata, CD_MTFACE)) + return false; + if (!LAYER_CMP(ldata, CD_MLOOPCOL, fdata, CD_MCOL)) + return false; + if (!LAYER_CMP(ldata, CD_PREVIEW_MLOOPCOL, fdata, CD_PREVIEW_MCOL)) + return false; + if (!LAYER_CMP(ldata, CD_ORIGSPACE_MLOOP, fdata, CD_ORIGSPACE)) + return false; + if (!LAYER_CMP(ldata, CD_NORMAL, fdata, CD_TESSLOOPNORMAL)) + return false; + if (!LAYER_CMP(ldata, CD_TANGENT, fdata, CD_TANGENT)) + return false; + +#undef TEST_RET + + /* if no layers are on either CustomData's, + * then there was nothing to do... */ + return a_num ? true : fallback; +} +#endif + + void CustomData_bmesh_update_active_layers(CustomData *fdata, CustomData *pdata, CustomData *ldata) { int act; diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 2adf8ebc615..23261b63486 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -777,7 +777,7 @@ makebreak: if ((tb_scale.h != 0.0f) && (cu->totbox > (curbox + 1)) && - ((-(yof - tb_scale.y)) > (tb_scale.h - (linedist * cu->fsize)) - yof_scale)) + ((-(yof - tb_scale.y)) > (tb_scale.h - linedist) - yof_scale)) { maxlen = 0; curbox++; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index ef760f2da26..36aeb97c3f0 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -2578,21 +2578,10 @@ static void image_init_imageuser(Image *ima, ImageUser *iuser) RenderResult *rr = ima->rr; iuser->multi_index = 0; - iuser->layer = iuser->view = 0; - iuser->passtype = SCE_PASS_COMBINED; - - if (rr) { - RenderLayer *rl = rr->layers.first; - - if (rl) { - RenderPass *rp = rl->passes.first; - - if (rp) - iuser->passtype = rp->passtype; - } + iuser->layer = iuser->pass = iuser->view = 0; + if (rr) BKE_image_multilayer_index(rr, iuser); - } } void BKE_image_init_imageuser(Image *ima, ImageUser *iuser) @@ -2740,6 +2729,52 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal) } } +#define PASSTYPE_UNSET -1 +/* return renderpass for a given pass index and active view */ +/* fallback to available if there are missing passes for active view */ +static RenderPass *image_render_pass_get(RenderLayer *rl, const int pass, const int view, int *r_passindex) +{ + RenderPass *rpass_ret = NULL; + RenderPass *rpass; + + int rp_index = 0; + int rp_passtype = PASSTYPE_UNSET; + + for (rpass = rl->passes.first; rpass; rpass = rpass->next, rp_index++) { + if (rp_index == pass) { + rpass_ret = rpass; + if (view == 0) { + /* no multiview or left eye */ + break; + } + else { + rp_passtype = rpass->passtype; + } + } + /* multiview */ + else if ((rp_passtype != PASSTYPE_UNSET) && + (rpass->passtype == rp_passtype) && + (rpass->view_id == view)) + { + rpass_ret = rpass; + break; + } + } + + /* fallback to the first pass in the layer */ + if (rpass_ret == NULL) { + rp_index = 0; + rpass_ret = rl->passes.first; + } + + if (r_passindex) { + *r_passindex = (rpass == rpass_ret ? rp_index : pass); + } + + return rpass_ret; +} +#undef PASSTYPE_UNSET + /* if layer or pass changes, we need an index for the imbufs list */ /* note it is called for rendered results, but it doesnt use the index! */ /* and because rendered results use fake layer/passes, don't correct for wrong indices here */ @@ -2759,27 +2794,16 @@ RenderPass *BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser) if (RE_HasFakeLayer(rr)) rl_index += 1; for (rl = rr->layers.first; rl; rl = rl->next, rl_index++) { - for (rpass = rl->passes.first; rpass; rpass = rpass->next, index++) { - if (iuser->layer == rl_index && - iuser->passtype == rpass->passtype && - rv_index == rpass->view_id) - { - break; - } - } - if (rpass) + if (iuser->layer == rl_index) { + int rp_index; + rpass = image_render_pass_get(rl, iuser->pass, rv_index, &rp_index); + iuser->multi_index = index + rp_index; break; + } + else { + index += BLI_listbase_count(&rl->passes); + } } - iuser->multi_index = (rpass ? index : 0); - } - - if (rpass == NULL) { - rl = rr->layers.first; - if (rl) - rpass = rl->passes.first; - - if (rpass && iuser) - iuser->passtype = rpass->passtype; } return rpass; @@ -3613,7 +3637,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc float *rectf, *rectz; unsigned int *rect; float dither; - int channels, layer, passtype; + int channels, layer, pass; ImBuf *ibuf; int from_render = (ima->render_slot == ima->last_render_slot); int actview; @@ -3630,7 +3654,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc channels = 4; layer = iuser->layer; - passtype = iuser->passtype; + pass = iuser->pass; actview = iuser->view; if ((ima->flag & IMA_IS_STEREO) && (iuser->flag & IMA_SHOW_STEREO)) @@ -3693,19 +3717,10 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc else if (rres.layers.first) { RenderLayer *rl = BLI_findlink(&rres.layers, layer - (rres.have_combined ? 1 : 0)); if (rl) { - RenderPass *rpass; - - for (rpass = rl->passes.first; rpass; rpass = rpass->next) { - if (passtype == rpass->passtype && - actview == rpass->view_id) - { - break; - } - } - + RenderPass *rpass = image_render_pass_get(rl, pass, actview, NULL); if (rpass) { rectf = rpass->rect; - if (passtype == SCE_PASS_COMBINED) { + if (pass == 0) { if (rectf == NULL) { /* Happens when Save Buffers is enabled. * Use display buffer stored in the render layer. diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 3e6edbe01e8..1333d28960c 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -43,6 +43,7 @@ #include "DNA_scene_types.h" #include "DNA_sequence_types.h" #include "DNA_anim_types.h" +#include "DNA_space_types.h" #include "BKE_fcurve.h" #include "BKE_sequencer.h" @@ -2480,7 +2481,7 @@ void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool for if ((seq->seq1->enddisp != seq->seq1->start) && (seq->seq1->len != 0)) { - fallback_fac = 1.0f; + fallback_fac = (float) seq->seq1->len / (float) (seq->seq1->enddisp - seq->seq1->start); flags = SEQ_SPEED_INTEGRATE; fcu = NULL; } @@ -2920,12 +2921,22 @@ static ImBuf *do_text_effect(const SeqRenderData *context, Sequence *seq, float const char *display_device; const int mono = blf_mono_font_render; // XXX int y_ofs, x, y; + float proxy_size_comp; display_device = context->scene->display_settings.display_device; display = IMB_colormanagement_display_get_named(display_device); + /* Compensate text size for preview render size. */ + if (context->preview_render_size == SEQ_PROXY_RENDER_SIZE_100) { + /* Should be rendered at 100%, but context->preview_render_size = 99 right now. */ + proxy_size_comp = 1.0f; + } + else { + proxy_size_comp = context->preview_render_size / 100.0f; + } + /* set before return */ - BLF_size(mono, (context->scene->r.size / 100.0f) * data->text_size, 72); + BLF_size(mono, proxy_size_comp * (context->scene->r.size / 100) * data->text_size, 72); BLF_buffer(mono, out->rect_float, (unsigned char *)out->rect, width, height, out->channels, display); diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 5ecd2fc74e8..7d492586b7d 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -50,6 +50,7 @@ #include "BKE_lattice.h" #include "BKE_deform.h" +#include "BKE_editmesh.h" #include "BKE_mesh.h" /* for OMP limits. */ #include "BKE_subsurf.h" @@ -278,6 +279,14 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, bool for BLI_SPACE_TRANSFORM_SETUP(&local2aux, calc->ob, calc->smd->auxTarget); } + /* use editmesh to avoid array allocation */ + if (calc->smd->target && calc->target->type == DM_TYPE_EDITBMESH) { + treeData.em_evil = BKE_editmesh_from_object(calc->smd->target); + } + if (calc->smd->auxTarget && auxMesh->type == DM_TYPE_EDITBMESH) { + auxData.em_evil = BKE_editmesh_from_object(calc->smd->auxTarget); + } + /* After sucessufuly build the trees, start projection vertexs */ if (bvhtree_from_mesh_looptri(&treeData, calc->target, 0.0, 4, 6) && (auxMesh == NULL || bvhtree_from_mesh_looptri(&auxData, auxMesh, 0.0, 4, 6))) diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 3a73d4cc0c7..4692af0ffa7 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1610,17 +1610,16 @@ bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch) while (ext_step[0]) { const char *ext_next; - int len_ext; + size_t len_ext; if ((ext_next = strchr(ext_step, ';'))) { - len_ext = (int)(ext_next - ext_step) + 1; + len_ext = ext_next - ext_step + 1; + BLI_strncpy(pattern, ext_step, (len_ext > sizeof(pattern)) ? sizeof(pattern) : len_ext); } else { - len_ext = sizeof(pattern); + len_ext = BLI_strncpy_rlen(pattern, ext_step, sizeof(pattern)); } - BLI_strncpy(pattern, ext_step, len_ext); - if (fnmatch(pattern, str, FNM_CASEFOLD) == 0) { return true; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9f6abb58e2c..7172327adac 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6526,6 +6526,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc else if (sl->spacetype == SPACE_FILE) { SpaceFile *sfile = (SpaceFile *)sl; sfile->op = NULL; + sfile->previews_timer = NULL; } else if (sl->spacetype == SPACE_ACTION) { SpaceAction *saction = (SpaceAction *)sl; @@ -6609,7 +6610,13 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc BLI_mempool_iternew(so->treestore, &iter); while ((tselem = BLI_mempool_iterstep(&iter))) { - tselem->id = restore_pointer_by_name(newmain, tselem->id, USER_IGNORE); + /* Do not try to restore pointers to drivers/sequence/etc., can crash in undo case! */ + if (TSE_IS_REAL_ID(tselem)) { + tselem->id = restore_pointer_by_name(newmain, tselem->id, USER_IGNORE); + } + else { + tselem->id = NULL; + } } if (so->treehash) { /* rebuild hash table, because it depends on ids too */ @@ -7056,6 +7063,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc) sfile->files = NULL; sfile->layout = NULL; sfile->op = NULL; + sfile->previews_timer = NULL; sfile->params = newdataadr(fd, sfile->params); } else if (sl->spacetype == SPACE_CLIP) { diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 4260348390e..a7e91e2b9fa 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -767,7 +767,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) { SpaceImage *sima = (SpaceImage *) sl; sima->iuser.flag |= IMA_SHOW_STEREO; - sima->iuser.passtype = SCE_PASS_COMBINED; break; } } diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 9fba5b147bf..cb1c856c05d 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -2947,7 +2947,7 @@ static void bevel_build_rings(BevelParams *bp, BMesh *bm, BevVert *bv) BLI_array_append(ve, v == vm->boundstart ? NULL : frep_e); } else { - BLI_array_append(vf, frep); + BLI_array_append(vf, boundvert_rep_face(v, NULL)); BLI_array_append(ve, NULL); } } while ((v = v->next) != vm->boundstart); diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp index 572e63a2ced..facd422c217 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cpp +++ b/source/blender/compositor/nodes/COM_ImageNode.cpp @@ -40,19 +40,19 @@ ImageNode::ImageNode(bNode *editorNode) : Node(editorNode) } NodeOperation *ImageNode::doMultilayerCheck(NodeConverter &converter, RenderLayer *rl, Image *image, ImageUser *user, - int framenumber, int outputsocketIndex, int passtype, int view, DataType datatype) const + int framenumber, int outputsocketIndex, int passindex, int view, DataType datatype) const { NodeOutput *outputSocket = this->getOutputSocket(outputsocketIndex); MultilayerBaseOperation *operation = NULL; switch (datatype) { case COM_DT_VALUE: - operation = new MultilayerValueOperation(passtype, view); + operation = new MultilayerValueOperation(passindex, view); break; case COM_DT_VECTOR: - operation = new MultilayerVectorOperation(passtype, view); + operation = new MultilayerVectorOperation(passindex, view); break; case COM_DT_COLOR: - operation = new MultilayerColorOperation(passtype, view); + operation = new MultilayerColorOperation(passindex, view); break; default: break; @@ -124,20 +124,21 @@ void ImageNode::convertToOperations(NodeConverter &converter, const CompositorCo } if (rpass) { + int passindex = BLI_findindex(&rl->passes, rpass); switch (rpass->channels) { case 1: operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, index, - rpass->passtype, view, COM_DT_VALUE); + passindex, view, COM_DT_VALUE); break; /* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */ /* XXX any way to detect actual vector images? */ case 3: operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, index, - rpass->passtype, view, COM_DT_VECTOR); + passindex, view, COM_DT_VECTOR); break; case 4: operation = doMultilayerCheck(converter, rl, image, imageuser, framenumber, index, - rpass->passtype, view, COM_DT_COLOR); + passindex, view, COM_DT_COLOR); break; default: /* dummy operation is added below */ diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp index 00be3b1cdde..b57dd4e32c3 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp @@ -27,9 +27,9 @@ extern "C" { # include "IMB_imbuf_types.h" } -MultilayerBaseOperation::MultilayerBaseOperation(int passtype, int view) : BaseImageOperation() +MultilayerBaseOperation::MultilayerBaseOperation(int passindex, int view) : BaseImageOperation() { - this->m_passtype = passtype; + this->m_passId = passindex; this->m_view = view; } @@ -39,7 +39,7 @@ ImBuf *MultilayerBaseOperation::getImBuf() int view = this->m_imageUser->view; this->m_imageUser->view = this->m_view; - this->m_imageUser->passtype = this->m_passtype; + this->m_imageUser->pass = this->m_passId; if (BKE_image_multilayer_index(this->m_image->rr, this->m_imageUser)) { ImBuf *ibuf = BaseImageOperation::getImBuf(); diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.h b/source/blender/compositor/operations/COM_MultilayerImageOperation.h index 2e140577d74..46a9319c373 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.h +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.h @@ -29,7 +29,7 @@ class MultilayerBaseOperation : public BaseImageOperation { private: - int m_passtype; + int m_passId; int m_view; RenderLayer *m_renderlayer; protected: @@ -38,13 +38,13 @@ public: /** * Constructor */ - MultilayerBaseOperation(int passtype, int view); + MultilayerBaseOperation(int passindex, int view); void setRenderLayer(RenderLayer *renderlayer) { this->m_renderlayer = renderlayer; } }; class MultilayerColorOperation : public MultilayerBaseOperation { public: - MultilayerColorOperation(int passtype, int view) : MultilayerBaseOperation(passtype, view) { + MultilayerColorOperation(int passindex, int view) : MultilayerBaseOperation(passindex, view) { this->addOutputSocket(COM_DT_COLOR); } void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); @@ -52,7 +52,7 @@ public: class MultilayerValueOperation : public MultilayerBaseOperation { public: - MultilayerValueOperation(int passtype, int view) : MultilayerBaseOperation(passtype, view) { + MultilayerValueOperation(int passindex, int view) : MultilayerBaseOperation(passindex, view) { this->addOutputSocket(COM_DT_VALUE); } void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); @@ -60,7 +60,7 @@ public: class MultilayerVectorOperation : public MultilayerBaseOperation { public: - MultilayerVectorOperation(int passtype, int view) : MultilayerBaseOperation(passtype, view) { + MultilayerVectorOperation(int passindex, int view) : MultilayerBaseOperation(passindex, view) { this->addOutputSocket(COM_DT_VECTOR); } void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index 080820e67a1..17db1cb8548 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -135,7 +135,7 @@ void BIF_createTransformOrientation(struct bContext *C, struct ReportList *repor void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *ts); void BIF_selectTransformOrientationValue(struct bContext *C, int orientation); -void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[3][3], const bool activeOnly); +void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[3][3], const short around); int BIF_countTransformOrientation(const struct bContext *C); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 42a9638d988..259e2e3a0c9 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5703,7 +5703,9 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle { ColorBand *coba; CBData *cbd; - int mx, my, a, xco, mindist = 12; + /* ignore zoom-level for mindist */ + int mindist = (50 * UI_DPI_FAC) * block->aspect; + int mx, my, a, xco; mx = event->x; my = event->y; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 356e85e9d63..b9bacb8203b 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -520,9 +520,10 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) } if (data_path) { + const char *data_delim = (data_path[0] == '[') ? "" : "."; BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), - "%s.%s", /* no need to translate */ - id_path, data_path); + "%s%s%s", /* no need to translate */ + id_path, data_delim, data_path); MEM_freeN(data_path); } else if (prop) { diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 75ee6d17307..465677a7e3f 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -190,7 +190,7 @@ static void image_buffer_rect_update(RenderJob *rj, RenderResult *rr, ImBuf *ibu * - sergey - */ /* TODO(sergey): Need to check has_combined here? */ - if (iuser->passtype == SCE_PASS_COMBINED) { + if (iuser->pass == 0) { RenderView *rv; size_t view_id = BKE_scene_multiview_view_id_get(&scene->r, viewname); rv = RE_RenderViewGetById(rr, view_id); @@ -525,6 +525,7 @@ static void render_image_update_pass_and_layer(RenderJob *rj, RenderResult *rr, } } + iuser->pass = sima->iuser.pass; iuser->layer = sima->iuser.layer; RE_ReleaseResult(rj->re); @@ -898,7 +899,6 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even rj->write_still = is_write_still && !is_animation; rj->iuser.scene = scene; rj->iuser.ok = 1; - rj->iuser.passtype = SCE_PASS_COMBINED; rj->reports = op->reports; rj->orig_layer = 0; rj->last_layer = 0; diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 987a709104c..0851a40718c 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1793,6 +1793,8 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type) */ void ED_screen_full_prevspace(bContext *C, ScrArea *sa, const bool was_prev_temp) { + BLI_assert(sa->full); + if (sa->flag & AREA_FLAG_STACKED_FULLSCREEN) { /* stacked fullscreen -> only go back to previous screen and don't toggle out of fullscreen */ ED_area_prevspace(C, sa); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index cf13c9c1d83..7108b2bda6f 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -298,6 +298,7 @@ typedef struct ProjPaintState { float cloneOffset[2]; float projectMat[4][4]; /* Projection matrix, use for getting screen coords */ + float projectMatInv[4][4]; /* inverse of projectMat */ float viewDir[3]; /* View vector, use for do_backfacecull and for ray casting with an ortho viewport */ float viewPos[3]; /* View location in object relative 3D space, so can compare to verts */ float clipsta, clipend; @@ -1247,6 +1248,55 @@ static void screen_px_from_persp( } +/** + * Set a direction vector based on a screen location. + * (use for perspective view, else we can simply use `ps->viewDir`) + * + * Similar functionality to #ED_view3d_win_to_vector + * + * \param r_dir: Resulting direction (length is undefined). + */ +static void screen_px_to_vector_persp( + int winx, int winy, const float projmat_inv[4][4], const float view_pos[3], + const float co_px[2], + float r_dir[3]) +{ + r_dir[0] = 2.0f * (co_px[0] / winx) - 1.0f; + r_dir[1] = 2.0f * (co_px[1] / winy) - 1.0f; + r_dir[2] = -0.5f; + mul_project_m4_v3((float(*)[4])projmat_inv, r_dir); + sub_v3_v3(r_dir, view_pos); +} + +/** + * Special function to return the factor fo a point along a line in pixel space. + * + * This is needed since we can't use #line_point_factor_v2 for perspective screen-space coords. + * + * \param p: 2D screen-space location. + * \param v1, v2: 3D object-space locations. + */ +static float screen_px_line_point_factor_v2_persp( + const ProjPaintState *ps, + const float p[2], + const float v1[3], const float v2[3]) +{ + const float zero[3] = {0}; + float v1_proj[3], v2_proj[3]; + float dir[3]; + + screen_px_to_vector_persp(ps->winx, ps->winy, ps->projectMatInv, ps->viewPos, p, dir); + + sub_v3_v3v3(v1_proj, v1, ps->viewPos); + sub_v3_v3v3(v2_proj, v2, ps->viewPos); + + project_plane_v3_v3v3(v1_proj, v1_proj, dir); + project_plane_v3_v3v3(v2_proj, v2_proj, dir); + + return line_point_factor_v2(zero, v1_proj, v2_proj); +} + + static void project_face_pixel( const float *lt_tri_uv[3], ImBuf *ibuf_other, const float w[3], unsigned char rgba_ub[4], float rgba_f[4]) @@ -2680,8 +2730,15 @@ static void project_paint_face_init( line_clip_rect2f(clip_rect, bucket_bounds, vCoSS[fidx1], vCoSS[fidx2], bucket_clip_edges[0], bucket_clip_edges[1])) { if (len_squared_v2v2(vCoSS[fidx1], vCoSS[fidx2]) > FLT_EPSILON) { /* avoid div by zero */ - fac1 = line_point_factor_v2(bucket_clip_edges[0], vCoSS[fidx1], vCoSS[fidx2]); - fac2 = line_point_factor_v2(bucket_clip_edges[1], vCoSS[fidx1], vCoSS[fidx2]); + + if (is_ortho) { + fac1 = line_point_factor_v2(bucket_clip_edges[0], vCoSS[fidx1], vCoSS[fidx2]); + fac2 = line_point_factor_v2(bucket_clip_edges[1], vCoSS[fidx1], vCoSS[fidx2]); + } + else { + fac1 = screen_px_line_point_factor_v2_persp(ps, bucket_clip_edges[0], vCo[fidx1], vCo[fidx2]); + fac2 = screen_px_line_point_factor_v2_persp(ps, bucket_clip_edges[1], vCo[fidx1], vCo[fidx2]); + } interp_v2_v2v2(seam_subsection[0], lt_uv_pxoffset[fidx1], lt_uv_pxoffset[fidx2], fac1); interp_v2_v2v2(seam_subsection[1], lt_uv_pxoffset[fidx1], lt_uv_pxoffset[fidx2], fac2); @@ -3104,6 +3161,7 @@ static void proj_paint_state_viewport_init( mul_m4_m4m4(ps->projectMat, winmat, vmat); } + invert_m4_m4(ps->projectMatInv, ps->projectMat); /* viewDir - object relative */ copy_m3_m4(mat, viewinv); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 6fa5f62177f..6dc1855401d 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -224,6 +224,7 @@ static bool paint_brush_update(bContext *C, bool location_sampled = false; bool location_success = false; bool do_random = false; + bool do_random_mask = false; /* XXX: Use pressure value from first brush step for brushes which don't * support strokes (grab, thumb). They depends on initial state and * brush coord/pressure/etc. @@ -271,9 +272,11 @@ static bool paint_brush_update(bContext *C, } if (paint_supports_dynamic_tex_coords(brush, mode)) { - if (((brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW) || - (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA) || - (brush->mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM))) + + if (ELEM(brush->mtex.brush_map_mode, + MTEX_MAP_MODE_VIEW, + MTEX_MAP_MODE_AREA, + MTEX_MAP_MODE_RANDOM)) { do_random = true; } @@ -286,6 +289,15 @@ static bool paint_brush_update(bContext *C, /* take care of mask texture, if any */ if (brush->mask_mtex.tex) { + + if (ELEM(brush->mask_mtex.brush_map_mode, + MTEX_MAP_MODE_VIEW, + MTEX_MAP_MODE_AREA, + MTEX_MAP_MODE_RANDOM)) + { + do_random_mask = true; + } + if (brush->mask_mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM) BKE_brush_randomize_texture_coords(ups, true); else { @@ -357,7 +369,9 @@ static bool paint_brush_update(bContext *C, ups->brush_rotation += -brush->mtex.random_angle / 2.0f + brush->mtex.random_angle * BLI_frand(); } + } + if (do_random_mask) { if (brush->mask_mtex.brush_angle_mode & MTEX_ANGLE_RANDOM) { ups->brush_rotation_sec += -brush->mask_mtex.random_angle / 2.0f + brush->mask_mtex.random_angle * BLI_frand(); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index f53d3781d90..0c652587ad1 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -233,6 +233,9 @@ typedef struct FileListEntryCache { int flags; + /* This one gathers all entries from both block and misc caches. Used for easy bulk-freing. */ + ListBase cached_entries; + /* Block cache: all entries between start and end index. used for part of the list on diplay. */ FileDirEntry **block_entries; int block_start_index, block_end_index, block_center_index, block_cursor; @@ -1016,6 +1019,7 @@ static void filelist_entry_free(FileDirEntry *entry) static void filelist_direntryarr_free(FileDirEntryArr *array) { +#if 0 FileDirEntry *entry, *entry_next; for (entry = array->entries.first; entry; entry = entry_next) { @@ -1023,6 +1027,9 @@ static void filelist_direntryarr_free(FileDirEntryArr *array) filelist_entry_free(entry); } BLI_listbase_clear(&array->entries); +#else + BLI_assert(BLI_listbase_is_empty(&array->entries)); +#endif array->nbr_entries = 0; array->nbr_entries_filtered = -1; array->entry_idx_start = -1; @@ -1182,6 +1189,8 @@ static void filelist_cache_previews_push(FileList *filelist, FileDirEntry *entry static void filelist_cache_init(FileListEntryCache *cache, size_t cache_size) { + BLI_listbase_clear(&cache->cached_entries); + cache->block_cursor = cache->block_start_index = cache->block_center_index = cache->block_end_index = 0; cache->block_entries = MEM_mallocN(sizeof(*cache->block_entries) * cache_size, __func__); @@ -1200,30 +1209,38 @@ static void filelist_cache_init(FileListEntryCache *cache, size_t cache_size) static void filelist_cache_free(FileListEntryCache *cache) { + FileDirEntry *entry, *entry_next; + if (!(cache->flags & FLC_IS_INIT)) { return; } filelist_cache_previews_free(cache, true); - /* Note we nearly have nothing to do here, entries are just 'borrowed', not owned by cache... */ MEM_freeN(cache->block_entries); BLI_ghash_free(cache->misc_entries, NULL, NULL); MEM_freeN(cache->misc_entries_indices); BLI_ghash_free(cache->uuids, NULL, NULL); + + for (entry = cache->cached_entries.first; entry; entry = entry_next) { + entry_next = entry->next; + filelist_entry_free(entry); + } + BLI_listbase_clear(&cache->cached_entries); } static void filelist_cache_clear(FileListEntryCache *cache, size_t new_size) { + FileDirEntry *entry, *entry_next; + if (!(cache->flags & FLC_IS_INIT)) { return; } filelist_cache_previews_clear(cache); - /* Note we nearly have nothing to do here, entries are just 'borrowed', not owned by cache... */ cache->block_cursor = cache->block_start_index = cache->block_center_index = cache->block_end_index = 0; if (new_size != cache->size) { cache->block_entries = MEM_reallocN(cache->block_entries, sizeof(*cache->block_entries) * new_size); @@ -1239,6 +1256,12 @@ static void filelist_cache_clear(FileListEntryCache *cache, size_t new_size) BLI_ghash_clear_ex(cache->uuids, NULL, NULL, new_size * 2); cache->size = new_size; + + for (entry = cache->cached_entries.first; entry; entry = entry_next) { + entry_next = entry->next; + filelist_entry_free(entry); + } + BLI_listbase_clear(&cache->cached_entries); } FileList *filelist_new(short type) @@ -1417,6 +1440,7 @@ int filelist_files_ensure(FileList *filelist) static FileDirEntry *filelist_file_create_entry(FileList *filelist, const int index) { FileListInternEntry *entry = filelist->filelist_intern.filtered[index]; + FileListEntryCache *cache = &filelist->filelist_cache; FileDirEntry *ret; FileDirEntryRevision *rev; @@ -1435,13 +1459,13 @@ static FileDirEntry *filelist_file_create_entry(FileList *filelist, const int in ret->blentype = entry->blentype; ret->typeflag = entry->typeflag; - BLI_addtail(&filelist->filelist.entries, ret); + BLI_addtail(&cache->cached_entries, ret); return ret; } static void filelist_file_release_entry(FileList *filelist, FileDirEntry *entry) { - BLI_remlink(&filelist->filelist.entries, entry); + BLI_remlink(&filelist->filelist_cache.cached_entries, entry); filelist_entry_free(entry); } @@ -2167,14 +2191,14 @@ static int filelist_readjob_list_dir( entry = MEM_callocN(sizeof(*entry), __func__); entry->relpath = MEM_dupallocN(files[i].relname); - if (S_ISDIR(files[i].s.st_mode)) { - entry->typeflag |= FILE_TYPE_DIR; - } entry->st = files[i].s; /* Set file type. */ - /* If we are considering .blend files as libs, promote them to directory status! */ - if (do_lib && BLO_has_bfile_extension(entry->relpath)) { + if (S_ISDIR(files[i].s.st_mode)) { + entry->typeflag = FILE_TYPE_DIR; + } + else if (do_lib && BLO_has_bfile_extension(entry->relpath)) { + /* If we are considering .blend files as libs, promote them to directory status. */ char name[FILE_MAX]; entry->typeflag = FILE_TYPE_BLENDER; diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 579860726c6..3af210f376b 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -418,7 +418,7 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void * uiItemS(layout); - nr = (rl ? BLI_listbase_count(&rl->passes) : 0) - 1; + nr = 0; fake_name = ui_imageuser_pass_fake_name(rl); if (fake_name) { @@ -427,7 +427,8 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void * } /* rendered results don't have a Combined pass */ - for (rpass = rl ? rl->passes.last : NULL; rpass; rpass = rpass->prev, nr--) { + /* multiview: the ordering must be ascending, so the left-most pass is always the one picked */ + for (rpass = rl ? rl->passes.first : NULL; rpass; rpass = rpass->next, nr++) { /* just show one pass of each kind */ if (passflag & rpass->passtype) @@ -436,18 +437,17 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void * passflag |= rpass->passtype; final: - uiDefButI(block, UI_BTYPE_BUT_MENU, B_NOP, IFACE_(rpass->internal_name), 0, 0, - UI_UNIT_X * 5, UI_UNIT_X, &iuser->passtype, (float) rpass->passtype, 0.0, 0, -1, ""); + uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, IFACE_(rpass->internal_name), 0, 0, + UI_UNIT_X * 5, UI_UNIT_X, &iuser->pass, (float) nr, 0.0, 0, -1, ""); } if (fake_name) { fake_name = NULL; rpass = &rpass_fake; + nr = 0; goto final; } - BLI_assert(nr == -1); - BKE_image_release_renderresult(scene, image); } @@ -550,7 +550,6 @@ static void image_multi_incpass_cb(bContext *C, void *rr_v, void *iuser_v) ImageUser *iuser = iuser_v; RenderLayer *rl; RenderPass *rp; - RenderPass *next = NULL; int layer = iuser->layer; if (RE_HasFakeLayer(rr)) @@ -559,20 +558,20 @@ static void image_multi_incpass_cb(bContext *C, void *rr_v, void *iuser_v) rl = BLI_findlink(&rr->layers, layer); if (rl) { - for (rp = rl->passes.first; rp; rp = rp->next) { - if (rp->passtype == iuser->passtype) { - next = rp->next; - if (next != NULL && next->passtype == rp->passtype) - next = next->next; + RenderPass *rpass = BLI_findlink(&rl->passes, iuser->pass); + int rp_index = iuser->pass + 1; + + if (rpass == NULL) + return; + + for (rp = rpass->next; rp; rp = rp->next, rp_index++) { + if (rp->passtype != rpass->passtype) { + iuser->pass = rp_index; + BKE_image_multilayer_index(rr, iuser); + WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL); break; } } - - if (next != NULL && iuser->passtype != next->passtype) { - iuser->passtype = next->passtype; - BKE_image_multilayer_index(rr, iuser); - WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL); - } } } static void image_multi_decpass_cb(bContext *C, void *rr_v, void *iuser_v) @@ -581,29 +580,31 @@ static void image_multi_decpass_cb(bContext *C, void *rr_v, void *iuser_v) ImageUser *iuser = iuser_v; RenderLayer *rl; RenderPass *rp; - RenderPass *prev = NULL; int layer = iuser->layer; + if (iuser->pass == 0) + return; + if (RE_HasFakeLayer(rr)) layer -= 1; rl = BLI_findlink(&rr->layers, layer); if (rl) { - for (rp = rl->passes.last; rp; rp = rp->prev) { - if (rp->passtype == iuser->passtype) { - prev = rp->prev; - if (prev != NULL && prev->passtype == rp->passtype) - prev = prev->prev; + RenderPass *rpass = BLI_findlink(&rl->passes, iuser->pass); + int rp_index = 0; + + if (rpass == NULL) + return; + + for (rp = rl->passes.first; rp; rp = rp->next, rp_index++) { + if (rp->passtype == rpass->passtype) { + iuser->pass = rp_index - 1; + BKE_image_multilayer_index(rr, iuser); + WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL); break; } } - - if (prev != NULL && iuser->passtype != prev->passtype) { - iuser->passtype = prev->passtype; - BKE_image_multilayer_index(rr, iuser); - WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL); - } } } @@ -692,7 +693,7 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, Image *image, RenderRes /* pass */ fake_name = ui_imageuser_pass_fake_name(rl); - rpass = (rl ? RE_pass_find_by_type(rl, iuser->passtype, ((RenderView *)rr->views.first)->name) : NULL); + rpass = (rl ? BLI_findlink(&rl->passes, iuser->pass - (fake_name ? 1 : 0)) : NULL); display_name = rpass ? rpass->internal_name : (fake_name ? fake_name : ""); but = uiDefMenuBut(block, ui_imageuser_pass_menu, rnd_pt, IFACE_(display_name), diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 928e064b730..98a0752f64d 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -157,7 +157,6 @@ static SpaceLink *image_new(const bContext *UNUSED(C)) simage->iuser.fie_ima = 2; simage->iuser.frames = 100; simage->iuser.flag = IMA_SHOW_STEREO; - simage->iuser.passtype = SCE_PASS_COMBINED; scopes_new(&simage->scopes); simage->sample_line_hist.height = 100; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 1ddd25f9219..6d420674f3e 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -220,7 +220,7 @@ static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, else if (tselem->id->lib) { BKE_report(reports, RPT_WARNING, "Cannot edit external libdata"); } - else if (te->idcode == ID_LI && te->parent) { + else if (te->idcode == ID_LI && ((Library *)tselem->id)->parent) { BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly linked library"); } else { diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index b18dd31d286..c89a1bb1b9f 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -68,47 +68,6 @@ typedef struct TreeElement { #define TE_LAZY_CLOSED 4 #define TE_FREE_NAME 8 -/* TreeStoreElem types */ -#define TSE_NLA 1 -#define TSE_NLA_ACTION 2 -#define TSE_DEFGROUP_BASE 3 -#define TSE_DEFGROUP 4 -#define TSE_BONE 5 -#define TSE_EBONE 6 -#define TSE_CONSTRAINT_BASE 7 -#define TSE_CONSTRAINT 8 -#define TSE_MODIFIER_BASE 9 -#define TSE_MODIFIER 10 -#define TSE_LINKED_OB 11 -// #define TSE_SCRIPT_BASE 12 // UNUSED -#define TSE_POSE_BASE 13 -#define TSE_POSE_CHANNEL 14 -#define TSE_ANIM_DATA 15 -#define TSE_DRIVER_BASE 16 -#define TSE_DRIVER 17 - -#define TSE_PROXY 18 -#define TSE_R_LAYER_BASE 19 -#define TSE_R_LAYER 20 -#define TSE_R_PASS 21 -#define TSE_LINKED_MAT 22 -/* NOTE, is used for light group */ -#define TSE_LINKED_LAMP 23 -#define TSE_POSEGRP_BASE 24 -#define TSE_POSEGRP 25 -#define TSE_SEQUENCE 26 -#define TSE_SEQ_STRIP 27 -#define TSE_SEQUENCE_DUP 28 -#define TSE_LINKED_PSYS 29 -#define TSE_RNA_STRUCT 30 -#define TSE_RNA_PROPERTY 31 -#define TSE_RNA_ARRAY_ELEM 32 -#define TSE_NLA_TRACK 33 -#define TSE_KEYMAP 34 -#define TSE_KEYMAP_ITEM 35 -#define TSE_ID_BASE 36 -#define TSE_GP_LAYER 37 - /* button events */ #define OL_NAMEBUTTON 1 diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 37fa007b4a7..d84ab595b22 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3769,7 +3769,7 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar, float twmat[3][3]; /* same as transform manipulator when normal is set */ - ED_getTransformOrientationMatrix(C, twmat, true); + ED_getTransformOrientationMatrix(C, twmat, V3D_ACTIVE); mat3_to_quat(obact_quat, twmat); invert_qt(obact_quat); diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index e2fbbf58a5c..0bda6e37fd1 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -62,6 +62,9 @@ #define USE_TABLET_SUPPORT +/* ensure the target position is one we can reach, see: T45771 */ +#define USE_PIXELSIZE_NATIVE_SUPPORT + /* prototypes */ static float getVelocityZeroTime(const float gravity, const float velocity); @@ -578,6 +581,16 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op) walk->center_mval[0] = walk->ar->winx * 0.5f; walk->center_mval[1] = walk->ar->winy * 0.5f; +#ifdef USE_PIXELSIZE_NATIVE_SUPPORT + walk->center_mval[0] += walk->ar->winrct.xmin; + walk->center_mval[1] += walk->ar->winrct.ymin; + + WM_cursor_compatible_xy(win, &walk->center_mval[0], &walk->center_mval[1]); + + walk->center_mval[0] -= walk->ar->winrct.xmin; + walk->center_mval[1] -= walk->ar->winrct.ymin; +#endif + copy_v2_v2_int(walk->prev_mval, walk->center_mval); WM_cursor_warp(win, diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 3cc53807d8d..d8000f03e86 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2075,47 +2075,41 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve t->launch_event = LEFTMOUSE; } + unit_m3(t->spacemtx); + initTransInfo(C, t, op, event); + initTransformOrientation(C, t); if (t->spacetype == SPACE_VIEW3D) { - initTransformOrientation(C, t); - t->draw_handle_apply = ED_region_draw_cb_activate(t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW); t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t); } else if (t->spacetype == SPACE_IMAGE) { - unit_m3(t->spacemtx); t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); //t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t); } else if (t->spacetype == SPACE_CLIP) { - unit_m3(t->spacemtx); t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t); } else if (t->spacetype == SPACE_NODE) { - unit_m3(t->spacemtx); /*t->draw_handle_apply = ED_region_draw_cb_activate(t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW);*/ t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t); } else if (t->spacetype == SPACE_IPO) { - unit_m3(t->spacemtx); t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); //t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t); } else if (t->spacetype == SPACE_ACTION) { - unit_m3(t->spacemtx); t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW); //t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL); t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t); } - else - unit_m3(t->spacemtx); createTransData(C, t); // make TransData structs from selection diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index cdd260b3edb..aab065675fe 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -727,7 +727,7 @@ bool createSpaceNormalTangent(float mat[3][3], const float normal[3], const floa struct TransformOrientation *addMatrixSpace(struct bContext *C, float mat[3][3], const char *name, const bool overwrite); -bool applyTransformOrientation(const struct bContext *C, float mat[3][3], char r_name[64]); +bool applyTransformOrientation(const struct bContext *C, float mat[3][3], char r_name[64], int index); #define ORIENTATION_NONE 0 #define ORIENTATION_NORMAL 1 @@ -735,7 +735,8 @@ bool applyTransformOrientation(const struct bContext *C, float mat[3][3], char r #define ORIENTATION_EDGE 3 #define ORIENTATION_FACE 4 -int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3], const bool activeOnly); +int getTransformOrientation_ex(const struct bContext *C, float normal[3], float plane[3], const short around); +int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3]); void freeEdgeSlideTempFaces(EdgeSlideData *sld); void freeEdgeSlideVerts(TransInfo *t); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index a08abb866e8..03f62a39a92 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1206,18 +1206,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve t->around = V3D_CURSOR; } - if (op && ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) && - RNA_property_is_set(op->ptr, prop))) - { - t->current_orientation = RNA_property_enum_get(op->ptr, prop); - - if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C)) { - t->current_orientation = V3D_MANIP_GLOBAL; - } - } - else { - t->current_orientation = v3d->twmode; - } + t->current_orientation = v3d->twmode; /* exceptional case */ if (t->around == V3D_LOCAL) { @@ -1304,6 +1293,16 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } t->around = V3D_CENTER; } + + if (op && ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) && + RNA_property_is_set(op->ptr, prop))) + { + t->current_orientation = RNA_property_enum_get(op->ptr, prop); + + if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C)) { + t->current_orientation = V3D_MANIP_GLOBAL; + } + } if (op && ((prop = RNA_struct_find_property(op->ptr, "release_confirm")) && RNA_property_is_set(op->ptr, prop))) diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 309c538de74..be0e67cd5b2 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -885,7 +885,7 @@ static int calc_manipulator_stats(const bContext *C) /* fall-through */ case V3D_MANIP_NORMAL: if (obedit || ob->mode & OB_MODE_POSE) { - ED_getTransformOrientationMatrix(C, mat, (v3d->around == V3D_ACTIVE)); + ED_getTransformOrientationMatrix(C, mat, v3d->around); copy_m4_m3(rv3d->twmat, mat); break; } @@ -897,7 +897,7 @@ static int calc_manipulator_stats(const bContext *C) * use the active pones axis for display [#33575], this works as expected on a single bone * and users who select many bones will understand whats going on and what local means * when they start transforming */ - ED_getTransformOrientationMatrix(C, mat, (v3d->around == V3D_ACTIVE)); + ED_getTransformOrientationMatrix(C, mat, v3d->around); copy_m4_m3(rv3d->twmat, mat); break; } @@ -910,7 +910,7 @@ static int calc_manipulator_stats(const bContext *C) copy_m4_m3(rv3d->twmat, mat); break; default: /* V3D_MANIP_CUSTOM */ - if (applyTransformOrientation(C, mat, NULL)) { + if (applyTransformOrientation(C, mat, NULL, v3d->twmode - V3D_MANIP_CUSTOM)) { copy_m4_m3(rv3d->twmat, mat); } break; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index cea19e928bc..d6fbc46715e 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -36,6 +36,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" +#include "DNA_space_types.h" #include "DNA_view3d_types.h" #include "BLI_math.h" @@ -144,7 +145,7 @@ static TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, float mat[3][3]; float normal[3], plane[3]; - getTransformOrientation(C, normal, plane, 0); + getTransformOrientation(C, normal, plane); if (createSpaceNormalTangent(mat, normal, plane) == 0) { BKE_reports_prepend(reports, "Cannot use zero-length bone"); @@ -164,7 +165,7 @@ static TransformOrientation *createCurveSpace(bContext *C, ReportList *reports, float mat[3][3]; float normal[3], plane[3]; - getTransformOrientation(C, normal, plane, 0); + getTransformOrientation(C, normal, plane); if (createSpaceNormalTangent(mat, normal, plane) == 0) { BKE_reports_prepend(reports, "Cannot use zero-length curve"); @@ -186,7 +187,7 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, float normal[3], plane[3]; int type; - type = getTransformOrientation(C, normal, plane, 0); + type = getTransformOrientation(C, normal, plane); switch (type) { case ORIENTATION_VERT: @@ -390,15 +391,12 @@ int BIF_countTransformOrientation(const bContext *C) return BLI_listbase_count(transform_spaces); } -bool applyTransformOrientation(const bContext *C, float mat[3][3], char *r_name) +bool applyTransformOrientation(const bContext *C, float mat[3][3], char *r_name, int index) { - View3D *v3d = CTX_wm_view3d(C); - int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); - ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; - TransformOrientation *ts = BLI_findlink(transform_spaces, selected_index); + TransformOrientation *ts = BLI_findlink(transform_spaces, index); - BLI_assert(selected_index >= 0); + BLI_assert(index >= 0); if (ts) { if (r_name) { @@ -442,7 +440,6 @@ static int count_bone_select(bArmature *arm, ListBase *lb, const bool do_it) void initTransformOrientation(bContext *C, TransInfo *t) { - View3D *v3d = CTX_wm_view3d(C); Object *ob = CTX_data_active_object(C); Object *obedit = CTX_data_active_object(C); @@ -462,7 +459,7 @@ void initTransformOrientation(bContext *C, TransInfo *t) case V3D_MANIP_NORMAL: if (obedit || (ob && ob->mode & OB_MODE_POSE)) { BLI_strncpy(t->spacename, IFACE_("normal"), sizeof(t->spacename)); - ED_getTransformOrientationMatrix(C, t->spacemtx, (v3d->around == V3D_ACTIVE)); + ED_getTransformOrientationMatrix(C, t->spacemtx, t->around); break; } /* fall-through */ /* we define 'normal' as 'local' in Object mode */ @@ -480,7 +477,9 @@ void initTransformOrientation(bContext *C, TransInfo *t) break; case V3D_MANIP_VIEW: - if (t->ar->regiontype == RGN_TYPE_WINDOW) { + if ((t->spacetype == SPACE_VIEW3D) && + (t->ar->regiontype == RGN_TYPE_WINDOW)) + { RegionView3D *rv3d = t->ar->regiondata; float mat[3][3]; @@ -494,7 +493,7 @@ void initTransformOrientation(bContext *C, TransInfo *t) } break; default: /* V3D_MANIP_CUSTOM */ - if (applyTransformOrientation(C, t->spacemtx, t->spacename)) { + if (applyTransformOrientation(C, t->spacemtx, t->spacename, t->current_orientation - V3D_MANIP_CUSTOM)) { /* pass */ } else { @@ -585,14 +584,14 @@ static unsigned int bm_mesh_faces_select_get_n(BMesh *bm, BMVert **elems, const } #endif -int getTransformOrientation(const bContext *C, float normal[3], float plane[3], const bool activeOnly) +int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3], const short around) { Scene *scene = CTX_data_scene(C); - View3D *v3d = CTX_wm_view3d(C); Object *obedit = CTX_data_edit_object(C); Base *base; Object *ob = OBACT; int result = ORIENTATION_NONE; + const bool activeOnly = (around == V3D_ACTIVE); zero_v3(normal); zero_v3(plane); @@ -855,7 +854,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], /* exception */ if (flag) { float tvec[3]; - if ((v3d->around == V3D_LOCAL) || + if ((around == V3D_LOCAL) || ELEM(flag, SEL_F2, SEL_F1 | SEL_F3, SEL_F1 | SEL_F2 | SEL_F3)) { BKE_nurb_bezt_calc_normal(nu, bezt, tvec); @@ -1017,6 +1016,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], } else { /* we need the one selected object, if its not active */ + View3D *v3d = CTX_wm_view3d(C); ob = OBACT; if (ob && (ob->flag & SELECT)) { /* pass */ @@ -1042,14 +1042,22 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], return result; } -void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[3][3], const bool activeOnly) +int getTransformOrientation(const bContext *C, float normal[3], float plane[3]) +{ + /* dummy value, not V3D_ACTIVE and not V3D_LOCAL */ + short around = V3D_CENTER; + + return getTransformOrientation_ex(C, normal, plane, around); +} + +void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[3][3], const short around) { float normal[3] = {0.0, 0.0, 0.0}; float plane[3] = {0.0, 0.0, 0.0}; int type; - type = getTransformOrientation(C, normal, plane, activeOnly); + type = getTransformOrientation_ex(C, normal, plane, around); switch (type) { case ORIENTATION_NORMAL: diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index 6088dccd4e9..56a8842a8d2 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -55,7 +55,8 @@ typedef struct ImageUser { char ok; char multiview_eye; /* multiview current eye - for internal use of drawing routines */ - int passtype; + short pass; + short pad; short multi_index, view, layer; /* listbase indices, for menu browsing or retrieve buffer */ short flag; diff --git a/source/blender/makesdna/DNA_outliner_types.h b/source/blender/makesdna/DNA_outliner_types.h index 53061b55e2d..984e3334414 100644 --- a/source/blender/makesdna/DNA_outliner_types.h +++ b/source/blender/makesdna/DNA_outliner_types.h @@ -56,7 +56,55 @@ typedef struct TreeStore { #define TSE_CHILDSEARCH 8 #define TSE_SEARCHMATCH 16 -/* TreeStoreElem types in BIF_outliner.h */ +/* TreeStoreElem->types */ +#define TSE_NLA 1 /* NO ID */ +#define TSE_NLA_ACTION 2 +#define TSE_DEFGROUP_BASE 3 +#define TSE_DEFGROUP 4 +#define TSE_BONE 5 +#define TSE_EBONE 6 +#define TSE_CONSTRAINT_BASE 7 +#define TSE_CONSTRAINT 8 +#define TSE_MODIFIER_BASE 9 +#define TSE_MODIFIER 10 +#define TSE_LINKED_OB 11 +/* #define TSE_SCRIPT_BASE 12 */ /* UNUSED */ +#define TSE_POSE_BASE 13 +#define TSE_POSE_CHANNEL 14 +#define TSE_ANIM_DATA 15 +#define TSE_DRIVER_BASE 16 /* NO ID */ +/* #define TSE_DRIVER 17 */ /* UNUSED */ + +#define TSE_PROXY 18 +#define TSE_R_LAYER_BASE 19 +#define TSE_R_LAYER 20 +#define TSE_R_PASS 21 +#define TSE_LINKED_MAT 22 +/* NOTE, is used for light group */ +#define TSE_LINKED_LAMP 23 +#define TSE_POSEGRP_BASE 24 +#define TSE_POSEGRP 25 +#define TSE_SEQUENCE 26 /* NO ID */ +#define TSE_SEQ_STRIP 27 /* NO ID */ +#define TSE_SEQUENCE_DUP 28 /* NO ID */ +#define TSE_LINKED_PSYS 29 +#define TSE_RNA_STRUCT 30 /* NO ID */ +#define TSE_RNA_PROPERTY 31 /* NO ID */ +#define TSE_RNA_ARRAY_ELEM 32 /* NO ID */ +#define TSE_NLA_TRACK 33 /* NO ID */ +#define TSE_KEYMAP 34 /* NO ID */ +#define TSE_KEYMAP_ITEM 35 /* NO ID */ +#define TSE_ID_BASE 36 /* NO ID */ +#define TSE_GP_LAYER 37 /* NO ID */ + + +/* Check whether given TreeStoreElem should have a real ID in its ->id member. */ +#define TSE_IS_REAL_ID(_tse) \ + (!ELEM((_tse)->type, TSE_NLA, TSE_NLA_TRACK, TSE_DRIVER_BASE, \ + TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP, \ + TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, \ + TSE_KEYMAP, TSE_KEYMAP_ITEM, TSE_ID_BASE, TSE_GP_LAYER)) + #endif diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 41bb0386ce6..b7478fd3311 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -4720,6 +4720,7 @@ char *RNA_path_full_struct_py(struct PointerRNA *ptr) char *RNA_path_full_property_py(PointerRNA *ptr, PropertyRNA *prop, int index) { char *id_path; + const char *data_delim; char *data_path; char *ret; @@ -4733,13 +4734,15 @@ char *RNA_path_full_property_py(PointerRNA *ptr, PropertyRNA *prop, int index) data_path = RNA_path_from_ID_to_property(ptr, prop); + data_delim = (data_path && data_path[0] == '[') ? "" : "."; + if ((index == -1) || (RNA_property_array_check(prop) == false)) { - ret = BLI_sprintfN("%s.%s", - id_path, data_path); + ret = BLI_sprintfN("%s%s%s", + id_path, data_delim, data_path); } else { - ret = BLI_sprintfN("%s.%s[%d]", - id_path, data_path, index); + ret = BLI_sprintfN("%s%s%s[%d]", + id_path, data_delim, data_path, index); } MEM_freeN(id_path); if (data_path) { diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 0d0b440ec08..561f5c9dd26 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -539,6 +539,11 @@ static void rna_def_imageuser(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */ RNA_def_property_ui_text(prop, "Layer", "Layer in multilayer image"); + prop = RNA_def_property(srna, "multilayer_pass", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "pass"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */ + RNA_def_property_ui_text(prop, "Pass", "Pass in multilayer image"); + prop = RNA_def_property(srna, "multilayer_view", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "view"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */ diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 88f0fbf4ce0..cd6ef3f16a4 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -1667,6 +1667,13 @@ static void py_module_dict_add_int(PyObject *dict, const char *name, int value) Py_DECREF(item); } +static void py_module_dict_add_int64(PyObject *dict, const char *name, int64_t value) +{ + PyObject *item; + PyDict_SetItemString(dict, name, item = PyLong_FromLongLong(value)); + Py_DECREF(item); +} + static void py_module_dict_add_method(PyObject *submodule, PyObject *dict, PyMethodDef *method_def, bool is_valid) { if (is_valid) { @@ -2332,6 +2339,7 @@ PyObject *BPyInit_bgl(void) } #define PY_DICT_ADD_INT(x) py_module_dict_add_int(dict, #x, x) +#define PY_DICT_ADD_INT64(x) py_module_dict_add_int64(dict, #x, x) /* GL_VERSION_1_1 */ { @@ -3024,15 +3032,57 @@ PyObject *BPyInit_bgl(void) /* GL_VERSION_1_4 */ { + PY_DICT_ADD_INT(GL_BLEND_DST_ALPHA); + PY_DICT_ADD_INT(GL_BLEND_DST_RGB); + PY_DICT_ADD_INT(GL_BLEND_SRC_ALPHA); + PY_DICT_ADD_INT(GL_BLEND_SRC_RGB); PY_DICT_ADD_INT(GL_CONSTANT_ALPHA); PY_DICT_ADD_INT(GL_CONSTANT_COLOR); + PY_DICT_ADD_INT(GL_DECR_WRAP); + PY_DICT_ADD_INT(GL_DEPTH_COMPONENT16); + PY_DICT_ADD_INT(GL_DEPTH_COMPONENT24); + PY_DICT_ADD_INT(GL_DEPTH_COMPONENT32); PY_DICT_ADD_INT(GL_FUNC_ADD); PY_DICT_ADD_INT(GL_FUNC_REVERSE_SUBTRACT); PY_DICT_ADD_INT(GL_FUNC_SUBTRACT); + PY_DICT_ADD_INT(GL_INCR_WRAP); PY_DICT_ADD_INT(GL_MAX); + PY_DICT_ADD_INT(GL_MAX_TEXTURE_LOD_BIAS); PY_DICT_ADD_INT(GL_MIN); + PY_DICT_ADD_INT(GL_MIRRORED_REPEAT); PY_DICT_ADD_INT(GL_ONE_MINUS_CONSTANT_ALPHA); PY_DICT_ADD_INT(GL_ONE_MINUS_CONSTANT_COLOR); + PY_DICT_ADD_INT(GL_POINT_FADE_THRESHOLD_SIZE); + PY_DICT_ADD_INT(GL_TEXTURE_COMPARE_FUNC); + PY_DICT_ADD_INT(GL_TEXTURE_COMPARE_MODE); + PY_DICT_ADD_INT(GL_TEXTURE_DEPTH_SIZE); + PY_DICT_ADD_INT(GL_TEXTURE_LOD_BIAS); + } + /* adding in GL_VERSION_1_4 removed from core profile */ + if (use_deprecated == true) { + PY_DICT_ADD_INT(GL_COLOR_SUM); + PY_DICT_ADD_INT(GL_COMPARE_R_TO_TEXTURE); + PY_DICT_ADD_INT(GL_CURRENT_FOG_COORDINATE); + PY_DICT_ADD_INT(GL_CURRENT_SECONDARY_COLOR); + PY_DICT_ADD_INT(GL_DEPTH_TEXTURE_MODE); + PY_DICT_ADD_INT(GL_FOG_COORDINATE); + PY_DICT_ADD_INT(GL_FOG_COORDINATE_ARRAY); + PY_DICT_ADD_INT(GL_FOG_COORDINATE_ARRAY_POINTER); + PY_DICT_ADD_INT(GL_FOG_COORDINATE_ARRAY_STRIDE); + PY_DICT_ADD_INT(GL_FOG_COORDINATE_ARRAY_TYPE); + PY_DICT_ADD_INT(GL_FOG_COORDINATE_SOURCE); + PY_DICT_ADD_INT(GL_FRAGMENT_DEPTH); + PY_DICT_ADD_INT(GL_GENERATE_MIPMAP); + PY_DICT_ADD_INT(GL_GENERATE_MIPMAP_HINT); + PY_DICT_ADD_INT(GL_POINT_DISTANCE_ATTENUATION); + PY_DICT_ADD_INT(GL_POINT_SIZE_MAX); + PY_DICT_ADD_INT(GL_POINT_SIZE_MIN); + PY_DICT_ADD_INT(GL_SECONDARY_COLOR_ARRAY); + PY_DICT_ADD_INT(GL_SECONDARY_COLOR_ARRAY_POINTER); + PY_DICT_ADD_INT(GL_SECONDARY_COLOR_ARRAY_SIZE); + PY_DICT_ADD_INT(GL_SECONDARY_COLOR_ARRAY_STRIDE); + PY_DICT_ADD_INT(GL_SECONDARY_COLOR_ARRAY_TYPE); + PY_DICT_ADD_INT(GL_TEXTURE_FILTER_CONTROL); } @@ -3216,23 +3266,262 @@ PyObject *BPyInit_bgl(void) PY_DICT_ADD_INT(GL_SLUMINANCE_ALPHA); } - /* GL_VERSION_3_0 */ { + PY_DICT_ADD_INT(GL_BGRA_INTEGER); + PY_DICT_ADD_INT(GL_BGR_INTEGER); + PY_DICT_ADD_INT(GL_BLUE_INTEGER); + PY_DICT_ADD_INT(GL_BUFFER_ACCESS_FLAGS); + PY_DICT_ADD_INT(GL_BUFFER_MAP_LENGTH); + PY_DICT_ADD_INT(GL_BUFFER_MAP_OFFSET); + PY_DICT_ADD_INT(GL_CLAMP_READ_COLOR); + PY_DICT_ADD_INT(GL_CLIP_DISTANCE0); + PY_DICT_ADD_INT(GL_CLIP_DISTANCE1); + PY_DICT_ADD_INT(GL_CLIP_DISTANCE2); + PY_DICT_ADD_INT(GL_CLIP_DISTANCE3); + PY_DICT_ADD_INT(GL_CLIP_DISTANCE4); + PY_DICT_ADD_INT(GL_CLIP_DISTANCE5); +#if 0 + PY_DICT_ADD_INT(GL_CLIP_DISTANCE6); + PY_DICT_ADD_INT(GL_CLIP_DISTANCE7); +#endif + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT0); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT1); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT2); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT3); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT4); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT5); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT6); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT7); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT8); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT9); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT10); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT11); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT12); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT13); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT14); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT15); +#if 0 + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT16); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT17); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT18); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT19); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT20); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT21); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT22); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT23); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT24); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT25); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT26); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT27); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT28); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT29); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT30); + PY_DICT_ADD_INT(GL_COLOR_ATTACHMENT31); +#endif + PY_DICT_ADD_INT(GL_COMPARE_REF_TO_TEXTURE); + PY_DICT_ADD_INT(GL_COMPRESSED_RED); + PY_DICT_ADD_INT(GL_COMPRESSED_RED_RGTC1); + PY_DICT_ADD_INT(GL_COMPRESSED_RG); + PY_DICT_ADD_INT(GL_COMPRESSED_RG_RGTC2); + PY_DICT_ADD_INT(GL_COMPRESSED_SIGNED_RED_RGTC1); + PY_DICT_ADD_INT(GL_COMPRESSED_SIGNED_RG_RGTC2); + PY_DICT_ADD_INT(GL_CONTEXT_FLAGS); + PY_DICT_ADD_INT(GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT); + PY_DICT_ADD_INT(GL_DEPTH24_STENCIL8); + PY_DICT_ADD_INT(GL_DEPTH32F_STENCIL8); + PY_DICT_ADD_INT(GL_DEPTH_ATTACHMENT); + PY_DICT_ADD_INT(GL_DEPTH_COMPONENT32F); + PY_DICT_ADD_INT(GL_DEPTH_STENCIL); + PY_DICT_ADD_INT(GL_DEPTH_STENCIL_ATTACHMENT); + PY_DICT_ADD_INT(GL_DRAW_FRAMEBUFFER); + PY_DICT_ADD_INT(GL_DRAW_FRAMEBUFFER_BINDING); + PY_DICT_ADD_INT(GL_FIXED_ONLY); + PY_DICT_ADD_INT(GL_FLOAT_32_UNSIGNED_INT_24_8_REV); + PY_DICT_ADD_INT(GL_FRAMEBUFFER); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_BINDING); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_COMPLETE); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_DEFAULT); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_SRGB); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_UNDEFINED); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_UNSUPPORTED); + PY_DICT_ADD_INT(GL_GREEN_INTEGER); + PY_DICT_ADD_INT(GL_HALF_FLOAT); + PY_DICT_ADD_INT(GL_INDEX); + PY_DICT_ADD_INT(GL_INTERLEAVED_ATTRIBS); + PY_DICT_ADD_INT(GL_INT_SAMPLER_1D); + PY_DICT_ADD_INT(GL_INT_SAMPLER_1D_ARRAY); + PY_DICT_ADD_INT(GL_INT_SAMPLER_2D); + PY_DICT_ADD_INT(GL_INT_SAMPLER_2D_ARRAY); + PY_DICT_ADD_INT(GL_INT_SAMPLER_3D); + PY_DICT_ADD_INT(GL_INT_SAMPLER_CUBE); + PY_DICT_ADD_INT(GL_INVALID_FRAMEBUFFER_OPERATION); + PY_DICT_ADD_INT(GL_MAJOR_VERSION); + PY_DICT_ADD_INT(GL_MAP_FLUSH_EXPLICIT_BIT); + PY_DICT_ADD_INT(GL_MAP_INVALIDATE_BUFFER_BIT); + PY_DICT_ADD_INT(GL_MAP_INVALIDATE_RANGE_BIT); + PY_DICT_ADD_INT(GL_MAP_READ_BIT); + PY_DICT_ADD_INT(GL_MAP_UNSYNCHRONIZED_BIT); + PY_DICT_ADD_INT(GL_MAP_WRITE_BIT); + PY_DICT_ADD_INT(GL_MAX_ARRAY_TEXTURE_LAYERS); + PY_DICT_ADD_INT(GL_MAX_CLIP_DISTANCES); + PY_DICT_ADD_INT(GL_MAX_COLOR_ATTACHMENTS); + PY_DICT_ADD_INT(GL_MAX_PROGRAM_TEXEL_OFFSET); + PY_DICT_ADD_INT(GL_MAX_RENDERBUFFER_SIZE); + PY_DICT_ADD_INT(GL_MAX_SAMPLES); + PY_DICT_ADD_INT(GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS); + PY_DICT_ADD_INT(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS); + PY_DICT_ADD_INT(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS); + PY_DICT_ADD_INT(GL_MAX_VARYING_COMPONENTS); + PY_DICT_ADD_INT(GL_MINOR_VERSION); + PY_DICT_ADD_INT(GL_MIN_PROGRAM_TEXEL_OFFSET); + PY_DICT_ADD_INT(GL_NUM_EXTENSIONS); + PY_DICT_ADD_INT(GL_PRIMITIVES_GENERATED); + PY_DICT_ADD_INT(GL_PROXY_TEXTURE_1D_ARRAY); + PY_DICT_ADD_INT(GL_PROXY_TEXTURE_2D_ARRAY); + PY_DICT_ADD_INT(GL_QUERY_BY_REGION_NO_WAIT); + PY_DICT_ADD_INT(GL_QUERY_BY_REGION_WAIT); + PY_DICT_ADD_INT(GL_QUERY_NO_WAIT); + PY_DICT_ADD_INT(GL_QUERY_WAIT); + PY_DICT_ADD_INT(GL_R11F_G11F_B10F); + PY_DICT_ADD_INT(GL_R16); + PY_DICT_ADD_INT(GL_R16F); + PY_DICT_ADD_INT(GL_R16I); + PY_DICT_ADD_INT(GL_R16UI); + PY_DICT_ADD_INT(GL_R32F); + PY_DICT_ADD_INT(GL_R32I); + PY_DICT_ADD_INT(GL_R32UI); + PY_DICT_ADD_INT(GL_R8); + PY_DICT_ADD_INT(GL_R8I); + PY_DICT_ADD_INT(GL_R8UI); + PY_DICT_ADD_INT(GL_RASTERIZER_DISCARD); + PY_DICT_ADD_INT(GL_READ_FRAMEBUFFER); + PY_DICT_ADD_INT(GL_READ_FRAMEBUFFER_BINDING); + PY_DICT_ADD_INT(GL_RED_INTEGER); + PY_DICT_ADD_INT(GL_RENDERBUFFER); + PY_DICT_ADD_INT(GL_RENDERBUFFER_ALPHA_SIZE); + PY_DICT_ADD_INT(GL_RENDERBUFFER_BINDING); + PY_DICT_ADD_INT(GL_RENDERBUFFER_BLUE_SIZE); + PY_DICT_ADD_INT(GL_RENDERBUFFER_DEPTH_SIZE); + PY_DICT_ADD_INT(GL_RENDERBUFFER_GREEN_SIZE); + PY_DICT_ADD_INT(GL_RENDERBUFFER_HEIGHT); + PY_DICT_ADD_INT(GL_RENDERBUFFER_INTERNAL_FORMAT); + PY_DICT_ADD_INT(GL_RENDERBUFFER_RED_SIZE); + PY_DICT_ADD_INT(GL_RENDERBUFFER_SAMPLES); + PY_DICT_ADD_INT(GL_RENDERBUFFER_STENCIL_SIZE); + PY_DICT_ADD_INT(GL_RENDERBUFFER_WIDTH); + PY_DICT_ADD_INT(GL_RG); + PY_DICT_ADD_INT(GL_RG16); + PY_DICT_ADD_INT(GL_RG16F); + PY_DICT_ADD_INT(GL_RG16I); + PY_DICT_ADD_INT(GL_RG16UI); + PY_DICT_ADD_INT(GL_RG32F); + PY_DICT_ADD_INT(GL_RG32I); + PY_DICT_ADD_INT(GL_RG32UI); + PY_DICT_ADD_INT(GL_RG8); + PY_DICT_ADD_INT(GL_RG8I); + PY_DICT_ADD_INT(GL_RG8UI); + PY_DICT_ADD_INT(GL_RGB16F); + PY_DICT_ADD_INT(GL_RGB16I); + PY_DICT_ADD_INT(GL_RGB16UI); + PY_DICT_ADD_INT(GL_RGB32F); + PY_DICT_ADD_INT(GL_RGB32I); + PY_DICT_ADD_INT(GL_RGB32UI); + PY_DICT_ADD_INT(GL_RGB8I); + PY_DICT_ADD_INT(GL_RGB8UI); + PY_DICT_ADD_INT(GL_RGB9_E5); + PY_DICT_ADD_INT(GL_RGBA16F); + PY_DICT_ADD_INT(GL_RGBA16I); + PY_DICT_ADD_INT(GL_RGBA16UI); + PY_DICT_ADD_INT(GL_RGBA32F); + PY_DICT_ADD_INT(GL_RGBA32I); + PY_DICT_ADD_INT(GL_RGBA32UI); + PY_DICT_ADD_INT(GL_RGBA8I); + PY_DICT_ADD_INT(GL_RGBA8UI); + PY_DICT_ADD_INT(GL_RGBA_INTEGER); + PY_DICT_ADD_INT(GL_RGB_INTEGER); + PY_DICT_ADD_INT(GL_RG_INTEGER); + PY_DICT_ADD_INT(GL_SAMPLER_1D_ARRAY); + PY_DICT_ADD_INT(GL_SAMPLER_1D_ARRAY_SHADOW); + PY_DICT_ADD_INT(GL_SAMPLER_2D_ARRAY); + PY_DICT_ADD_INT(GL_SAMPLER_2D_ARRAY_SHADOW); + PY_DICT_ADD_INT(GL_SAMPLER_CUBE_SHADOW); + PY_DICT_ADD_INT(GL_SEPARATE_ATTRIBS); + PY_DICT_ADD_INT(GL_STENCIL_ATTACHMENT); + PY_DICT_ADD_INT(GL_STENCIL_INDEX1); + PY_DICT_ADD_INT(GL_STENCIL_INDEX16); + PY_DICT_ADD_INT(GL_STENCIL_INDEX4); + PY_DICT_ADD_INT(GL_STENCIL_INDEX8); + PY_DICT_ADD_INT(GL_TEXTURE_1D_ARRAY); + PY_DICT_ADD_INT(GL_TEXTURE_2D_ARRAY); + PY_DICT_ADD_INT(GL_TEXTURE_ALPHA_TYPE); + PY_DICT_ADD_INT(GL_TEXTURE_BINDING_1D_ARRAY); + PY_DICT_ADD_INT(GL_TEXTURE_BINDING_2D_ARRAY); + PY_DICT_ADD_INT(GL_TEXTURE_BLUE_TYPE); + PY_DICT_ADD_INT(GL_TEXTURE_DEPTH_TYPE); + PY_DICT_ADD_INT(GL_TEXTURE_GREEN_TYPE); + PY_DICT_ADD_INT(GL_TEXTURE_RED_TYPE); + PY_DICT_ADD_INT(GL_TEXTURE_SHARED_SIZE); + PY_DICT_ADD_INT(GL_TEXTURE_STENCIL_SIZE); + PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_BUFFER); + PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING); + PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_BUFFER_MODE); + PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_BUFFER_SIZE); + PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_BUFFER_START); + PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); + PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_VARYINGS); + PY_DICT_ADD_INT(GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_10F_11F_11F_REV); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_24_8); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_5_9_9_9_REV); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_1D); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_1D_ARRAY); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_2D); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_3D); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_CUBE); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_VEC2); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_VEC3); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_VEC4); + PY_DICT_ADD_INT(GL_UNSIGNED_NORMALIZED); PY_DICT_ADD_INT(GL_VERTEX_ARRAY_BINDING); + PY_DICT_ADD_INT(GL_VERTEX_ATTRIB_ARRAY_INTEGER); } /* adding in GL_VERSION_3_0 removed from core profile */ if (use_deprecated == true) { PY_DICT_ADD_INT(GL_ALPHA_INTEGER); PY_DICT_ADD_INT(GL_CLAMP_FRAGMENT_COLOR); PY_DICT_ADD_INT(GL_CLAMP_VERTEX_COLOR); + PY_DICT_ADD_INT(GL_TEXTURE_INTENSITY_TYPE); + PY_DICT_ADD_INT(GL_TEXTURE_LUMINANCE_TYPE); } - /* GL_VERSION_3_1 */ { PY_DICT_ADD_INT(GL_ACTIVE_UNIFORM_BLOCKS); PY_DICT_ADD_INT(GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH); + PY_DICT_ADD_INT(GL_COPY_READ_BUFFER); + PY_DICT_ADD_INT(GL_COPY_WRITE_BUFFER); + PY_DICT_ADD_INT(GL_INT_SAMPLER_2D_RECT); + PY_DICT_ADD_INT(GL_INT_SAMPLER_BUFFER); PY_DICT_ADD_INT(GL_INVALID_INDEX); PY_DICT_ADD_INT(GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS); PY_DICT_ADD_INT(GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS); @@ -3240,9 +3529,31 @@ PyObject *BPyInit_bgl(void) PY_DICT_ADD_INT(GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS); PY_DICT_ADD_INT(GL_MAX_FRAGMENT_UNIFORM_BLOCKS); PY_DICT_ADD_INT(GL_MAX_GEOMETRY_UNIFORM_BLOCKS); + PY_DICT_ADD_INT(GL_MAX_RECTANGLE_TEXTURE_SIZE); + PY_DICT_ADD_INT(GL_MAX_TEXTURE_BUFFER_SIZE); PY_DICT_ADD_INT(GL_MAX_UNIFORM_BLOCK_SIZE); PY_DICT_ADD_INT(GL_MAX_UNIFORM_BUFFER_BINDINGS); PY_DICT_ADD_INT(GL_MAX_VERTEX_UNIFORM_BLOCKS); + PY_DICT_ADD_INT(GL_PRIMITIVE_RESTART); + PY_DICT_ADD_INT(GL_PRIMITIVE_RESTART_INDEX); + PY_DICT_ADD_INT(GL_PROXY_TEXTURE_RECTANGLE); + PY_DICT_ADD_INT(GL_R16_SNORM); + PY_DICT_ADD_INT(GL_R8_SNORM); + PY_DICT_ADD_INT(GL_RG16_SNORM); + PY_DICT_ADD_INT(GL_RG8_SNORM); + PY_DICT_ADD_INT(GL_RGB16_SNORM); + PY_DICT_ADD_INT(GL_RGB8_SNORM); + PY_DICT_ADD_INT(GL_RGBA16_SNORM); + PY_DICT_ADD_INT(GL_RGBA8_SNORM); + PY_DICT_ADD_INT(GL_SAMPLER_2D_RECT); + PY_DICT_ADD_INT(GL_SAMPLER_2D_RECT_SHADOW); + PY_DICT_ADD_INT(GL_SAMPLER_BUFFER); + PY_DICT_ADD_INT(GL_SIGNED_NORMALIZED); + PY_DICT_ADD_INT(GL_TEXTURE_BINDING_BUFFER); + PY_DICT_ADD_INT(GL_TEXTURE_BINDING_RECTANGLE); + PY_DICT_ADD_INT(GL_TEXTURE_BUFFER); + PY_DICT_ADD_INT(GL_TEXTURE_BUFFER_DATA_STORE_BINDING); + PY_DICT_ADD_INT(GL_TEXTURE_RECTANGLE); PY_DICT_ADD_INT(GL_UNIFORM_ARRAY_STRIDE); PY_DICT_ADD_INT(GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS); PY_DICT_ADD_INT(GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES); @@ -3264,34 +3575,98 @@ PyObject *BPyInit_bgl(void) PY_DICT_ADD_INT(GL_UNIFORM_OFFSET); PY_DICT_ADD_INT(GL_UNIFORM_SIZE); PY_DICT_ADD_INT(GL_UNIFORM_TYPE); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_2D_RECT); + PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_BUFFER); } /* GL_VERSION_3_2 */ { + PY_DICT_ADD_INT(GL_ALREADY_SIGNALED); + PY_DICT_ADD_INT(GL_CONDITION_SATISFIED); + PY_DICT_ADD_INT(GL_CONTEXT_COMPATIBILITY_PROFILE_BIT); + PY_DICT_ADD_INT(GL_CONTEXT_CORE_PROFILE_BIT); + PY_DICT_ADD_INT(GL_CONTEXT_PROFILE_MASK); + PY_DICT_ADD_INT(GL_DEPTH_CLAMP); + PY_DICT_ADD_INT(GL_FIRST_VERTEX_CONVENTION); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_ATTACHMENT_LAYERED); + PY_DICT_ADD_INT(GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS); + PY_DICT_ADD_INT(GL_GEOMETRY_INPUT_TYPE); + PY_DICT_ADD_INT(GL_GEOMETRY_OUTPUT_TYPE); + PY_DICT_ADD_INT(GL_GEOMETRY_SHADER); + PY_DICT_ADD_INT(GL_GEOMETRY_VERTICES_OUT); PY_DICT_ADD_INT(GL_INT_SAMPLER_2D_MULTISAMPLE); PY_DICT_ADD_INT(GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY); + PY_DICT_ADD_INT(GL_LAST_VERTEX_CONVENTION); + PY_DICT_ADD_INT(GL_LINES_ADJACENCY); + PY_DICT_ADD_INT(GL_LINE_STRIP_ADJACENCY); PY_DICT_ADD_INT(GL_MAX_COLOR_TEXTURE_SAMPLES); PY_DICT_ADD_INT(GL_MAX_DEPTH_TEXTURE_SAMPLES); + PY_DICT_ADD_INT(GL_MAX_FRAGMENT_INPUT_COMPONENTS); + PY_DICT_ADD_INT(GL_MAX_GEOMETRY_INPUT_COMPONENTS); + PY_DICT_ADD_INT(GL_MAX_GEOMETRY_OUTPUT_COMPONENTS); + PY_DICT_ADD_INT(GL_MAX_GEOMETRY_OUTPUT_VERTICES); + PY_DICT_ADD_INT(GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS); + PY_DICT_ADD_INT(GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS); + PY_DICT_ADD_INT(GL_MAX_GEOMETRY_UNIFORM_COMPONENTS); PY_DICT_ADD_INT(GL_MAX_INTEGER_SAMPLES); PY_DICT_ADD_INT(GL_MAX_SAMPLE_MASK_WORDS); + PY_DICT_ADD_INT(GL_MAX_SERVER_WAIT_TIMEOUT); + PY_DICT_ADD_INT(GL_MAX_VERTEX_OUTPUT_COMPONENTS); + PY_DICT_ADD_INT(GL_OBJECT_TYPE); + PY_DICT_ADD_INT(GL_PROGRAM_POINT_SIZE); + PY_DICT_ADD_INT(GL_PROVOKING_VERTEX); PY_DICT_ADD_INT(GL_PROXY_TEXTURE_2D_MULTISAMPLE); PY_DICT_ADD_INT(GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY); + PY_DICT_ADD_INT(GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION); PY_DICT_ADD_INT(GL_SAMPLER_2D_MULTISAMPLE); PY_DICT_ADD_INT(GL_SAMPLER_2D_MULTISAMPLE_ARRAY); PY_DICT_ADD_INT(GL_SAMPLE_MASK); PY_DICT_ADD_INT(GL_SAMPLE_MASK_VALUE); PY_DICT_ADD_INT(GL_SAMPLE_POSITION); + PY_DICT_ADD_INT(GL_SIGNALED); + PY_DICT_ADD_INT(GL_SYNC_CONDITION); + PY_DICT_ADD_INT(GL_SYNC_FENCE); + PY_DICT_ADD_INT(GL_SYNC_FLAGS); + PY_DICT_ADD_INT(GL_SYNC_FLUSH_COMMANDS_BIT); + PY_DICT_ADD_INT(GL_SYNC_GPU_COMMANDS_COMPLETE); + PY_DICT_ADD_INT(GL_SYNC_STATUS); PY_DICT_ADD_INT(GL_TEXTURE_2D_MULTISAMPLE); PY_DICT_ADD_INT(GL_TEXTURE_2D_MULTISAMPLE_ARRAY); PY_DICT_ADD_INT(GL_TEXTURE_BINDING_2D_MULTISAMPLE); PY_DICT_ADD_INT(GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY); + PY_DICT_ADD_INT(GL_TEXTURE_CUBE_MAP_SEAMLESS); PY_DICT_ADD_INT(GL_TEXTURE_FIXED_SAMPLE_LOCATIONS); PY_DICT_ADD_INT(GL_TEXTURE_SAMPLES); + PY_DICT_ADD_INT(GL_TIMEOUT_EXPIRED); + PY_DICT_ADD_INT64(GL_TIMEOUT_IGNORED); + PY_DICT_ADD_INT(GL_TRIANGLES_ADJACENCY); + PY_DICT_ADD_INT(GL_TRIANGLE_STRIP_ADJACENCY); + PY_DICT_ADD_INT(GL_UNSIGNALED); PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE); PY_DICT_ADD_INT(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY); + PY_DICT_ADD_INT(GL_WAIT_FAILED); } + /* GL_VERSION_3_3 */ + { + PY_DICT_ADD_INT(GL_ANY_SAMPLES_PASSED); + PY_DICT_ADD_INT(GL_INT_2_10_10_10_REV); + PY_DICT_ADD_INT(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS); + PY_DICT_ADD_INT(GL_ONE_MINUS_SRC1_ALPHA); + PY_DICT_ADD_INT(GL_ONE_MINUS_SRC1_COLOR); + PY_DICT_ADD_INT(GL_RGB10_A2UI); + PY_DICT_ADD_INT(GL_SAMPLER_BINDING); + PY_DICT_ADD_INT(GL_SRC1_COLOR); + PY_DICT_ADD_INT(GL_TEXTURE_SWIZZLE_A); + PY_DICT_ADD_INT(GL_TEXTURE_SWIZZLE_B); + PY_DICT_ADD_INT(GL_TEXTURE_SWIZZLE_G); + PY_DICT_ADD_INT(GL_TEXTURE_SWIZZLE_R); + PY_DICT_ADD_INT(GL_TEXTURE_SWIZZLE_RGBA); + PY_DICT_ADD_INT(GL_TIMESTAMP); + PY_DICT_ADD_INT(GL_TIME_ELAPSED); + PY_DICT_ADD_INT(GL_VERTEX_ATTRIB_ARRAY_DIVISOR); + } return submodule; } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index bd07c7370a4..5414c4e4204 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -988,15 +988,16 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self) path = RNA_path_from_ID_to_property(&self->ptr, self->prop); if (path) { + const char *data_delim = (path[0] == '[') ? "" : "."; if (GS(id->name) == ID_NT) { /* nodetree paths are not accurate */ ret = PyUnicode_FromFormat("bpy.data...%s", path); } else { - ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s", + ret = PyUnicode_FromFormat("bpy.data.%s[%R]%s%s", BKE_idcode_to_name_plural(GS(id->name)), tmp_str, - path); + data_delim, path); } MEM_freeN((void *)path); @@ -3388,6 +3389,21 @@ static PyObject *pyrna_prop_as_bytes(BPy_PropertyRNA *self) } } +PyDoc_STRVAR(pyrna_prop_update_doc, +".. method:: update()\n" +"\n" +" Execute the properties update callback.\n" +"\n" +" .. note::\n" +" This is called when assigning a property,\n" +" however in rare cases its useful to call explicitly.\n" +); +static PyObject *pyrna_prop_update(BPy_PropertyRNA *self) +{ + RNA_property_update(BPy_GetContext(), &self->ptr, self->prop); + Py_RETURN_NONE; +} + PyDoc_STRVAR(pyrna_struct_type_recast_doc, ".. method:: type_recast()\n" "\n" @@ -4721,6 +4737,7 @@ static struct PyMethodDef pyrna_struct_methods[] = { static struct PyMethodDef pyrna_prop_methods[] = { {"path_from_id", (PyCFunction)pyrna_prop_path_from_id, METH_NOARGS, pyrna_prop_path_from_id_doc}, {"as_bytes", (PyCFunction)pyrna_prop_as_bytes, METH_NOARGS, pyrna_prop_as_bytes_doc}, + {"update", (PyCFunction)pyrna_prop_update, METH_NOARGS, pyrna_prop_update_doc}, {"__dir__", (PyCFunction)pyrna_prop_dir, METH_NOARGS, NULL}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c index f933c02390c..a7ece10f06c 100644 --- a/source/blender/python/intern/gpu.c +++ b/source/blender/python/intern/gpu.c @@ -79,6 +79,13 @@ static PyObject *PyInit_gpu(void) if (m == NULL) return NULL; + + /* Take care to update docs when editing: 'doc/python_api/rst/gpu.rst' */ + + + /* -------------------------------------------------------------------- */ + /* GPUDynamicType */ + /* device constant groups */ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_GROUP_MISC); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_GROUP_LAMP); @@ -90,12 +97,14 @@ static PyObject *PyInit_gpu(void) /* device constants */ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_NONE); + /* GPU_DYNAMIC_GROUP_OBJECT */ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_VIEWMAT); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_MAT); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_VIEWIMAT); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_IMAT); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_COLOR); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE); + /* GPU_DYNAMIC_GROUP_LAMP */ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNVEC); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNCO); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DYNIMAT); @@ -105,27 +114,35 @@ static PyObject *PyInit_gpu(void) PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_ATT1); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_ATT2); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DISTANCE); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_SPOTBLEND); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_SPOTSIZE); + PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_SPOTBLEND); + /* GPU_DYNAMIC_GROUP_SAMPLER */ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_SAMPLER_2DBUFFER); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_SAMPLER_2DIMAGE); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_SAMPLER_2DSHADOW); + /* GPU_DYNAMIC_GROUP_MIST */ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MIST_ENABLE); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MIST_START); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MIST_DISTANCE); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MIST_INTENSITY); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MIST_TYPE); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MIST_COLOR); + /* GPU_DYNAMIC_GROUP_WORLD */ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_HORIZON_COLOR); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_AMBIENT_COLOR); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_ALPHA); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_AMB); + /* GPU_DYNAMIC_GROUP_MAT */ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_DIFFRGB); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_EMIT); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_HARD); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_REF); - PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_SPEC); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_SPECRGB); + PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_SPEC); + PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_HARD); + PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_EMIT); + PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_AMB); + PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_ALPHA); + + + /* -------------------------------------------------------------------- */ + /* GPUDataType */ PY_MODULE_ADD_CONSTANT(m, GPU_DATA_1I); PY_MODULE_ADD_CONSTANT(m, GPU_DATA_1F); @@ -136,6 +153,12 @@ static PyObject *PyInit_gpu(void) PY_MODULE_ADD_CONSTANT(m, GPU_DATA_16F); PY_MODULE_ADD_CONSTANT(m, GPU_DATA_4UB); + + /* -------------------------------------------------------------------- */ + /* CustomDataType + * + * Intentionally only include the subset used by the GPU API. + */ PY_MODULE_ADD_CONSTANT(m, CD_MTFACE); PY_MODULE_ADD_CONSTANT(m, CD_ORCO); PY_MODULE_ADD_CONSTANT(m, CD_TANGENT); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 96039b7116c..46fb0603038 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1270,8 +1270,11 @@ static void main_render_result_new(Render *re) BLI_rw_mutex_unlock(&re->resultmutex); - if (re->result->do_exr_tile) - render_result_exr_file_begin(re); + if (re->result) { + if (re->result->do_exr_tile) { + render_result_exr_file_begin(re); + } + } } static void threaded_tile_processor(Render *re) diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 2c7f3537222..919e7ceb3a4 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -138,6 +138,7 @@ void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle); void WM_paint_cursor_tag_redraw(struct wmWindow *win, struct ARegion *ar); void WM_cursor_warp (struct wmWindow *win, int x, int y); +void WM_cursor_compatible_xy(wmWindow *win, int *x, int *y); float WM_cursor_pressure (const struct wmWindow *win); /* event map */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index f81fed0021f..510df63efa0 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1804,7 +1804,13 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand const SpaceLink *sl = sa->spacedata.first; const bool was_prev_temp = (sl->next && sl->next->spacetype == SPACE_IMAGE); - ED_screen_full_prevspace(C, sa, was_prev_temp); + if (sa->full) { + ED_screen_full_prevspace(C, sa, was_prev_temp); + } + /* user may have left fullscreen */ + else { + ED_area_prevspace(C, sa); + } } wm_handler_op_context(C, handler, CTX_wm_window(C)->eventstate); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index af7e9c8ca33..8b7780bebdb 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1557,6 +1557,18 @@ void WM_cursor_warp(wmWindow *win, int x, int y) } /** + * Set x, y to values we can actually position the cursor to. + */ +void WM_cursor_compatible_xy(wmWindow *win, int *x, int *y) +{ + float f = GHOST_GetNativePixelSize(win->ghostwin); + if (f != 1.0f) { + *x = (int)(*x / f) * f; + *y = (int)(*y / f) * f; + } +} + +/** * Get the cursor pressure, in most cases you'll want to use wmTabletData from the event */ float WM_cursor_pressure(const struct wmWindow *win) diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h index f2b37ec5587..b155faf2837 100644 --- a/source/gameengine/Ketsji/KX_WorldInfo.h +++ b/source/gameengine/Ketsji/KX_WorldInfo.h @@ -36,10 +36,6 @@ #include "KX_KetsjiEngine.h" #include "EXP_PyObjectPlus.h" -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - #ifdef USE_MATHUTILS void KX_WorldInfo_Mathutils_Callback_Init(void); #endif @@ -104,10 +100,6 @@ public: static int pyattr_set_ambient_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); virtual PyObject *py_repr(void); #endif - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_WorldInfo") -#endif }; #endif /* __KX_WORLDINFO_H__ */ diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index f1ce8356e20..cedc27c3b92 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -75,6 +75,12 @@ texturewidth(-1), textureheight(-1), RAS_2DFilterManager::~RAS_2DFilterManager() { FreeTextures(); + + for (int passindex = 0; passindex < MAX_RENDER_PASS; passindex++) { + if (m_filters[passindex]) { + glDeleteObjectARB(m_filters[passindex]); + } + } } void RAS_2DFilterManager::PrintShaderErrors(unsigned int shader, const char *task, const char *code) @@ -119,11 +125,10 @@ unsigned int RAS_2DFilterManager::CreateShaderProgram(const char* shadersource) glGetObjectParameterivARB(fShader, GL_COMPILE_STATUS, &success); - if (!success) - { + if (!success) { /*Shader Comile Error*/ PrintShaderErrors(fShader, "compile", shadersource); - return 0; + goto fail; } program = glCreateProgramObjectARB(); @@ -131,23 +136,37 @@ unsigned int RAS_2DFilterManager::CreateShaderProgram(const char* shadersource) glLinkProgramARB(program); glGetObjectParameterivARB(program, GL_LINK_STATUS, &success); - if (!success) - { + if (!success) { /*Program Link Error*/ PrintShaderErrors(fShader, "link", shadersource); - return 0; + goto fail; } glValidateProgramARB(program); glGetObjectParameterivARB(program, GL_VALIDATE_STATUS, &success); - if (!success) - { + if (!success) { /*Program Validation Error*/ PrintShaderErrors(fShader, "validate", shadersource); - return 0; + goto fail; + } + + /* owned by 'program' */ + if (fShader) { + glDeleteObjectARB(fShader); } return program; + + +fail: + if (fShader) { + glDeleteObjectARB(fShader); + } + + if (program) { + glDeleteObjectARB(program); + } + return 0; } unsigned int RAS_2DFilterManager::CreateShaderProgram(int filtermode) diff --git a/source/gameengine/VideoTexture/FilterBase.h b/source/gameengine/VideoTexture/FilterBase.h index 25a6d5ff31c..498917e2375 100644 --- a/source/gameengine/VideoTexture/FilterBase.h +++ b/source/gameengine/VideoTexture/FilterBase.h @@ -116,6 +116,10 @@ protected: // otherwise return converted pixel return m_previous->m_filter->convert(src, x, y, size, pixSize); } + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("GE:FilterBase") +#endif }; |