Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_edit.c
| Context not available. | |||||
| case SPACE_VIEW3D: /* 3D-View */ | case SPACE_VIEW3D: /* 3D-View */ | ||||
| case SPACE_TIME: /* Timeline - XXX: this is a hack to get it to show GP keyframes for 3D view */ | case SPACE_TIME: /* Timeline - XXX: this is a hack to get it to show GP keyframes for 3D view */ | ||||
| { | { | ||||
| const char gpencil_src = (scene) ? scene->toolsettings->gpencil_src : GP_TOOL_SOURCE_SCENE; | BLI_assert(scene && ELEM(scene->toolsettings->gpencil_src, | ||||
| GP_TOOL_SOURCE_SCENE, GP_TOOL_SOURCE_OBJECT)); | |||||
| if (gpencil_src == GP_TOOL_SOURCE_OBJECT) { | |||||
| if (scene->toolsettings->gpencil_src == GP_TOOL_SOURCE_OBJECT) { | |||||
| /* legacy behaviour for usage with old addons requiring object-linked to objects */ | /* legacy behaviour for usage with old addons requiring object-linked to objects */ | ||||
| /* just in case no active/selected object... */ | /* just in case no active/selected object... */ | ||||
| Context not available. | |||||
| return &ob->gpd; | return &ob->gpd; | ||||
| } | } | ||||
| /* else: defaults to scene... */ | /* else: defaults to scene... */ | ||||
| } | } | ||||
| else { | else { | ||||
| /* prefer to use scene's data, unless it doesn't exist (and object's does instead) */ | if (ptr) RNA_id_pointer_create(&scene->id, ptr); | ||||
| bool scene_ok = (scene != NULL); | return &scene->gpd; | ||||
| 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; | break; | ||||
| } | } | ||||
| Context not available. | |||||