[Bf-blender-cvs] [b628990ae8e] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Antonio Vazquez
noreply at git.blender.org
Fri Jun 2 13:27:04 CEST 2017
Commit: b628990ae8eddc7f78918fa66679653349169f2c
Author: Antonio Vazquez
Date: Fri Jun 2 10:08:27 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBb628990ae8eddc7f78918fa66679653349169f2c
Merge branch 'blender2.8' into greasepencil-object
===================================================================
===================================================================
diff --cc release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index b2f24109afc,52835a00796..fd4976c6390
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@@ -926,13 -884,9 +926,13 @@@ class GreasePencilDataPanel
# Owner Selector
if context.space_data.type == 'VIEW_3D':
- layout.prop(context.tool_settings, "grease_pencil_source", expand=True)
+ layout.row().prop(context.tool_settings, "grease_pencil_source", expand=True)
elif context.space_data.type == 'CLIP_EDITOR':
- layout.prop(context.space_data, "grease_pencil_source", expand=True)
+ layout.row().prop(context.space_data, "grease_pencil_source", expand=True)
+ elif context.space_data.type == 'PROPERTIES':
+ if context.space_data.context == 'SCENE':
+ gpd_owner = context.scene
+ gpd = context.scene.grease_pencil
# Grease Pencil data selector
layout.template_ID(gpd_owner, "grease_pencil", new="gpencil.data_add", unlink="gpencil.data_unlink")
diff --cc source/blender/blenloader/intern/readfile.c
index 40863ae5b39,8e89c61d9f7..32d62701fe3
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -9846,12 -9955,15 +9984,21 @@@ static void expand_gpencil(FileData *fd
expand_animdata(fd, mainvar, gpd->adt);
}
+static void expand_palette(FileData *fd, Main *mainvar, Palette *palette)
+{
+ if (palette->adt)
+ expand_animdata(fd, mainvar, palette->adt);
+}
+
+ static void expand_workspace(FileData *fd, Main *mainvar, WorkSpace *workspace)
+ {
+ ListBase *layouts = BKE_workspace_layouts_get(workspace);
+
+ for (WorkSpaceLayout *layout = layouts->first; layout; layout = layout->next) {
+ expand_doit(fd, mainvar, BKE_workspace_layout_screen_get(layout));
+ }
+ }
+
/**
* Set the callback func used over all ID data found by \a BLO_expand_main func.
*
diff --cc source/blender/blenloader/intern/versioning_280.c
index 3cebaa78746,fa03725fa6f..b8990f18757
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -36,8 -36,8 +36,9 @@@
#include "DNA_mesh_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
+ #include "DNA_view3d_types.h"
#include "DNA_genfile.h"
+#include "DNA_gpencil_types.h"
#include "BKE_collection.h"
#include "BKE_customdata.h"
@@@ -46,11 -46,9 +47,15 @@@
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_scene.h"
++<<<<<<< HEAD
+#include "BKE_gpencil.h"
+#include "BKE_paint.h"
++=======
+ #include "BKE_workspace.h"
++>>>>>>> blender2.8
#include "BLI_listbase.h"
+#include "BLI_math.h"
#include "BLI_mempool.h"
#include "BLI_string.h"
@@@ -258,75 -348,54 +355,99 @@@ void blo_do_versions_280(FileData *fd,
}
}
}
++<<<<<<< HEAD
+ /* ------- convert grease pencil palettes to blender palettes --------------- */
+ if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "Palette", "*palette")) {
+ for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
+ /* first create all palettes and colors */
+ Palette *first = NULL;
+ for (bGPDpalette *oldpalette = gpd->palettes.first; oldpalette; oldpalette = oldpalette->next) {
+ /* create palette */
+ Palette *newpalette = BKE_palette_add(main, oldpalette->info);
+ /* save first to use later */
+ if (first == NULL) {
+ first = newpalette;
+ }
+ /* enable fake user by default */
+ id_fake_user_set(&newpalette->id);
+
+ for (bGPDpalettecolor *oldcolor = oldpalette->colors.first; oldcolor; oldcolor = oldcolor->next) {
+ PaletteColor *newcolor = BKE_palette_color_add_name(newpalette, oldcolor->info);
+ /* set color attributes */
+ copy_v4_v4(newcolor->rgb, oldcolor->color);
+ copy_v4_v4(newcolor->fill, oldcolor->fill);
+ newcolor->flag = oldcolor->flag;
+ }
+ /* set first color active by default */
+ if (!BLI_listbase_is_empty(&newpalette->colors)) {
+ newpalette->active_color = 0;
+ }
+ }
+ /* second, assign the palette and the color (always to first palette) */
+ for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+ for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
+ Palette *palette = first;
+ PaletteColor *palcolor = BKE_palette_color_getbyname(first, gps->colorname);
+
+ gps->palette = palette;
+ gps->palcolor = palcolor;
+ }
+ }
+ }
+ }
+ }
+ /* ------- end grease pencil palettes conversion --------------- */
++=======
++>>>>>>> blender2.8
}
- if (!DNA_struct_elem_find(fd->filesdna, "GPUDOFSettings", "float", "ratio")) {
- for (Camera *ca = main->camera.first; ca; ca = ca->id.next) {
- ca->gpu_dof.ratio = 1.0f;
+ if (!MAIN_VERSION_ATLEAST(main, 280, 1)) {
+ if (!DNA_struct_elem_find(fd->filesdna, "GPUDOFSettings", "float", "ratio")) {
+ for (Camera *ca = main->camera.first; ca; ca = ca->id.next) {
+ ca->gpu_dof.ratio = 1.0f;
+ }
}
- }
- if (!DNA_struct_elem_find(fd->filesdna, "SceneLayer", "IDProperty", "*properties")) {
- for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
- for (SceneLayer *sl = scene->render_layers.first; sl; sl = sl->next) {
- IDPropertyTemplate val = {0};
- sl->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
- BKE_scene_layer_engine_settings_create(sl->properties);
+ if (!DNA_struct_elem_find(fd->filesdna, "SceneLayer", "IDProperty", "*properties")) {
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ for (SceneLayer *sl = scene->render_layers.first; sl; sl = sl->next) {
+ IDPropertyTemplate val = {0};
+ sl->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
+ BKE_scene_layer_engine_settings_create(sl->properties);
+ }
+ }
+ }
+
+ /* MTexPoly now removed. */
+ if (DNA_struct_find(fd->filesdna, "MTexPoly")) {
+ const int cd_mtexpoly = 15; /* CD_MTEXPOLY, deprecated */
+ for (Mesh *me = main->mesh.first; me; me = me->id.next) {
+ /* If we have UV's, so this file will have MTexPoly layers too! */
+ if (me->mloopuv != NULL) {
+ CustomData_update_typemap(&me->pdata);
+ CustomData_free_layers(&me->pdata, cd_mtexpoly, me->totpoly);
+ BKE_mesh_update_customdata_pointers(me, false);
+ }
}
}
- }
- /* MTexPoly now removed. */
- if (DNA_struct_find(fd->filesdna, "MTexPoly")) {
- const int cd_mtexpoly = 15; /* CD_MTEXPOLY, deprecated */
- for (Mesh *me = main->mesh.first; me; me = me->id.next) {
- /* If we have UV's, so this file will have MTexPoly layers too! */
- if (me->mloopuv != NULL) {
- CustomData_update_typemap(&me->pdata);
- CustomData_free_layers(&me->pdata, cd_mtexpoly, me->totpoly);
- BKE_mesh_update_customdata_pointers(me, false);
+ if (!DNA_struct_elem_find(fd->filesdna, "View3D", "short", "custom_orientation_index")) {
+ for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
+ for (ScrArea *area = screen->areabase.first; area; area = area->next) {
+ for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ if (v3d->twmode >= V3D_MANIP_CUSTOM) {
+ v3d->custom_orientation_index = v3d->twmode - V3D_MANIP_CUSTOM;
+ v3d->twmode = V3D_MANIP_CUSTOM;
+ }
+ else {
+ v3d->custom_orientation_index = -1;
+ }
+ }
+ }
+ }
}
}
}
diff --cc source/blender/editors/space_view3d/view3d_header.c
index bbb5ca90d28,31677e08207..f379c80723e
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@@ -304,37 -299,7 +299,11 @@@ void uiTemplateHeader3D(uiLayout *layou
/* other buttons: */
UI_block_emboss_set(block, UI_EMBOSS);
-
+
+ /* mode */
+ if ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE)) {
+ modeselect = OB_MODE_GPENCIL_EDIT;
+ }
- else if (ob) {
- modeselect = ob->mode;
- is_paint = ELEM(ob->mode, OB_MODE_SCULPT, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT, OB_MODE_TEXTURE_PAINT);
- }
- else {
- modeselect = OB_MODE_OBJECT;
- }
-
- row = uiLayoutRow(layout, false);
- {
- EnumPropertyItem *item = rna_enum_object_mode_items;
- const char *name = "";
- int icon = ICON_OBJECT_DATAMODE;
-
- while (item->identifier) {
- if (item->value == modeselect && item->identifier[0]) {
- name = IFACE_(item->name);
- icon = item->icon;
- break;
- }
- item++;
- }
-
- uiItemMenuEnumO(row, C, "OBJECT_OT_mode_set", "mode", name, icon);
- }
-
row = uiLayoutRow(layout, true);
uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
if (!ob || ELEM(ob->mode, OB_MODE_OBJECT, OB_MODE_POSE, OB_MODE_WEIGHT_PAINT)) {
More information about the Bf-blender-cvs
mailing list