2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-13 17:44:30 +00:00
|
|
|
* ***** 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/space_image.c
|
|
|
|
* \ingroup spimage
|
|
|
|
*/
|
|
|
|
|
2012-02-19 22:17:30 +00:00
|
|
|
#include "DNA_mesh_types.h"
|
2012-07-24 19:29:24 +00:00
|
|
|
#include "DNA_mask_types.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_meshdata_types.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2013-01-15 07:56:38 +00:00
|
|
|
#include "BLI_threads.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
#include "BKE_colortools.h"
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.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 "BKE_image.h"
|
2011-11-08 13:07:16 +00:00
|
|
|
#include "BKE_scene.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
#include "BKE_screen.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 "IMB_imbuf_types.h"
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
#include "ED_image.h"
|
2012-07-24 19:29:24 +00:00
|
|
|
#include "ED_mask.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 "ED_mesh.h"
|
2012-08-03 20:56:04 +00:00
|
|
|
#include "ED_node.h"
|
2013-10-31 17:20:31 +00:00
|
|
|
#include "ED_render.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
#include "ED_space_api.h"
|
|
|
|
#include "ED_screen.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 "ED_uvedit.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
#include "BIF_gl.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 "RNA_access.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
#include "UI_resources.h"
|
2014-02-13 19:49:26 +02:00
|
|
|
#include "UI_interface.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
#include "UI_view2d.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 "image_intern.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
2010-01-20 04:19:55 +00:00
|
|
|
/**************************** common state *****************************/
|
|
|
|
|
2010-04-06 02:05:54 +00:00
|
|
|
static void image_scopes_tag_refresh(ScrArea *sa)
|
2010-01-19 02:26:36 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
|
2010-01-19 02:26:36 +00:00
|
|
|
ARegion *ar;
|
2010-04-06 02:05:54 +00:00
|
|
|
|
2010-01-19 02:26:36 +00:00
|
|
|
/* only while histogram is visible */
|
2012-03-28 11:53:18 +00:00
|
|
|
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
2014-02-13 19:49:26 +02:00
|
|
|
if (ar->regiontype == RGN_TYPE_TOOLS && ar->flag & RGN_FLAG_HIDDEN)
|
2010-01-19 02:26:36 +00:00
|
|
|
return;
|
|
|
|
}
|
2010-04-06 02:05:54 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
sima->scopes.ok = 0;
|
2010-01-19 02:26:36 +00:00
|
|
|
}
|
|
|
|
|
2010-04-06 02:05:54 +00:00
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
/* ******************** manage regions ********************* */
|
|
|
|
|
|
|
|
ARegion *image_has_buttons_region(ScrArea *sa)
|
|
|
|
{
|
|
|
|
ARegion *ar, *arnew;
|
2011-05-20 05:27:31 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ar) return ar;
|
2009-02-21 15:31:01 +00:00
|
|
|
|
|
|
|
/* add subdiv level; after header */
|
2012-03-28 11:53:18 +00:00
|
|
|
ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
|
2011-05-20 05:27:31 +00:00
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
/* is error! */
|
2012-03-28 11:53:18 +00:00
|
|
|
if (ar == NULL) return NULL;
|
2009-02-21 15:31:01 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
arnew = MEM_callocN(sizeof(ARegion), "buttons for image");
|
2009-02-21 15:31:01 +00:00
|
|
|
|
|
|
|
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
|
2012-03-28 11:53:18 +00:00
|
|
|
arnew->regiontype = RGN_TYPE_UI;
|
2014-01-12 00:50:43 +01:00
|
|
|
arnew->alignment = RGN_ALIGN_RIGHT;
|
2009-02-21 15:31:01 +00:00
|
|
|
|
|
|
|
arnew->flag = RGN_FLAG_HIDDEN;
|
|
|
|
|
|
|
|
return arnew;
|
|
|
|
}
|
|
|
|
|
2014-02-13 19:49:26 +02:00
|
|
|
ARegion *image_has_tools_region(ScrArea *sa)
|
2010-01-19 01:32:06 +00:00
|
|
|
{
|
|
|
|
ARegion *ar, *arnew;
|
2011-05-20 05:27:31 +00:00
|
|
|
|
2014-02-13 19:49:26 +02:00
|
|
|
ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ar) return ar;
|
2011-05-20 05:27:31 +00:00
|
|
|
|
2010-01-19 01:32:06 +00:00
|
|
|
/* add subdiv level; after buttons */
|
2012-03-28 11:53:18 +00:00
|
|
|
ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
|
2011-05-20 05:27:31 +00:00
|
|
|
|
2010-01-19 01:32:06 +00:00
|
|
|
/* is error! */
|
2012-03-28 11:53:18 +00:00
|
|
|
if (ar == NULL) return NULL;
|
2010-01-19 01:32:06 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
arnew = MEM_callocN(sizeof(ARegion), "scopes for image");
|
2010-01-19 01:32:06 +00:00
|
|
|
|
|
|
|
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
|
2014-02-13 19:49:26 +02:00
|
|
|
arnew->regiontype = RGN_TYPE_TOOLS;
|
2014-01-12 00:50:43 +01:00
|
|
|
arnew->alignment = RGN_ALIGN_LEFT;
|
2010-01-19 01:32:06 +00:00
|
|
|
|
|
|
|
arnew->flag = RGN_FLAG_HIDDEN;
|
2010-04-06 02:05:54 +00:00
|
|
|
|
|
|
|
image_scopes_tag_refresh(sa);
|
2010-01-19 02:26:36 +00:00
|
|
|
|
2010-01-19 01:32:06 +00:00
|
|
|
return arnew;
|
|
|
|
}
|
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
/* ******************** default callbacks for image space ***************** */
|
|
|
|
|
2010-10-14 12:24:08 +00:00
|
|
|
static SpaceLink *image_new(const bContext *UNUSED(C))
|
2008-12-13 17:44:30 +00:00
|
|
|
{
|
|
|
|
ARegion *ar;
|
|
|
|
SpaceImage *simage;
|
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
simage = MEM_callocN(sizeof(SpaceImage), "initimage");
|
|
|
|
simage->spacetype = SPACE_IMAGE;
|
2012-07-25 10:55:45 +00:00
|
|
|
simage->zoom = 1.0f;
|
2014-04-01 11:34:00 +11:00
|
|
|
simage->lock = true;
|
2013-01-29 12:03:38 +00:00
|
|
|
simage->flag = SI_SHOW_GPENCIL | SI_USE_ALPHA;
|
2012-03-28 11:53:18 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
simage->iuser.ok = true;
|
2012-03-28 11:53:18 +00:00
|
|
|
simage->iuser.fie_ima = 2;
|
|
|
|
simage->iuser.frames = 100;
|
2010-05-10 01:46:44 +00:00
|
|
|
|
|
|
|
scopes_new(&simage->scopes);
|
2012-03-28 11:53:18 +00:00
|
|
|
simage->sample_line_hist.height = 100;
|
2009-12-04 04:56:42 +00:00
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
/* header */
|
2012-03-28 11:53:18 +00:00
|
|
|
ar = MEM_callocN(sizeof(ARegion), "header for image");
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
BLI_addtail(&simage->regionbase, ar);
|
2012-03-28 11:53:18 +00:00
|
|
|
ar->regiontype = RGN_TYPE_HEADER;
|
|
|
|
ar->alignment = RGN_ALIGN_BOTTOM;
|
2008-12-13 17:44:30 +00:00
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
/* buttons/list view */
|
2012-03-28 11:53:18 +00:00
|
|
|
ar = MEM_callocN(sizeof(ARegion), "buttons for image");
|
2009-02-21 15:31:01 +00:00
|
|
|
|
|
|
|
BLI_addtail(&simage->regionbase, ar);
|
2012-03-28 11:53:18 +00:00
|
|
|
ar->regiontype = RGN_TYPE_UI;
|
2014-01-12 00:50:43 +01:00
|
|
|
ar->alignment = RGN_ALIGN_RIGHT;
|
2009-02-21 15:31:01 +00:00
|
|
|
ar->flag = RGN_FLAG_HIDDEN;
|
|
|
|
|
2014-02-13 19:49:26 +02:00
|
|
|
/* scopes/uv sculpt/paint */
|
2012-03-28 11:53:18 +00:00
|
|
|
ar = MEM_callocN(sizeof(ARegion), "buttons for image");
|
2010-01-19 01:32:06 +00:00
|
|
|
|
|
|
|
BLI_addtail(&simage->regionbase, ar);
|
2014-02-13 19:49:26 +02:00
|
|
|
ar->regiontype = RGN_TYPE_TOOLS;
|
2014-01-12 00:50:43 +01:00
|
|
|
ar->alignment = RGN_ALIGN_LEFT;
|
2010-01-19 01:32:06 +00:00
|
|
|
ar->flag = RGN_FLAG_HIDDEN;
|
2010-04-06 02:05:54 +00:00
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
/* main area */
|
2012-03-28 11:53:18 +00:00
|
|
|
ar = MEM_callocN(sizeof(ARegion), "main area for image");
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
BLI_addtail(&simage->regionbase, ar);
|
2012-03-28 11:53:18 +00:00
|
|
|
ar->regiontype = RGN_TYPE_WINDOW;
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
return (SpaceLink *)simage;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* not spacelink itself */
|
|
|
|
static void image_free(SpaceLink *sl)
|
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
SpaceImage *simage = (SpaceImage *) sl;
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2010-04-06 02:05:54 +00:00
|
|
|
scopes_free(&simage->scopes);
|
2008-12-13 17:44:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
/* spacetype; init callback, add handlers */
|
2010-10-14 12:24:08 +00:00
|
|
|
static void image_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
|
2008-12-13 17:44:30 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
ListBase *lb = WM_dropboxmap_find("Image", SPACE_IMAGE, 0);
|
2008-12-13 17:44:30 +00:00
|
|
|
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
/* add drop boxes */
|
|
|
|
WM_event_add_dropbox_handler(&sa->handlers, lb);
|
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static SpaceLink *image_duplicate(SpaceLink *sl)
|
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
SpaceImage *simagen = MEM_dupallocN(sl);
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
/* clear or remove stuff from old */
|
2011-03-23 14:24:13 +00:00
|
|
|
|
|
|
|
scopes_new(&simagen->scopes);
|
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
return (SpaceLink *)simagen;
|
|
|
|
}
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void image_operatortypes(void)
|
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
|
|
|
{
|
|
|
|
WM_operatortype_append(IMAGE_OT_view_all);
|
|
|
|
WM_operatortype_append(IMAGE_OT_view_pan);
|
|
|
|
WM_operatortype_append(IMAGE_OT_view_selected);
|
|
|
|
WM_operatortype_append(IMAGE_OT_view_zoom);
|
|
|
|
WM_operatortype_append(IMAGE_OT_view_zoom_in);
|
|
|
|
WM_operatortype_append(IMAGE_OT_view_zoom_out);
|
|
|
|
WM_operatortype_append(IMAGE_OT_view_zoom_ratio);
|
2011-06-25 18:51:29 +00:00
|
|
|
WM_operatortype_append(IMAGE_OT_view_ndof);
|
2009-01-30 12:58:00 +00:00
|
|
|
|
2009-02-10 23:17:58 +00:00
|
|
|
WM_operatortype_append(IMAGE_OT_new);
|
|
|
|
WM_operatortype_append(IMAGE_OT_open);
|
2012-06-01 17:28:09 +00:00
|
|
|
WM_operatortype_append(IMAGE_OT_match_movie_length);
|
2009-02-10 23:17:58 +00:00
|
|
|
WM_operatortype_append(IMAGE_OT_replace);
|
|
|
|
WM_operatortype_append(IMAGE_OT_reload);
|
|
|
|
WM_operatortype_append(IMAGE_OT_save);
|
|
|
|
WM_operatortype_append(IMAGE_OT_save_as);
|
|
|
|
WM_operatortype_append(IMAGE_OT_save_sequence);
|
|
|
|
WM_operatortype_append(IMAGE_OT_pack);
|
|
|
|
WM_operatortype_append(IMAGE_OT_unpack);
|
2011-02-23 12:02:43 +00:00
|
|
|
|
|
|
|
WM_operatortype_append(IMAGE_OT_invert);
|
2009-02-11 19:16:14 +00:00
|
|
|
|
2010-02-09 19:37:37 +00:00
|
|
|
WM_operatortype_append(IMAGE_OT_cycle_render_slot);
|
|
|
|
|
2009-02-10 23:17:58 +00:00
|
|
|
WM_operatortype_append(IMAGE_OT_sample);
|
2010-03-23 01:22:33 +00:00
|
|
|
WM_operatortype_append(IMAGE_OT_sample_line);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(IMAGE_OT_curves_point_set);
|
2009-02-10 23:17:58 +00:00
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
WM_operatortype_append(IMAGE_OT_properties);
|
2014-02-13 19:49:26 +02:00
|
|
|
WM_operatortype_append(IMAGE_OT_toolshelf);
|
2014-04-02 17:58:34 +06:00
|
|
|
|
|
|
|
WM_operatortype_append(IMAGE_OT_change_frame);
|
2014-06-28 19:13:54 +02:00
|
|
|
|
|
|
|
WM_operatortype_append(IMAGE_OT_read_renderlayers);
|
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
|
|
|
}
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void image_keymap(struct wmKeyConfig *keyconf)
|
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
|
|
|
{
|
2012-03-24 02:51:46 +00:00
|
|
|
wmKeyMap *keymap = WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0);
|
2010-10-13 01:58:09 +00:00
|
|
|
wmKeyMapItem *kmi;
|
2012-03-30 16:09:12 +00:00
|
|
|
int i;
|
2009-02-21 15:31:01 +00:00
|
|
|
|
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_new", NKEY, KM_PRESS, KM_ALT, 0);
|
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_open", OKEY, KM_PRESS, KM_ALT, 0);
|
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_reload", RKEY, KM_PRESS, KM_ALT, 0);
|
2014-06-28 19:13:54 +02:00
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_read_renderlayers", RKEY, KM_PRESS, KM_CTRL, 0);
|
2009-02-21 15:31:01 +00:00
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_save", SKEY, KM_PRESS, KM_ALT, 0);
|
2009-11-01 00:06:53 +00:00
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_save_as", F3KEY, KM_PRESS, 0, 0);
|
2009-02-21 15:31:01 +00:00
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_properties", NKEY, KM_PRESS, 0, 0);
|
2014-02-13 19:49:26 +02:00
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_toolshelf", TKEY, KM_PRESS, 0, 0);
|
2010-02-09 19:37:37 +00:00
|
|
|
|
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_cycle_render_slot", JKEY, KM_PRESS, 0, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "IMAGE_OT_cycle_render_slot", JKEY, KM_PRESS, KM_ALT, 0)->ptr, "reverse", true);
|
2009-02-21 15:31:01 +00:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
keymap = WM_keymap_find(keyconf, "Image", SPACE_IMAGE, 0);
|
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
|
|
|
|
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
|
2013-08-20 23:40:46 +00:00
|
|
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "IMAGE_OT_view_all", FKEY, KM_PRESS, 0, 0);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "fit_view", true);
|
2013-08-20 23:40:46 +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
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_pan", MIDDLEMOUSE, KM_PRESS, 0, 0);
|
2010-09-30 21:07:42 +00:00
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_pan", MIDDLEMOUSE, KM_PRESS, KM_SHIFT, 0);
|
2010-01-11 11:14:36 +00:00
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_pan", MOUSEPAN, 0, 0, 0);
|
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
|
|
|
|
2011-06-25 18:51:29 +00:00
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_all", NDOF_BUTTON_FIT, KM_PRESS, 0, 0); // or view selected?
|
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_ndof", NDOF_MOTION, 0, 0, 0);
|
|
|
|
|
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
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_in", WHEELINMOUSE, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_out", WHEELOUTMOUSE, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_in", PADPLUSKEY, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_out", PADMINUS, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0);
|
2010-01-11 11:14:36 +00:00
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom", MOUSEZOOM, 0, 0, 0);
|
2012-12-29 13:21:01 +00:00
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom", MOUSEPAN, 0, KM_CTRL, 0);
|
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
|
|
|
|
2012-12-14 22:08:19 +00:00
|
|
|
/* ctrl now works as well, shift + numpad works as arrow keys on Windows */
|
|
|
|
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD8, KM_PRESS, KM_CTRL, 0)->ptr, "ratio", 8.0f);
|
|
|
|
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD4, KM_PRESS, KM_CTRL, 0)->ptr, "ratio", 4.0f);
|
|
|
|
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD2, KM_PRESS, KM_CTRL, 0)->ptr, "ratio", 2.0f);
|
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
|
|
|
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD8, KM_PRESS, KM_SHIFT, 0)->ptr, "ratio", 8.0f);
|
|
|
|
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD4, KM_PRESS, KM_SHIFT, 0)->ptr, "ratio", 4.0f);
|
|
|
|
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD2, KM_PRESS, KM_SHIFT, 0)->ptr, "ratio", 2.0f);
|
2012-12-14 22:08:19 +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
|
|
|
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD1, KM_PRESS, 0, 0)->ptr, "ratio", 1.0f);
|
|
|
|
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD2, KM_PRESS, 0, 0)->ptr, "ratio", 0.5f);
|
|
|
|
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD4, KM_PRESS, 0, 0)->ptr, "ratio", 0.25f);
|
|
|
|
RNA_float_set(WM_keymap_add_item(keymap, "IMAGE_OT_view_zoom_ratio", PAD8, KM_PRESS, 0, 0)->ptr, "ratio", 0.125f);
|
2009-01-30 12:58:00 +00:00
|
|
|
|
2014-04-02 17:58:34 +06:00
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_change_frame", LEFTMOUSE, KM_PRESS, 0, 0);
|
|
|
|
|
2009-02-10 23:17:58 +00:00
|
|
|
WM_keymap_add_item(keymap, "IMAGE_OT_sample", ACTIONMOUSE, KM_PRESS, 0, 0);
|
2009-03-29 02:15:13 +00:00
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "IMAGE_OT_curves_point_set", ACTIONMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "point", 0);
|
|
|
|
RNA_enum_set(WM_keymap_add_item(keymap, "IMAGE_OT_curves_point_set", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "point", 1);
|
2009-02-10 23:17:58 +00:00
|
|
|
|
2010-10-13 01:58:09 +00:00
|
|
|
/* toggle editmode is handy to have while UV unwrapping */
|
2012-03-24 02:51:46 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
|
2010-10-13 01:58:09 +00:00
|
|
|
RNA_enum_set(kmi->ptr, "mode", OB_MODE_EDIT);
|
2014-04-01 11:34:00 +11:00
|
|
|
RNA_boolean_set(kmi->ptr, "toggle", true);
|
2012-03-30 16:09:12 +00:00
|
|
|
|
|
|
|
/* fast switch to render slots */
|
2012-04-21 12:51:47 +00:00
|
|
|
for (i = 0; i < MAX2(IMA_MAX_RENDER_SLOT, 9); i++) {
|
2012-06-17 09:58:26 +00:00
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_int", ONEKEY + i, KM_PRESS, 0, 0);
|
2012-03-30 16:09:12 +00:00
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.image.render_slot");
|
|
|
|
RNA_int_set(kmi->ptr, "value", i);
|
|
|
|
}
|
2012-08-06 12:12:45 +00:00
|
|
|
|
|
|
|
/* pivot */
|
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
|
|
|
|
RNA_string_set(kmi->ptr, "value", "CENTER");
|
|
|
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
|
|
|
|
RNA_string_set(kmi->ptr, "value", "MEDIAN");
|
|
|
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, 0, 0);
|
|
|
|
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
|
|
|
|
RNA_string_set(kmi->ptr, "value", "CURSOR");
|
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
|
|
|
}
|
|
|
|
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
/* dropboxes */
|
2013-03-13 09:03:46 +00:00
|
|
|
static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
if (drag->type == WM_DRAG_PATH)
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void image_drop_copy(wmDrag *drag, wmDropBox *drop)
|
|
|
|
{
|
|
|
|
/* copy drag path to properties */
|
2010-06-14 03:52:10 +00:00
|
|
|
RNA_string_set(drop->ptr, "filepath", drag->path);
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* area+region dropbox definition */
|
|
|
|
static void image_dropboxes(void)
|
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
ListBase *lb = WM_dropboxmap_find("Image", SPACE_IMAGE, 0);
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
|
|
|
WM_dropbox_add(lb, "IMAGE_OT_open", image_drop_poll, image_drop_copy);
|
|
|
|
}
|
|
|
|
|
2012-08-03 20:56:04 +00:00
|
|
|
/**
|
|
|
|
* \note take care not to get into feedback loop here,
|
|
|
|
* calling composite job causes viewer to refresh.
|
|
|
|
*/
|
|
|
|
static void image_refresh(const bContext *C, ScrArea *sa)
|
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
|
|
|
{
|
2011-11-08 13:07:16 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2012-08-03 20:56:04 +00:00
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
2012-03-28 11:53:18 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
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
|
|
|
Image *ima;
|
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
ima = ED_space_image(sima);
|
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
|
|
|
|
2012-06-04 10:41:18 +00:00
|
|
|
BKE_image_user_check_frame_calc(&sima->iuser, scene->r.cfra, 0);
|
2010-03-16 08:06:50 +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
|
|
|
/* check if we have to set the image from the editmesh */
|
2012-08-03 20:56:04 +00:00
|
|
|
if (ima && (ima->source == IMA_SRC_VIEWER && sima->mode == SI_MODE_MASK)) {
|
2013-06-24 22:41:37 +00:00
|
|
|
if (scene->nodetree) {
|
|
|
|
Mask *mask = ED_space_image_get_mask(sima);
|
|
|
|
if (mask) {
|
|
|
|
ED_node_composite_job(C, scene->nodetree, scene);
|
2012-08-03 20:56:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ima && (ima->source == IMA_SRC_VIEWER || sima->pin)) {
|
|
|
|
/* pass */
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (obedit && obedit->type == OB_MESH) {
|
2012-03-28 11:53:18 +00:00
|
|
|
Mesh *me = (Mesh *)obedit->data;
|
|
|
|
struct BMEditMesh *em = me->edit_btmesh;
|
2014-04-01 11:34:00 +11:00
|
|
|
bool sloppy = true; /* partially selected face is ok */
|
|
|
|
bool selected = !(scene->toolsettings->uv_flag & UV_SYNC_SELECTION); /* only selected active face? */
|
2011-11-08 13:07:16 +00:00
|
|
|
|
2012-05-05 14:33:36 +00:00
|
|
|
if (BKE_scene_use_new_shading_nodes(scene)) {
|
2013-04-15 18:05:53 +00:00
|
|
|
/* new shading system does not alter image */
|
2011-11-08 13:07:16 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* old shading system, we set texface */
|
2011-11-10 03:05:11 +00:00
|
|
|
MTexPoly *tf;
|
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
|
|
|
|
2012-03-27 04:46:52 +00:00
|
|
|
if (em && EDBM_mtexpoly_check(em)) {
|
2012-08-31 15:01:40 +00:00
|
|
|
tf = EDBM_mtexpoly_active_get(em, NULL, sloppy, selected);
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tf) {
|
2011-11-08 13:07:16 +00:00
|
|
|
/* don't need to check for pin here, see above */
|
2012-03-28 11:53:18 +00:00
|
|
|
sima->image = tf->tpage;
|
2011-11-08 13:07:16 +00:00
|
|
|
|
2012-10-07 09:48:59 +00:00
|
|
|
if ((sima->flag & SI_EDITTILE) == 0) {
|
|
|
|
sima->curtile = tf->tile;
|
|
|
|
}
|
2011-11-08 13:07:16 +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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-29 20:28:18 +01:00
|
|
|
static void image_listener(bScreen *sc, ScrArea *sa, wmNotifier *wmn)
|
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
|
|
|
{
|
2014-01-29 20:28:18 +01:00
|
|
|
Scene *scene = sc->scene;
|
2012-03-28 11:53:18 +00:00
|
|
|
SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
|
2010-01-19 01:32:06 +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
|
|
|
/* context changes */
|
2012-03-28 11:53:18 +00:00
|
|
|
switch (wmn->category) {
|
2013-04-02 12:41:11 +00:00
|
|
|
case NC_WINDOW:
|
|
|
|
/* notifier comes from editing color space */
|
|
|
|
image_scopes_tag_refresh(sa);
|
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
break;
|
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
|
|
|
case NC_SCENE:
|
2012-03-28 11:53:18 +00:00
|
|
|
switch (wmn->data) {
|
2010-03-16 08:06:50 +00:00
|
|
|
case ND_FRAME:
|
2010-04-06 02:05:54 +00:00
|
|
|
image_scopes_tag_refresh(sa);
|
2010-03-28 23:30:00 +00:00
|
|
|
ED_area_tag_refresh(sa);
|
2012-08-03 20:56:04 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
2010-03-28 23:30:00 +00:00
|
|
|
break;
|
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
|
|
|
case ND_MODE:
|
2012-09-19 17:09:14 +00:00
|
|
|
if (wmn->subtype == NS_EDITMODE_MESH)
|
|
|
|
ED_area_tag_refresh(sa);
|
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
break;
|
2009-01-27 17:12:40 +00:00
|
|
|
case ND_RENDER_RESULT:
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
case ND_RENDER_OPTIONS:
|
2009-01-27 17:12:40 +00:00
|
|
|
case ND_COMPO_RESULT:
|
2010-01-20 04:19:55 +00:00
|
|
|
if (ED_space_image_show_render(sima))
|
2010-04-06 02:05:54 +00:00
|
|
|
image_scopes_tag_refresh(sa);
|
2012-08-03 20:56:04 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
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
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2009-12-30 14:37:25 +00:00
|
|
|
case NC_IMAGE:
|
2010-01-31 23:25:57 +00:00
|
|
|
if (wmn->reference == sima->image || !wmn->reference) {
|
2013-05-15 14:37:05 +00:00
|
|
|
if (wmn->action != NA_PAINTING) {
|
|
|
|
image_scopes_tag_refresh(sa);
|
|
|
|
ED_area_tag_refresh(sa);
|
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
}
|
2010-01-19 01:32:06 +00:00
|
|
|
}
|
2009-02-11 19:16:14 +00:00
|
|
|
break;
|
2012-10-21 05:46:41 +00:00
|
|
|
case NC_SPACE:
|
2012-03-24 06:38:07 +00:00
|
|
|
if (wmn->data == ND_SPACE_IMAGE) {
|
2010-04-06 02:05:54 +00:00
|
|
|
image_scopes_tag_refresh(sa);
|
2009-09-16 17:43:09 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
2010-03-28 23:30:00 +00:00
|
|
|
}
|
2009-09-16 17:43:09 +00:00
|
|
|
break;
|
2012-07-25 13:44:59 +00:00
|
|
|
case NC_MASK:
|
2012-08-01 10:50:39 +00:00
|
|
|
{
|
|
|
|
// Scene *scene = wmn->window->screen->scene;
|
|
|
|
/* ideally would check for: ED_space_image_check_show_maskedit(scene, sima) but we cant get the scene */
|
|
|
|
if (sima->mode == SI_MODE_MASK) {
|
|
|
|
switch (wmn->data) {
|
|
|
|
case ND_SELECT:
|
2012-08-03 20:56:04 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
break;
|
2012-08-01 10:50:39 +00:00
|
|
|
case ND_DATA:
|
|
|
|
case ND_DRAW:
|
2012-08-03 20:56:04 +00:00
|
|
|
/* causes node-recalc */
|
2012-08-01 10:50:39 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
2012-08-03 20:56:04 +00:00
|
|
|
ED_area_tag_refresh(sa);
|
2012-08-01 10:50:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch (wmn->action) {
|
|
|
|
case NA_SELECTED:
|
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
break;
|
|
|
|
case NA_EDITED:
|
2012-08-03 20:56:04 +00:00
|
|
|
/* causes node-recalc */
|
2012-08-01 10:50:39 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
2012-08-03 20:56:04 +00:00
|
|
|
ED_area_tag_refresh(sa);
|
2012-08-01 10:50:39 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-07-25 13:44:59 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-08-01 10:50:39 +00:00
|
|
|
}
|
2009-09-16 17:43:09 +00:00
|
|
|
case NC_GEOM:
|
2013-07-21 17:04:54 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
switch (wmn->data) {
|
2009-09-16 17:43:09 +00:00
|
|
|
case ND_DATA:
|
|
|
|
case ND_SELECT:
|
2010-12-13 14:47:31 +00:00
|
|
|
image_scopes_tag_refresh(sa);
|
2009-12-14 18:15:48 +00:00
|
|
|
ED_area_tag_refresh(sa);
|
2009-07-08 15:34:41 +00:00
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
break;
|
|
|
|
}
|
2013-07-21 17:04:54 +00:00
|
|
|
break;
|
|
|
|
}
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
case NC_OBJECT:
|
2010-11-15 07:07:14 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
switch (wmn->data) {
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
case ND_TRANSFORM:
|
2010-11-15 07:07:14 +00:00
|
|
|
case ND_MODIFIER:
|
2014-03-11 17:46:11 +11:00
|
|
|
{
|
|
|
|
Object *ob = OBACT;
|
|
|
|
if (ob && (ob == wmn->reference) && (ob->mode & OB_MODE_EDIT)) {
|
2014-01-29 20:28:18 +01:00
|
|
|
if (sima->lock && (sima->flag & SI_DRAWSHADOW)) {
|
|
|
|
ED_area_tag_refresh(sa);
|
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
}
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
}
|
|
|
|
break;
|
2014-03-11 17:46:11 +11:00
|
|
|
}
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
|
|
|
}
|
2014-03-11 17:46:11 +11:00
|
|
|
|
2013-07-21 08:16:37 +00:00
|
|
|
break;
|
2010-11-15 07:07:14 +00:00
|
|
|
}
|
2014-05-30 16:26:29 +06:00
|
|
|
case NC_ID:
|
|
|
|
{
|
|
|
|
if (wmn->action == NA_RENAME) {
|
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2014-09-16 14:28:58 +06:00
|
|
|
case NC_WM:
|
2014-09-18 09:37:49 +10:00
|
|
|
if (wmn->data == ND_UNDO) {
|
2014-09-16 14:28:58 +06:00
|
|
|
ED_area_tag_redraw(sa);
|
|
|
|
ED_area_tag_refresh(sa);
|
|
|
|
}
|
|
|
|
break;
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-24 19:29:24 +00:00
|
|
|
const char *image_context_dir[] = {"edit_image", "edit_mask", NULL};
|
2011-02-15 14:38:43 +00:00
|
|
|
|
2009-03-19 19:03:38 +00:00
|
|
|
static int image_context(const bContext *C, const char *member, bContextDataResult *result)
|
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
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
SpaceImage *sima = CTX_wm_space_image(C);
|
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
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (CTX_data_dir(member)) {
|
2011-02-15 14:38:43 +00:00
|
|
|
CTX_data_dir_set(result, image_context_dir);
|
2009-06-20 14:55:28 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (CTX_data_equals(member, "edit_image")) {
|
2012-03-28 11:53:18 +00:00
|
|
|
CTX_data_id_pointer_set(result, (ID *)ED_space_image(sima));
|
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
|
|
|
return 1;
|
|
|
|
}
|
2012-07-24 19:29:24 +00:00
|
|
|
else if (CTX_data_equals(member, "edit_mask")) {
|
2012-07-25 13:44:59 +00:00
|
|
|
Mask *mask = ED_space_image_get_mask(sima);
|
2012-07-24 19:29:24 +00:00
|
|
|
if (mask) {
|
|
|
|
CTX_data_id_pointer_set(result, &mask->id);
|
|
|
|
}
|
2014-04-01 11:34:00 +11:00
|
|
|
return true;
|
2012-07-24 19:29:24 +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
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************** main region ***************************/
|
|
|
|
|
|
|
|
/* sets up the fields of the View2D from zoom and offset */
|
2009-10-22 23:22:05 +00:00
|
|
|
static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar)
|
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
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
Image *ima = ED_space_image(sima);
|
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
|
|
|
float x1, y1, w, h;
|
|
|
|
int width, height, winx, winy;
|
|
|
|
|
|
|
|
#if 0
|
2012-10-21 07:58:38 +00:00
|
|
|
if (image_preview_active(curarea, &width, &height)) {}
|
2009-02-17 21:07:01 +00:00
|
|
|
else
|
2009-10-22 23:22:05 +00:00
|
|
|
#endif
|
2012-07-25 16:30:53 +00:00
|
|
|
ED_space_image_get_size(sima, &width, &height);
|
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
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
w = width;
|
|
|
|
h = height;
|
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
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ima)
|
2012-03-28 11:53:18 +00:00
|
|
|
h *= ima->aspy / ima->aspx;
|
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
|
|
|
|
2012-09-15 11:48:20 +00:00
|
|
|
winx = BLI_rcti_size_x(&ar->winrct) + 1;
|
|
|
|
winy = BLI_rcti_size_y(&ar->winrct) + 1;
|
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
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
ar->v2d.tot.xmin = 0;
|
|
|
|
ar->v2d.tot.ymin = 0;
|
|
|
|
ar->v2d.tot.xmax = w;
|
|
|
|
ar->v2d.tot.ymax = 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
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
ar->v2d.mask.xmin = ar->v2d.mask.ymin = 0;
|
|
|
|
ar->v2d.mask.xmax = winx;
|
|
|
|
ar->v2d.mask.ymax = winy;
|
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
|
|
|
/* which part of the image space do we see? */
|
2012-03-28 11:53:18 +00:00
|
|
|
x1 = ar->winrct.xmin + (winx - sima->zoom * w) / 2.0f;
|
|
|
|
y1 = ar->winrct.ymin + (winy - sima->zoom * h) / 2.0f;
|
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
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
x1 -= sima->zoom * sima->xof;
|
|
|
|
y1 -= sima->zoom * sima->yof;
|
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
|
|
|
|
|
|
|
/* relative display right */
|
2012-03-28 11:53:18 +00:00
|
|
|
ar->v2d.cur.xmin = ((ar->winrct.xmin - (float)x1) / sima->zoom);
|
|
|
|
ar->v2d.cur.xmax = ar->v2d.cur.xmin + ((float)winx / sima->zoom);
|
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
|
|
|
|
|
|
|
/* relative display left */
|
2012-03-28 11:53:18 +00:00
|
|
|
ar->v2d.cur.ymin = ((ar->winrct.ymin - (float)y1) / sima->zoom);
|
|
|
|
ar->v2d.cur.ymax = ar->v2d.cur.ymin + ((float)winy / sima->zoom);
|
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
|
|
|
|
|
|
|
/* normalize 0.0..1.0 */
|
|
|
|
ar->v2d.cur.xmin /= w;
|
|
|
|
ar->v2d.cur.xmax /= w;
|
|
|
|
ar->v2d.cur.ymin /= h;
|
|
|
|
ar->v2d.cur.ymax /= h;
|
|
|
|
}
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
|
|
|
static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
|
|
|
|
{
|
2009-10-22 23:22:05 +00:00
|
|
|
wmKeyMap *keymap;
|
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
|
|
|
// image space manages own v2d
|
|
|
|
// UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
|
2009-02-19 23:53:40 +00:00
|
|
|
|
2012-07-25 14:46:38 +00:00
|
|
|
/* mask polls mode */
|
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "Mask Editing", 0, 0);
|
|
|
|
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
|
|
|
|
2009-02-19 23:53:40 +00:00
|
|
|
/* image paint polls for mode */
|
2014-07-21 12:02:05 +02:00
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "Curve", 0, 0);
|
|
|
|
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
|
|
|
|
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "Paint Curve", 0, 0);
|
|
|
|
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
|
2009-02-19 23:53:40 +00:00
|
|
|
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
2009-07-08 15:34:41 +00:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "UV Editor", 0, 0);
|
2009-10-22 23:22:05 +00:00
|
|
|
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
2008-12-13 17:44:30 +00:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "UV Sculpt", 0, 0);
|
2012-01-17 16:31:13 +00:00
|
|
|
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
/* own keymaps */
|
2012-03-24 02:51:46 +00:00
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
|
2009-02-21 15:31:01 +00:00
|
|
|
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
2012-03-24 02:51:46 +00:00
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "Image", SPACE_IMAGE, 0);
|
2008-12-13 17:44:30 +00:00
|
|
|
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void image_main_area_draw(const bContext *C, ARegion *ar)
|
|
|
|
{
|
|
|
|
/* draw entirely, view changes should be handled here */
|
2012-03-28 11:53:18 +00:00
|
|
|
SpaceImage *sima = CTX_wm_space_image(C);
|
|
|
|
Object *obact = CTX_data_active_object(C);
|
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2012-07-26 09:54:52 +00:00
|
|
|
Mask *mask = NULL;
|
2014-07-21 12:02:05 +02:00
|
|
|
bool curve = false;
|
2012-03-28 11:53:18 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
View2D *v2d = &ar->v2d;
|
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
|
|
|
//View2DScrollers *scrollers;
|
2008-12-13 17:44:30 +00:00
|
|
|
float col[3];
|
|
|
|
|
2011-01-04 15:19:16 +00:00
|
|
|
/* XXX not supported yet, disabling for now */
|
|
|
|
scene->r.scemode &= ~R_COMP_CROP;
|
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
/* clear and setup matrix */
|
|
|
|
UI_GetThemeColor3fv(TH_BACK, col);
|
|
|
|
glClearColor(col[0], col[1], col[2], 0.0);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
/* put scene context variable in iuser */
|
2013-10-31 17:20:31 +00:00
|
|
|
if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) {
|
|
|
|
/* for render result, try to use the currently rendering scene */
|
|
|
|
Scene *render_scene = ED_render_job_get_scene(C);
|
|
|
|
if (render_scene)
|
|
|
|
sima->iuser.scene = render_scene;
|
|
|
|
else
|
|
|
|
sima->iuser.scene = scene;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sima->iuser.scene = scene;
|
2009-10-22 23:22:05 +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
|
|
|
/* we set view2d from own zoom and offset each time */
|
2009-10-22 23:22:05 +00:00
|
|
|
image_main_area_set_view2d(sima, ar);
|
2012-07-24 19:29:24 +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
|
|
|
/* we draw image in pixelspace */
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
draw_image_main(C, ar);
|
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
|
|
|
|
|
|
|
/* and uvs in 0.0-1.0 space */
|
2010-10-14 01:22:14 +00:00
|
|
|
UI_view2d_view_ortho(v2d);
|
2013-04-10 16:59:55 +00:00
|
|
|
|
|
|
|
ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
|
|
|
|
|
2012-01-17 16:31:13 +00:00
|
|
|
draw_uvedit_main(sima, ar, scene, obedit, obact);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-07-26 09:54:52 +00:00
|
|
|
/* check for mask (delay draw) */
|
2012-07-31 17:31:34 +00:00
|
|
|
if (ED_space_image_show_uvedit(sima, obedit)) {
|
2012-07-26 09:54:52 +00:00
|
|
|
/* pass */
|
|
|
|
}
|
|
|
|
else if (sima->mode == SI_MODE_MASK) {
|
|
|
|
mask = ED_space_image_get_mask(sima);
|
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
else if (ED_space_image_paint_curve(C)) {
|
|
|
|
curve = true;
|
|
|
|
}
|
2012-07-26 09:54:52 +00:00
|
|
|
|
2009-11-01 00:06:53 +00:00
|
|
|
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
|
2012-06-10 12:09:25 +00:00
|
|
|
|
2012-12-17 02:34:53 +00:00
|
|
|
if (sima->flag & SI_SHOW_GPENCIL) {
|
|
|
|
/* Grease Pencil too (in addition to UV's) */
|
2014-04-01 11:34:00 +11:00
|
|
|
draw_image_grease_pencil((bContext *)C, true);
|
2012-12-17 02:34:53 +00:00
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-06-10 12:09:25 +00:00
|
|
|
/* sample line */
|
|
|
|
draw_image_sample_line(sima);
|
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
UI_view2d_view_restore(C);
|
2009-11-01 00:06:53 +00:00
|
|
|
|
2012-12-17 02:34:53 +00:00
|
|
|
if (sima->flag & SI_SHOW_GPENCIL) {
|
|
|
|
/* draw Grease Pencil - screen space only */
|
2014-04-01 11:34:00 +11:00
|
|
|
draw_image_grease_pencil((bContext *)C, false);
|
2012-12-17 02:34:53 +00:00
|
|
|
}
|
2012-06-10 12:09:25 +00:00
|
|
|
|
2012-07-26 09:54:52 +00:00
|
|
|
if (mask) {
|
2013-01-15 07:56:38 +00:00
|
|
|
Image *image = ED_space_image(sima);
|
|
|
|
int width, height, show_viewer;
|
2012-09-13 02:28:48 +00:00
|
|
|
float aspx, aspy;
|
2013-01-15 07:56:38 +00:00
|
|
|
|
|
|
|
show_viewer = (image && image->source == IMA_SRC_VIEWER);
|
|
|
|
|
|
|
|
if (show_viewer) {
|
2013-01-15 07:56:50 +00:00
|
|
|
/* ED_space_image_get* will acquire image buffer which requires
|
2013-01-15 07:56:38 +00:00
|
|
|
* lock here by the same reason why lock is needed in draw_image_main
|
|
|
|
*/
|
|
|
|
BLI_lock_thread(LOCK_DRAW_IMAGE);
|
|
|
|
}
|
|
|
|
|
2012-07-26 22:41:40 +00:00
|
|
|
ED_space_image_get_size(sima, &width, &height);
|
2012-09-13 02:28:48 +00:00
|
|
|
ED_space_image_get_aspect(sima, &aspx, &aspy);
|
2013-01-15 07:56:38 +00:00
|
|
|
|
|
|
|
if (show_viewer)
|
|
|
|
BLI_unlock_thread(LOCK_DRAW_IMAGE);
|
|
|
|
|
2012-07-26 09:54:52 +00:00
|
|
|
ED_mask_draw_region(mask, ar,
|
2013-10-12 14:09:05 +00:00
|
|
|
sima->mask_info.draw_flag,
|
|
|
|
sima->mask_info.draw_type,
|
|
|
|
sima->mask_info.overlay_mode,
|
2012-07-26 09:54:52 +00:00
|
|
|
width, height,
|
2012-09-13 02:28:48 +00:00
|
|
|
aspx, aspy,
|
2014-04-01 11:34:00 +11:00
|
|
|
true, false,
|
2012-07-26 09:54:52 +00:00
|
|
|
NULL, C);
|
|
|
|
|
2013-10-12 14:09:05 +00:00
|
|
|
UI_view2d_view_ortho(v2d);
|
2013-08-26 20:23:26 +00:00
|
|
|
draw_image_cursor(ar, sima->cursor);
|
2013-10-12 14:09:05 +00:00
|
|
|
UI_view2d_view_restore(C);
|
2012-07-24 19:29:24 +00:00
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
else if (curve) {
|
|
|
|
UI_view2d_view_ortho(v2d);
|
|
|
|
draw_image_cursor(ar, sima->cursor);
|
|
|
|
UI_view2d_view_restore(C);
|
|
|
|
}
|
2012-07-24 19:29:24 +00:00
|
|
|
|
2014-04-02 16:50:06 +06:00
|
|
|
draw_image_cache(C, ar);
|
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
/* scrollers? */
|
2012-03-03 16:31:46 +00:00
|
|
|
#if 0
|
2012-03-28 11:53:18 +00:00
|
|
|
scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_UNIT_VALUES, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
|
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
|
|
|
UI_view2d_scrollers_draw(C, v2d, scrollers);
|
2012-03-03 16:31:46 +00:00
|
|
|
UI_view2d_scrollers_free(scrollers);
|
|
|
|
#endif
|
2008-12-13 17:44:30 +00:00
|
|
|
}
|
|
|
|
|
2013-06-24 22:41:33 +00:00
|
|
|
static void image_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn)
|
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
|
|
|
/* context changes */
|
2012-03-28 11:53:18 +00:00
|
|
|
switch (wmn->category) {
|
2012-10-05 19:51:11 +00:00
|
|
|
case NC_GPENCIL:
|
|
|
|
if (wmn->action == NA_EDITED)
|
2010-04-05 06:52:27 +00:00
|
|
|
ED_region_tag_redraw(ar);
|
2012-03-28 11:53:18 +00:00
|
|
|
break;
|
2013-05-15 14:37:05 +00:00
|
|
|
case NC_IMAGE:
|
|
|
|
if (wmn->action == NA_PAINTING)
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
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
|
|
|
}
|
2008-12-13 17:44:30 +00:00
|
|
|
}
|
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
/* *********************** buttons region ************************ */
|
|
|
|
|
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
|
|
|
static void image_buttons_area_init(wmWindowManager *wm, ARegion *ar)
|
|
|
|
{
|
2009-10-22 23:22:05 +00:00
|
|
|
wmKeyMap *keymap;
|
2009-05-19 17:13:33 +00:00
|
|
|
|
2013-02-10 14:59:38 +00:00
|
|
|
ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
|
2009-05-19 17:13:33 +00:00
|
|
|
ED_region_panels_init(wm, ar);
|
2009-02-21 15:31:01 +00:00
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
|
2009-02-21 15:31:01 +00:00
|
|
|
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void image_buttons_area_draw(const bContext *C, ARegion *ar)
|
|
|
|
{
|
2009-07-29 22:57:53 +00:00
|
|
|
ED_region_panels(C, ar, 1, NULL, -1);
|
2009-02-21 15:31:01 +00:00
|
|
|
}
|
|
|
|
|
2013-06-24 22:41:33 +00:00
|
|
|
static void image_buttons_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn)
|
2009-02-21 15:31:01 +00:00
|
|
|
{
|
|
|
|
/* context changes */
|
2012-03-28 11:53:18 +00:00
|
|
|
switch (wmn->category) {
|
2012-02-17 16:06:32 +00:00
|
|
|
case NC_TEXTURE:
|
|
|
|
case NC_MATERIAL:
|
|
|
|
/* sending by texture render job and needed to properly update displaying
|
|
|
|
* brush texture icon */
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
2014-02-28 18:12:05 +01:00
|
|
|
case NC_SCENE:
|
|
|
|
switch (wmn->data) {
|
|
|
|
case ND_MODE:
|
|
|
|
case ND_RENDER_RESULT:
|
|
|
|
case ND_COMPO_RESULT:
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NC_IMAGE:
|
|
|
|
if (wmn->action != NA_PAINTING)
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
|
|
|
case NC_NODE:
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
2009-02-21 15:31:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-19 01:32:06 +00:00
|
|
|
/* *********************** scopes region ************************ */
|
|
|
|
|
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
2014-02-13 19:49:26 +02:00
|
|
|
static void image_tools_area_init(wmWindowManager *wm, ARegion *ar)
|
2010-01-19 01:32:06 +00:00
|
|
|
{
|
|
|
|
wmKeyMap *keymap;
|
|
|
|
|
2013-02-10 14:59:38 +00:00
|
|
|
ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
|
2010-01-19 01:32:06 +00:00
|
|
|
ED_region_panels_init(wm, ar);
|
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
|
2010-01-19 01:32:06 +00:00
|
|
|
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
|
|
|
}
|
|
|
|
|
2014-02-13 19:49:26 +02:00
|
|
|
static void image_tools_area_draw(const bContext *C, ARegion *ar)
|
2010-01-19 01:32:06 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
SpaceImage *sima = CTX_wm_space_image(C);
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
2010-01-28 07:26:21 +00:00
|
|
|
void *lock;
|
2012-03-28 11:53:18 +00:00
|
|
|
ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
|
2014-02-13 19:49:26 +02:00
|
|
|
/* XXX performance regression if name of scopes category changes! */
|
|
|
|
PanelCategoryStack *category = UI_panel_category_active_find(ar, "Scopes");
|
|
|
|
|
|
|
|
/* only update scopes if scope category is active */
|
|
|
|
if (category) {
|
|
|
|
if (ibuf) {
|
|
|
|
if (!sima->scopes.ok) {
|
|
|
|
BKE_histogram_update_sample_line(&sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings);
|
|
|
|
}
|
|
|
|
if (sima->image->flag & IMA_VIEW_AS_RENDER)
|
|
|
|
scopes_update(&sima->scopes, ibuf, &scene->view_settings, &scene->display_settings);
|
|
|
|
else
|
|
|
|
scopes_update(&sima->scopes, ibuf, NULL, &scene->display_settings);
|
2012-06-13 22:38:31 +00:00
|
|
|
}
|
2010-04-06 02:05:54 +00:00
|
|
|
}
|
2012-11-15 15:59:58 +00:00
|
|
|
ED_space_image_release_buffer(sima, ibuf, lock);
|
2010-01-28 07:26:21 +00:00
|
|
|
|
2010-01-19 01:32:06 +00:00
|
|
|
ED_region_panels(C, ar, 1, NULL, -1);
|
|
|
|
}
|
|
|
|
|
2014-02-13 19:49:26 +02:00
|
|
|
static void image_tools_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn)
|
2010-01-19 01:32:06 +00:00
|
|
|
{
|
|
|
|
/* context changes */
|
2012-03-28 11:53:18 +00:00
|
|
|
switch (wmn->category) {
|
2014-02-28 18:12:05 +01:00
|
|
|
case NC_GPENCIL:
|
|
|
|
if (wmn->data == ND_DATA)
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
|
|
|
case NC_BRUSH:
|
|
|
|
if (wmn->action == NA_EDITED)
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
2010-01-28 07:26:21 +00:00
|
|
|
case NC_SCENE:
|
2012-03-28 11:53:18 +00:00
|
|
|
switch (wmn->data) {
|
2010-01-28 07:26:21 +00:00
|
|
|
case ND_MODE:
|
|
|
|
case ND_RENDER_RESULT:
|
|
|
|
case ND_COMPO_RESULT:
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NC_IMAGE:
|
2013-05-15 14:37:05 +00:00
|
|
|
if (wmn->action != NA_PAINTING)
|
|
|
|
ED_region_tag_redraw(ar);
|
2010-01-28 07:26:21 +00:00
|
|
|
break;
|
|
|
|
case NC_NODE:
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
|
|
|
|
2010-01-19 01:32:06 +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
|
|
|
/************************* header region **************************/
|
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
/* add handlers, stuff you only do once or on area/region changes */
|
2010-10-14 12:24:08 +00:00
|
|
|
static void image_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
|
2008-12-13 17:44:30 +00:00
|
|
|
{
|
2009-06-16 01:22:56 +00:00
|
|
|
ED_region_header_init(ar);
|
2008-12-13 17:44:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void image_header_area_draw(const bContext *C, ARegion *ar)
|
|
|
|
{
|
2009-06-16 01:22:56 +00:00
|
|
|
ED_region_header(C, ar);
|
2008-12-13 17:44:30 +00:00
|
|
|
}
|
|
|
|
|
2013-06-24 22:41:33 +00:00
|
|
|
static void image_header_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn)
|
2010-03-09 06:49:58 +00:00
|
|
|
{
|
|
|
|
/* context changes */
|
2012-03-28 11:53:18 +00:00
|
|
|
switch (wmn->category) {
|
2010-03-09 06:49:58 +00:00
|
|
|
case NC_SCENE:
|
2012-03-28 11:53:18 +00:00
|
|
|
switch (wmn->data) {
|
2010-03-09 06:49:58 +00:00
|
|
|
case ND_MODE:
|
|
|
|
case ND_TOOLSETTINGS:
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NC_GEOM:
|
2012-03-28 11:53:18 +00:00
|
|
|
switch (wmn->data) {
|
2010-03-09 06:49:58 +00:00
|
|
|
case ND_DATA:
|
|
|
|
case ND_SELECT:
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
|
|
|
}
|
2013-07-21 17:04:54 +00:00
|
|
|
break;
|
2010-03-09 06:49:58 +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
|
|
|
/**************************** spacetype *****************************/
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
/* only called once, from space/spacetypes.c */
|
|
|
|
void ED_spacetype_image(void)
|
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype image");
|
2008-12-13 17:44:30 +00:00
|
|
|
ARegionType *art;
|
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
st->spaceid = SPACE_IMAGE;
|
2009-12-19 22:37:51 +00:00
|
|
|
strncpy(st->name, "Image", BKE_ST_MAXNAME);
|
2008-12-13 17:44:30 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
st->new = image_new;
|
|
|
|
st->free = image_free;
|
|
|
|
st->init = image_init;
|
|
|
|
st->duplicate = image_duplicate;
|
|
|
|
st->operatortypes = image_operatortypes;
|
|
|
|
st->keymap = image_keymap;
|
|
|
|
st->dropboxes = image_dropboxes;
|
|
|
|
st->refresh = image_refresh;
|
|
|
|
st->listener = image_listener;
|
|
|
|
st->context = image_context;
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
/* regions: main window */
|
2012-03-28 11:53:18 +00:00
|
|
|
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
|
2008-12-13 17:44:30 +00:00
|
|
|
art->regionid = RGN_TYPE_WINDOW;
|
2012-03-28 11:53:18 +00:00
|
|
|
art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
|
|
|
|
art->init = image_main_area_init;
|
|
|
|
art->draw = image_main_area_draw;
|
|
|
|
art->listener = image_main_area_listener;
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
/* regions: listview/buttons */
|
2012-03-28 11:53:18 +00:00
|
|
|
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
|
2009-02-21 15:31:01 +00:00
|
|
|
art->regionid = RGN_TYPE_UI;
|
2012-03-28 11:53:18 +00:00
|
|
|
art->prefsizex = 220; // XXX
|
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
|
|
|
|
art->listener = image_buttons_area_listener;
|
|
|
|
art->init = image_buttons_area_init;
|
|
|
|
art->draw = image_buttons_area_draw;
|
2009-02-21 15:31:01 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
2011-05-02 11:11:57 +00:00
|
|
|
ED_uvedit_buttons_register(art);
|
2014-02-13 19:49:26 +02:00
|
|
|
image_buttons_register(art);
|
|
|
|
|
2010-01-19 01:32:06 +00:00
|
|
|
/* regions: statistics/scope buttons */
|
2012-03-28 11:53:18 +00:00
|
|
|
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
|
2014-02-13 19:49:26 +02:00
|
|
|
art->regionid = RGN_TYPE_TOOLS;
|
2012-03-28 11:53:18 +00:00
|
|
|
art->prefsizex = 220; // XXX
|
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
|
2014-02-13 19:49:26 +02:00
|
|
|
art->listener = image_tools_area_listener;
|
|
|
|
art->init = image_tools_area_init;
|
|
|
|
art->draw = image_tools_area_draw;
|
2010-01-19 01:32:06 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2009-05-19 17:13:33 +00:00
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
/* regions: header */
|
2012-03-28 11:53:18 +00:00
|
|
|
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
|
2008-12-13 17:44:30 +00:00
|
|
|
art->regionid = RGN_TYPE_HEADER;
|
2012-03-28 11:53:18 +00:00
|
|
|
art->prefsizey = HEADERY;
|
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
|
|
|
|
art->listener = image_header_area_listener;
|
|
|
|
art->init = image_header_area_init;
|
|
|
|
art->draw = image_header_area_draw;
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
|
|
|
BKE_spacetype_register(st);
|
|
|
|
}
|
2011-05-11 09:31:00 +00:00
|
|
|
|