UI: Move Auto-Offset toggle to User Preferences #111589
|
@ -52,9 +52,9 @@ const UserDef U_default = {
|
|||
.dbl_click_time = 350,
|
||||
.mini_axis_type = USER_MINI_AXIS_TYPE_GIZMO,
|
||||
.uiflag = (USER_FILTERFILEEXTS | USER_DRAWVIEWINFO | USER_PLAINMENUS |
|
||||
USER_LOCK_CURSOR_ADJUST | USER_DEPTH_CURSOR | USER_AUTOPERSP | USER_GLOBALUNDO |
|
||||
USER_HIDE_DOT | USER_SHOW_GIZMO_NAVIGATE | USER_SHOW_VIEWPORTNAME | USER_SHOW_FPS |
|
||||
USER_CONTINUOUS_MOUSE | USER_SAVE_PROMPT),
|
||||
USER_LOCK_CURSOR_ADJUST | USER_DEPTH_CURSOR | USER_AUTOPERSP |
|
||||
USER_NODE_AUTO_OFFSET | USER_GLOBALUNDO | USER_HIDE_DOT | USER_SHOW_GIZMO_NAVIGATE |
|
||||
USER_SHOW_VIEWPORTNAME | USER_SHOW_FPS | USER_CONTINUOUS_MOUSE | USER_SAVE_PROMPT),
|
||||
.uiflag2 = USER_REGION_OVERLAP,
|
||||
.gpu_flag = USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE | USER_GPU_FLAG_SUBDIVISION_EVALUATION,
|
||||
.app_flag = 0,
|
||||
|
|
|
@ -262,11 +262,6 @@ class NODE_MT_view(Menu):
|
|||
|
||||
layout.separator()
|
||||
|
||||
# Auto-offset nodes (called "insert_offset" in code)
|
||||
layout.prop(snode, "use_insert_offset")
|
||||
|
||||
layout.separator()
|
||||
|
||||
sub = layout.column()
|
||||
sub.operator_context = 'EXEC_REGION_WIN'
|
||||
sub.operator("view2d.zoom_in")
|
||||
|
|
|
@ -499,6 +499,7 @@ class USERPREF_PT_edit_node_editor(EditingPanel, CenterAlignMixIn, Panel):
|
|||
edit = prefs.edit
|
||||
|
||||
col = layout.column()
|
||||
col.prop(edit, "node_use_insert_offset", text="Auto-Offset")
|
||||
col.prop(edit, "node_margin", text="Auto-Offset Margin")
|
||||
col.prop(edit, "node_preview_resolution", text="Preview Resolution")
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ extern "C" {
|
|||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 18
|
||||
#define BLENDER_FILE_SUBVERSION 19
|
||||
|
||||
/* Minimum Blender version that supports reading file written with the current
|
||||
* version. Older Blender versions will test this and cancel loading the file, showing a warning to
|
||||
|
|
|
@ -554,7 +554,7 @@ void blo_do_versions_userdef(UserDef *userdef)
|
|||
|
||||
userdef->flag &= ~(USER_FLAG_UNUSED_4);
|
||||
|
||||
userdef->uiflag &= ~(USER_HEADER_FROM_PREF | USER_UIFLAG_UNUSED_12 | USER_REGISTER_ALL_USERS);
|
||||
userdef->uiflag &= ~(USER_HEADER_FROM_PREF | USER_REGISTER_ALL_USERS);
|
||||
}
|
||||
|
||||
if (!USER_VERSION_ATLEAST(280, 41)) {
|
||||
|
@ -856,6 +856,10 @@ void blo_do_versions_userdef(UserDef *userdef)
|
|||
userdef->playback_fps_samples = 8;
|
||||
}
|
||||
Rawalanche marked this conversation as resolved
Outdated
|
||||
|
||||
if (!USER_VERSION_ATLEAST(400, 19)) {
|
||||
userdef->uiflag |= USER_NODE_AUTO_OFFSET;
|
||||
}
|
||||
|
||||
/**
|
||||
* Versioning code until next subversion bump goes here.
|
||||
*
|
||||
|
|
|
@ -2201,7 +2201,7 @@ void node_insert_on_link_flags(Main &bmain, SpaceNode &snode)
|
|||
}
|
||||
|
||||
/* Set up insert offset data, it needs stuff from here. */
|
||||
if ((snode.flag & SNODE_SKIP_INSOFFSET) == 0) {
|
||||
if (U.uiflag & USER_NODE_AUTO_OFFSET) {
|
||||
BLI_assert(snode.runtime->iofsd == nullptr);
|
||||
NodeInsertOfsData *iofsd = MEM_cnew<NodeInsertOfsData>(__func__);
|
||||
|
||||
|
@ -2603,7 +2603,7 @@ static int node_insert_offset_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
BLI_assert((snode->flag & SNODE_SKIP_INSOFFSET) == 0);
|
||||
BLI_assert(U.uiflag & USER_NODE_AUTO_OFFSET);
|
||||
|
||||
iofsd->ntree = snode->edittree;
|
||||
iofsd->anim_timer = WM_event_timer_add(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.02);
|
||||
|
|
|
@ -299,7 +299,7 @@ static void headerTranslation(TransInfo *t, const float vec[3], char str[UI_MAX_
|
|||
else {
|
||||
if (t->spacetype == SPACE_NODE) {
|
||||
SpaceNode *snode = (SpaceNode *)t->area->spacedata.first;
|
||||
if ((snode->flag & SNODE_SKIP_INSOFFSET) == 0) {
|
||||
if (U.uiflag & USER_NODE_AUTO_OFFSET) {
|
||||
const char *str_dir = (snode->insert_ofs_dir == SNODE_INSERTOFS_DIR_RIGHT) ?
|
||||
TIP_("right") :
|
||||
TIP_("left");
|
||||
|
|
|
@ -1654,8 +1654,7 @@ typedef enum eSpaceNode_Flag {
|
|||
SNODE_FLAG_UNUSED_10 = (1 << 10), /* cleared */
|
||||
SNODE_FLAG_UNUSED_11 = (1 << 11), /* cleared */
|
||||
SNODE_PIN = (1 << 12),
|
||||
/** automatically offset following nodes in a chain on insertion */
|
||||
SNODE_SKIP_INSOFFSET = (1 << 13),
|
||||
SNODE_FLAG_UNUSED_12 = (1 << 13),
|
||||
} eSpaceNode_Flag;
|
||||
Rawalanche marked this conversation as resolved
Outdated
Hans Goudey
commented
"cleared" means that the flag has been reset by versioning in order for it to be used later. The comment can just be removed here I think. "cleared" means that the flag has been reset by versioning in order for it to be used later. The comment can just be removed here I think.
|
||||
|
||||
/** #SpaceNode.texfrom */
|
||||
|
|
|
@ -1186,7 +1186,7 @@ typedef enum eUserpref_UI_Flag {
|
|||
USER_MENUOPENAUTO = (1 << 9),
|
||||
USER_DEPTH_CURSOR = (1 << 10),
|
||||
USER_AUTOPERSP = (1 << 11),
|
||||
USER_UIFLAG_UNUSED_12 = (1 << 12), /* cleared */
|
||||
USER_NODE_AUTO_OFFSET = (1 << 12),
|
||||
USER_GLOBALUNDO = (1 << 13),
|
||||
USER_ORBIT_SELECTION = (1 << 14),
|
||||
USER_DEPTH_NAVIGATE = (1 << 15),
|
||||
|
|
|
@ -7637,16 +7637,6 @@ static void rna_def_space_node(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Cursor Location", "Location for adding new nodes");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, nullptr);
|
||||
|
||||
/* insert offset (called "Auto-offset" in UI) */
|
||||
prop = RNA_def_property(srna, "use_insert_offset", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", SNODE_SKIP_INSOFFSET);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Auto-offset",
|
||||
"Automatically offset the following or previous nodes in a "
|
||||
"chain when inserting a new node");
|
||||
RNA_def_property_ui_icon(prop, ICON_NODE_INSERT_ON, 1);
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "insert_offset_direction", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_bitflag_sdna(prop, nullptr, "insert_ofs_dir");
|
||||
RNA_def_property_enum_items(prop, insert_ofs_dir_items);
|
||||
|
|
|
@ -5572,6 +5572,13 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
|
|||
"Duplicate Node Tree",
|
||||
"Make copies of node groups when duplicating nodes in the node editor");
|
||||
|
||||
prop = RNA_def_property(srna, "node_use_insert_offset", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "uiflag", USER_NODE_AUTO_OFFSET);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Auto-offset",
|
||||
"Automatically offset the following or previous nodes in a "
|
||||
"chain when inserting a new node");
|
||||
|
||||
/* Currently only used for insert offset (aka auto-offset),
|
||||
* maybe also be useful for later stuff though. */
|
||||
prop = RNA_def_property(srna, "node_margin", PROP_INT, PROP_PIXEL);
|
||||
|
|
Loading…
Reference in New Issue
This should be moved to a new subversion bump, otherwise it may not run (it didn't for me). You can increase the file subversion in
BKE_blend_version.h
and move this to a newif
check.Also seems like this is resetting the flag, when it should be enabling it--
userdef->uiflag |= USER_NODE_AUTO_OFFSET;
would enable the flag.