[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32786] trunk/blender: Lock to Cursor

Nathan Letwory nathan at letworyinteractive.com
Sun Oct 31 02:18:26 CET 2010


Revision: 32786
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32786
Author:   jesterking
Date:     2010-10-31 02:18:26 +0100 (Sun, 31 Oct 2010)

Log Message:
-----------
Lock to Cursor
Patch by Dan Eicher. In 3dview properties you can enable this. Rotating view then uses cursor as pivot point. Note that with this option enabled just relocating the 3d cursor also changes the 3dview.

Sebastian K?\195?\182nig: "Now the 3d cursor is actually useful" (sitting next to me while applying patch at bconf hostel)

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_view3d.py
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c
    trunk/blender/source/blender/makesdna/DNA_view3d_types.h
    trunk/blender/source/blender/makesrna/intern/rna_space.c

Modified: trunk/blender/release/scripts/ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d.py	2010-10-31 01:04:31 UTC (rev 32785)
+++ trunk/blender/release/scripts/ui/space_view3d.py	2010-10-31 01:18:26 UTC (rev 32786)
@@ -1951,6 +1951,8 @@
         col.prop(view, "lock_object", text="")
         if view.lock_object and view.lock_object.type == 'ARMATURE':
             col.prop_search(view, "lock_bone", view.lock_object.data, "bones", text="")
+        elif not view.lock_object:
+            col.prop(view, "lock_cursor", text="Lock to Cursor")
 
         col = layout.column(align=True)
         col.label(text="Clip:")

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2010-10-31 01:04:31 UTC (rev 32785)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2010-10-31 01:18:26 UTC (rev 32786)
@@ -1205,6 +1205,11 @@
 			}
 			translate_m4( rv3d->viewmat,-vec[0], -vec[1], -vec[2]);
 		}
+		else if (v3d->ob_centre_cursor) {
+			float vec[3];
+			copy_v3_v3(vec, give_cursor(scene, v3d));
+			translate_m4(rv3d->viewmat, -vec[0], -vec[1], -vec[2]);
+		}
 		else translate_m4( rv3d->viewmat,rv3d->ofs[0], rv3d->ofs[1], rv3d->ofs[2]);
 	}
 }

Modified: trunk/blender/source/blender/makesdna/DNA_view3d_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_view3d_types.h	2010-10-31 01:04:31 UTC (rev 32785)
+++ trunk/blender/source/blender/makesdna/DNA_view3d_types.h	2010-10-31 01:18:26 UTC (rev 32786)
@@ -160,7 +160,7 @@
 	 * The drawing mode for the 3d display. Set to OB_WIRE, OB_SOLID,
 	 * OB_SHADED or OB_TEXTURE */
 	short drawtype;
-	short pad2;
+	short ob_centre_cursor;		/* optional bool for 3d cursor to define center */
 	short scenelock, around, pad3;
 	short flag, flag2;
 	

Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c	2010-10-31 01:04:31 UTC (rev 32785)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c	2010-10-31 01:18:26 UTC (rev 32786)
@@ -1016,6 +1016,11 @@
 	RNA_def_property_ui_text(prop, "Lock Bone", "3D View center is locked to this bone's position");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
+	prop= RNA_def_property(srna, "lock_cursor", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "ob_centre_cursor", 1);
+	RNA_def_property_ui_text(prop, "Lock Bone", "3D View center is locked to the cursor's position");
+	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
 	prop= RNA_def_property(srna, "viewport_shade", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "drawtype");
 	RNA_def_property_enum_items(prop, viewport_shade_items);





More information about the Bf-blender-cvs mailing list