← All ideas
  • Published 11 Jul 2019

Rotate Canvas in Grease Pencil

It would be very usefull to have the posibility to roatate the view localy in the viewport. When I want draw large vertical lines would bemuch easier to rotate the canvas (krita like) and draw it rather then trying to do it right with the canvas straight.

This is an update: a small addon that does what iI wanted. github.com/juanquico/addon_rotate_canvas

09.png

98.4%

Development Status: Open

Upvote 61 Downvote 1
juanquico
11 Jul 2019

18 Comments

flareless.roam

Here I posted a small add-on that does the job: 2D Viewport Roll

4
juanquico Author

* @Flareless Roam * I liked it! i've done other script for the camera. But i realy like how you put the hotkey. I will try to replicar some like that in my script.

github.com/juanquico/addon_rotate_canvas

1
juanpsolis

Hello guys, as long as I ve resarched this hasnt been solved. This is my proposal, I work on design and advertising and know how important is this feature for those who work drawing. My proposal focus on precision of the feature and "universality" so it can work precise with, tablet or mouse. I hope I m not asking too much. Thank you everyone.

Image

2
testure

* @juanpsolis * The reply on this proposal with the most upvotes has a modal operator addon that does exactly what you're asking for.

youtube.com/watch

1
juanpsolis

* @testure * Just tested it, its cool and it helps, but it is still limmited.

yasharjk

I use these scripts to orbit, roll and change fov modal

I assigned

Alt+Shift+Middle drag to roll

Alt+Ctrl+Middle drag to orbit horizontal

Ctrl+Shift+Middle drag to orbit vertical

Alt+Ctrl+Shift+Middle drag to change fov

Pretty handy specially with pen which has no scroll. I'm going to change the rotational tweak behavior to linear vertical/horizontal and use tweak direction to switch orbit. i will post the updated version.

these are bare operator scripts i can package them as addon if needed..

{attachment ViewOrbitModalpy}

import bpy,mathutils
Operator = bpy.types.Operator
Vector = mathutils.Vector

class ViewOrbitModal(Operator):
    """Orbit or Roll Viewport Modal"""
    bl_idname = "view3d.view_orbit_modal"
    bl_label = "View Orbit Modal"


    type = bpy.props.EnumProperty(
        items = [
        ('HORIZONTAL','Horizontal',''),
        ('VERTICAL','Vertical',''),
        ('ROLL','Roll',''),
        ('VIEW','View','')
        ],
        name = "Type",
    )

    def get_vec(self, context, event):
        x = event.mouse_region_x-context.region.width/2
        y = event.mouse_region_y-context.region.height/2
        return Vector((x,y))

    def modal(self, context, event):
        if event.type == 'MOUSEMOVE': 
            vec = self.get_vec(context, event)
            delta = self.vec.angle_signed(vec)

            if self.type == 'HORIZONTAL':
                bpy.ops.view3d.view_orbit(angle=delta, type='ORBITRIGHT')
            elif self.type == 'VERTICAL':
                bpy.ops.view3d.view_orbit(angle=delta, type='ORBITUP')
            elif self.type == 'ROLL':
                bpy.ops.view3d.view_roll(angle=delta)

            self.vec = vec

        elif event.type in ('LEFTMOUSE','MIDDLEMOUSE','RIGHTMOUSE','ESC'):
            return {'FINISHED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        self.vec = self.get_vec(context, event)
        context.window_manager.modal_handler_add(self)
        return {'RUNNING_MODAL'}

class ViewFovModal(Operator):
    """Set lens/FOV value of viewport or camera modal"""
    bl_idname = "view3d.view_fov_modal"
    bl_label = "View FOV Modal"

    def get_cam(self,context):
        space = context.area.spaces[0]
        if space.region_3d.view_perspective == 'CAMERA':
            return space.camera.data
        else:
            return context.space_data


    def modal(self, context, event):
        if event.type == 'MOUSEMOVE':  
            delta = event.mouse_region_y - self.init
            delta/=2
            cam = self.get_cam(context)
            cam.lens = self.value + delta
            context.area.header_text_set(str(cam.lens))
            # print(cam.lens)



        elif event.type in ('LEFTMOUSE','MIDDLEMOUSE','RIGHTMOUSE','ESC'):
            context.area.header_text_set()
            return {'FINISHED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        self.init = event.mouse_region_y
        self.value = self.get_cam(context).lens
        context.window_manager.modal_handler_add(self)
        return {'RUNNING_MODAL'}    

 bpy.utils.register_module(__name__)


2
ChameleonScales

<kbd>Shift</kbd>+<kbd>numpad 4</kbd> and <kbd>Shift</kbd>+<kbd>numpad 6</kbd> respectively rotate the view right or left in a 2D manner (it rotates the view camera in its local axis). I know it's not as smooth as a good mouse drag but in case you didn't know about it, you have that in the mean time.

⚠ Note: you have to either be out of the scene's active camera or lock the camera to the view for it to work.

2
ChameleonScales

* @Craig Jones * This shortcut works in the grease pencil workspace. You just have to do either of the things I mentioned because by default the view is in the active camera. What do you mean by "set it to 2D"? We're in 3D space so I don't really get you here.

ChameleonScales

* @Craig Jones: *

No they don't, not here.

Just to clarify, this is what I mean when I say it works in the Grease Pencil workspace:

juanquico Author

It's a good solution locking the view to the camera but i don't want to give the posibility to animate the camera doing that and if the camera is alredy animated.

1
Vyach

* @juanquico * It can work like Alt+B, but making cutted part shaded, So you still can roll view and draw out of borders. You already can change color of clipping But can`t roll when in camera. {attachment 7014759jpg}

CandleComet

This means the ability to rotate (roll) the view when in camera perspective (without the camera itself rotating). Right?

1
juanquico Author

This is a pretty much what i wanted. github.com/juanquico/addon_rotate_canvas

Vyach

Here is two ways.

  1. rotate view/camera
  2. rotate GP-object.

Anyway, you can clear rotation. But I upvote for easier and smoother roll than Shift+numkeys.

testure

pretty easy modal operator to write. if there are enough people interested I might write one.

zuorion

--- how to delete post? ---

ChameleonScales

* @Pawel Piotrowski * you can't.