2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-13 17:44:30 +00:00
|
|
|
* 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
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2008-12-13 17:44:30 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup spimage
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
#include "DNA_gpencil_types.h"
|
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"
|
2014-11-14 14:06:29 +01:00
|
|
|
#include "DNA_image_types.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
#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"
|
2017-05-24 23:14:32 +10:00
|
|
|
#include "BKE_editmesh.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"
|
2017-03-02 15:03:02 +01:00
|
|
|
#include "BKE_layer.h"
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
#include "BKE_library.h"
|
2018-11-07 18:00:24 +01:00
|
|
|
#include "BKE_material.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"
|
2018-07-04 13:00:46 +02:00
|
|
|
#include "BKE_workspace.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
2018-12-05 14:35:45 +11:00
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
|
|
|
#include "RNA_enum_types.h"
|
|
|
|
|
2017-04-04 13:09:17 +02:00
|
|
|
#include "DEG_depsgraph.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"
|
2017-06-16 07:30:27 +10:00
|
|
|
#include "ED_transform.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
2018-05-30 22:07:07 +02:00
|
|
|
#include "WM_message.h"
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
#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"
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_framebuffer.h"
|
2019-01-09 22:26:52 +01:00
|
|
|
#include "GPU_batch_presets.h"
|
|
|
|
#include "GPU_viewport.h"
|
|
|
|
|
|
|
|
/* TODO(fclem) remove bad level calls */
|
|
|
|
#include "../draw/DRW_engine.h"
|
|
|
|
#include "wm_draw.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) {
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ar->regiontype == RGN_TYPE_TOOL_PROPS && ar->flag & RGN_FLAG_HIDDEN) {
|
2010-01-19 02:26:36 +00:00
|
|
|
return;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2010-01-19 02:26:36 +00:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2018-01-17 10:00:14 +11:00
|
|
|
static void image_user_refresh_scene(const bContext *C, SpaceImage *sima)
|
|
|
|
{
|
2019-03-11 12:44:14 +01:00
|
|
|
/* Update scene image user for acquiring render results. */
|
|
|
|
sima->iuser.scene = CTX_data_scene(C);
|
|
|
|
|
2018-01-17 10:00:14 +11:00
|
|
|
if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) {
|
2019-03-11 12:44:14 +01:00
|
|
|
/* While rendering, prefer scene that is being rendered. */
|
2018-01-17 10:00:14 +11:00
|
|
|
Scene *render_scene = ED_render_job_get_current_scene(C);
|
|
|
|
if (render_scene) {
|
|
|
|
sima->iuser.scene = render_scene;
|
|
|
|
}
|
|
|
|
}
|
2019-03-11 12:44:14 +01:00
|
|
|
|
|
|
|
/* Auto switch image to show in UV editor when selection changes. */
|
|
|
|
ED_space_image_auto_set(C, sima);
|
2018-01-17 10:00:14 +11: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);
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ar) {
|
|
|
|
return ar;
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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! */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ar == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
arnew = MEM_callocN(sizeof(ARegion), "buttons for image");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
arnew->flag = RGN_FLAG_HIDDEN;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
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);
|
2019-03-26 21:16:47 +11: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! */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ar == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
arnew = MEM_callocN(sizeof(ARegion), "scopes for image");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2010-01-19 01:32:06 +00:00
|
|
|
return arnew;
|
|
|
|
}
|
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
/* ******************** default callbacks for image space ***************** */
|
|
|
|
|
2018-04-21 19:30:56 +02:00
|
|
|
static SpaceLink *image_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
|
2008-12-13 17:44:30 +00:00
|
|
|
{
|
|
|
|
ARegion *ar;
|
|
|
|
SpaceImage *simage;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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;
|
2018-05-24 21:19:38 +02:00
|
|
|
simage->flag = SI_SHOW_GPENCIL | SI_USE_ALPHA | SI_COORDFLOATS;
|
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.frames = 100;
|
2018-05-24 21:19:38 +02:00
|
|
|
simage->iuser.flag = IMA_SHOW_STEREO | IMA_ANIM_ALWAYS;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
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");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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;
|
2018-12-14 09:47:10 +11:00
|
|
|
ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
2018-06-04 09:31:30 +02: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");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
return (SpaceLink *)simage;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* not spacelink itself */
|
|
|
|
static void image_free(SpaceLink *sl)
|
2018-06-04 09:31:30 +02:00
|
|
|
{
|
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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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);
|
2016-05-07 04:22:48 +10:00
|
|
|
WM_operatortype_append(IMAGE_OT_view_zoom_border);
|
2016-08-18 00:21:55 -04:00
|
|
|
#ifdef WITH_INPUT_NDOF
|
2011-06-25 18:51:29 +00:00
|
|
|
WM_operatortype_append(IMAGE_OT_view_ndof);
|
2016-08-18 00:21:55 -04:00
|
|
|
#endif
|
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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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);
|
2018-06-14 22:46:30 +02:00
|
|
|
WM_operatortype_append(IMAGE_OT_clear_render_slot);
|
|
|
|
WM_operatortype_append(IMAGE_OT_add_render_slot);
|
|
|
|
WM_operatortype_append(IMAGE_OT_remove_render_slot);
|
2010-02-09 19:37:37 +00:00
|
|
|
|
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
|
|
|
|
2017-11-22 10:52:39 -02:00
|
|
|
WM_operatortype_append(IMAGE_OT_read_viewlayers);
|
2014-10-08 18:02:49 +02:00
|
|
|
WM_operatortype_append(IMAGE_OT_render_border);
|
|
|
|
WM_operatortype_append(IMAGE_OT_clear_render_border);
|
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
|
|
|
{
|
2018-11-08 15:59:51 +11:00
|
|
|
WM_keymap_ensure(keyconf, "Image Generic", SPACE_IMAGE, 0);
|
|
|
|
WM_keymap_ensure(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
|
|
|
}
|
|
|
|
|
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 */
|
2018-08-07 10:38:20 +02:00
|
|
|
static bool image_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip))
|
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
|
|
|
{
|
2019-01-15 23:24:20 +11:00
|
|
|
if (drag->type == WM_DRAG_PATH) {
|
|
|
|
/* rule might not work? */
|
|
|
|
if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) {
|
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;
|
2019-01-15 23:24:20 +11: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
|
|
|
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);
|
2018-06-04 09:31:30 +02: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
|
|
|
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;
|
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
|
|
|
|
2019-02-18 13:23:49 +01:00
|
|
|
BKE_image_user_frame_calc(&sima->iuser, scene->r.cfra);
|
2018-06-04 09:31:30 +02: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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2018-07-04 15:14:57 +02:00
|
|
|
static void image_listener(wmWindow *win, ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene))
|
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 = (SpaceImage *)sa->spacedata.first;
|
2018-06-04 09:31:30 +02: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:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (wmn->subtype == NS_EDITMODE_MESH) {
|
2012-09-19 17:09:14 +00:00
|
|
|
ED_area_tag_refresh(sa);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2012-09-19 17:09:14 +00:00
|
|
|
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:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ED_space_image_show_render(sima)) {
|
2010-04-06 02:05:54 +00:00
|
|
|
image_scopes_tag_refresh(sa);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
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;
|
2019-01-15 23:24:20 +11:00
|
|
|
/* ideally would check for: ED_space_image_check_show_maskedit(scene, sima)
|
|
|
|
* but we cant get the scene */
|
2012-08-01 10:50:39 +00:00
|
|
|
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
|
|
|
{
|
2018-07-04 15:14:57 +02:00
|
|
|
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
|
2017-11-23 13:51:49 -02:00
|
|
|
Object *ob = OBACT(view_layer);
|
2018-04-05 18:20:27 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2018-07-15 14:24:10 +02:00
|
|
|
static void IMAGE_GGT_gizmo2d(wmGizmoGroupType *gzgt)
|
2017-06-16 07:30:27 +10:00
|
|
|
{
|
2018-07-15 14:24:10 +02:00
|
|
|
gzgt->name = "UV Transform Gizmo";
|
|
|
|
gzgt->idname = "IMAGE_GGT_gizmo2d";
|
2017-06-16 07:30:27 +10:00
|
|
|
|
2018-10-04 12:04:36 +10:00
|
|
|
gzgt->gzmap_params.spaceid = SPACE_IMAGE;
|
|
|
|
gzgt->gzmap_params.regionid = RGN_TYPE_WINDOW;
|
2017-06-16 07:30:27 +10:00
|
|
|
|
2018-07-15 14:24:10 +02:00
|
|
|
gzgt->poll = ED_widgetgroup_gizmo2d_poll;
|
|
|
|
gzgt->setup = ED_widgetgroup_gizmo2d_setup;
|
|
|
|
gzgt->refresh = ED_widgetgroup_gizmo2d_refresh;
|
|
|
|
gzgt->draw_prepare = ED_widgetgroup_gizmo2d_draw_prepare;
|
2017-06-16 07:30:27 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
static void image_widgets(void)
|
|
|
|
{
|
2018-10-04 12:04:36 +10:00
|
|
|
WM_gizmogrouptype_append(IMAGE_GGT_gizmo2d);
|
2017-06-16 07:30:27 +10: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
|
|
|
/************************** main region ***************************/
|
|
|
|
|
|
|
|
/* sets up the fields of the View2D from zoom and offset */
|
2015-11-28 17:14:45 +01:00
|
|
|
static void image_main_region_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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-08-15 19:24:00 +02:00
|
|
|
int width, height;
|
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
|
|
|
|
2018-08-15 19:24:00 +02:00
|
|
|
float w = width;
|
|
|
|
float h = height;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ima) {
|
2012-03-28 11:53:18 +00:00
|
|
|
h *= ima->aspy / ima->aspx;
|
2019-03-26 21:16:47 +11: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
|
|
|
|
2018-08-15 19:24:00 +02:00
|
|
|
int winx = BLI_rcti_size_x(&ar->winrct) + 1;
|
|
|
|
int winy = BLI_rcti_size_y(&ar->winrct) + 1;
|
|
|
|
|
|
|
|
/* For region overlap, move center so image doesn't overlap header. */
|
|
|
|
rcti visible_rect;
|
|
|
|
ED_region_visible_rect(ar, &visible_rect);
|
|
|
|
const int visible_winy = BLI_rcti_size_y(&visible_rect) + 1;
|
|
|
|
int visible_centerx = 0;
|
|
|
|
int visible_centery = visible_rect.ymin + (visible_winy - winy) / 2;
|
2018-06-04 09:31:30 +02: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;
|
2018-06-04 09:31:30 +02: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? */
|
2018-08-15 19:24:00 +02:00
|
|
|
float x1 = ar->winrct.xmin + visible_centerx + (winx - sima->zoom * w) / 2.0f;
|
|
|
|
float y1 = ar->winrct.ymin + visible_centery + (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;
|
2018-06-04 09:31:30 +02: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
|
|
|
/* 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);
|
2018-06-04 09:31:30 +02: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
|
|
|
/* 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);
|
2018-06-04 09:31:30 +02: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
|
|
|
/* 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 */
|
2015-11-28 17:14:45 +01:00
|
|
|
static void image_main_region_init(wmWindowManager *wm, ARegion *ar)
|
2008-12-13 17:44:30 +00:00
|
|
|
{
|
2009-10-22 23:22:05 +00:00
|
|
|
wmKeyMap *keymap;
|
2018-06-04 09:31:30 +02: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 */
|
2018-08-31 13:36:14 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Mask Editing", 0, 0);
|
2012-07-25 14:46:38 +00:00
|
|
|
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 */
|
2018-08-31 13:36:14 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Curve", 0, 0);
|
2014-07-21 12:02:05 +02:00
|
|
|
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
|
|
|
|
|
2018-08-31 13:36:14 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Paint Curve", 0, 0);
|
2014-07-21 12:02:05 +02:00
|
|
|
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
|
|
|
|
2018-08-31 13:36:14 +10:00
|
|
|
keymap = WM_keymap_ensure(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
|
|
|
|
2018-08-31 13:36:14 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "UV Editor", 0, 0);
|
2009-10-22 23:22:05 +00:00
|
|
|
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-08-31 13:36:14 +10:00
|
|
|
keymap = WM_keymap_ensure(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 */
|
2018-08-31 13:36:14 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
|
2009-02-21 15:31:01 +00:00
|
|
|
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
2018-08-31 13:36:14 +10:00
|
|
|
keymap = WM_keymap_ensure(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);
|
|
|
|
}
|
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
static void image_main_region_draw(const bContext *C, ARegion *ar)
|
2008-12-13 17:44:30 +00:00
|
|
|
{
|
|
|
|
/* 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);
|
2017-04-04 13:09:17 +02:00
|
|
|
Depsgraph *depsgraph = CTX_data_depsgraph(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);
|
2017-11-23 13:51:49 -02:00
|
|
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
2012-03-28 11:53:18 +00:00
|
|
|
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];
|
2015-04-20 19:57:57 +02:00
|
|
|
|
2019-01-09 22:26:52 +01:00
|
|
|
/* XXX This is in order to draw UI batches with the DRW
|
|
|
|
* olg context since we now use it for drawing the entire area */
|
|
|
|
gpu_batch_presets_reset();
|
|
|
|
|
|
|
|
/* TODO(fclem) port to draw manager and remove the depth buffer allocation. */
|
2019-01-25 12:58:31 -02:00
|
|
|
GPUViewport *viewport = ar->draw_buffer->viewport[ar->draw_buffer->stereo ? sima->iuser.multiview_eye : 0];
|
|
|
|
DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport);
|
2019-01-09 22:26:52 +01:00
|
|
|
GPU_framebuffer_bind(fbl->color_only_fb);
|
|
|
|
|
2011-01-04 15:19:16 +00:00
|
|
|
/* XXX not supported yet, disabling for now */
|
|
|
|
scene->r.scemode &= ~R_COMP_CROP;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
/* clear and setup matrix */
|
|
|
|
UI_GetThemeColor3fv(TH_BACK, col);
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_clear_color(col[0], col[1], col[2], 0.0);
|
|
|
|
GPU_clear(GPU_COLOR_BIT);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2018-01-17 10:00:14 +11:00
|
|
|
image_user_refresh_scene(C, sima);
|
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 */
|
2015-11-28 17:14:45 +01:00
|
|
|
image_main_region_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);
|
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
ED_uvedit_draw_main(sima, ar, scene, view_layer, obedit, obact, depsgraph);
|
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
|
|
|
|
*/
|
2018-02-16 01:13:46 +11:00
|
|
|
BLI_thread_lock(LOCK_DRAW_IMAGE);
|
2013-01-15 07:56:38 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (show_viewer) {
|
2018-02-16 01:13:46 +11:00
|
|
|
BLI_thread_unlock(LOCK_DRAW_IMAGE);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2013-01-15 07:56:38 +00:00
|
|
|
|
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);
|
2014-10-31 15:32:59 +01:00
|
|
|
ED_image_draw_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);
|
2014-10-31 15:32:59 +01:00
|
|
|
ED_image_draw_cursor(ar, sima->cursor);
|
2014-07-21 12:02:05 +02:00
|
|
|
UI_view2d_view_restore(C);
|
|
|
|
}
|
2012-07-24 19:29:24 +00:00
|
|
|
|
2018-07-14 23:49:00 +02:00
|
|
|
WM_gizmomap_draw(ar->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
|
2017-06-16 07:30:27 +10: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
|
|
|
}
|
|
|
|
|
2017-05-02 09:58:01 +10:00
|
|
|
static void image_main_region_listener(
|
2018-07-04 15:14:57 +02:00
|
|
|
wmWindow *UNUSED(win), ScrArea *sa, ARegion *ar,
|
2017-05-02 09:58:01 +10:00
|
|
|
wmNotifier *wmn, const Scene *UNUSED(scene))
|
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) {
|
2017-06-16 07:30:27 +10:00
|
|
|
case NC_GEOM:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ELEM(wmn->data, ND_DATA, ND_SELECT)) {
|
2018-07-14 23:49:00 +02:00
|
|
|
WM_gizmomap_tag_refresh(ar->gizmo_map);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2017-06-16 07:30:27 +10:00
|
|
|
break;
|
2012-10-05 19:51:11 +00:00
|
|
|
case NC_GPENCIL:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
|
2015-01-07 13:12:37 +13:00
|
|
|
ED_region_tag_redraw(ar);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
else if (wmn->data & ND_GPENCIL_EDITMODE) {
|
2010-04-05 06:52:27 +00:00
|
|
|
ED_region_tag_redraw(ar);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2012-03-28 11:53:18 +00:00
|
|
|
break;
|
2013-05-15 14:37:05 +00:00
|
|
|
case NC_IMAGE:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (wmn->action == NA_PAINTING) {
|
2013-05-15 14:37:05 +00:00
|
|
|
ED_region_tag_redraw(ar);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-07-14 23:49:00 +02:00
|
|
|
WM_gizmomap_tag_refresh(ar->gizmo_map);
|
2013-05-15 14:37:05 +00:00
|
|
|
break;
|
2014-11-14 13:50:10 +01:00
|
|
|
case NC_MATERIAL:
|
|
|
|
if (wmn->data == ND_SHADING_LINKS) {
|
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (sima->iuser.scene && (sima->iuser.scene->toolsettings->uv_flag & UV_SHOW_SAME_IMAGE)) {
|
2014-11-14 13:50:10 +01:00
|
|
|
ED_region_tag_redraw(ar);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2014-11-14 13:50:10 +01:00
|
|
|
}
|
|
|
|
break;
|
Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
2017-06-01 19:56:58 +02:00
|
|
|
case NC_SCREEN:
|
|
|
|
if (ELEM(wmn->data, ND_LAYER)) {
|
|
|
|
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 */
|
2015-11-28 17:14:45 +01:00
|
|
|
static void image_buttons_region_init(wmWindowManager *wm, ARegion *ar)
|
2009-02-21 15:31:01 +00:00
|
|
|
{
|
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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-08-31 13:36:14 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
|
2009-02-21 15:31:01 +00:00
|
|
|
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
|
|
|
}
|
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
static void image_buttons_region_draw(const bContext *C, ARegion *ar)
|
2009-02-21 15:31:01 +00:00
|
|
|
{
|
2019-01-24 14:36:52 +01:00
|
|
|
SpaceImage *sima = CTX_wm_space_image(C);
|
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
void *lock;
|
|
|
|
ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
|
|
|
|
/* 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);
|
|
|
|
}
|
2019-03-26 21:16:47 +11:00
|
|
|
if (sima->image->flag & IMA_VIEW_AS_RENDER) {
|
2019-01-24 14:36:52 +01:00
|
|
|
ED_space_image_scopes_update(C, sima, ibuf, true);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
else {
|
2019-01-24 14:36:52 +01:00
|
|
|
ED_space_image_scopes_update(C, sima, ibuf, false);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-01-24 14:36:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ED_space_image_release_buffer(sima, ibuf, lock);
|
|
|
|
|
2018-06-11 19:30:48 +02:00
|
|
|
ED_region_panels(C, ar);
|
2009-02-21 15:31:01 +00:00
|
|
|
}
|
|
|
|
|
2017-05-02 09:58:01 +10:00
|
|
|
static void image_buttons_region_listener(
|
2018-07-04 15:14:57 +02:00
|
|
|
wmWindow *UNUSED(win), ScrArea *UNUSED(sa), ARegion *ar,
|
2017-05-02 09:58:01 +10:00
|
|
|
wmNotifier *wmn, const Scene *UNUSED(scene))
|
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:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (wmn->action != NA_PAINTING) {
|
2014-02-28 18:12:05 +01:00
|
|
|
ED_region_tag_redraw(ar);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2014-02-28 18:12:05 +01:00
|
|
|
break;
|
|
|
|
case NC_NODE:
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
2015-01-07 13:12:37 +13:00
|
|
|
case NC_GPENCIL:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
|
2015-01-07 13:12:37 +13:00
|
|
|
ED_region_tag_redraw(ar);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2015-01-07 13:12:37 +13:00
|
|
|
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 */
|
2015-11-28 17:14:45 +01:00
|
|
|
static void image_tools_region_init(wmWindowManager *wm, ARegion *ar)
|
2010-01-19 01:32:06 +00:00
|
|
|
{
|
|
|
|
wmKeyMap *keymap;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-08-31 13:36:14 +10:00
|
|
|
keymap = WM_keymap_ensure(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
|
2010-01-19 01:32:06 +00:00
|
|
|
WM_event_add_keymap_handler(&ar->handlers, keymap);
|
|
|
|
}
|
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
static void image_tools_region_draw(const bContext *C, ARegion *ar)
|
2010-01-19 01:32:06 +00:00
|
|
|
{
|
2018-06-11 19:30:48 +02:00
|
|
|
ED_region_panels(C, ar);
|
2010-01-19 01:32:06 +00:00
|
|
|
}
|
|
|
|
|
2017-05-02 09:58:01 +10:00
|
|
|
static void image_tools_region_listener(
|
2018-07-04 15:14:57 +02:00
|
|
|
wmWindow *UNUSED(win), ScrArea *UNUSED(sa), ARegion *ar,
|
2017-05-02 09:58:01 +10:00
|
|
|
wmNotifier *wmn, const Scene *UNUSED(scene))
|
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:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (wmn->data == ND_DATA || ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
|
2014-02-28 18:12:05 +01:00
|
|
|
ED_region_tag_redraw(ar);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2014-02-28 18:12:05 +01:00
|
|
|
break;
|
|
|
|
case NC_BRUSH:
|
2015-09-21 10:32:14 +10:00
|
|
|
/* NA_SELECTED is used on brush changes */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
|
2014-02-28 18:12:05 +01:00
|
|
|
ED_region_tag_redraw(ar);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2014-02-28 18:12:05 +01:00
|
|
|
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:
|
2019-03-26 21:16:47 +11:00
|
|
|
if (wmn->action != NA_PAINTING) {
|
2013-05-15 14:37:05 +00:00
|
|
|
ED_region_tag_redraw(ar);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2010-01-28 07:26:21 +00:00
|
|
|
break;
|
|
|
|
case NC_NODE:
|
|
|
|
ED_region_tag_redraw(ar);
|
|
|
|
break;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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 */
|
2015-11-28 17:14:45 +01:00
|
|
|
static void image_header_region_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
|
|
|
}
|
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
static void image_header_region_draw(const bContext *C, ARegion *ar)
|
2008-12-13 17:44:30 +00:00
|
|
|
{
|
2018-01-17 10:00:14 +11:00
|
|
|
ScrArea *sa = CTX_wm_area(C);
|
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
|
|
|
|
|
|
|
image_user_refresh_scene(C, sima);
|
|
|
|
|
2009-06-16 01:22:56 +00:00
|
|
|
ED_region_header(C, ar);
|
2008-12-13 17:44:30 +00:00
|
|
|
}
|
|
|
|
|
2017-05-02 09:58:01 +10:00
|
|
|
static void image_header_region_listener(
|
2018-07-04 15:14:57 +02:00
|
|
|
wmWindow *UNUSED(win), ScrArea *UNUSED(sa), ARegion *ar,
|
2017-05-02 09:58:01 +10:00
|
|
|
wmNotifier *wmn, const Scene *UNUSED(scene))
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
static void image_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id)
|
|
|
|
{
|
|
|
|
SpaceImage *simg = (SpaceImage *)slink;
|
|
|
|
|
|
|
|
if (!ELEM(GS(old_id->name), ID_IM, ID_GD, ID_MSK)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ID *)simg->image == old_id) {
|
|
|
|
simg->image = (Image *)new_id;
|
|
|
|
id_us_ensure_real(new_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ID *)simg->gpd == old_id) {
|
|
|
|
simg->gpd = (bGPdata *)new_id;
|
|
|
|
id_us_min(old_id);
|
|
|
|
id_us_plus(new_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ID *)simg->mask_info.mask == old_id) {
|
|
|
|
simg->mask_info.mask = (Mask *)new_id;
|
|
|
|
id_us_ensure_real(new_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-05 14:35:45 +11:00
|
|
|
/**
|
|
|
|
* \note Used for splitting out a subset of modes is more involved,
|
|
|
|
* The previous non-uv-edit mode is stored so switching back to the
|
|
|
|
* image doesn't always reset the sub-mode.
|
|
|
|
*/
|
|
|
|
static int image_space_subtype_get(ScrArea *sa)
|
|
|
|
{
|
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
|
|
|
return sima->mode == SI_MODE_UV ? SI_MODE_UV : SI_MODE_VIEW;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void image_space_subtype_set(ScrArea *sa, int value)
|
|
|
|
{
|
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
|
|
|
if (value == SI_MODE_UV) {
|
|
|
|
if (sima->mode != SI_MODE_UV) {
|
|
|
|
sima->mode_prev = sima->mode;
|
|
|
|
}
|
|
|
|
sima->mode = value;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sima->mode = sima->mode_prev;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void image_space_subtype_item_extend(
|
|
|
|
bContext *UNUSED(C), EnumPropertyItem **item, int *totitem)
|
|
|
|
{
|
|
|
|
RNA_enum_items_add(item, totitem, rna_enum_space_image_mode_items);
|
|
|
|
}
|
|
|
|
|
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;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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);
|
2018-06-04 09:31:30 +02: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;
|
2018-07-14 23:49:00 +02:00
|
|
|
st->gizmos = image_widgets;
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
st->id_remap = image_id_remap;
|
2018-12-05 14:35:45 +11:00
|
|
|
st->space_subtype_item_extend = image_space_subtype_item_extend;
|
|
|
|
st->space_subtype_get = image_space_subtype_get;
|
|
|
|
st->space_subtype_set = image_space_subtype_set;
|
ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:29:38 +02:00
|
|
|
|
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;
|
2019-02-20 14:29:29 +11:00
|
|
|
art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_TOOL | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->init = image_main_region_init;
|
|
|
|
art->draw = image_main_region_draw;
|
|
|
|
art->listener = image_main_region_listener;
|
2008-12-13 17:44:30 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-01-24 14:36:52 +01:00
|
|
|
/* regions: listview/buttons/scopes */
|
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;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->listener = image_buttons_region_listener;
|
|
|
|
art->init = image_buttons_region_init;
|
|
|
|
art->draw = image_buttons_region_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);
|
|
|
|
|
2019-01-24 14:36:52 +01:00
|
|
|
/* regions: tool(bar) */
|
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;
|
2018-10-04 08:54:48 +10:00
|
|
|
art->prefsizex = 58; /* XXX */
|
|
|
|
art->prefsizey = 50; /* XXX */
|
2012-03-28 11:53:18 +00:00
|
|
|
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->listener = image_tools_region_listener;
|
2018-10-04 08:54:48 +10:00
|
|
|
art->message_subscribe = ED_region_generic_tools_region_message_subscribe;
|
|
|
|
art->snap_size = ED_region_generic_tools_region_snap_size;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->init = image_tools_region_init;
|
|
|
|
art->draw = image_tools_region_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;
|
2015-11-28 17:14:45 +01:00
|
|
|
art->listener = image_header_region_listener;
|
|
|
|
art->init = image_header_region_init;
|
|
|
|
art->draw = image_header_region_draw;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-06-12 10:11:32 +02:00
|
|
|
/* regions: hud */
|
|
|
|
art = ED_area_type_hud(st->spaceid);
|
|
|
|
BLI_addhead(&st->regiontypes, art);
|
|
|
|
|
2008-12-13 17:44:30 +00:00
|
|
|
BKE_spacetype_register(st);
|
|
|
|
}
|