Merge branch 'blender-v4.4-release'
This commit is contained in:
@@ -130,6 +130,7 @@ struct SpaceType {
|
||||
int (*space_subtype_get)(ScrArea *area);
|
||||
void (*space_subtype_set)(ScrArea *area, int value);
|
||||
void (*space_subtype_item_extend)(bContext *C, EnumPropertyItem **item, int *totitem);
|
||||
int (*space_subtype_prev_get)(ScrArea *area);
|
||||
|
||||
/* Return a custom name, based on subtype or other reason. */
|
||||
blender::StringRefNull (*space_name_get)(const ScrArea *area);
|
||||
|
||||
@@ -2602,7 +2602,9 @@ void ED_area_newspace(bContext *C, ScrArea *area, int type, const bool skip_regi
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
SpaceType *st = BKE_spacetype_from_id(type);
|
||||
|
||||
if (area->spacetype != type) {
|
||||
const bool change_spacetype = area->spacetype != type;
|
||||
|
||||
if (change_spacetype) {
|
||||
SpaceLink *slold = static_cast<SpaceLink *>(area->spacedata.first);
|
||||
/* store area->type->exit callback */
|
||||
void (*area_exit)(wmWindowManager *, ScrArea *) = area->type ? area->type->exit : nullptr;
|
||||
@@ -2711,10 +2713,13 @@ void ED_area_newspace(bContext *C, ScrArea *area, int type, const bool skip_regi
|
||||
}
|
||||
|
||||
/* Set area space subtype if applicable. */
|
||||
if (st->space_subtype_item_extend != nullptr) {
|
||||
if (st && st->space_subtype_item_extend != nullptr) {
|
||||
BLI_assert(st->space_subtype_prev_get != nullptr);
|
||||
st->space_subtype_set(area, area->butspacetype_subtype);
|
||||
if (change_spacetype) {
|
||||
st->space_subtype_set(area, st->space_subtype_prev_get(area));
|
||||
}
|
||||
}
|
||||
area->butspacetype_subtype = 0;
|
||||
|
||||
if (BLI_listbase_is_single(&CTX_wm_screen(C)->areabase)) {
|
||||
/* If there is only one area update the window title. */
|
||||
|
||||
@@ -875,15 +875,8 @@ static int action_space_subtype_get(ScrArea *area)
|
||||
static void action_space_subtype_set(ScrArea *area, int value)
|
||||
{
|
||||
SpaceAction *sact = static_cast<SpaceAction *>(area->spacedata.first);
|
||||
if (value == SACTCONT_TIMELINE) {
|
||||
if (sact->mode != SACTCONT_TIMELINE) {
|
||||
sact->mode_prev = sact->mode;
|
||||
}
|
||||
sact->mode = value;
|
||||
}
|
||||
else {
|
||||
sact->mode = sact->mode_prev;
|
||||
}
|
||||
sact->mode_prev = sact->mode;
|
||||
sact->mode = value;
|
||||
}
|
||||
|
||||
static void action_space_subtype_item_extend(bContext * /*C*/,
|
||||
@@ -893,6 +886,12 @@ static void action_space_subtype_item_extend(bContext * /*C*/,
|
||||
RNA_enum_items_add(item, totitem, rna_enum_space_action_mode_items);
|
||||
}
|
||||
|
||||
static int action_space_subtype_prev_get(ScrArea *area)
|
||||
{
|
||||
SpaceAction *sact = static_cast<SpaceAction *>(area->spacedata.first);
|
||||
return sact->mode_prev;
|
||||
}
|
||||
|
||||
static blender::StringRefNull action_space_name_get(const ScrArea *area)
|
||||
{
|
||||
SpaceAction *sact = static_cast<SpaceAction *>(area->spacedata.first);
|
||||
@@ -941,6 +940,7 @@ void ED_spacetype_action()
|
||||
st->space_subtype_item_extend = action_space_subtype_item_extend;
|
||||
st->space_subtype_get = action_space_subtype_get;
|
||||
st->space_subtype_set = action_space_subtype_set;
|
||||
st->space_subtype_prev_get = action_space_subtype_prev_get;
|
||||
st->space_name_get = action_space_name_get;
|
||||
st->space_icon_get = action_space_icon_get;
|
||||
st->blend_read_data = action_space_blend_read_data;
|
||||
|
||||
@@ -825,6 +825,7 @@ static void file_space_subtype_set(ScrArea *area, int value)
|
||||
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
||||
region->v2d.flag &= ~V2D_IS_INIT;
|
||||
}
|
||||
sfile->browse_mode_prev = sfile->browse_mode;
|
||||
sfile->browse_mode = value;
|
||||
}
|
||||
|
||||
@@ -833,6 +834,12 @@ static void file_space_subtype_item_extend(bContext * /*C*/, EnumPropertyItem **
|
||||
RNA_enum_items_add(item, totitem, rna_enum_space_file_browse_mode_items);
|
||||
}
|
||||
|
||||
static int file_space_subtype_prev_get(ScrArea *area)
|
||||
{
|
||||
SpaceFile *sfile = static_cast<SpaceFile *>(area->spacedata.first);
|
||||
return sfile->browse_mode_prev;
|
||||
}
|
||||
|
||||
static blender::StringRefNull file_space_name_get(const ScrArea *area)
|
||||
{
|
||||
SpaceFile *sfile = static_cast<SpaceFile *>(area->spacedata.first);
|
||||
@@ -944,6 +951,7 @@ void ED_spacetype_file()
|
||||
st->space_subtype_item_extend = file_space_subtype_item_extend;
|
||||
st->space_subtype_get = file_space_subtype_get;
|
||||
st->space_subtype_set = file_space_subtype_set;
|
||||
st->space_subtype_prev_get = file_space_subtype_prev_get;
|
||||
st->space_name_get = file_space_name_get;
|
||||
st->space_icon_get = file_space_icon_get;
|
||||
st->context = file_context;
|
||||
|
||||
@@ -866,6 +866,7 @@ static int graph_space_subtype_get(ScrArea *area)
|
||||
static void graph_space_subtype_set(ScrArea *area, int value)
|
||||
{
|
||||
SpaceGraph *sgraph = static_cast<SpaceGraph *>(area->spacedata.first);
|
||||
sgraph->mode_prev = sgraph->mode;
|
||||
sgraph->mode = value;
|
||||
}
|
||||
|
||||
@@ -876,6 +877,12 @@ static void graph_space_subtype_item_extend(bContext * /*C*/,
|
||||
RNA_enum_items_add(item, totitem, rna_enum_space_graph_mode_items);
|
||||
}
|
||||
|
||||
static int graph_space_subtype_prev_get(ScrArea *area)
|
||||
{
|
||||
SpaceGraph *sgraph = static_cast<SpaceGraph *>(area->spacedata.first);
|
||||
return sgraph->mode_prev;
|
||||
}
|
||||
|
||||
static blender::StringRefNull graph_space_name_get(const ScrArea *area)
|
||||
{
|
||||
SpaceGraph *sgraph = static_cast<SpaceGraph *>(area->spacedata.first);
|
||||
@@ -938,6 +945,7 @@ void ED_spacetype_ipo()
|
||||
st->space_subtype_item_extend = graph_space_subtype_item_extend;
|
||||
st->space_subtype_get = graph_space_subtype_get;
|
||||
st->space_subtype_set = graph_space_subtype_set;
|
||||
st->space_subtype_prev_get = graph_space_subtype_prev_get;
|
||||
st->space_name_get = graph_space_name_get;
|
||||
st->space_icon_get = graph_space_icon_get;
|
||||
st->blend_read_data = graph_space_blend_read_data;
|
||||
|
||||
@@ -1063,15 +1063,8 @@ static int image_space_subtype_get(ScrArea *area)
|
||||
static void image_space_subtype_set(ScrArea *area, int value)
|
||||
{
|
||||
SpaceImage *sima = static_cast<SpaceImage *>(area->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;
|
||||
}
|
||||
sima->mode_prev = sima->mode;
|
||||
sima->mode = value;
|
||||
}
|
||||
|
||||
static void image_space_subtype_item_extend(bContext * /*C*/,
|
||||
@@ -1081,6 +1074,12 @@ static void image_space_subtype_item_extend(bContext * /*C*/,
|
||||
RNA_enum_items_add(item, totitem, rna_enum_space_image_mode_items);
|
||||
}
|
||||
|
||||
static int image_space_subtype_prev_get(ScrArea *area)
|
||||
{
|
||||
SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
return sima->mode_prev;
|
||||
}
|
||||
|
||||
static blender::StringRefNull image_space_name_get(const ScrArea *area)
|
||||
{
|
||||
SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
@@ -1158,6 +1157,7 @@ void ED_spacetype_image()
|
||||
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;
|
||||
st->space_subtype_prev_get = image_space_subtype_prev_get;
|
||||
st->space_name_get = image_space_name_get;
|
||||
st->space_icon_get = image_space_icon_get;
|
||||
st->blend_read_data = image_space_blend_read_data;
|
||||
|
||||
@@ -1310,6 +1310,17 @@ static int node_space_subtype_get(ScrArea *area)
|
||||
static void node_space_subtype_set(ScrArea *area, int value)
|
||||
{
|
||||
SpaceNode *snode = static_cast<SpaceNode *>(area->spacedata.first);
|
||||
int value_prev = node_space_subtype_get(area);
|
||||
|
||||
/* Save the subtype. */
|
||||
blender::bke::bNodeTreeType *typeinfo = rna_node_tree_type_from_enum(value_prev);
|
||||
if (typeinfo) {
|
||||
STRNCPY(snode->tree_idname_prev, typeinfo->idname.c_str());
|
||||
}
|
||||
else {
|
||||
snode->tree_idname_prev[0] = '\0';
|
||||
}
|
||||
|
||||
ED_node_set_tree_type(snode, rna_node_tree_type_from_enum(value));
|
||||
}
|
||||
|
||||
@@ -1323,6 +1334,12 @@ static void node_space_subtype_item_extend(bContext *C, EnumPropertyItem **item,
|
||||
}
|
||||
}
|
||||
|
||||
static int node_space_subtype_prev_get(ScrArea *area)
|
||||
{
|
||||
SpaceNode *snode = static_cast<SpaceNode *>(area->spacedata.first);
|
||||
return rna_node_tree_idname_to_enum(snode->tree_idname_prev);
|
||||
}
|
||||
|
||||
static blender::StringRefNull node_space_name_get(const ScrArea *area)
|
||||
{
|
||||
SpaceNode *snode = static_cast<SpaceNode *>(area->spacedata.first);
|
||||
@@ -1390,6 +1407,7 @@ void ED_spacetype_node()
|
||||
st->space_subtype_item_extend = node_space_subtype_item_extend;
|
||||
st->space_subtype_get = node_space_subtype_get;
|
||||
st->space_subtype_set = node_space_subtype_set;
|
||||
st->space_subtype_prev_get = node_space_subtype_prev_get;
|
||||
st->space_name_get = node_space_name_get;
|
||||
st->space_icon_get = node_space_icon_get;
|
||||
st->blend_read_data = node_space_blend_read_data;
|
||||
|
||||
@@ -439,6 +439,7 @@ typedef struct ScrArea {
|
||||
*/
|
||||
char butspacetype;
|
||||
short butspacetype_subtype;
|
||||
short butspacetype_subtype_prev;
|
||||
|
||||
/** Size. */
|
||||
short winx, winy;
|
||||
@@ -453,7 +454,6 @@ typedef struct ScrArea {
|
||||
* runtime variable, updated by executing operators.
|
||||
*/
|
||||
short region_active_win;
|
||||
char _pad[2];
|
||||
|
||||
/** Callbacks for this space type. */
|
||||
struct SpaceType *type;
|
||||
|
||||
@@ -484,8 +484,10 @@ typedef struct SpaceGraph {
|
||||
|
||||
/** Mode for the Graph editor (eGraphEdit_Mode). */
|
||||
short mode;
|
||||
short mode_prev;
|
||||
/* Snapping now lives on the Scene. */
|
||||
short autosnap DNA_DEPRECATED;
|
||||
char _pad[2];
|
||||
/** Settings for Graph editor (eGraphEdit_Flag). */
|
||||
int flag;
|
||||
|
||||
@@ -495,7 +497,6 @@ typedef struct SpaceGraph {
|
||||
float cursorVal;
|
||||
/** Pivot point for transforms. */
|
||||
int around;
|
||||
char _pad[4];
|
||||
|
||||
SpaceGraph_Runtime runtime;
|
||||
} SpaceGraph;
|
||||
@@ -914,7 +915,7 @@ typedef struct SpaceFile {
|
||||
|
||||
/** Is this a File Browser or an Asset Browser? */
|
||||
char browse_mode; /* eFileBrowse_Mode */
|
||||
char _pad1[1];
|
||||
char browse_mode_prev;
|
||||
|
||||
short tags;
|
||||
|
||||
@@ -1609,6 +1610,7 @@ typedef struct SpaceNode {
|
||||
|
||||
/* tree type for the current node tree */
|
||||
char tree_idname[64];
|
||||
char tree_idname_prev[64];
|
||||
/** Same as #bNodeTree::type (deprecated). */
|
||||
int treetype DNA_DEPRECATED;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user