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>2013-11-06 21:46:32 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-11-06 21:46:32 +0400
commit73986000902c34020f581a6ef7395a9259b7f6c2 (patch)
treeb79234644a3b81a66514abb3fe9e16e877294050 /source/blender/editors/space_node/node_draw.c
parent480d4317ded845dd69d167c909807290bddd77ab (diff)
True grid snapping for nodes: This snaps nodes to the actual background grid instead of using incremental offset (which is not useful for nodes). Increment snapping has been disabled for nodes to avoid
confusion, grid snap is now the default as it seems to be the most wanted and easy to use mode. Absolute grid snapping happens in a somewhat generic function 'applyGridAbsolute', which could also be used for objects and other transforms later on. It is conceptually similar to the 'project' snapping option, in that it calculates a delta vector for each element on top of the overall transform, which places each node on the grid. Node transform now uses the top-left node corner for TransformData->loc. The transform center is still the average of node centers, so that scaling and rotation works nicely. snapGrid*** functions have been renamed to snapGridIncrement*** to distinguish better between incremental and absolute grid snapping.
Diffstat (limited to 'source/blender/editors/space_node/node_draw.c')
-rw-r--r--source/blender/editors/space_node/node_draw.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 65eb75f8523..e031e056cd3 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -72,6 +72,11 @@
/* XXX interface.h */
extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select);
+float ED_node_grid_size(void)
+{
+ return U.widget_unit;
+}
+
void ED_node_tree_update(const bContext *C)
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -1325,7 +1330,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
snode_setup_v2d(snode, ar, center);
/* grid, uses theme color based on node path depth */
- UI_view2d_multi_grid_draw(v2d, (depth > 0 ? TH_NODE_GROUP : TH_BACK), U.widget_unit, 5, 2);
+ UI_view2d_multi_grid_draw(v2d, (depth > 0 ? TH_NODE_GROUP : TH_BACK), ED_node_grid_size(), NODE_GRID_STEPS, 2);
/* backdrop */
draw_nodespace_back_pix(C, ar, snode, path->parent_key);
@@ -1350,7 +1355,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
}
else {
/* default grid */
- UI_view2d_multi_grid_draw(v2d, TH_BACK, U.widget_unit, 5, 2);
+ UI_view2d_multi_grid_draw(v2d, TH_BACK, ED_node_grid_size(), NODE_GRID_STEPS, 2);
/* backdrop */
draw_nodespace_back_pix(C, ar, snode, NODE_INSTANCE_KEY_NONE);