Commit: cd540f393756b9261ba8b1b435e8316a41692a20
Author: Joshua Leung
Date:   Mon Oct 13 01:22:26 2014 +1300
Branches: GPencil_EditStrokes
https://developer.blender.org/rBcd540f393756b9261ba8b1b435e8316a41692a20

Grease Pencil Drawing: Default to storing on the scene when painting in 3D View

Grease Pencil will now draw on scene-level when drawing in the 3D view,
unless the active object has grease pencil data assigned (i.e. for files
saved in old versions).

The per-object method proved to be far too messy and confusing in practice,
as it was often all too easy to forget which object you had painted with.

While at present, the place where it stores strokes isn't able to be configured
from the UI yet, simply hooking up a Grease Pencil datablock into an Object's
Grease Pencil data slot should work (some tweaks are coming in the following 
commit
to add support for this)

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

M       source/blender/editors/gpencil/gpencil_edit.c

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

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 8811fc4..8fcfd47 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -100,14 +100,31 @@ bGPdata **ED_gpencil_data_get_pointers_direct(ID 
*screen_id, Scene *scene, ScrAr
                switch (sa->spacetype) {
                        case SPACE_VIEW3D: /* 3D-View */
                        {
-                               /* TODO: we can include other data-types such 
as bones later if need be... */
-
-                               /* just in case no active/selected object */
-                               if (ob && (ob->flag & SELECT)) {
-                                       /* for now, as long as there's an 
object, default to using that in 3D-View */
+                               /* default to using scene's data, unless it 
doesn't exist (and object's does instead) */
+                               /* XXX: this will require a toggle switch later 
to be more predictable */
+                               bool scene_ok = (scene != NULL);
+                               bool ob_ok    = ((ob) && (ob->flag & SELECT) && 
(ob->gpd));
+                               
+                               if (ob_ok || !scene_ok) {
+                                       /* Object Case (not good for users):
+                                        * - For existing files with 
object-level already, 
+                                        *   or where user has explicitly 
assigned to object,
+                                        *   we can use the object as the 
host...
+                                        *
+                                        * - If there is no scene data provided 
(rare/impossible)
+                                        *   we will also be forced to use the 
object
+                                        */
                                        if (ptr) RNA_id_pointer_create((ID 
*)ob, ptr);
                                        return &ob->gpd;
                                }
+                               else {
+                                       /* Scene Case (default):
+                                        * This is the new (as of 2014-Oct-13, 
for 2.73) default setting
+                                        * which should work better for most 
users.
+                                        */
+                                       if (ptr) RNA_id_pointer_create((ID 
*)scene, ptr);
+                                       return &scene->gpd;
+                               }
                                break;
                        }
                        case SPACE_NODE: /* Nodes Editor */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to