[Bf-blender-cvs] [6f213c32e85] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Antonio Vazquez
noreply at git.blender.org
Sat Dec 2 11:28:27 CET 2017
Commit: 6f213c32e85e262ffa0f4fb5253196fe12978e7a
Author: Antonio Vazquez
Date: Sat Dec 2 11:28:07 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB6f213c32e85e262ffa0f4fb5253196fe12978e7a
Merge branch 'blender2.8' into greasepencil-object
Conflicts:
source/blender/blenloader/intern/versioning_280.c
===================================================================
===================================================================
diff --cc source/blender/blenloader/intern/readfile.c
index b4c77eba191,e6d2be02977..281ff5bc509
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -254,9 -253,8 +254,10 @@@ 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);
+ 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 short flag);
+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 3be663ae31a,f500e64d3f9..c0078db3eb0
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -53,8 -52,8 +54,9 @@@
#include "BKE_collection.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"
@@@ -548,75 -549,60 +555,129 @@@ void do_versions_after_linking_280(Mai
}
}
+ {
+ for (WorkSpace *workspace = main->workspaces.first; workspace; workspace = workspace->id.next) {
+ if (workspace->view_layer) {
+ /* During 2.8 work we temporarly stored view-layer in the
+ * workspace directly, but should be stored there per-scene. */
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ if (BLI_findindex(&scene->view_layers, workspace->view_layer) > -1) {
+ BKE_workspace_view_layer_set(workspace, workspace->view_layer, scene);
+ workspace->view_layer = NULL;
+ }
+ }
+ }
+ BLI_assert(workspace->view_layer == NULL);
+ }
+ }
+
+ {
+ /* Since we don't have access to FileData we check the (always valid) master collection of the group. */
+ for (Group *group = main->group.first; group; group = group->id.next) {
+ if (group->collection == NULL) {
+ BKE_group_init(group);
+ SceneCollection *sc = GROUP_MASTER_COLLECTION(group);
+ SceneCollection *sc_hidden = NULL;
+
+ for (GroupObject *go = group->gobject.first; go; go = go->next) {
+ if (go->ob->lay & group->layer){
+ BKE_collection_object_add(&group->id, sc, go->ob);
+ }
+ else {
+ if (sc_hidden == NULL) {
+ sc_hidden = BKE_collection_add(&group->id, sc, COLLECTION_TYPE_GROUP_INTERNAL, "Hidden");
+ }
+ BKE_collection_object_add(&group->id, sc_hidden, go->ob);
+ }
+ }
+
+ if (sc_hidden != NULL) {
+ LayerCollection *layer_collection_master, *layer_collection_hidden;
+
+ layer_collection_master = group->view_layer->layer_collections.first;
+ layer_collection_hidden = layer_collection_master->layer_collections.first;
+
+ layer_collection_hidden->flag &= ~COLLECTION_VISIBLE;
+ }
+ }
+
+ GroupObject *go;
+ while ((go = BLI_pophead(&group->gobject))) {
+ MEM_freeN(go);
+ }
+ }
+ }
+ }
+
+ /* Grease Pencil Object */
+ if (!MAIN_VERSION_ATLEAST(main, 280, 2)) {
+ /* Convert grease pencil datablock to GP object */
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ if (scene->gpd) {
+ Object *ob;
+ ViewLayer *view_layer = BKE_view_layer_from_scene_get(scene);
+ 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);
+ scene->gpd = NULL;
+
+ /* set cache as dirty */
+ BKE_gpencil_batch_cache_dirty(ob->data);
+ }
+ }
+ /* init grease pencil grids and paper */
+ 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;
+ v3d->gpencil_grid_size[0] = GP_DEFAULT_GRID_SIZE;
+ v3d->gpencil_grid_size[1] = GP_DEFAULT_GRID_SIZE;
+ ARRAY_SET_ITEMS(v3d->gpencil_paper_color, 1.0f, 1.0f, 1.0f, 0.7f);
+ }
+ }
+ }
+ }
+
+ }
+
+ /* XXX: Merge back into previous case... leaving like this so the Hero animatic/production files so far don't break */
+ if (!MAIN_VERSION_ATLEAST(main, 280, 3)) {
+ /* 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);
+ }
+ }
+ }
+
+ }
+}
+
static void do_version_layer_collections_idproperties(ListBase *lb)
{
IDPropertyTemplate val = {0};
diff --cc source/blender/collada/SceneExporter.cpp
index 8915e051023,c375c09d869..1fad026ce74
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@@ -177,14 -176,15 +178,15 @@@ void SceneExporter::writeNodes(const Ev
}
// empty object
- else if (ob->type == OB_EMPTY) { // TODO: handle groups (OB_DUPLIGROUP
+ else if ((ob->type == OB_EMPTY) || (ob->type == OB_GPENCIL)) { // TODO: handle groups (OB_DUPLIGROUP
if ((ob->transflag & OB_DUPLIGROUP) == OB_DUPLIGROUP && ob->dup_group) {
- GroupObject *go = NULL;
- Group *gr = ob->dup_group;
- /* printf("group detected '%s'\n", gr->id.name + 2); */
- for (go = (GroupObject *)(gr->gobject.first); go; go = go->next) {
- printf("\t%s\n", go->ob->id.name);
+ Group *group = ob->dup_group;
+ /* printf("group detected '%s'\n", group->id.name + 2); */
+ FOREACH_GROUP_OBJECT(group, object)
+ {
+ printf("\t%s\n", object->id.name);
}
+ FOREACH_GROUP_OBJECT_END
}
}
More information about the Bf-blender-cvs
mailing list