[Bf-extensions-cvs] [da05f713] master: space_view3d_enhanced_3d_cursor: T63750 Broken > Remove from contrib
meta-androcto
noreply at git.blender.org
Sun Sep 8 11:39:05 CEST 2019
Commit: da05f7138eb6de290b33c9fce348628ce6439135
Author: meta-androcto
Date: Sun Sep 8 19:38:50 2019 +1000
Branches: master
https://developer.blender.org/rBACda05f7138eb6de290b33c9fce348628ce6439135
space_view3d_enhanced_3d_cursor: T63750 Broken > Remove from contrib
===================================================================
D space_view3d_enhanced_3d_cursor.py
===================================================================
diff --git a/space_view3d_enhanced_3d_cursor.py b/space_view3d_enhanced_3d_cursor.py
deleted file mode 100644
index 5b4e87a3..00000000
--- a/space_view3d_enhanced_3d_cursor.py
+++ /dev/null
@@ -1,5721 +0,0 @@
-# ***** 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 3 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, see <http://www.gnu.org/licenses/>.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-# <pep8-80 compliant>
-
-bl_info = {
- "name": "Enhanced 3D Cursor",
- "description": "Cursor history and bookmarks; drag/snap cursor.",
- "author": "dairin0d",
- "version": (3, 0, 7),
- "blender": (2, 77, 0),
- "location": "View3D > Action mouse; F10; Properties panel",
- "warning": "",
- "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
- "Scripts/3D_interaction/Enhanced_3D_Cursor",
- "tracker_url": "https://github.com/dairin0d/enhanced-3d-cursor/issues",
- "category": "3D View"}
-
-"""
-Breakdown:
- Addon registration
- Keymap utils
- Various utils (e.g. find_region)
- OpenGL; drawing utils
- Non-undoable data storage
- Cursor utils
- Stick-object
- Cursor monitor
- Addon's GUI
- Addon's properties
- Addon's operators
- ID Block emulator
- Mesh cache
- Snap utils
- View3D utils
- Transform orientation / coordinate system utils
- Generic transform utils
- Main operator
- ...
-.
-
-First step is to re-make the cursor addon (make something usable first).
-CAD tools should be done without the hassle.
-
-TODO:
- strip trailing space? (one of campbellbarton's commits did that)
-
- IDEAS:
- - implement 'GIMBAL' orientation (euler axes)
- - mini-Z-buffer in the vicinity of mouse coords (using raycasts)
- - an orientation that points towards cursor
- (from current selection to cursor)
- - user coordinate systems (using e.g. empties to store different
- systems; when user switches to such UCS, origin will be set to
- "cursor", cursor will be sticked to the empty, and a custom
- transform orientation will be aligned with the empty)
- - "Stick" transform orientation that is always aligned with the
- object cursor is "sticked" to?
- - make 'NORMAL' system also work for bones?
- - user preferences? (stored in a file)
- - create spline/edge_mesh from history?
- - API to access history/bookmarks/operators from other scripts?
- - Snap selection to bookmark?
- - Optimize
- - Clean up code, move to several files?
- LATER:
- ISSUES:
- Limitations:
- - I need to emulate in Python some things that Blender doesn't
- currently expose through API:
- - obtaining matrix of predefined transform orientation
- - obtaining position of pivot
- For some kinds of information (e.g. active vertex/edge,
- selected meta-elements), there is simply no workaround.
- - Snapping to vertices/edges works differently than in Blender.
- First of all, iteration over all vertices/edges of all
- objects along the ray is likely to be very slow.
- Second, it's more human-friendly to snap to visible
- elements (or at least with approximately known position).
- - In editmode I have to exit-and-enter it to get relevant
- information about current selection. Thus any operator
- would automatically get applied when you click on 3D View.
- Mites:
- QUESTIONS:
-==============================================================================
-Borrowed code/logic:
-- space_view3d_panel_measure.py (Buerbaum Martin "Pontiac"):
- - OpenGL state storing/restoring; working with projection matrices.
-"""
-
-import bpy
-import bgl
-import blf
-import bmesh
-
-from mathutils import Vector, Matrix, Quaternion, Euler
-
-from mathutils.geometry import (intersect_line_sphere,
- intersect_ray_tri,
- barycentric_transform,
- tessellate_polygon,
- intersect_line_line,
- intersect_line_plane,
- )
-
-from bpy_extras.view3d_utils import (region_2d_to_location_3d,
- location_3d_to_region_2d,
- )
-
-import math
-import time
-
-# ====== MODULE GLOBALS / CONSTANTS ====== #
-tmp_name = chr(0x10ffff) # maximal Unicode value
-epsilon = 0.000001
-
-# ====== SET CURSOR OPERATOR ====== #
-class EnhancedSetCursor(bpy.types.Operator):
- """Cursor history and bookmarks; drag/snap cursor."""
- bl_idname = "view3d.cursor3d_enhanced"
- bl_label = "Enhanced Set Cursor"
-
- key_char_map = {
- 'PERIOD':".", 'NUMPAD_PERIOD':".",
- 'MINUS':"-", 'NUMPAD_MINUS':"-",
- 'EQUAL':"+", 'NUMPAD_PLUS':"+",
- #'E':"e", # such big/small numbers aren't useful
- 'ONE':"1", 'NUMPAD_1':"1",
- 'TWO':"2", 'NUMPAD_2':"2",
- 'THREE':"3", 'NUMPAD_3':"3",
- 'FOUR':"4", 'NUMPAD_4':"4",
- 'FIVE':"5", 'NUMPAD_5':"5",
- 'SIX':"6", 'NUMPAD_6':"6",
- 'SEVEN':"7", 'NUMPAD_7':"7",
- 'EIGHT':"8", 'NUMPAD_8':"8",
- 'NINE':"9", 'NUMPAD_9':"9",
- 'ZERO':"0", 'NUMPAD_0':"0",
- 'SPACE':" ",
- 'SLASH':"/", 'NUMPAD_SLASH':"/",
- 'NUMPAD_ASTERIX':"*",
- }
-
- key_coordsys_map = {
- 'LEFT_BRACKET':-1,
- 'RIGHT_BRACKET':1,
- ':':-1, # Instead of [ for French keyboards
- '!':1, # Instead of ] for French keyboards
- 'J':'VIEW',
- 'K':"Surface",
- 'L':'LOCAL',
- 'B':'GLOBAL',
- 'N':'NORMAL',
- 'M':"Scaled",
- }
-
- key_pivot_map = {
- 'H':'ACTIVE',
- 'U':'CURSOR',
- 'I':'INDIVIDUAL',
- 'O':'CENTER',
- 'P':'MEDIAN',
- }
-
- key_snap_map = {
- 'C':'INCREMENT',
- 'V':'VERTEX',
- 'E':'EDGE',
- 'F':'FACE',
- }
-
- key_tfm_mode_map = {
- 'G':'MOVE',
- 'R':'ROTATE',
- 'S':'SCALE',
- }
-
- key_map = {
- "confirm":{'ACTIONMOUSE'}, # also 'RET' ?
- "cancel":{'SELECTMOUSE', 'ESC'},
- "free_mouse":{'F10'},
- "make_normal_snapshot":{'W'},
- "make_tangential_snapshot":{'Q'},
- "use_absolute_coords":{'A'},
- "snap_to_raw_mesh":{'D'},
- "use_object_centers":{'T'},
- "precision_up":{'PAGE_UP'},
- "precision_down":{'PAGE_DOWN'},
- "move_caret_prev":{'LEFT_ARROW'},
- "move_caret_next":{'RIGHT_ARROW'},
- "move_caret_home":{'HOME'},
- "move_caret_end":{'END'},
- "change_current_axis":{'TAB', 'RET', 'NUMPAD_ENTER'},
- "prev_axis":{'UP_ARROW'},
- "next_axis":{'DOWN_ARROW'},
- "remove_next_character":{'DEL'},
- "remove_last_character":{'BACK_SPACE'},
- "copy_axes":{'C'},
- "paste_axes":{'V'},
- "cut_axes":{'X'},
- }
-
- gizmo_factor = 0.15
- click_period = 0.25
-
- angle_grid_steps = {True:1.0, False:5.0}
- scale_grid_steps = {True:0.01, False:0.1}
-
- # ====== OPERATOR METHOD OVERLOADS ====== #
- @classmethod
- def poll(cls, context):
- area_types = {'VIEW_3D',} # also: IMAGE_EDITOR ?
- return ((context.area.type in area_types) and
- (context.region.type == "WINDOW") and
- (not find_settings().cursor_lock))
-
- def modal(self, context, event):
- context.area.tag_redraw()
- return self.try_process_input(context, event)
-
- def invoke(self, context, event):
- # Attempt to launch the monitor
- if bpy.ops.view3d.cursor3d_monitor.poll():
- bpy.ops.view3d.cursor3d_monitor()
-
- # Don't interfere with these modes when only mouse is pressed
- if ('SCULPT' in context.mode) or ('PAINT' in context.mode):
- if "MOUSE" in event.type:
- return {'CANCELLED'}
-
- CursorDynamicSettings.active_transform_operator = self
-
- tool_settings = context.tool_settings
-
- settings = find_settings()
- tfm_opts = settings.transform_options
-
- settings_scene = context.scene.cursor_3d_tools_settings
-
- self.setup_keymaps(context, event)
-
- # Coordinate System Utility
- self.particles, self.csu = gather_particles(context=context)
- self.particles = [View3D_Cursor(context)]
-
- self.csu.source_pos = self.particles[0].get_location()
- self.csu.source_rot = self.particles[0].get_rotation()
- self.csu.source_scale = self.particles[0].get_scale()
-
- # View3D Utility
- self.vu = ViewUtility(context.region, context.space_data,
- context.region_data)
-
- # Snap Utility
- self.su = SnapUtility(context)
-
- # turn off view locking for the duration of the operator
- self.view_pos = self.vu.get_position(True)
- self.vu.set_position(self.vu.get_position(), True)
- self.view_locks = self.vu.get_locks()
- self.vu.set_locks({})
-
- # Initialize runtime states
- self.initiated_by_mouse = ("MOUSE" in event.type)
- self.free_mouse = not self.initiated_by_mouse
- self.use_object_centers = False
- self.axes_values = ["", "", ""]
- self.axes_coords = [None, None, None]
- self.axes_eval_success = [True, True, True]
- self.allowed_axes = [True, True, True]
- self.current_axis = 0
- self.caret_p
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list