2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-13 17:44:30 +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-13 17:44:30 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/space_image/image_header.c
|
|
|
|
|
* \ingroup spimage
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
#include "DNA_object_types.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
#include "DNA_space_types.h"
|
|
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
#include "BLI_editVert.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
2009-02-09 20:58:31 +00:00
|
|
|
#include "ED_image.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
|
|
#include "UI_interface.h"
|
2011-02-27 18:03:19 +00:00
|
|
|
#include "UI_resources.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
#include "image_intern.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
2009-01-30 12:58:00 +00:00
|
|
|
/********************** toolbox operator *********************/
|
|
|
|
|
|
2010-10-14 12:24:08 +00:00
|
|
|
static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
|
2009-01-30 12:58:00 +00:00
|
|
|
{
|
2009-07-28 16:33:02 +00:00
|
|
|
SpaceImage *sima= CTX_wm_space_image(C);
|
2009-01-30 12:58:00 +00:00
|
|
|
Object *obedit= CTX_data_edit_object(C);
|
2009-04-22 18:39:44 +00:00
|
|
|
uiPopupMenu *pup;
|
|
|
|
|
uiLayout *layout;
|
2009-01-30 12:58:00 +00:00
|
|
|
int show_uvedit;
|
|
|
|
|
|
2009-02-09 20:58:31 +00:00
|
|
|
show_uvedit= ED_space_image_show_uvedit(sima, obedit);
|
2009-01-30 12:58:00 +00:00
|
|
|
|
2011-02-27 18:03:19 +00:00
|
|
|
pup= uiPupMenuBegin(C, "Toolbox", ICON_NONE);
|
2009-04-22 18:39:44 +00:00
|
|
|
layout= uiPupMenuLayout(pup);
|
2009-01-30 12:58:00 +00:00
|
|
|
|
2011-02-27 18:03:19 +00:00
|
|
|
uiItemM(layout, C, "IMAGE_MT_view", NULL, ICON_NONE);
|
|
|
|
|
if(show_uvedit) uiItemM(layout, C, "IMAGE_MT_select", NULL, ICON_NONE);
|
|
|
|
|
uiItemM(layout, C, "IMAGE_MT_image", NULL, ICON_NONE);
|
|
|
|
|
if(show_uvedit) uiItemM(layout, C, "IMAGE_MT_uvs", NULL, ICON_NONE);
|
2009-01-30 12:58:00 +00:00
|
|
|
|
2009-04-22 18:39:44 +00:00
|
|
|
uiPupMenuEnd(C, pup);
|
2009-01-30 12:58:00 +00:00
|
|
|
|
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void IMAGE_OT_toolbox(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
|
|
|
|
ot->name= "Toolbox";
|
|
|
|
|
ot->idname= "IMAGE_OT_toolbox";
|
|
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
|
ot->invoke= toolbox_invoke;
|
|
|
|
|
ot->poll= space_image_main_area_poll;
|
|
|
|
|
}
|
|
|
|
|
|