Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_relations.c
| Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_displist.h" | #include "BKE_displist.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_group.h" | #include "BKE_group.h" | ||||
| #include "BKE_fcurve.h" | #include "BKE_fcurve.h" | ||||
| #include "BKE_lamp.h" | #include "BKE_lamp.h" | ||||
| #include "BKE_lattice.h" | #include "BKE_lattice.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_library_query.h" | #include "BKE_library_query.h" | ||||
| #include "BKE_localview.h" | |||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "BKE_mball.h" | #include "BKE_mball.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_sca.h" | #include "BKE_sca.h" | ||||
| ▲ Show 20 Lines • Show All 1,246 Lines • ▼ Show 20 Lines | static unsigned int move_to_layer_init(bContext *C, wmOperator *op) | ||||
| } | } | ||||
| return lay; | return lay; | ||||
| } | } | ||||
| static int move_to_layer_invoke(bContext *C, wmOperator *op, const wmEvent *event) | static int move_to_layer_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| View3D *v3d = CTX_wm_view3d(C); | View3D *v3d = CTX_wm_view3d(C); | ||||
| if (v3d && v3d->localvd) { | if (v3d && v3d->localviewd) { | ||||
| return WM_operator_confirm_message(C, op, "Move out of Local View"); | return WM_operator_confirm_message(C, op, "Move out of Local View"); | ||||
| } | } | ||||
| else { | else { | ||||
| move_to_layer_init(C, op); | move_to_layer_init(C, op); | ||||
| return WM_operator_props_popup(C, op, event); | return WM_operator_props_popup(C, op, event); | ||||
| } | } | ||||
| } | } | ||||
| static int move_to_layer_exec(bContext *C, wmOperator *op) | static int move_to_layer_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| View3D *v3d = CTX_wm_view3d(C); | View3D *v3d = CTX_wm_view3d(C); | ||||
| unsigned int lay, local; | unsigned int lay; | ||||
| /* bool is_lamp = false; */ /* UNUSED */ | /* bool is_lamp = false; */ /* UNUSED */ | ||||
| lay = move_to_layer_init(C, op); | lay = move_to_layer_init(C, op); | ||||
| lay &= 0xFFFFFF; | |||||
| if (lay == 0) return OPERATOR_CANCELLED; | if (lay == 0) return OPERATOR_CANCELLED; | ||||
| if (v3d && v3d->localvd) { | |||||
| /* now we can move out of localview. */ | |||||
| /* note: layers are set in bases, library objects work for this */ | /* note: layers are set in bases, library objects work for this */ | ||||
| CTX_DATA_BEGIN (C, Base *, base, selected_bases) | CTX_DATA_BEGIN (C, Base *, base, selected_bases) | ||||
| { | { | ||||
| lay = base->lay & ~v3d->lay; | /* Move object out of local view and deselect */ | ||||
| base->lay = lay; | /* TODO maybe this can be done a bit nicer? */ | ||||
| base->object->lay = lay; | if (v3d && v3d->localviewd) { | ||||
| BKE_localview_object_unassign(v3d, base->object); | |||||
| base->object->flag &= ~SELECT; | base->object->flag &= ~SELECT; | ||||
| base->flag &= ~SELECT; | base->flag &= ~SELECT; | ||||
brecht: Why does this require deselecting? Is that an issue in the old system that still applies to the… | |||||
SeverinAuthorUnsubmitted Not Done Inline ActionsJust copied what old code did, I actually have no idea why it's deselecting. Severin: Just copied what old code did, I actually have no idea why it's deselecting. | |||||
| /* if (base->object->type == OB_LAMP) is_lamp = true; */ | |||||
| } | |||||
| CTX_DATA_END; | |||||
| } | } | ||||
| else { | base->lay = base->object->lay = lay; | ||||
| /* normal non localview operation */ | |||||
| /* note: layers are set in bases, library objects work for this */ | |||||
| CTX_DATA_BEGIN (C, Base *, base, selected_bases) | |||||
| { | |||||
| /* upper byte is used for local view */ | |||||
| local = base->lay & 0xFF000000; | |||||
| base->lay = lay + local; | |||||
| base->object->lay = lay; | |||||
| /* if (base->object->type == OB_LAMP) is_lamp = true; */ | /* if (base->object->type == OB_LAMP) is_lamp = true; */ | ||||
| } | } | ||||
| CTX_DATA_END; | CTX_DATA_END; | ||||
| } | |||||
| /* warning, active object may be hidden now */ | /* warning, active object may be hidden now */ | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene); | WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene); | WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene); | ||||
| DAG_relations_tag_update(bmain); | DAG_relations_tag_update(bmain); | ||||
| ▲ Show 20 Lines • Show All 1,141 Lines • Show Last 20 Lines | |||||
Why does this require deselecting? Is that an issue in the old system that still applies to the new one?