[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55783] trunk/blender: Two small fixes:

Ton Roosendaal ton at blender.org
Thu Apr 4 17:10:53 CEST 2013


Revision: 55783
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55783
Author:   ton
Date:     2013-04-04 15:10:52 +0000 (Thu, 04 Apr 2013)
Log Message:
-----------
Two small fixes:

- "Add node" was showing on wrong location when used via pulldown menus.
  Now this option will put the nodes in center of the view.

- The Curves widget was making itself smaller/bigger based on width of region.
  That messes up the layout engine now - especially the code that checks if
  there's a scroller needed or not (it went into an eternal feedback loop).

  Now this widget has fixed height (like the other larger widgets).

  Better would be to allow such large widgets to be scaled vertically individually.
  That's for the todo!

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_operators/node.py
    trunk/blender/source/blender/editors/interface/interface_templates.c
    trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
    trunk/blender/source/blender/makesrna/intern/rna_space.c

Modified: trunk/blender/release/scripts/startup/bl_operators/node.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/node.py	2013-04-04 14:07:10 UTC (rev 55782)
+++ trunk/blender/release/scripts/startup/bl_operators/node.py	2013-04-04 15:10:52 UTC (rev 55783)
@@ -29,10 +29,14 @@
     def store_mouse_cursor(context, event):
         space = context.space_data
         v2d = context.region.view2d
+        tree = space.edit_tree
 
         # convert mouse position to the View2D for later node placement
-        space.cursor_location = v2d.region_to_view(event.mouse_region_x,
+        if context.region.type == 'WINDOW':
+            space.cursor_location = v2d.region_to_view(event.mouse_region_x,
                                                    event.mouse_region_y)
+        else:
+            space.cursor_location = tree.view_center
 
     def create_node(self, context, node_type):
         space = context.space_data

Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c	2013-04-04 14:07:10 UTC (rev 55782)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c	2013-04-04 15:10:52 UTC (rev 55783)
@@ -2119,7 +2119,7 @@
 	/* curve itself */
 	size = uiLayoutGetWidth(layout);
 	row = uiLayoutRow(layout, FALSE);
-	uiDefBut(block, BUT_CURVE, 0, "", 0, 0, size, MIN2(size, 10.0f * UI_UNIT_X), cumap, 0.0f, 1.0f, bg, 0, "");
+	uiDefBut(block, BUT_CURVE, 0, "", 0, 0, size, 8.0f * UI_UNIT_X, cumap, 0.0f, 1.0f, bg, 0, "");
 
 	/* sliders for selected point */
 	for (i = 0; i < cm->totpoint; i++) {

Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2013-04-04 14:07:10 UTC (rev 55782)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2013-04-04 15:10:52 UTC (rev 55783)
@@ -6872,6 +6872,11 @@
 	RNA_def_struct_refine_func(srna, "rna_NodeTree_refine");
 	RNA_def_struct_register_funcs(srna, "rna_NodeTree_register", "rna_NodeTree_unregister", NULL);
 
+	prop = RNA_def_property(srna, "view_center", PROP_FLOAT, PROP_XYZ);
+	RNA_def_property_array(prop, 2);
+	RNA_def_property_float_sdna(prop, NULL, "view_center");
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	
 	/* AnimData */
 	rna_def_animdata_common(srna);
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c	2013-04-04 14:07:10 UTC (rev 55782)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c	2013-04-04 15:10:52 UTC (rev 55783)
@@ -3356,7 +3356,8 @@
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
 
 	/* the mx/my "cursor" in the node editor is used only by operators to store the mouse position */
-	prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
+	RNA_def_property_array(prop, 2);
 	RNA_def_property_float_sdna(prop, NULL, "cursor");
 	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);




More information about the Bf-blender-cvs mailing list