2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-12 18:47:12 +00:00
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-12-12 18:47:12 +00:00
|
|
|
*
|
2008-12-20 12:36:14 +00:00
|
|
|
* The Original Code is Copyright (C) 2004-2008 Blender Foundation.
|
2008-12-12 18:47:12 +00:00
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/space_view3d/view3d_header.c
|
|
|
|
|
* \ingroup spview3d
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2008-12-12 18:47:12 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdio.h>
|
2008-12-20 12:36:14 +00:00
|
|
|
#include <stdlib.h>
|
2008-12-12 18:47:12 +00:00
|
|
|
|
|
|
|
|
#include "DNA_scene_types.h"
|
2010-08-10 05:41:51 +00:00
|
|
|
#include "DNA_object_types.h"
|
2008-12-12 18:47:12 +00:00
|
|
|
|
2009-02-07 03:21:28 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
|
2008-12-12 18:47:12 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_math.h"
|
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
#include "BLI_editVert.h"
|
|
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
|
2011-09-20 07:39:25 +00:00
|
|
|
#include "BLF_translation.h"
|
2011-06-15 11:41:15 +00:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2008-12-20 12:36:14 +00:00
|
|
|
#include "BKE_depsgraph.h"
|
|
|
|
|
#include "BKE_effect.h"
|
|
|
|
|
#include "BKE_main.h"
|
|
|
|
|
#include "BKE_mesh.h"
|
|
|
|
|
#include "BKE_modifier.h"
|
2009-08-15 19:48:50 +00:00
|
|
|
#include "BKE_paint.h"
|
2008-12-12 18:47:12 +00:00
|
|
|
#include "BKE_screen.h"
|
|
|
|
|
|
2009-01-01 18:05:12 +00:00
|
|
|
#include "ED_mesh.h"
|
2008-12-12 18:47:12 +00:00
|
|
|
#include "ED_util.h"
|
2009-01-05 19:32:04 +00:00
|
|
|
#include "ED_screen.h"
|
2009-07-08 16:17:47 +00:00
|
|
|
#include "ED_transform.h"
|
2008-12-19 12:48:30 +00:00
|
|
|
#include "ED_types.h"
|
2008-12-12 18:47:12 +00:00
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
2009-02-20 18:01:33 +00:00
|
|
|
#include "RNA_define.h"
|
2009-08-16 16:38:32 +00:00
|
|
|
#include "RNA_enum_types.h"
|
2009-02-20 18:01:33 +00:00
|
|
|
|
2008-12-12 18:47:12 +00:00
|
|
|
#include "UI_interface.h"
|
|
|
|
|
#include "UI_resources.h"
|
|
|
|
|
|
|
|
|
|
#include "view3d_intern.h"
|
|
|
|
|
|
|
|
|
|
|
2008-12-20 12:36:14 +00:00
|
|
|
/* View3d->modeselect
|
|
|
|
|
* This is a bit of a dodgy hack to enable a 'mode' menu with icons+labels
|
|
|
|
|
* rather than those buttons.
|
|
|
|
|
* I know the implementation's not good - it's an experiment to see if this
|
|
|
|
|
* approach would work well
|
|
|
|
|
*
|
|
|
|
|
* This can be cleaned when I make some new 'mode' icons.
|
|
|
|
|
*/
|
|
|
|
|
|
2008-12-31 22:43:29 +00:00
|
|
|
#define TEST_EDITMESH if(obedit==0) return; \
|
|
|
|
|
if( (v3d->lay & obedit->lay)==0 ) return;
|
2008-12-20 12:36:14 +00:00
|
|
|
|
|
|
|
|
/* view3d handler codes */
|
|
|
|
|
#define VIEW3D_HANDLER_BACKGROUND 1
|
|
|
|
|
#define VIEW3D_HANDLER_PROPERTIES 2
|
|
|
|
|
#define VIEW3D_HANDLER_OBJECT 3
|
|
|
|
|
#define VIEW3D_HANDLER_PREVIEW 4
|
|
|
|
|
#define VIEW3D_HANDLER_MULTIRES 5
|
|
|
|
|
#define VIEW3D_HANDLER_TRANSFORM 6
|
|
|
|
|
#define VIEW3D_HANDLER_GREASEPENCIL 7
|
2009-03-17 21:44:58 +00:00
|
|
|
#define VIEW3D_HANDLER_BONESKETCH 8
|
2008-12-20 12:36:14 +00:00
|
|
|
|
|
|
|
|
/* end XXX ************* */
|
|
|
|
|
|
2009-02-10 15:38:00 +00:00
|
|
|
static void do_view3d_header_buttons(bContext *C, void *arg, int event);
|
2008-12-20 12:36:14 +00:00
|
|
|
|
|
|
|
|
#define B_SCENELOCK 101
|
|
|
|
|
#define B_FULL 102
|
|
|
|
|
#define B_HOME 103
|
|
|
|
|
#define B_VIEWBUT 104
|
|
|
|
|
#define B_PERSP 105
|
|
|
|
|
#define B_MODESELECT 108
|
|
|
|
|
#define B_SEL_VERT 110
|
|
|
|
|
#define B_SEL_EDGE 111
|
|
|
|
|
#define B_SEL_FACE 112
|
|
|
|
|
#define B_MAN_TRANS 116
|
|
|
|
|
#define B_MAN_ROT 117
|
|
|
|
|
#define B_MAN_SCALE 118
|
|
|
|
|
#define B_NDOF 119
|
|
|
|
|
#define B_MAN_MODE 120
|
|
|
|
|
#define B_REDR 122
|
|
|
|
|
#define B_NOP 123
|
2009-10-26 12:42:25 +00:00
|
|
|
|
2009-07-03 04:24:19 +00:00
|
|
|
// XXX quickly ported across
|
|
|
|
|
static void handle_view3d_lock(bContext *C)
|
|
|
|
|
{
|
2009-10-26 12:42:25 +00:00
|
|
|
Main *bmain= CTX_data_main(C);
|
2009-07-03 04:24:19 +00:00
|
|
|
Scene *scene= CTX_data_scene(C);
|
|
|
|
|
ScrArea *sa= CTX_wm_area(C);
|
2009-07-28 16:33:02 +00:00
|
|
|
View3D *v3d= CTX_wm_view3d(C);
|
2009-07-03 04:24:19 +00:00
|
|
|
|
|
|
|
|
if (v3d != NULL && sa != NULL) {
|
2009-09-22 04:40:16 +00:00
|
|
|
if(v3d->localvd==NULL && v3d->scenelock && sa->spacetype==SPACE_VIEW3D) {
|
2009-07-03 04:24:19 +00:00
|
|
|
/* copy to scene */
|
|
|
|
|
scene->lay= v3d->lay;
|
2010-06-04 01:39:34 +00:00
|
|
|
scene->layact= v3d->layact;
|
2009-07-03 04:24:19 +00:00
|
|
|
scene->camera= v3d->camera;
|
2009-10-26 12:42:25 +00:00
|
|
|
|
|
|
|
|
/* not through notifiery, listener don't have context
|
|
|
|
|
and non-open screens or spaces need to be updated too */
|
2010-04-22 19:57:18 +00:00
|
|
|
BKE_screen_view3d_main_sync(&bmain->screen, scene);
|
2009-07-03 04:24:19 +00:00
|
|
|
|
2009-10-19 04:56:19 +00:00
|
|
|
/* notifiers for scene update */
|
2009-10-26 12:42:25 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_LAYER, scene);
|
2009-07-03 04:24:19 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-19 16:30:52 +00:00
|
|
|
/* layer code is on three levels actually:
|
|
|
|
|
- here for operator
|
|
|
|
|
- uiTemplateLayers in interface/ code for buttons
|
|
|
|
|
- ED_view3d_scene_layer_set for RNA
|
|
|
|
|
*/
|
2011-03-30 15:28:38 +00:00
|
|
|
static void view3d_layers_editmode_ensure(Scene *scene, View3D *v3d)
|
|
|
|
|
{
|
|
|
|
|
/* sanity check - when in editmode disallow switching the editmode layer off since its confusing
|
|
|
|
|
* an alternative would be to always draw the editmode object. */
|
|
|
|
|
if(scene->obedit && (scene->obedit->lay & v3d->lay)==0) {
|
|
|
|
|
int bit;
|
|
|
|
|
for(bit=0; bit<32; bit++) {
|
|
|
|
|
if(scene->obedit->lay & (1<<bit)) {
|
|
|
|
|
v3d->lay |= 1<<bit;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-13 14:16:36 +00:00
|
|
|
static int view3d_layers_exec(bContext *C, wmOperator *op)
|
2009-02-20 18:01:33 +00:00
|
|
|
{
|
|
|
|
|
Scene *scene= CTX_data_scene(C);
|
|
|
|
|
ScrArea *sa= CTX_wm_area(C);
|
|
|
|
|
View3D *v3d= sa->spacedata.first;
|
|
|
|
|
int nr= RNA_int_get(op->ptr, "nr");
|
2010-01-03 04:21:40 +00:00
|
|
|
int toggle= RNA_boolean_get(op->ptr, "toggle");
|
2009-02-20 18:01:33 +00:00
|
|
|
|
2009-09-22 04:40:16 +00:00
|
|
|
if(nr < 0)
|
2009-02-20 18:01:33 +00:00
|
|
|
return OPERATOR_CANCELLED;
|
2010-03-26 08:32:54 +00:00
|
|
|
|
2009-09-22 04:40:16 +00:00
|
|
|
if(nr == 0) {
|
|
|
|
|
/* all layers */
|
|
|
|
|
if(!v3d->layact)
|
|
|
|
|
v3d->layact= 1;
|
2010-03-26 08:32:54 +00:00
|
|
|
|
|
|
|
|
if (toggle && v3d->lay == ((1<<20)-1)) {
|
|
|
|
|
/* return to active layer only */
|
|
|
|
|
v3d->lay = v3d->layact;
|
2011-03-30 15:28:38 +00:00
|
|
|
|
|
|
|
|
view3d_layers_editmode_ensure(scene, v3d);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2010-03-26 08:32:54 +00:00
|
|
|
v3d->lay |= (1<<20)-1;
|
|
|
|
|
}
|
2009-09-22 04:40:16 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2010-01-30 15:23:17 +00:00
|
|
|
int bit;
|
2009-09-22 04:40:16 +00:00
|
|
|
nr--;
|
|
|
|
|
|
2010-01-03 04:21:40 +00:00
|
|
|
if(RNA_boolean_get(op->ptr, "extend")) {
|
|
|
|
|
if(toggle && v3d->lay & (1<<nr) && (v3d->lay & ~(1<<nr)))
|
|
|
|
|
v3d->lay &= ~(1<<nr);
|
|
|
|
|
else
|
|
|
|
|
v3d->lay |= (1<<nr);
|
2010-01-30 15:23:17 +00:00
|
|
|
} else {
|
2009-09-22 04:40:16 +00:00
|
|
|
v3d->lay = (1<<nr);
|
2010-01-30 15:23:17 +00:00
|
|
|
}
|
2011-03-30 15:28:38 +00:00
|
|
|
|
|
|
|
|
view3d_layers_editmode_ensure(scene, v3d);
|
|
|
|
|
|
2009-09-22 04:40:16 +00:00
|
|
|
/* set active layer, ensure to always have one */
|
|
|
|
|
if(v3d->lay & (1<<nr))
|
|
|
|
|
v3d->layact= 1<<nr;
|
|
|
|
|
else if((v3d->lay & v3d->layact)==0) {
|
2010-01-30 15:23:17 +00:00
|
|
|
for(bit=0; bit<32; bit++) {
|
2009-09-22 04:40:16 +00:00
|
|
|
if(v3d->lay & (1<<bit)) {
|
|
|
|
|
v3d->layact= 1<<bit;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-07-19 16:53:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-03 04:24:19 +00:00
|
|
|
if(v3d->scenelock) handle_view3d_lock(C);
|
2009-02-20 18:01:33 +00:00
|
|
|
|
2011-03-23 15:15:42 +00:00
|
|
|
DAG_on_visible_update(CTX_data_main(C), FALSE);
|
2009-02-20 18:01:33 +00:00
|
|
|
|
|
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* applies shift and alt, lazy coding or ok? :) */
|
|
|
|
|
/* the local per-keymap-entry keymap will solve it */
|
2011-02-13 14:16:36 +00:00
|
|
|
static int view3d_layers_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
2009-02-20 18:01:33 +00:00
|
|
|
{
|
|
|
|
|
if(event->ctrl || event->oskey)
|
|
|
|
|
return OPERATOR_PASS_THROUGH;
|
|
|
|
|
|
|
|
|
|
if(event->shift)
|
|
|
|
|
RNA_boolean_set(op->ptr, "extend", 1);
|
|
|
|
|
|
|
|
|
|
if(event->alt) {
|
|
|
|
|
int nr= RNA_int_get(op->ptr, "nr") + 10;
|
|
|
|
|
RNA_int_set(op->ptr, "nr", nr);
|
|
|
|
|
}
|
2011-02-13 14:16:36 +00:00
|
|
|
view3d_layers_exec(C, op);
|
2009-02-20 18:01:33 +00:00
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-13 14:16:36 +00:00
|
|
|
static int view3d_layers_poll(bContext *C)
|
2010-01-03 04:21:40 +00:00
|
|
|
{
|
|
|
|
|
return (ED_operator_view3d_active(C) && CTX_wm_view3d(C)->localvd==NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-20 18:01:33 +00:00
|
|
|
void VIEW3D_OT_layers(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2011-09-15 13:20:18 +00:00
|
|
|
ot->name= "Layers";
|
|
|
|
|
ot->description= "Toggle layer(s) visibility";
|
2009-02-20 18:01:33 +00:00
|
|
|
ot->idname= "VIEW3D_OT_layers";
|
|
|
|
|
|
|
|
|
|
/* api callbacks */
|
2011-02-13 14:16:36 +00:00
|
|
|
ot->invoke= view3d_layers_invoke;
|
|
|
|
|
ot->exec= view3d_layers_exec;
|
|
|
|
|
ot->poll= view3d_layers_poll;
|
2009-02-20 18:01:33 +00:00
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
|
|
|
|
2011-09-15 13:20:18 +00:00
|
|
|
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");
|
|
|
|
|
RNA_def_boolean(ot->srna, "toggle", 1, "Toggle", "Toggle the layer");
|
2009-02-20 18:01:33 +00:00
|
|
|
}
|
|
|
|
|
|
2011-09-19 10:32:53 +00:00
|
|
|
static int modeselect_addmode(char *str, const char *title, int id, int icon)
|
|
|
|
|
{
|
|
|
|
|
static char formatstr[] = "|%s %%x%d %%i%d";
|
|
|
|
|
|
2011-09-19 15:10:38 +00:00
|
|
|
if(UI_translate_iface())
|
2011-09-19 10:32:53 +00:00
|
|
|
return sprintf(str, formatstr, BLF_gettext(title), id, icon);
|
|
|
|
|
else
|
|
|
|
|
return sprintf(str, formatstr, title, id, icon);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-20 12:36:14 +00:00
|
|
|
static char *view3d_modeselect_pup(Scene *scene)
|
|
|
|
|
{
|
|
|
|
|
Object *ob= OBACT;
|
2011-05-05 15:21:43 +00:00
|
|
|
static char string[256];
|
2011-09-22 18:42:16 +00:00
|
|
|
const char *title= N_("Mode: %t");
|
2008-12-20 12:36:14 +00:00
|
|
|
char *str = string;
|
|
|
|
|
|
2011-09-19 10:32:53 +00:00
|
|
|
if(U.transopts&USER_TR_IFACE)
|
|
|
|
|
title= BLF_gettext(title);
|
|
|
|
|
|
2011-09-22 18:42:16 +00:00
|
|
|
BLI_strncpy(str, title, sizeof(string));
|
|
|
|
|
|
2011-09-19 10:32:53 +00:00
|
|
|
str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA);
|
2008-12-20 12:36:14 +00:00
|
|
|
|
2011-07-30 15:45:27 +00:00
|
|
|
if(ob==NULL || ob->data==NULL) return string;
|
2011-08-17 12:09:02 +00:00
|
|
|
if(ob->id.lib) return string;
|
2008-12-20 12:36:14 +00:00
|
|
|
|
2011-08-17 12:09:02 +00:00
|
|
|
if(!((ID *)ob->data)->lib) {
|
|
|
|
|
/* if active object is editable */
|
|
|
|
|
if ( ((ob->type == OB_MESH)
|
|
|
|
|
|| (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
|
|
|
|
|
|| (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) {
|
|
|
|
|
|
2011-09-19 10:32:53 +00:00
|
|
|
str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
|
2011-08-17 12:09:02 +00:00
|
|
|
}
|
|
|
|
|
else if (ob->type == OB_ARMATURE) {
|
|
|
|
|
if (ob->mode & OB_MODE_POSE)
|
2011-09-19 10:32:53 +00:00
|
|
|
str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT);
|
2011-08-17 12:09:02 +00:00
|
|
|
else
|
2011-09-19 10:32:53 +00:00
|
|
|
str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
|
2011-08-17 12:09:02 +00:00
|
|
|
}
|
2008-12-20 12:36:14 +00:00
|
|
|
|
2011-08-17 12:09:02 +00:00
|
|
|
if (ob->type == OB_MESH) {
|
2008-12-20 12:36:14 +00:00
|
|
|
|
2011-09-19 10:32:53 +00:00
|
|
|
str += modeselect_addmode(str, N_("Sculpt Mode"), OB_MODE_SCULPT, ICON_SCULPTMODE_HLT);
|
|
|
|
|
str += modeselect_addmode(str, N_("Vertex Paint"), OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT);
|
|
|
|
|
str += modeselect_addmode(str, N_("Texture Paint"), OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT);
|
|
|
|
|
str += modeselect_addmode(str, N_("Weight Paint"), OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT);
|
2011-08-17 12:09:02 +00:00
|
|
|
}
|
2008-12-20 12:36:14 +00:00
|
|
|
}
|
2011-08-17 12:09:02 +00:00
|
|
|
|
2008-12-20 12:36:14 +00:00
|
|
|
/* if active object is an armature */
|
|
|
|
|
if (ob->type==OB_ARMATURE) {
|
2011-09-19 10:32:53 +00:00
|
|
|
str += modeselect_addmode(str, N_("Pose Mode"), OB_MODE_POSE, ICON_POSE_HLT);
|
2008-12-20 12:36:14 +00:00
|
|
|
}
|
|
|
|
|
|
2009-08-29 15:20:36 +00:00
|
|
|
if (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody)) {
|
2011-09-19 10:32:53 +00:00
|
|
|
str += modeselect_addmode(str, N_("Particle Mode"), OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE);
|
2008-12-20 12:36:14 +00:00
|
|
|
}
|
2011-04-23 12:57:03 +00:00
|
|
|
(void)str;
|
2008-12-20 12:36:14 +00:00
|
|
|
return (string);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2010-10-14 01:22:14 +00:00
|
|
|
static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event)
|
2008-12-20 12:36:14 +00:00
|
|
|
{
|
2009-02-20 18:01:33 +00:00
|
|
|
wmWindow *win= CTX_wm_window(C);
|
2009-06-23 00:41:55 +00:00
|
|
|
ToolSettings *ts= CTX_data_tool_settings(C);
|
2008-12-20 12:36:14 +00:00
|
|
|
ScrArea *sa= CTX_wm_area(C);
|
|
|
|
|
View3D *v3d= sa->spacedata.first;
|
2008-12-31 22:43:29 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2009-01-01 18:05:12 +00:00
|
|
|
EditMesh *em= NULL;
|
2009-12-03 09:49:21 +00:00
|
|
|
int ctrl= win->eventstate->ctrl, shift= win->eventstate->shift;
|
2009-08-16 16:38:32 +00:00
|
|
|
PointerRNA props_ptr;
|
2009-01-01 18:05:12 +00:00
|
|
|
|
|
|
|
|
if(obedit && obedit->type==OB_MESH) {
|
2009-04-11 08:26:51 +00:00
|
|
|
em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
|
2009-01-01 18:05:12 +00:00
|
|
|
}
|
2008-12-20 12:36:14 +00:00
|
|
|
/* watch it: if sa->win does not exist, check that when calling direct drawing routines */
|
|
|
|
|
|
|
|
|
|
switch(event) {
|
2009-01-12 09:04:53 +00:00
|
|
|
case B_REDR:
|
|
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
|
break;
|
2008-12-20 12:36:14 +00:00
|
|
|
|
|
|
|
|
case B_MODESELECT:
|
2009-08-16 16:38:32 +00:00
|
|
|
WM_operator_properties_create(&props_ptr, "OBJECT_OT_mode_set");
|
|
|
|
|
RNA_enum_set(&props_ptr, "mode", v3d->modeselect);
|
|
|
|
|
WM_operator_name_call(C, "OBJECT_OT_mode_set", WM_OP_EXEC_REGION_WIN, &props_ptr);
|
2009-09-08 02:09:14 +00:00
|
|
|
WM_operator_properties_free(&props_ptr);
|
2009-08-16 16:38:32 +00:00
|
|
|
break;
|
2008-12-20 12:36:14 +00:00
|
|
|
|
|
|
|
|
case B_SEL_VERT:
|
2009-01-01 18:05:12 +00:00
|
|
|
if(em) {
|
|
|
|
|
if(shift==0 || em->selectmode==0)
|
|
|
|
|
em->selectmode= SCE_SELECT_VERTEX;
|
2009-06-23 00:41:55 +00:00
|
|
|
ts->selectmode= em->selectmode;
|
2009-01-01 18:05:12 +00:00
|
|
|
EM_selectmode_set(em);
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
|
2009-01-01 18:05:12 +00:00
|
|
|
ED_undo_push(C, "Selectmode Set: Vertex");
|
|
|
|
|
}
|
2008-12-20 12:36:14 +00:00
|
|
|
break;
|
|
|
|
|
case B_SEL_EDGE:
|
2009-01-01 18:05:12 +00:00
|
|
|
if(em) {
|
|
|
|
|
if(shift==0 || em->selectmode==0){
|
|
|
|
|
if( (em->selectmode ^ SCE_SELECT_EDGE) == SCE_SELECT_VERTEX){
|
|
|
|
|
if(ctrl) EM_convertsel(em, SCE_SELECT_VERTEX,SCE_SELECT_EDGE);
|
|
|
|
|
}
|
|
|
|
|
em->selectmode = SCE_SELECT_EDGE;
|
2008-12-20 12:36:14 +00:00
|
|
|
}
|
2009-06-23 00:41:55 +00:00
|
|
|
ts->selectmode= em->selectmode;
|
2009-01-01 18:05:12 +00:00
|
|
|
EM_selectmode_set(em);
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
|
2009-01-01 18:05:12 +00:00
|
|
|
ED_undo_push(C, "Selectmode Set: Edge");
|
2008-12-20 12:36:14 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case B_SEL_FACE:
|
2009-01-01 18:05:12 +00:00
|
|
|
if(em) {
|
|
|
|
|
if( shift==0 || em->selectmode==0){
|
2010-04-12 02:10:50 +00:00
|
|
|
if( ((em->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) || ((em->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE)){
|
|
|
|
|
if(ctrl)
|
|
|
|
|
EM_convertsel(em, (em->selectmode ^ SCE_SELECT_FACE),SCE_SELECT_FACE);
|
2009-01-01 18:05:12 +00:00
|
|
|
}
|
|
|
|
|
em->selectmode = SCE_SELECT_FACE;
|
2008-12-20 12:36:14 +00:00
|
|
|
}
|
2009-06-23 00:41:55 +00:00
|
|
|
ts->selectmode= em->selectmode;
|
2009-01-01 18:05:12 +00:00
|
|
|
EM_selectmode_set(em);
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
|
2009-01-01 18:05:12 +00:00
|
|
|
ED_undo_push(C, "Selectmode Set: Face");
|
2008-12-20 12:36:14 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case B_MAN_TRANS:
|
2009-07-08 15:01:28 +00:00
|
|
|
if( shift==0 || v3d->twtype==0) {
|
2008-12-20 12:36:14 +00:00
|
|
|
v3d->twtype= V3D_MANIP_TRANSLATE;
|
2009-07-08 15:01:28 +00:00
|
|
|
}
|
2010-03-22 09:30:00 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
|
break;
|
2008-12-20 12:36:14 +00:00
|
|
|
case B_MAN_ROT:
|
2009-07-08 15:01:28 +00:00
|
|
|
if( shift==0 || v3d->twtype==0) {
|
2010-03-22 09:30:00 +00:00
|
|
|
v3d->twtype= V3D_MANIP_ROTATE;
|
2009-07-08 15:01:28 +00:00
|
|
|
}
|
2010-03-22 09:30:00 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
2008-12-20 12:36:14 +00:00
|
|
|
break;
|
|
|
|
|
case B_MAN_SCALE:
|
2009-07-08 15:01:28 +00:00
|
|
|
if( shift==0 || v3d->twtype==0) {
|
2010-03-22 09:30:00 +00:00
|
|
|
v3d->twtype= V3D_MANIP_SCALE;
|
2009-07-08 15:01:28 +00:00
|
|
|
}
|
2010-03-22 09:30:00 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
2008-12-20 12:36:14 +00:00
|
|
|
break;
|
|
|
|
|
case B_NDOF:
|
2010-03-22 09:30:00 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
2008-12-20 12:36:14 +00:00
|
|
|
break;
|
|
|
|
|
case B_MAN_MODE:
|
2010-03-22 09:30:00 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
2008-12-20 12:36:14 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-03-30 07:28:37 +00:00
|
|
|
|
2009-03-30 13:53:48 +00:00
|
|
|
if(obedit && obedit->type==OB_MESH)
|
2009-04-11 08:26:51 +00:00
|
|
|
BKE_mesh_end_editmesh(obedit->data, em);
|
2008-12-20 12:36:14 +00:00
|
|
|
}
|
|
|
|
|
|
2009-08-16 16:38:32 +00:00
|
|
|
/* Returns the icon associated with an object mode */
|
|
|
|
|
static int object_mode_icon(int mode)
|
|
|
|
|
{
|
|
|
|
|
EnumPropertyItem *item = object_mode_items;
|
|
|
|
|
|
|
|
|
|
while(item->name != NULL) {
|
|
|
|
|
if(item->value == mode)
|
|
|
|
|
return item->icon;
|
|
|
|
|
++item;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ICON_OBJECT_DATAMODE;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-02 11:34:57 +00:00
|
|
|
void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
|
|
|
|
|
{
|
|
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
|
|
|
|
uiBlock *block= uiLayoutGetBlock(layout);
|
|
|
|
|
|
|
|
|
|
uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL);
|
|
|
|
|
|
|
|
|
|
if(obedit && (obedit->type == OB_MESH)) {
|
|
|
|
|
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
|
|
|
|
|
uiLayout *row;
|
|
|
|
|
|
|
|
|
|
row= uiLayoutRow(layout, 1);
|
|
|
|
|
block= uiLayoutGetBlock(row);
|
Code holiday commit:
- fix: user pref, window title was reset to 'Blender' on tab usage
- Undo history menu back:
- name "Undo History"
- hotkey alt+ctrl+z (alt+apple+z for mac)
- works like 2.4x, only for global undo, editmode and particle edit.
- Menu scroll
- for small windows or screens, popup menus now allow to display
all items, using internal scrolling
- works with a timer, scrolling 10 items per second when mouse
is over the top or bottom arrow
- if menu is too big to display, it now draws to top or bottom,
based on largest available space.
- also works for hotkey driven pop up menus.
- User pref "DPI" follows widget/layout size
- widgets & headers now become bigger and smaller, to match
'dpi' font sizes. Works well to match UI to monitor size.
- note that icons can get fuzzy, we need better mipmaps for it
2011-06-04 17:03:46 +00:00
|
|
|
uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode");
|
|
|
|
|
uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select mode");
|
|
|
|
|
uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Face select mode");
|
2011-05-02 11:34:57 +00:00
|
|
|
|
|
|
|
|
BKE_mesh_end_editmesh(obedit->data, em);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-20 07:47:27 +00:00
|
|
|
#define TIP_(msgid) UI_translate_do_tooltip(msgid)
|
2009-07-11 13:32:20 +00:00
|
|
|
void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
|
2008-12-20 12:36:14 +00:00
|
|
|
{
|
2009-11-28 18:19:34 +00:00
|
|
|
bScreen *screen= CTX_wm_screen(C);
|
2008-12-20 12:36:14 +00:00
|
|
|
ScrArea *sa= CTX_wm_area(C);
|
|
|
|
|
View3D *v3d= sa->spacedata.first;
|
|
|
|
|
Scene *scene= CTX_data_scene(C);
|
2009-06-23 00:41:55 +00:00
|
|
|
ToolSettings *ts= CTX_data_tool_settings(C);
|
2009-11-29 02:42:47 +00:00
|
|
|
PointerRNA v3dptr, toolsptr, sceneptr;
|
2008-12-20 12:36:14 +00:00
|
|
|
Object *ob= OBACT;
|
2008-12-31 22:43:29 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2008-12-20 12:36:14 +00:00
|
|
|
uiBlock *block;
|
2011-08-18 17:09:23 +00:00
|
|
|
uiBut *but;
|
2009-11-01 14:04:37 +00:00
|
|
|
uiLayout *row;
|
2011-05-05 15:21:43 +00:00
|
|
|
const float dpi_fac= UI_DPI_FAC;
|
2008-12-20 12:36:14 +00:00
|
|
|
|
2010-04-28 07:25:39 +00:00
|
|
|
RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr);
|
2009-11-28 19:38:05 +00:00
|
|
|
RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &toolsptr);
|
2009-11-29 02:42:47 +00:00
|
|
|
RNA_pointer_create(&scene->id, &RNA_Scene, scene, &sceneptr);
|
2009-11-28 19:38:05 +00:00
|
|
|
|
2009-11-28 21:52:37 +00:00
|
|
|
block= uiLayoutGetBlock(layout);
|
2009-02-10 15:38:00 +00:00
|
|
|
uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL);
|
2008-12-20 12:36:14 +00:00
|
|
|
|
|
|
|
|
/* other buttons: */
|
|
|
|
|
uiBlockSetEmboss(block, UI_EMBOSS);
|
|
|
|
|
|
|
|
|
|
/* mode */
|
2009-08-16 16:38:32 +00:00
|
|
|
if(ob)
|
|
|
|
|
v3d->modeselect = ob->mode;
|
|
|
|
|
else
|
|
|
|
|
v3d->modeselect = OB_MODE_OBJECT;
|
|
|
|
|
|
2009-11-28 21:52:37 +00:00
|
|
|
uiBlockBeginAlign(block);
|
2009-08-16 16:38:32 +00:00
|
|
|
uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) ,
|
2011-09-19 10:32:53 +00:00
|
|
|
0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_(N_("Mode")));
|
2009-11-28 21:52:37 +00:00
|
|
|
uiBlockEndAlign(block);
|
2008-12-20 12:36:14 +00:00
|
|
|
|
2009-11-28 21:27:28 +00:00
|
|
|
/* Draw type */
|
2011-02-27 18:03:19 +00:00
|
|
|
uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
2008-12-20 12:36:14 +00:00
|
|
|
|
2009-11-28 20:02:10 +00:00
|
|
|
if (obedit==NULL && ((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)))) {
|
|
|
|
|
/* Manipulators aren't used in weight paint mode */
|
2008-12-20 12:36:14 +00:00
|
|
|
|
2009-11-28 21:27:28 +00:00
|
|
|
PointerRNA meshptr;
|
|
|
|
|
|
|
|
|
|
RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr);
|
2011-07-21 18:46:59 +00:00
|
|
|
if(ob->mode & (OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT)) {
|
2011-07-20 15:56:35 +00:00
|
|
|
uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
2011-09-19 02:43:03 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2011-09-18 17:10:28 +00:00
|
|
|
|
2011-07-20 15:56:35 +00:00
|
|
|
row= uiLayoutRow(layout, 1);
|
|
|
|
|
uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
2011-09-14 08:45:12 +00:00
|
|
|
uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
2011-07-20 15:56:35 +00:00
|
|
|
}
|
2009-11-28 21:27:28 +00:00
|
|
|
} else {
|
2010-12-03 17:05:21 +00:00
|
|
|
const char *str_menu;
|
2009-11-28 21:27:28 +00:00
|
|
|
|
|
|
|
|
row= uiLayoutRow(layout, 1);
|
2011-02-27 18:03:19 +00:00
|
|
|
uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
|
|
|
|
uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
2009-11-28 21:27:28 +00:00
|
|
|
|
2009-11-28 20:02:10 +00:00
|
|
|
/* Transform widget / manipulators */
|
2009-11-28 21:52:37 +00:00
|
|
|
row= uiLayoutRow(layout, 1);
|
2011-02-27 18:03:19 +00:00
|
|
|
uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
2009-11-28 21:52:37 +00:00
|
|
|
block= uiLayoutGetBlock(row);
|
2008-12-20 12:36:14 +00:00
|
|
|
|
2009-11-28 20:02:10 +00:00
|
|
|
if(v3d->twflag & V3D_USE_MANIPULATOR) {
|
2011-09-19 10:32:53 +00:00
|
|
|
but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Translate manipulator mode")));
|
2011-08-18 17:09:23 +00:00
|
|
|
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
2011-09-19 10:32:53 +00:00
|
|
|
but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Rotate manipulator mode")));
|
2011-08-18 17:09:23 +00:00
|
|
|
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
2011-09-19 10:32:53 +00:00
|
|
|
but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Scale manipulator mode")));
|
2011-08-18 17:09:23 +00:00
|
|
|
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
2009-11-28 20:02:10 +00:00
|
|
|
}
|
2008-12-20 12:36:14 +00:00
|
|
|
|
2009-11-28 20:02:10 +00:00
|
|
|
if (v3d->twmode > (BIF_countTransformOrientation(C) - 1) + V3D_MANIP_CUSTOM) {
|
|
|
|
|
v3d->twmode = 0;
|
|
|
|
|
}
|
2008-12-20 12:36:14 +00:00
|
|
|
|
2011-09-19 10:32:53 +00:00
|
|
|
str_menu = BIF_menustringTransformOrientation(C, N_("Orientation"));
|
|
|
|
|
but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_(N_("Transform Orientation")));
|
2011-08-18 17:09:23 +00:00
|
|
|
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
2010-12-03 17:05:21 +00:00
|
|
|
MEM_freeN((void *)str_menu);
|
2009-11-28 20:02:10 +00:00
|
|
|
}
|
2011-04-21 15:53:30 +00:00
|
|
|
|
2009-11-28 20:02:10 +00:00
|
|
|
if(obedit==NULL && v3d->localvd==NULL) {
|
2010-10-19 01:21:22 +00:00
|
|
|
unsigned int ob_lay = ob ? ob->lay : 0;
|
2009-12-03 09:49:21 +00:00
|
|
|
|
2009-11-29 06:04:39 +00:00
|
|
|
/* Layers */
|
2009-12-03 09:49:21 +00:00
|
|
|
if (v3d->scenelock)
|
2010-08-17 07:49:53 +00:00
|
|
|
uiTemplateLayers(layout, &sceneptr, "layers", &v3dptr, "layers_used", ob_lay);
|
2009-12-03 09:49:21 +00:00
|
|
|
else
|
2010-08-17 07:49:53 +00:00
|
|
|
uiTemplateLayers(layout, &v3dptr, "layers", &v3dptr, "layers_used", ob_lay);
|
2008-12-20 12:36:14 +00:00
|
|
|
|
2009-11-28 21:27:28 +00:00
|
|
|
/* Scene lock */
|
2011-02-27 18:03:19 +00:00
|
|
|
uiItemR(layout, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
2009-11-28 20:02:10 +00:00
|
|
|
}
|
2010-01-30 01:25:02 +00:00
|
|
|
|
2011-05-02 11:34:57 +00:00
|
|
|
uiTemplateEditModeSelection(layout, C);
|
2008-12-12 18:47:12 +00:00
|
|
|
}
|
2011-09-19 10:32:53 +00:00
|
|
|
#undef TIP_
|