Last active
May 14, 2024 03:29
-
-
Save Fweeb/bb61c15139bff338cb17 to your computer and use it in GitHub Desktop.
Blender add-on for exposing the 3D View's rotation locking feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ***** 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 LICENCE BLOCK ***** | |
bl_info = { | |
"name": "Lock View", | |
"description": "Exposes rotation locking in the 3D View to a specific viewing angle", | |
"author": "Jason van Gumster (Fweeb)", | |
"version": (1, 0, 1), | |
"blender": (3, 0, 0), | |
"location": "3D View > Properties Region > View", | |
"warning": "", | |
"wiki_url": "", | |
"tracker_url": "", | |
"category": "3D View"} | |
import bpy | |
def lock_ui(self, context): | |
layout = self.layout | |
layout.prop(context.space_data.region_3d, 'lock_rotation', text='Lock View Rotation') | |
def register(): | |
bpy.types.VIEW3D_PT_view3d_properties.append(lock_ui) | |
def unregister(): | |
bpy.types.VIEW3D_PT_view3d_properties.remove(lock_ui) | |
if __name__ == "__main__": | |
register() |
Cool - thanks. Yes, there's definitely some workarounds! I tend to use view roll a lot when drawing in blender - there's a reason it was built into old animation light tables, and it's easily accessible in stuff like photoshop (hold R) and toon boom (hold ctrl+alt) - and you currently don't need to have a camera for it to work, but of course it gets disabled by view lock. There's a request to add this as core functionality but these things can take a while! https://blender.community/c/rightclickselect/q2cbbc/?sorting=hot
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there @df-0!
I think what you're looking for is technically possible, but would certainly require quite a bit more work. Right now, this add-on is just exposing functionality that's already built into Blender.
However, there is a workaround. I'm assuming that you're using Grease Pencil from the 2D Animation template. If you do that, you have a camera object and you're drawing from that camera's view. So if you want to rotate the view, you can just select the camera object and rotate that. It's a bit clunky because you have to hop out of Draw mode to do that, so maybe an add-on could be written that allows limited camera movement from within Edit mode. Maybe I'll play with that in the next week or so.