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:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-06-29 18:34:46 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-06-29 18:34:46 +0400
commit83093d677049f6ba085c34d1719906e2ee3cc3d1 (patch)
tree22c356af6a5657cd8bf1b37ddb3ca5503a243d73 /source/blender/makesrna
parent344ca17247accd2848081e69eab00ab7aac4a0ae (diff)
Extended modes for snapping in the node editor.
The transform operators in nodes will now use the unselected nodes to generate snapping points. Unlike object snapping, node snapping works for the x/y axes separately and snaps node borders to same borders of unselected nodes. The sensitive area for node borders extends over the whole view2D range, to enable simple alignment of nodes in both x and y direction. For snap points in the node editor an additional enum value is stored to indicate the type of node border (left/right/top/bottom). This works as a constraint on possible node alignments: only same border types align with each other.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/RNA_enum_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_scene.c17
2 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index a8d176db767..a0614a9d82a 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -45,6 +45,7 @@ extern EnumPropertyItem proportional_falloff_curve_only_items[];
extern EnumPropertyItem proportional_editing_items[];
extern EnumPropertyItem snap_target_items[];
extern EnumPropertyItem snap_element_items[];
+extern EnumPropertyItem snap_node_element_items[];
extern EnumPropertyItem mesh_select_mode_items[];
extern EnumPropertyItem space_type_items[];
extern EnumPropertyItem region_type_items[];
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 7a2f0736e98..4c0d6eb30d2 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -136,6 +136,14 @@ EnumPropertyItem snap_element_items[] = {
{0, NULL, 0, NULL, NULL}
};
+EnumPropertyItem snap_node_element_items[] = {
+ {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
+ {SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_SNAP_EDGE, "Node X", "Snap to left/right node border"},
+ {SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_SNAP_EDGE, "Node Y", "Snap to top/bottom node border"},
+ {SCE_SNAP_MODE_NODE_XY, "NODE_XY", ICON_SNAP_EDGE, "Node X / Y", "Snap to any node border"},
+ {0, NULL, 0, NULL, NULL}
+};
+
/* workaround for duplice enums,
* have each enum line as a defne then conditionally set it or not
@@ -1626,6 +1634,13 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_enum_items(prop, snap_element_items);
RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to");
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ /* node editor uses own set of snap modes */
+ prop = RNA_def_property(srna, "snap_node_element", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "snap_node_mode");
+ RNA_def_property_enum_items(prop, snap_node_element_items);
+ RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "snap_target");
@@ -1651,7 +1666,7 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Project to Self", "Snap onto itself (editmode)");
RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
+
/* Grease Pencil */
prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINTSESSIONS_ON);