[Bf-blender-cvs] [f46e9144483] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Antonio Vazquez
noreply at git.blender.org
Sat May 19 13:25:05 CEST 2018
Commit: f46e9144483d2f100e1c117328d00edc3d5cd459
Author: Antonio Vazquez
Date: Sat May 19 13:05:23 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBf46e9144483d2f100e1c117328d00edc3d5cd459
Merge branch 'blender2.8' into greasepencil-object
Conflicts:
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/library_query.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/versioning_280.c
source/blender/collada/SceneExporter.cpp
source/blender/editors/gpencil/gpencil_convert.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_relations.c
source/blender/editors/space_outliner/outliner_draw.c
source/blender/editors/space_outliner/outliner_select.c
===================================================================
===================================================================
diff --cc source/blender/blenkernel/CMakeLists.txt
index 485d5487e01,867b5884114..a3de1998d6e
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@@ -114,8 -114,6 +114,7 @@@ set(SR
intern/font.c
intern/freestyle.c
intern/gpencil.c
+ intern/gpencil_modifier.c
- intern/group.c
intern/icons.c
intern/icons_rasterize.c
intern/idcode.c
diff --cc source/blender/blenkernel/intern/library_query.c
index 9b1332b1d70,dbfe619153d..12cb704f03b
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@@ -407,13 -416,14 +416,13 @@@ void BKE_library_foreach_ID_link(Main *
SEQ_END
}
- FOREACH_SCENE_COLLECTION_BEGIN(scene, sc)
- {
- for (LinkData *link = sc->objects.first; link; link = link->next) {
- CALLBACK_INVOKE_ID(link->data, IDWALK_CB_USER);
- }
- CALLBACK_INVOKE(scene->gpd, IDWALK_CB_USER);
+
+ for (CollectionObject *cob = scene->master_collection->gobject.first; cob; cob = cob->next) {
+ CALLBACK_INVOKE(cob->ob, IDWALK_CB_USER);
+ }
+ for (CollectionChild *child = scene->master_collection->children.first; child; child = child->next) {
+ CALLBACK_INVOKE(child->collection, IDWALK_CB_USER);
}
- FOREACH_SCENE_COLLECTION_END;
ViewLayer *view_layer;
for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
diff --cc source/blender/blenloader/intern/readfile.c
index 90b5fcfabfc,35b699f29b8..13c10062d58
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -129,8 -130,6 +130,7 @@@
#include "BKE_effect.h"
#include "BKE_fcurve.h"
#include "BKE_global.h" // for G
+#include "BKE_gpencil.h"
- #include "BKE_group.h"
#include "BKE_layer.h"
#include "BKE_library.h" // for which_libbase
#include "BKE_library_idmap.h"
@@@ -259,11 -258,10 +259,12 @@@ static void *read_struct(FileData *fd,
static void direct_link_modifiers(FileData *fd, ListBase *lb);
static BHead *find_bhead_from_code_name(FileData *fd, const short idcode, const char *name);
static BHead *find_bhead_from_idname(FileData *fd, const char *idname);
+
+ #ifdef USE_COLLECTION_COMPAT_28
static void expand_scene_collection(FileData *fd, Main *mainvar, SceneCollection *sc);
- static SceneCollection *get_scene_collection_active_or_create(
- struct Scene *scene, struct ViewLayer *view_layer, const int flag);
+ #endif
+static void direct_link_animdata(FileData *fd, AnimData *adt);
+static void lib_link_animdata(FileData *fd, ID *id, AnimData *adt);
/* this function ensures that reports are printed,
* in the case of libraray linking errors this is important!
diff --cc source/blender/blenloader/intern/versioning_280.c
index 06c67824e20,43302408dc4..889dfd87cb8
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -59,9 -58,7 +59,8 @@@
#include "BKE_collection.h"
#include "BKE_constraint.h"
#include "BKE_customdata.h"
+#include "BKE_colortools.h"
#include "BKE_freestyle.h"
- #include "BKE_group.h"
#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_main.h"
@@@ -694,106 -844,17 +850,100 @@@ void do_versions_after_linking_280(Mai
}
}
+ /* Grease Pencil Object */
+ /* Convert grease pencil datablock to GP object */
+#if 0 /* XXX: Needs review - maybe we don't want to do this, as annotations could cause havok on cycles files! */
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ if (scene->gpd) {
+ Object *ob;
+ ViewLayer *view_layer = scene->view_layers.first; /* Weak, but at least it goes somewhere... */
+ if (view_layer == NULL) {
+ view_layer = BKE_view_layer_add(scene, "Viewport");
+ printf("added scene layer again - %p\n", view_layer);
+ }
+
+ ob = BKE_object_add_for_data(main, scene, view_layer, OB_GPENCIL, "GP_Scene", &scene->gpd->id, false);
+ zero_v3(ob->loc);
+
+ /* convert grease pencil palettes (version >= 2.78) to materials and weights */
+ bGPdata *gpd = scene->gpd;
+ for (const bGPDpalette *palette = gpd->palettes.first; palette; palette = palette->next) {
+ for (bGPDpalettecolor *palcolor = palette->colors.first; palcolor; palcolor = palcolor->next) {
+
+ /* create material slot */
+ BKE_object_material_slot_add(ob);
+ Material *ma = BKE_material_add_gpencil(main, palcolor->info);
+ assign_material(ob, ma, ob->totcol, BKE_MAT_ASSIGN_EXISTING);
+
+ /* copy color settings */
+ MaterialGPencilStyle *gp_style = ma->gp_style;
+ copy_v4_v4(gp_style->rgb, palcolor->color);
+ copy_v4_v4(gp_style->fill, palcolor->fill);
+ gp_style->flag = palcolor->flag;
+
+ /* fix strokes */
+ 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) {
+ if (STREQ(gps->colorname, palcolor->info)) {
+ gps->mat_nr = ob->totcol - 1;
+ }
+ /* create weights array */
+ gps->dvert = MEM_callocN(sizeof(gps->dvert) * gps->totpoints, "gp_stroke_weights");
+ }
+ }
+ }
+ }
+ }
+
+ /* set cache as dirty */
+ BKE_gpencil_batch_cache_dirty(ob->data);
+
+ scene->gpd = NULL;
+ }
+ }
+
+ /* Handle object-linked grease pencil datablocks */
+ for (Object *ob = main->object.first; ob; ob = ob->id.next) {
+ if (ob->gpd) {
+ if (ob->type == OB_GPENCIL) {
+ /* GP Object - remap the links */
+ ob->data = ob->gpd;
+ ob->gpd = NULL;
+ }
+ else if (ob->type == OB_EMPTY) {
+ /* Empty with GP data - This should be able to be converted
+ * to a GP object with little data loss
+ */
+ ob->data = ob->gpd;
+ ob->gpd = NULL;
+ ob->type = OB_GPENCIL;
+ }
+ else {
+ /* FIXME: What to do in this case?
+ *
+ * We cannot create new objects for these, as we don't have a scene & scene layer
+ * to put them into from here...
+ */
+ printf("WARNING: Old Grease Pencil data ('%s') still exists on Object '%s'\n",
+ ob->gpd->id.name + 2, ob->id.name + 2);
+ }
+ }
+ }
+#endif
+}
+
- static void do_version_view_layer_visibility(ViewLayer *view_layer)
- {
- LayerCollection *layer_collection;
- for (layer_collection = view_layer->layer_collections.first;
- layer_collection;
- layer_collection = layer_collection->next)
- {
- if (layer_collection->flag & COLLECTION_DISABLED) {
- BKE_collection_enable(view_layer, layer_collection);
- layer_collection->flag &= ~COLLECTION_DISABLED;
+ #ifdef USE_COLLECTION_COMPAT_28
+ if (use_collection_compat_28 && !MAIN_VERSION_ATLEAST(main, 280, 14)) {
+ for (Collection *group = main->collection.first; group; group = group->id.next) {
+ do_version_group_collection_to_collection(main, group);
}
- if ((layer_collection->flag & (1 << 0)) == 0) { /* !COLLECTION_VISIBLE */
- layer_collection->flag |= COLLECTION_DISABLED;
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ do_version_scene_collection_to_collection(main, scene);
}
- layer_collection->flag |= COLLECTION_VIEWPORT | COLLECTION_RENDER;
}
+ #endif
}
void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
@@@ -937,72 -995,11 +1084,73 @@@
}
}
}
-
+ #endif
++
+ {
+ /* Grease pencil sculpt and paint cursors */
+ if (!DNA_struct_elem_find(fd->filesdna, "GP_BrushEdit_Settings", "int", "weighttype")) {
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ /* sculpt brushes */
+ GP_BrushEdit_Settings *gset = &scene->toolsettings->gp_sculpt;
+ if (gset) {
+ gset->alpha = 1.0f;
+ gset->weighttype = GP_EDITBRUSH_TYPE_WEIGHT;
+ }
+ }
+ }
+
+ {
+ float curcolor_add[3], curcolor_sub[3];
+ ARRAY_SET_ITEMS(curcolor_add, 1.0f, 0.6f, 0.6f);
+ ARRAY_SET_ITEMS(curcolor_sub, 0.6f, 0.6f, 1.0f);
+ GP_EditBrush_Data *gp_brush;
+
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ ToolSettings *ts = scene->toolsettings;
+ /* sculpt brushes */
+ GP_BrushEdit_Settings *gset = &ts->gp_sculpt;
+ for (int i = 0; i < TOT_GP_EDITBRUSH_TYPES; ++i) {
+ gp_brush = &gset->brush[i];
+ gp_brush->flag |= GP_EDITBRUSH_FLAG_ENABLE_CURSOR;
+ copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
+ copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
+ }
+ }
+ }
+
+ /* Init grease pencil edit line color */
+ if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "float", "line_color[4]")) {
+ for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
+ ARRAY_SET_ITEMS(gpd->line_color, 0.6f, 0.6f, 0.6f, 0.5f);
+ }
+ }
+
+ /* Init grease pencil pixel size factor */
+ if (!DNA_struct_elem_find(fd->filesdna, "bGPDdata", "int", "pixfactor")) {
+ for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
+ gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
+ }
+ }
+
+ /* Grease pencil multiframe falloff curve */
+ if (!DNA_struct_elem_find(fd->filesdna, "GP_BrushEdit_Settings", "CurveMapping", "cur_falloff")) {
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ /* sculpt brushes */
+ GP_BrushEdit_Settings *gset = &scene->toolsettings->gp_sculpt;
+ if ((gset) && (gset->cur_falloff == NULL)) {
+ gset->cur_falloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
+ curvemapping_initialize(gset->cur_falloff);
+ curvemap_reset(gset->cur_falloff->cm,
+ &gset->cur_falloff->clipr,
+ CURVE_PRESET_GAUSS,
+ CURVEMAP_SLOPE_POSITIVE);
+ }
+ }
+ }
+ }
}
-#ifdef USE_COLLECTION_COMPAT_28
- if (use_collection_compat_28 && !MAIN_VERSION_ATLEAST(main, 280, 3)) {
+ if (!MAIN_VERSION_ATLEAST(main, 280, 3)) {
for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
ViewLayer *view_layer;
for (view_layer = scene->view_layer
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list