Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2017-02-07 12:18:38 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-02-07 13:11:00 +0300
commitaeb8e81f2741aabc95d14bce7a83cef45481959c (patch)
tree16a9a4af34f0b7cd114c66ea38625b1ca8e453e6 /source/blender/editors/space_view3d/view3d_select.c
parent97fa285ae1b9b320f04ac0ac427917abc2de180a (diff)
Render Layers and Collections (merge from render-layers)
Design Documents ---------------- * https://wiki.blender.org/index.php/Dev:2.8/Source/Layers * https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised User Commit Log --------------- * New Layer and Collection system to replace render layers and viewport layers. * A layer is a set of collections of objects (and their drawing options) required for specific tasks. * A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers. * All Scenes have a master collection that all other collections are children of. * New collection "context" tab (in Properties Editor) * New temporary viewport "collections" panel to control per-collection visibility Missing User Features --------------------- * Collection "Filter" Option to add objects based on their names * Collection Manager operators The existing buttons are placeholders * Collection Manager drawing The editor main region is empty * Collection Override * Per-Collection engine settings This will come as a separate commit, as part of the clay-engine branch Dev Commit Log -------------- * New DNA file (DNA_layer_types.h) with the new structs We are replacing Base by a new extended Base while keeping it backward compatible with some legacy settings (i.e., lay, flag_legacy). Renamed all Base to BaseLegacy to make it clear the areas of code that still need to be converted Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp * Unittesting for main syncronization requirements - read, write, add/copy/remove objects, copy scene, collection link/unlinking, context) * New Editor: Collection Manager Based on patch by Julian Eisel This is extracted from the layer-manager branch. With the following changes: - Renamed references of layer manager to collections manager - I doesn't include the editors/space_collections/ draw and util files - The drawing code itself will be implemented separately by Julian * Base / Object: A little note about them. Original Blender code would try to keep them in sync through the code, juggling flags back and forth. This will now be handled by Depsgraph, keeping Object and Bases more separated throughout the non-rendering code. Scene.base is being cleared in doversion, and the old viewport drawing code was poorly converted to use the new bases while the new viewport code doesn't get merged and replace the old one. Python API Changes ------------------ ``` - scene.layers + # no longer exists - scene.objects + scene.scene_layers.active.objects - scene.objects.active + scene.render_layers.active.objects.active - bpy.context.scene.objects.link() + bpy.context.scene_collection.objects.link() - bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None) + bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None) - bpy.context.object.select + bpy.context.object.select = True + bpy.context.object.select = False + bpy.context.object.select_get() + bpy.context.object.select_set(action='SELECT') + bpy.context.object.select_set(action='DESELECT') -AddObjectHelper.layers + # no longer exists ```
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_select.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c72
1 files changed, 45 insertions, 27 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 3239d07553f..e7c8cd340c8 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -64,11 +64,13 @@
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_depsgraph.h"
+#include "BKE_layer.h"
#include "BKE_mball.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_editmesh.h"
+#include "BKE_scene.h"
#include "BKE_tracking.h"
#include "BKE_utildefines.h"
@@ -401,7 +403,7 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, const int mcords[]
static void object_deselect_all_visible(Scene *scene, View3D *v3d)
{
- Base *base;
+ BaseLegacy *base;
for (base = scene->base.first; base; base = base->next) {
if (BASE_SELECTABLE(v3d, base)) {
@@ -413,7 +415,7 @@ static void object_deselect_all_visible(Scene *scene, View3D *v3d)
static void do_lasso_select_objects(ViewContext *vc, const int mcords[][2], const short moves,
const bool extend, const bool select)
{
- Base *base;
+ BaseLegacy *base;
if (extend == false && select)
object_deselect_all_visible(vc->scene, vc->v3d);
@@ -424,7 +426,6 @@ static void do_lasso_select_objects(ViewContext *vc, const int mcords[][2], cons
if (BLI_lasso_is_point_inside(mcords, moves, base->sx, base->sy, IS_CLIPPED)) {
ED_base_object_select(base, select ? BA_SELECT : BA_DESELECT);
- base->object->flag = base->flag;
}
}
if (vc->obact == base->object && (base->object->mode & OB_MODE_POSE)) {
@@ -1017,8 +1018,8 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
if (!toggle) {
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
- if (base->flag & SELECT) {
- ED_base_object_select(base, BA_DESELECT);
+ if ((base->flag & BASE_SELECTED) != 0) {
+ ED_object_base_select(base, BA_DESELECT);
changed = true;
}
}
@@ -1029,8 +1030,8 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
{
/* this is a bit dodjy, there should only be ONE object with this name, but library objects can mess this up */
if (STREQ(name, base->object->id.name + 2)) {
- ED_base_object_activate(C, base);
- ED_base_object_select(base, BA_SELECT);
+ ED_object_base_activate(C, base);
+ ED_object_base_select(base, BA_SELECT);
changed = true;
}
}
@@ -1074,12 +1075,12 @@ void VIEW3D_OT_select_menu(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "toggle", 0, "Toggle", "Toggle selection instead of deselecting everything first");
}
-static void deselectall_except(Scene *scene, Base *b) /* deselect all except b */
+static void deselectall_except(Scene *scene, BaseLegacy *b) /* deselect all except b */
{
- Base *base;
+ BaseLegacy *base;
for (base = FIRSTBASE; base; base = base->next) {
- if (base->flag & SELECT) {
+ if (base->flag_legacy & SELECT) {
if (b != base) {
ED_base_object_select(base, BA_DESELECT);
}
@@ -1087,12 +1088,16 @@ static void deselectall_except(Scene *scene, Base *b) /* deselect all except b
}
}
-static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], short toggle)
+static BaseLegacy *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], short toggle)
{
short baseCount = 0;
bool ok;
LinkNode *linklist = NULL;
-
+
+ /* handle base->selcol */
+ TODO_LAYER_BASE;
+#if 0
+
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
ok = false;
@@ -1164,6 +1169,19 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
BLI_linklist_free(linklist, NULL);
return NULL;
}
+#else
+
+ (void)C;
+ (void)vc,
+ (void)buffer;
+ (void)hits;
+ (void)mval;
+ (void)toggle;
+ (void)baseCount;
+ (void)ok;
+ (void)linklist;
+ return NULL;
+#endif
}
static bool selectbuffer_has_bones(const unsigned int *buffer, const unsigned int hits)
@@ -1275,12 +1293,12 @@ static short mixed_bones_object_selectbuffer(
}
/* returns basact */
-static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int hits,
- Base *startbase, bool has_bones, bool do_nearest)
+static BaseLegacy *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int hits,
+ BaseLegacy *startbase, bool has_bones, bool do_nearest)
{
Scene *scene = vc->scene;
View3D *v3d = vc->v3d;
- Base *base, *basact = NULL;
+ BaseLegacy *base, *basact = NULL;
int a;
if (do_nearest) {
@@ -1299,7 +1317,7 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
}
else {
/* only exclude active object when it is selected... */
- if (BASACT && (BASACT->flag & SELECT) && hits > 1) notcol = BASACT->selcol;
+ if (BASACT && (BASACT->flag_legacy & SELECT) && hits > 1) notcol = BASACT->selcol;
for (a = 0; a < hits; a++) {
if (min > buffer[4 * a + 1] && notcol != (buffer[4 * a + 3] & 0xFFFF)) {
@@ -1358,10 +1376,10 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
}
/* mval comes from event->mval, only use within region handlers */
-Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
+BaseLegacy *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
{
ViewContext vc;
- Base *basact = NULL;
+ BaseLegacy *basact = NULL;
unsigned int buffer[MAXPICKBUF];
int hits;
bool do_nearest;
@@ -1408,7 +1426,7 @@ static bool ed_object_select_pick(
ARegion *ar = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
Scene *scene = CTX_data_scene(C);
- Base *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL;
+ BaseLegacy *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL;
bool is_obedit;
float dist = ED_view3d_select_dist_px() * 1.3333f;
bool retval = false;
@@ -1520,8 +1538,8 @@ static bool ed_object_select_pick(
changed = true;
}
- basact->flag |= SELECT;
- basact->object->flag = basact->flag;
+ basact->flag_legacy |= SELECT;
+ basact->object->flag = basact->flag_legacy;
retval = true;
@@ -1544,8 +1562,8 @@ static bool ed_object_select_pick(
/* we make the armature selected:
* not-selected active object in posemode won't work well for tools */
- basact->flag |= SELECT;
- basact->object->flag = basact->flag;
+ basact->flag_legacy |= SELECT;
+ basact->object->flag = basact->flag_legacy;
retval = true;
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, basact->object);
@@ -1586,7 +1604,7 @@ static bool ed_object_select_pick(
ED_base_object_select(basact, BA_DESELECT);
}
else if (toggle) {
- if (basact->flag & SELECT) {
+ if (basact->flag_legacy & SELECT) {
if (basact == oldbasact) {
ED_base_object_select(basact, BA_DESELECT);
}
@@ -2051,7 +2069,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
*/
if (hits > 0) { /* no need to loop if there's no hit */
- Base *base;
+ BaseLegacy *base;
col = vbuffer + 3;
for (base = vc->scene->base.first; base && hits; base = base->next) {
@@ -2793,9 +2811,9 @@ static bool object_circle_select(ViewContext *vc, const bool select, const int m
const int select_flag = select ? SELECT : 0;
- Base *base;
+ BaseLegacy *base;
for (base = FIRSTBASE; base; base = base->next) {
- if (BASE_SELECTABLE(vc->v3d, base) && ((base->flag & SELECT) != select_flag)) {
+ if (BASE_SELECTABLE(vc->v3d, base) && ((base->flag_legacy & SELECT) != select_flag)) {
float screen_co[2];
if (ED_view3d_project_float_global(vc->ar, base->object->obmat[3], screen_co,
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)