Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2015-08-01 18:39:48 +0300
committerJulian Eisel <eiseljulian@gmail.com>2015-08-01 18:56:44 +0300
commit47bc66fc8dfe2b89e2b5be029c63f9043c8c2174 (patch)
treed9756829bb6313f82f7ae99e467ec65580156a40 /source/blender/makesrna
parent31bf82c17d780660160ebf4e1a4be004b8933b9d (diff)
Note Editor: Auto-offset nodes on insertion
Implements "Auto-offset" (called "insert offset" in code) feature for Node Editor, developed during and after LSOC :) Idea and sponsoring by Sebastian König, blendFX, Mathias Eimann, Mikavaa, Knick Design When you drop a node with at least one input and one output socket onto a an existing connection between two nodes, Auto-offset will, depending on the direction setting, automatically and animated move the left or right and all of its following nodes away to make room for the new node. The direction for offsetting can be toggled while you are moving the node by pressing „T“. The auto-offset is enabled by default but can be disabled in the header of the node-editor. The offset margin can be changed in the editing section of the User Preferences. Thanks a lot to the sponsors, and especially to Sebastian who helped *a lot* with this. That's how users can help developing Blender!
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_space.c20
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c6
2 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 838465f1517..4df0b8df0f7 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -4095,6 +4095,12 @@ static void rna_def_space_node(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem insert_ofs_dir_items[] = {
+ {SNODE_INSERTOFS_DIR_RIGHT, "RIGHT", 0, "Right"},
+ {SNODE_INSERTOFS_DIR_LEFT, "LEFT", 0, "Left"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
static EnumPropertyItem dummy_items[] = {
{0, "DUMMY", 0, "", ""},
{0, NULL, 0, NULL, NULL}};
@@ -4208,6 +4214,20 @@ 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, NULL);
+ /* 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, NULL, "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, NULL);
+
+ prop = RNA_def_property(srna, "insert_offset_direction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "insert_ofs_dir");
+ RNA_def_property_enum_items(prop, insert_ofs_dir_items);
+ RNA_def_property_ui_text(prop, "Auto-offset Direction", "Direction to offset nodes on insertion");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
+
RNA_api_space_node(srna);
}
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 5bf8fe76c91..b4ae82290fd 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3848,6 +3848,12 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_duplicate_particle", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_PSYS);
RNA_def_property_ui_text(prop, "Duplicate Particle", "Causes particle systems to be duplicated with the object");
+
+ /* 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_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "node_margin");
+ RNA_def_property_ui_text(prop, "Auto-offset Margin", "Minimum distance between nodes for Auto-offsetting nodes");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
}
static void rna_def_userdef_system(BlenderRNA *brna)