[Bf-extensions-cvs] [4b8c1ac] master: Add experemental tips addon to show tips in the splash screen

Campbell Barton noreply at git.blender.org
Sat Jan 31 18:27:09 CET 2015


Commit: 4b8c1acd6ed54917283a10a350c1f0f280b811f9
Author: Campbell Barton
Date:   Sun Feb 1 04:24:45 2015 +1100
Branches: master
https://developer.blender.org/rBAC4b8c1acd6ed54917283a10a350c1f0f280b811f9

Add experemental tips addon to show tips in the splash screen

- each stored in tips.txt is a tip displayed on startup
- tips may optionally have a URL to Blender's manual (denoted by ' ~')

===================================================================

A	ui_splash_tips/__init__.py
A	ui_splash_tips/tips.txt

===================================================================

diff --git a/ui_splash_tips/__init__.py b/ui_splash_tips/__init__.py
new file mode 100644
index 0000000..6d2b07f
--- /dev/null
+++ b/ui_splash_tips/__init__.py
@@ -0,0 +1,110 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+bl_info = {
+    "name": "Splash Startup Tips",
+    "description": "Show a tip on startup",
+    "blender": (2, 73, 0),
+    "location": "Splash Screen",
+    "warning": "",
+    "category": "UI",
+}
+
+
+def find_random_line(f):
+    import os
+
+    chunk_size = 16
+    with open(f, 'rb') as f_handle:
+        import random
+        f_handle.seek(0, os.SEEK_END)
+        size = f_handle.tell()
+        i = random.randint(1, size)
+
+        # find the line
+        while i != 0:
+            i -= chunk_size
+            if i < 0:
+                i = 0
+            f_handle.seek(i, os.SEEK_SET)
+            d = f_handle.read(chunk_size)
+            i_newline = d.rfind(b'\n')
+            if i_newline == -1:
+                pass
+            else:
+                i += i_newline + 1
+                break
+
+        f_handle.seek(i, os.SEEK_SET)
+        data_chunks = []
+        i_newline = -1
+        while i_newline == -1:
+            d = f_handle.read(chunk_size)
+            i_newline = d.find(b'\n')
+            if i_newline != -1:
+                d = d[:i_newline]
+            data_chunks.append(d)
+        return b''.join(data_chunks)
+
+    return data
+
+
+def find_random_tip():
+    import os
+
+    text = find_random_line(
+            os.path.join(os.path.dirname(__file__), "tips.txt"),
+            )
+
+    url_index = text.rfind(b' ~')
+    if url_index != -1:
+        text, url = text[:url_index], text[url_index + 2:]
+    else:
+        url = b''
+    print(text)
+    print(url)
+    return text.decode("utf-8"), url.decode("utf-8")
+
+
+def menu_func(self, context):
+    url_prefix = "https://www.blender.org/manual"
+
+    layout = self.layout
+    tip, url = find_random_tip()
+    col = layout.row()
+    col.label(tip)
+    if url:
+        col.operator("wm.url_open", text="", icon='INFO').url = url_prefix + url
+    layout.separator()
+
+
+import bpy
+
+
+def register():
+    bpy.types.USERPREF_MT_splash_footer.append(menu_func)
+
+
+def unregister():
+    bpy.types.USERPREF_MT_splash_footer.remove(menu_func)
+
+
+if __name__ == "__main__":
+    register()
diff --git a/ui_splash_tips/tips.txt b/ui_splash_tips/tips.txt
new file mode 100644
index 0000000..d585d63
--- /dev/null
+++ b/ui_splash_tips/tips.txt
@@ -0,0 +1,28 @@
+Hold Ctrl while scrolling the mouse wheel while over the toolbar to quickly switch tabs.
+Hold Alt when orbiting to snap the view to 45° increments.
+Press Ctrl-C when hovering the cursor over an input field to copy it and Ctrl-V to paste in it.
+Press F5 over a sidebar or a header to flip it to the other side of the window.
+Pressing G twice in Mesh Edit Mode activates the Slide command.
+Ctrl-LMB on a panel’s header will open it, while closing all the other panels.
+Pin panels by clicking on their headers with RMB and choosing Pin, to keep them visible in all tabs.
+Press E with the mouse cursor over an Object Selection Field to activate an Object Picker.
+Only allow an object to transform in a certain direction by using Transform Locks.
+You can make objects appear and disappear by animating their Layer Relation.
+Make objects always appear in front of others by activating the X-Ray mode.
+Make moving rotated objects easier by going into Local Transform mode.
+When you use Loop Cut and Slide, use the Mouse Wheel to add more cuts.
+See vertices behind other faces by turning off Limit Selection to Visible.
+If you see weird shading on your mesh, try Recalculate Normals and Remove Doubles.
+You can add new geometry with Ctrl-LMB in Edit Mode.
+Press Ctrl-Up Arrow to maximize a window. Repeat to minimize.
+Click the little arrows in the outliner to prevent view-port selection, Ctrl-LMB click them to do it to all their children too.
+When adding plane, cube, or cylinder in edit mode, auto align to active edge, and set radius to active edge length
+Shift+Click any folder icon to open that folder within your Operating System
+Shift+Click-And-Drag a window’s corner drag area to separate that window into it’s own Blender instance - Great for multiple monitors!
+Ctrl+Click-And-Drag a window’s corner drag area into another window to swap them.
+Spacebar opens the tool search popup.
+Ctrl-C over tools & menu-items to copy the Python command.
+Backspace over input fields to clear their value.
+Shift-Click-And-Drag the manipulator axis to transform on that plane.
+Trouble navigating your Scene? Try the Walk Navigation. ~/getting_started/basics/navigating/3d_view.html#view-navigation
+Need to cut a hole in a mesh? Try the Knife tool. ~/modeling/meshes/editing/subdividing/knife_subdivide.html



More information about the Bf-extensions-cvs mailing list