diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2016-10-13 19:42:54 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2016-10-13 19:42:54 +0300 |
commit | dfa5b32c8cc4f9df7da660754eae773f5df102e6 (patch) | |
tree | 73e32bbc235b36a991f722d589c00462fb7eee8b /source | |
parent | ecbedce81eb45e013ff03af64be9bc71c896e85b (diff) | |
parent | 625b504b23beb11e8a02408e7474e38fa525e8ee (diff) |
Merge remote-tracking branch 'origin/master' into blender2.8
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 37 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 28 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 4 | ||||
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/fsmenu.c | 8 | ||||
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_gpencil.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_smoke.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 12 | ||||
-rw-r--r-- | source/blender/nodes/shader/node_shader_tree.c | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 6 |
16 files changed, 102 insertions, 48 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index efffc90e96c..29e84336526 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -105,6 +105,7 @@ struct Object *BKE_object_lod_matob_get(struct Object *ob, struct Scene *scene); struct Object *BKE_object_copy_ex(struct Main *bmain, struct Object *ob, bool copy_caches); struct Object *BKE_object_copy(struct Main *bmain, struct Object *ob); void BKE_object_make_local(struct Main *bmain, struct Object *ob, const bool lib_local); +void BKE_object_make_local_ex(struct Main *bmain, struct Object *ob, const bool lib_local, const bool clear_proxy); bool BKE_object_is_libdata(struct Object *ob); bool BKE_object_obdata_is_libdata(struct Object *ob); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 8168817491f..f75b3c0df85 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -3675,15 +3675,15 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs, * We do it based on the specified name. */ if (gattribs->layer[b].name[0]) { - layer = CustomData_get_named_layer_index(&dm->loopData, CD_TANGENT, gattribs->layer[b].name); - type = CD_TANGENT; + layer = CustomData_get_named_layer_index(ldata, CD_MLOOPUV, gattribs->layer[b].name); + type = CD_MTFACE; if (layer == -1) { layer = CustomData_get_named_layer_index(ldata, CD_MLOOPCOL, gattribs->layer[b].name); type = CD_MCOL; } if (layer == -1) { - layer = CustomData_get_named_layer_index(ldata, CD_MLOOPUV, gattribs->layer[b].name); - type = CD_MTFACE; + layer = CustomData_get_named_layer_index(&dm->loopData, CD_TANGENT, gattribs->layer[b].name); + type = CD_TANGENT; } if (layer == -1) { continue; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index e917c79a92f..28177e0b488 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1575,15 +1575,6 @@ void id_clear_lib_data_ex(Main *bmain, ID *id, const bool id_in_mainlist) if ((key = BKE_key_from_id(id))) { id_clear_lib_data_ex(bmain, &key->id, id_in_mainlist); /* sigh, why are keys in Main? */ } - - if (GS(id->name) == ID_OB) { - Object *object = (Object *)id; - if (object->proxy_from != NULL) { - object->proxy_from->proxy = NULL; - object->proxy_from->proxy_group = NULL; - } - object->proxy = object->proxy_from = object->proxy_group = NULL; - } } void id_clear_lib_data(Main *bmain, ID *id) @@ -1658,7 +1649,15 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged if (lib == NULL || id->lib == lib) { if (id->lib) { /* In this specific case, we do want to make ID local even if it has no local usage yet... */ - id_make_local(bmain, id, false, true); + if (GS(id->name) == ID_OB) { + /* Special case for objects because we don't want proxy pointers to be + * cleared yet. This will happen down the road in this function. + */ + BKE_object_make_local_ex(bmain, (Object*)id, true, false); + } + else { + id_make_local(bmain, id, false, true); + } } else { id->tag &= ~(LIB_TAG_EXTERN | LIB_TAG_INDIRECT | LIB_TAG_NEW); @@ -1697,12 +1696,10 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged if (id->newid) { bool is_local = false, is_lib = false; - BKE_library_ID_test_usages(bmain, id, &is_local, &is_lib); - - /* Attempt to re-link appended proxy objects. This allows appending of an entire scene + /* Attempt to re-link copied proxy objects. This allows appending of an entire scene * from another blend file into this one, even when that blend file contains proxified - * armatures. Since the proxified object needs to be linked (not local), this will - * only work when the "Localize all" checkbox is disabled. + * armatures that have local references. Since the proxified object needs to be linked + * (not local), this will only work when the "Localize all" checkbox is disabled. * TL;DR: this is a dirty hack on top of an already weak feature (proxies). */ if (GS(id->name) == ID_OB && ((Object *)id)->proxy != NULL) { Object *ob = (Object *)id; @@ -1722,12 +1719,18 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged id->newid->name, ob->proxy->id.name, is_local, is_lib); } else { - /* we can switch the proxy'ing from the linked-in to the made-local proxy. */ - BKE_object_make_proxy(ob_new, ob->proxy, ob->proxy_group); + /* we can switch the proxy'ing from the linked-in to the made-local proxy. + * BKE_object_make_proxy() shouldn't be used here, as it allocates memory that + * was already allocated by BKE_object_make_local_ex() (which called BKE_object_copy_ex). */ + ob_new->proxy = ob->proxy; + ob_new->proxy_group = ob->proxy_group; + ob_new->proxy_from = ob->proxy_from; + ob_new->proxy->proxy_from = ob_new; ob->proxy = ob->proxy_from = ob->proxy_group = NULL; } } + BKE_library_ID_test_usages(bmain, id, &is_local, &is_lib); if (!is_local && !is_lib) { BKE_libblock_free(bmain, id); do_loop = true; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 85322408099..f7257b2b0dd 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1018,7 +1018,7 @@ Object *BKE_object_copy(Main *bmain, Object *ob) return BKE_object_copy_ex(bmain, ob, false); } -void BKE_object_make_local(Main *bmain, Object *ob, const bool lib_local) +void BKE_object_make_local_ex(Main *bmain, Object *ob, const bool lib_local, const bool clear_proxy) { bool is_local = false, is_lib = false; @@ -1038,6 +1038,13 @@ void BKE_object_make_local(Main *bmain, Object *ob, const bool lib_local) if (!is_lib) { id_clear_lib_data(bmain, &ob->id); BKE_id_expand_local(&ob->id); + if (clear_proxy) { + if (ob->proxy_from != NULL) { + ob->proxy_from->proxy = NULL; + ob->proxy_from->proxy_group = NULL; + } + ob->proxy = ob->proxy_from = ob->proxy_group = NULL; + } } else { Object *ob_new = BKE_object_copy(bmain, ob); @@ -1052,6 +1059,11 @@ void BKE_object_make_local(Main *bmain, Object *ob, const bool lib_local) } } +void BKE_object_make_local(Main *bmain, Object *ob, const bool lib_local) +{ + BKE_object_make_local_ex(bmain, ob, lib_local, true); +} + /* Returns true if the Object is from an external blend file (libdata) */ bool BKE_object_is_libdata(Object *ob) { diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index aca0c833aea..125d6962332 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -886,7 +886,7 @@ Scene *BKE_scene_set_name(Main *bmain, const char *name) Scene *sce = (Scene *)BKE_libblock_find_name_ex(bmain, ID_SCE, name); if (sce) { BKE_scene_set_background(bmain, sce); - printf("Scene switch: '%s' in file: '%s'\n", name, bmain->name); + printf("Scene switch for render: '%s' in file: '%s'\n", name, bmain->name); return sce; } diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index f8b98ebb8b7..33e44d73894 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -350,6 +350,10 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo } offset = -min_coord - range / 2.0f; } + else if (max_coord == min_coord) { + factor = 1.0f; + offset = -min_coord; + } } BLI_assert(factor != 0.0f); if (r_offset) { diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 976b5ed1193..875522e01c6 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -184,11 +184,8 @@ static const char *ui_item_name_add_colon(const char *name, char namestr[UI_MAX_ return name; } -static int ui_item_fit(int item, int pos, int all, int available, bool is_last, int alignment, int *offset) +static int ui_item_fit(int item, int pos, int all, int available, bool is_last, int alignment) { - if (offset) - *offset = 0; - /* available == 0 is unlimited */ if (available == 0) return item; @@ -2110,7 +2107,7 @@ static void ui_litem_layout_row(uiLayout *litem) minw = ui_litem_min_width(itemw); if (w - lastw > 0) - neww = ui_item_fit(itemw, x, totw, w - lastw, !item->next, litem->alignment, NULL); + neww = ui_item_fit(itemw, x, totw, w - lastw, !item->next, litem->alignment); else neww = 0; /* no space left, all will need clamping to minimum size */ @@ -2144,12 +2141,12 @@ static void ui_litem_layout_row(uiLayout *litem) if (item->flag) { /* fixed minimum size items */ - itemw = ui_item_fit(minw, fixedx, fixedw, min_ii(w, fixedw), !item->next, litem->alignment, NULL); + itemw = ui_item_fit(minw, fixedx, fixedw, min_ii(w, fixedw), !item->next, litem->alignment); fixedx += itemw; } else { /* free size item */ - itemw = ui_item_fit(itemw, freex, freew, w - fixedw, !item->next, litem->alignment, NULL); + itemw = ui_item_fit(itemw, freex, freew, w - fixedw, !item->next, litem->alignment); freex += itemw; } @@ -2469,7 +2466,7 @@ static void ui_litem_layout_column_flow(uiLayout *litem) uiLayoutItemFlow *flow = (uiLayoutItemFlow *)litem; uiItem *item; int col, x, y, w, emh, emy, miny, itemw, itemh; - int toth, totitem, offset; + int toth, totitem; /* compute max needed width and total height */ toth = 0; @@ -2491,22 +2488,27 @@ static void ui_litem_layout_column_flow(uiLayout *litem) /* create column per column */ col = 0; + w = (litem->w - (flow->totcol - 1) * style->columnspace) / flow->totcol; for (item = litem->items.first; item; item = item->next) { - ui_item_size(item, NULL, &itemh); - itemw = ui_item_fit(1, x - litem->x, flow->totcol, w, col == flow->totcol - 1, litem->alignment, &offset); - + ui_item_size(item, &itemw, &itemh); + + itemw = (litem->alignment == UI_LAYOUT_ALIGN_EXPAND) ? w : min_ii(w, itemw); + y -= itemh; emy -= itemh; - ui_item_position(item, x + offset, y, itemw, itemh); + ui_item_position(item, x, y, itemw, itemh); y -= style->buttonspacey; miny = min_ii(miny, y); /* decide to go to next one */ if (col < flow->totcol - 1 && emy <= -emh) { - x += itemw + style->columnspace; + x += w + style->columnspace; y = litem->y; emy = 0; /* need to reset height again for next column */ col++; + + /* (< remaining width > - < space between remaining columns >) / <remamining columns > */ + w = ((litem->w - (x - litem->x)) - (flow->totcol - col - 1) * style->columnspace) / (flow->totcol - col); } } diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 233406333f2..9d9cae6f347 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -2767,6 +2767,10 @@ void init_userdef_do_versions(void) for (btheme = U.themes.first; btheme; btheme = btheme->next) { rgba_char_args_set(btheme->tv3d.vertex_bevel, 0, 165, 255, 255); rgba_char_args_set(btheme->tv3d.edge_bevel, 0, 165, 255, 255); + + /* 3dView Keyframe Indicators */ + btheme->tv3d.time_keyframe[3] = 0xFF; + btheme->tv3d.time_gp_keyframe[3] = 0xFF; } } diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 6f3694d1db8..0716c062ab9 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -442,7 +442,7 @@ static void add_gpencil_renderpass(OGLRender *oglrender, RenderResult *rr, Rende if (BLI_listbase_is_empty(&gpd->layers)) { return; } - if ((oglrender->v3d->flag2 & V3D_SHOW_GPENCIL) == 0) { + if (oglrender->v3d != NULL && (oglrender->v3d->flag2 & V3D_SHOW_GPENCIL) == 0) { return; } diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 72034b4f828..631ff06a77a 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -518,14 +518,18 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) CFURLEnumeratorRef volEnum = CFURLEnumeratorCreateForMountedVolumes(NULL, kCFURLEnumeratorSkipInvisibles, NULL); while (result != kCFURLEnumeratorEnd) { - unsigned char defPath[FILE_MAX]; + char defPath[FILE_MAX]; result = CFURLEnumeratorGetNextURL(volEnum, &cfURL, NULL); if (result != kCFURLEnumeratorSuccess) continue; CFURLGetFileSystemRepresentation(cfURL, false, (UInt8 *)defPath, FILE_MAX); - fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)defPath, NULL, FS_INSERT_SORTED); + + /* Add end slash for consistency with other platforms */ + BLI_add_slash(defPath); + + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, defPath, NULL, FS_INSERT_SORTED); } CFRelease(volEnum); diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index d378ca9a78c..a40b257b75b 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -522,9 +522,9 @@ static int startffmpeg(struct anim *anim) anim->duration = pFormatCtx->streams[videoStream]->nb_frames; } else { - anim->duration = ceil(pFormatCtx->duration * - av_q2d(frame_rate) / - AV_TIME_BASE); + anim->duration = (int)(pFormatCtx->duration * + av_q2d(frame_rate) / + AV_TIME_BASE + 0.5f); } frs_num = frame_rate.num; diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 9b881c13347..7ba89538b18 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -783,6 +783,16 @@ static void rna_GPencilPalette_info_set(PointerRNA *ptr, const char *value) sizeof(palette->info)); } +static char *rna_GPencilPalette_path(PointerRNA *ptr) +{ + bGPDpalette *palette = ptr->data; + char name_esc[sizeof(palette->info) * 2]; + + BLI_strescape(name_esc, palette->info, sizeof(name_esc)); + + return BLI_sprintfN("palettes[\"%s\"]", name_esc); +} + static char *rna_GPencilPalette_color_path(PointerRNA *ptr) { bGPdata *gpd = ptr->id.data; @@ -1510,6 +1520,7 @@ static void rna_def_gpencil_palette(BlenderRNA *brna) srna = RNA_def_struct(brna, "GPencilPalette", NULL); RNA_def_struct_sdna(srna, "bGPDpalette"); RNA_def_struct_ui_text(srna, "Grease Pencil Palette", "Collection of related palettes"); + RNA_def_struct_path_func(srna, "rna_GPencilPalette_path"); RNA_def_struct_ui_icon(srna, ICON_COLOR); /* Name */ diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index b0be30ac355..6baf2f3631d 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -729,7 +729,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "draw_velocity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw_velocity", 0); - RNA_def_property_ui_text(prop, "Draw Velocity", "Toggle visualation of the velocity field as needles"); + RNA_def_property_ui_text(prop, "Draw Velocity", "Toggle visualization of the velocity field as needles"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); prop = RNA_def_property(srna, "vector_draw_type", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 9eaff19770a..04b8942ecb9 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -520,6 +520,13 @@ static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values) v3d->lay = ED_view3d_scene_layer_set(v3d->lay, values, &v3d->layact); } +static int rna_SpaceView3D_active_layer_get(PointerRNA *ptr) +{ + View3D *v3d = (View3D *)(ptr->data); + + return (int)(log(v3d->layact) / M_LN2); +} + static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { DAG_on_visible_update(bmain, false); @@ -2637,6 +2644,11 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible in this 3D View"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_layer_update"); + prop = RNA_def_property(srna, "active_layer", PROP_INT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); + RNA_def_property_int_funcs(prop, "rna_SpaceView3D_active_layer_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Active Layer", "Active 3D view layer index"); + prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000); RNA_def_property_array(prop, 8); diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 8523b7275bf..40d1cfdfcb0 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -327,7 +327,8 @@ static void ntree_shader_link_builtin_group_normal( /* Need to update tree so all node instances nodes gets proper sockets. */ bNode *group_input_node = ntreeFindType(group_ntree, NODE_GROUP_INPUT); node_group_verify(ntree, group_node, &group_ntree->id); - node_group_input_verify(group_ntree, group_input_node, &group_ntree->id); + if (group_input_node) + node_group_input_verify(group_ntree, group_input_node, &group_ntree->id); ntreeUpdateTree(G.main, group_ntree); /* Assumes sockets are always added at the end. */ bNodeSocket *group_node_normal_socket = group_node->inputs.last; @@ -370,7 +371,7 @@ static void ntree_shader_link_builtin_group_normal( group_displacement_socket); ntreeUpdateTree(G.main, group_ntree); } - else { + else if (group_input_node) { /* Connect group node normal input. */ nodeAddLink(ntree, node_from, socket_from, diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 33f12927f2b..a132d323a8c 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2875,8 +2875,8 @@ void WM_OT_straightline_gesture(wmOperatorType *ot) /* *********************** radial control ****************** */ -#define WM_RADIAL_CONTROL_DISPLAY_SIZE (200) -#define WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE (35) +#define WM_RADIAL_CONTROL_DISPLAY_SIZE (200 * UI_DPI_FAC) +#define WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE (35 * UI_DPI_FAC) #define WM_RADIAL_CONTROL_DISPLAY_WIDTH (WM_RADIAL_CONTROL_DISPLAY_SIZE - WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE) #define WM_RADIAL_MAX_STR 10 @@ -3153,7 +3153,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd if (rmin > 0.0f) glutil_draw_lined_arc(0.0, (float)(M_PI * 2.0), rmin, 40); - BLF_size(fontid, 1.5 * fstyle_points, 1.0f / U.dpi); + BLF_size(fontid, 1.5 * fstyle_points * U.pixelsize, U.dpi); BLF_enable(fontid, BLF_SHADOW); BLF_shadow(fontid, 3, (const float[4]){0.0f, 0.0f, 0.0f, 0.5f}); BLF_shadow_offset(fontid, 1, -1); |