[Bf-blender-cvs] [c3f5c1dd20e] greasepencil-object: Cleanup: Remove "Scene->gp_object"

Joshua Leung noreply at git.blender.org
Tue Jul 3 17:48:35 CEST 2018


Commit: c3f5c1dd20eb93f9585fdcd73a63245802113a6a
Author: Joshua Leung
Date:   Wed Jul 4 02:48:24 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rBc3f5c1dd20eb93f9585fdcd73a63245802113a6a

Cleanup: Remove "Scene->gp_object"

This was from an earlier design for supporting Annotations,
where in the 3D view, we would have only had GP Objects.
Now that we've moved away from that idea, and are back to
having a separate "Annotations" system, this concept can
be removed from the code again.

===================================================================

M	release/scripts/startup/bl_ui/properties_scene.py
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_relations.c
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index d7f7bba7f20..ada0e00471b 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -76,7 +76,6 @@ class SCENE_PT_scene(SceneButtonsPanel, Panel):
         layout.prop(scene, "camera")
         layout.prop(scene, "background_set")
         layout.prop(scene, "active_clip")
-        layout.prop(scene, "gpencil_object")
 
 
 class SCENE_PT_unit(SceneButtonsPanel, Panel):
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 64a8c76470e..f68cce0ff35 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -425,10 +425,9 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
 		/* NOTE: part of SCE_COPY_LINK_DATA and SCE_COPY_FULL operations
 		 * are done outside of blenkernel with ED_object_single_users! */
 
-		/*  camera and gp_object  */
+		/*  camera   */
 		if (ELEM(type, SCE_COPY_LINK_DATA, SCE_COPY_FULL)) {
 			ID_NEW_REMAP(sce_copy->camera);
-			ID_NEW_REMAP(sce_copy->gp_object);
 		}
 
 		return sce_copy;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6dfb8e28d87..ac6afedea39 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5892,7 +5892,6 @@ static void lib_link_scene(FileData *fd, Main *main)
 			sce->world = newlibadr_us(fd, sce->id.lib, sce->world);
 			sce->set = newlibadr(fd, sce->id.lib, sce->set);
 			sce->gpd = newlibadr_us(fd, sce->id.lib, sce->gpd);
-			sce->gp_object = newlibadr(fd, sce->id.lib, sce->gp_object);
 
 			link_paint(fd, sce, &sce->toolsettings->sculpt->paint);
 			link_paint(fd, sce, &sce->toolsettings->vpaint->paint);
@@ -9804,8 +9803,6 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
 	if (sce->gpd)
 		expand_doit(fd, mainvar, sce->gpd);
 
-	expand_doit(fd, mainvar, sce->gp_object);
-
 	if (sce->ed) {
 		Sequence *seq;
 
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 875628ba732..758d3268861 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1689,37 +1689,11 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p)
 				return 0;
 			}
 
-			/* if active object doesn't exist or it's not a Grease Pencil object,
-			 * use the scene's gp_object (), or create one if it doesn't exist
-			 */
+			/* if active object doesn't exist or isn't a GP Object, create one */
 			float *cur = ED_view3d_cursor3d_get(p->scene, v3d)->location;
 			if ((!obact) || (obact->type != OB_GPENCIL)) {
-				if (p->scene->gp_object) {
-					/* use existing default */
-					/* XXX: This will still lose whatever mode we were in before,
-					 *      making GP less convenient for annotations than it used to be
-					 */
-					obact = p->scene->gp_object;
-
-					/* temporarily activate the object */
-					ViewLayer *view_layer = CTX_data_view_layer(C);
-					Base *base = BKE_view_layer_base_find(view_layer, obact);
-					if (base) {
-						if (CTX_data_edit_object(C))
-							ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR);  /* freedata, and undo */
-
-						view_layer->basact = base;
-						ED_object_base_activate(C, base);
-					}
-					else {
-						printf("ERROR: Couldn't find base for active gp_object (view_layer = %p, obact = %s)\n", view_layer, obact->id.name);
-					}
-				}
-				else {
-					/* create new default object */
-					obact = ED_add_gpencil_object(C, p->scene, cur);
-					p->scene->gp_object = obact;
-				}
+				/* create new default object */
+				obact = ED_add_gpencil_object(C, p->scene, cur);
 			}
 			/* assign object after all checks to be sure we have one active */
 			p->ob = obact;
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 362b5e82463..90058c70191 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1374,16 +1374,6 @@ static int object_delete_exec(bContext *C, wmOperator *op)
 			}
 		}
 
-		/* remove as scene default annotation object */
-		if (ob->type == OB_GPENCIL) {
-			Scene *scene_iter;
-			for (scene_iter = bmain->scene.first; scene_iter; scene_iter = scene_iter->id.next) {
-				if (scene->gp_object == ob) {
-					scene->gp_object = NULL;
-				}
-			}
-		}
-
 		/* remove from current scene only */
 		ED_object_base_free_and_unlink(bmain, scene, ob);
 		changed = true;
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 2f8d7c68ba4..304fc45a7b9 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1709,9 +1709,6 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
 	ID_NEW_REMAP(scene->camera);
 	if (v3d) ID_NEW_REMAP(v3d->camera);
 
-	/* gp_object */
-	ID_NEW_REMAP(scene->gp_object);
-
 	/* object and collection pointers */
 	libblock_relink_collection(master_collection);
 }
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 13e245d9f3e..c211d8443be 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1534,8 +1534,6 @@ typedef struct Scene {
 	uint64_t customdata_mask_modal; /* XXX. same as above but for temp operator use (gl renders) */
 
 
-	struct Object *gp_object;     /* default GP object for annotations */
-
 	/* Color Management */
 	ColorManagedViewSettings view_settings;
 	ColorManagedDisplaySettings display_settings;
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index dc9cb1f72d5..bfa90732fee 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -6239,13 +6239,6 @@ void RNA_def_scene(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Annotations", "Grease Pencil data-block used for annotations in the 3D view");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 
-	prop = RNA_def_property(srna, "gpencil_object", PROP_POINTER, PROP_NONE);
-	RNA_def_property_pointer_sdna(prop, NULL, "gp_object");
-	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_GPencil_object_poll");
-	RNA_def_property_ui_text(prop, "GPencil Object", "Grease Pencil object where scene annotations are stored by default");
-	RNA_def_property_update(prop, NC_GPENCIL | NA_EDITED, NULL);
-
 	/* active MovieClip */
 	prop = RNA_def_property(srna, "active_clip", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "clip");



More information about the Bf-blender-cvs mailing list