forked from bartvdbraak/blender
- removed View3D->localview since it wasnt set on entering localview (making many tools fail, add objects for eg.), check localvd instead.
- Accent (`) key now sets all layers (like in 2.4x) - added Alt+C keybinding for converting object types.
This commit is contained in:
parent
b55919069e
commit
7ead925ce4
@ -4843,7 +4843,7 @@ static float lambda_cp_line(float p[3], float l1[3], float l2[3])
|
||||
/* useful to calculate an even width shell, by taking the angle between 2 planes.
|
||||
* The return value is a scale on the offset.
|
||||
* no angle between planes is 1.0, as the angle between the 2 planes approches 180d
|
||||
* the distance gets very hight, 180d would be inf, but this case isnt valid */
|
||||
* the distance gets very high, 180d would be inf, but this case isn't valid */
|
||||
float AngleToLength(const float angle)
|
||||
{
|
||||
return (angle < SMALL_NUMBER) ? 1.0f : fabsf(1.0f / cosf(angle * (M_PI/180.0f)));
|
||||
|
@ -4688,7 +4688,6 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
|
||||
v3d->layact= v3d->localvd->layact;
|
||||
MEM_freeN(v3d->localvd);
|
||||
v3d->localvd= NULL;
|
||||
v3d->localview= 0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ void sort_faces(Scene *scene, View3D *v3d)
|
||||
if (event == 1)
|
||||
Mat4MulMat4(mat, OBACT->obmat, rv3d->viewmat); /* apply the view matrix to the object matrix */
|
||||
else if (event == 2) { /* sort from cursor */
|
||||
if( v3d && v3d->localview ) {
|
||||
if( v3d && v3d->localvd ) {
|
||||
VECCOPY(cur, v3d->cursor);
|
||||
} else {
|
||||
VECCOPY(cur, scene->cursor);
|
||||
|
@ -110,7 +110,7 @@ void ED_object_base_init_from_view(bContext *C, Base *base)
|
||||
VECCOPY(ob->loc, scene->cursor);
|
||||
}
|
||||
else {
|
||||
if (v3d->localview) {
|
||||
if (v3d->localvd) {
|
||||
base->lay= ob->lay= v3d->layact | v3d->lay;
|
||||
VECCOPY(ob->loc, v3d->cursor);
|
||||
}
|
||||
|
@ -244,6 +244,7 @@ void ED_keymap_object(wmWindowManager *wm)
|
||||
WM_keymap_add_item(keymap, "OBJECT_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "OBJECT_OT_duplicate", DKEY, KM_PRESS, KM_ALT, 0)->ptr, "linked", 1);
|
||||
WM_keymap_add_item(keymap, "OBJECT_OT_join", JKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "OBJECT_OT_convert", CKEY, KM_PRESS, KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "OBJECT_OT_proxy_make", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
|
||||
|
||||
// XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith
|
||||
|
@ -994,7 +994,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if(lay==0) return OPERATOR_CANCELLED;
|
||||
|
||||
if(v3d && v3d->localview) {
|
||||
if(v3d && v3d->localvd) {
|
||||
/* now we can move out of localview. */
|
||||
// XXX if (!okee("Move from localview")) return;
|
||||
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
|
||||
|
@ -259,7 +259,6 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
|
||||
if(v3do->localvd) {
|
||||
v3do->localvd= NULL;
|
||||
v3do->properties_storage= NULL;
|
||||
v3do->localview= 0;
|
||||
v3do->lay= v3dn->localvd->lay;
|
||||
v3do->lay &= 0xFFFFFF;
|
||||
}
|
||||
|
@ -732,7 +732,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d)
|
||||
char *name = view3d_get_name(v3d, rv3d);
|
||||
char *printable = NULL;
|
||||
|
||||
if (v3d->localview) {
|
||||
if (v3d->localvd) {
|
||||
printable = malloc(strlen(name) + strlen(" (Local)_")); /* '_' gives space for '\0' */
|
||||
strcpy(printable, name);
|
||||
strcat(printable, " (Local)");
|
||||
@ -745,7 +745,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d)
|
||||
BLF_draw_default(22, ar->winy-17, 0.0f, printable);
|
||||
}
|
||||
|
||||
if (v3d->localview) {
|
||||
if (v3d->localvd) {
|
||||
free(printable);
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ static void handle_view3d_lock(bContext *C)
|
||||
View3D *v3d= CTX_wm_view3d(C);
|
||||
|
||||
if (v3d != NULL && sa != NULL) {
|
||||
if(v3d->localview==0 && v3d->scenelock && sa->spacetype==SPACE_VIEW3D) {
|
||||
if(v3d->localvd==NULL && v3d->scenelock && sa->spacetype==SPACE_VIEW3D) {
|
||||
|
||||
/* copy to scene */
|
||||
scene->lay= v3d->lay;
|
||||
@ -195,27 +195,38 @@ static int layers_exec(bContext *C, wmOperator *op)
|
||||
View3D *v3d= sa->spacedata.first;
|
||||
int nr= RNA_int_get(op->ptr, "nr");
|
||||
|
||||
if(nr<=0)
|
||||
if(nr < 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
nr--;
|
||||
|
||||
if(RNA_boolean_get(op->ptr, "extend"))
|
||||
v3d->lay |= (1<<nr);
|
||||
else
|
||||
v3d->lay = (1<<nr);
|
||||
|
||||
/* set active layer, ensure to always have one */
|
||||
if(v3d->lay & (1<<nr))
|
||||
v3d->layact= 1<<nr;
|
||||
else if((v3d->lay & v3d->layact)==0) {
|
||||
int bit= 0;
|
||||
if(nr == 0) {
|
||||
/* all layers */
|
||||
v3d->lay |= (1<<20)-1;
|
||||
|
||||
if(!v3d->layact)
|
||||
v3d->layact= 1;
|
||||
}
|
||||
else {
|
||||
nr--;
|
||||
|
||||
if(RNA_boolean_get(op->ptr, "extend"))
|
||||
v3d->lay |= (1<<nr);
|
||||
else
|
||||
v3d->lay = (1<<nr);
|
||||
|
||||
while(bit<32) {
|
||||
if(v3d->lay & (1<<bit)) {
|
||||
v3d->layact= 1<<bit;
|
||||
break;
|
||||
/* set active layer, ensure to always have one */
|
||||
if(v3d->lay & (1<<nr))
|
||||
v3d->layact= 1<<nr;
|
||||
else if((v3d->lay & v3d->layact)==0) {
|
||||
int bit= 0;
|
||||
|
||||
while(bit<32) {
|
||||
if(v3d->lay & (1<<bit)) {
|
||||
v3d->layact= 1<<bit;
|
||||
break;
|
||||
}
|
||||
bit++;
|
||||
}
|
||||
bit++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,8 +274,8 @@ void VIEW3D_OT_layers(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_int(ot->srna, "nr", 1, 0, 20, "Number", "", 0, 20);
|
||||
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "");
|
||||
RNA_def_int(ot->srna, "nr", 1, 0, 20, "Number", "The layer number to set, zero for all layers", 0, 20);
|
||||
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Add this layer to the current view layers");
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -2078,7 +2089,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
|
||||
}
|
||||
|
||||
/* LAYERS */
|
||||
if(obedit==NULL && v3d->localview==0) {
|
||||
if(obedit==NULL && v3d->localvd==NULL) {
|
||||
int ob_lay = ob ? ob->lay : 0;
|
||||
uiBlockBeginAlign(block);
|
||||
for(a=0; a<5; a++) {
|
||||
|
@ -157,6 +157,7 @@ void view3d_keymap(wmWindowManager *wm)
|
||||
WM_keymap_add_item(keymap, "VIEW3D_OT_game_start", PKEY, KM_PRESS, 0, 0);
|
||||
|
||||
/* layers, shift + alt are properties set in invoke() */
|
||||
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ACCENTGRAVEKEY, KM_PRESS, 0, 0)->ptr, "nr", 0);
|
||||
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ONEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 1);
|
||||
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", TWOKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 2);
|
||||
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", THREEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 3);
|
||||
|
@ -110,7 +110,7 @@ void view3d_operator_needs_opengl(const bContext *C)
|
||||
|
||||
float *give_cursor(Scene *scene, View3D *v3d)
|
||||
{
|
||||
if(v3d && v3d->localview) return v3d->cursor;
|
||||
if(v3d && v3d->localvd) return v3d->cursor;
|
||||
else return scene->cursor;
|
||||
}
|
||||
|
||||
@ -1303,7 +1303,6 @@ static void initlocalview(Scene *scene, ScrArea *sa)
|
||||
base->object->lay= base->lay;
|
||||
}
|
||||
}
|
||||
v3d->localview= 0;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1325,7 +1324,6 @@ static void restore_localviewdata(ScrArea *sa, int free)
|
||||
if(free) {
|
||||
MEM_freeN(v3d->localvd);
|
||||
v3d->localvd= NULL;
|
||||
v3d->localview= 0;
|
||||
}
|
||||
|
||||
for(ar= sa->regionbase.first; ar; ar= ar->next) {
|
||||
|
@ -144,7 +144,7 @@ typedef struct View3D {
|
||||
* The drawing mode for the 3d display. Set to OB_WIRE, OB_SOLID,
|
||||
* OB_SHADED or OB_TEXTURE */
|
||||
short drawtype;
|
||||
short localview;
|
||||
short pad2;
|
||||
short scenelock, around, pad3;
|
||||
short flag, flag2;
|
||||
|
||||
|
@ -602,11 +602,9 @@ static void rna_def_space_3dview(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View.");
|
||||
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "localview", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "localview", 0);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
prop= RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "localvd");
|
||||
RNA_def_property_ui_text(prop, "Local View", "Display an isolated sub-set of objects, apart from the scene visibility.");
|
||||
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "lens");
|
||||
|
Loading…
Reference in New Issue
Block a user