bpy: how do I list the “pivot center for rotation/scaling” items?

I’m new to blender and python.
I would like to create a pie menu that lists the “pivot center for rotation/scaling” items (active element, median point, 3d cursor, …).

I found the very useful “Ui Pie Menu” python template in the text editor, but I don’t know what to replace the “pie.operator_enum”‘s function arguments with, here is the template code:

import bpy
from bpy.types import Menu

# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)

class VIEW3D_PIE_template(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Select Mode"

    def draw(self, context):
        layout = self.layout

        pie = layout.menu_pie()
        # operator_enum will just spread all available options
        # for the type enum of the operator on the pie
        pie.operator_enum("mesh.select_mode", "type")

def register():

def unregister():

if __name__ == "__main__":


I know that I need to replace this line:

pie.operator_enum("mesh.select_mode", "type")

But what with?

I tried this without luck:


but it didn’t work.

Shapekey paths crash due to alt-s scaling (new data)

I’m having an issue where if a bunch of paths in a row are assigned a shape key, blender 2.79b will crash. Sometimes strands will just explode, as seen in the file as it opens; that’s all (meant to be) hair.

The thing is that I think that alt-s scaling might be the culprit.

“Stable Enough” at rest

Explosion https://i.stack.imgur.com/CbqTc.png

I’m using the paths-as-hair technique outlined in the recent video seen here: https://www.youtube.com/watch?v=t2XjdzzWCqI

I have saved the hair prop in its own file here http://pasteall.org/blend/index.php?id=50703

I made this file ready to go for a shape key, but it just wanted to do its own thing and explode instead. Rotate the selected vertex on Y (for a wind effect) and than tab out. Sometimes It crashes for me, and other times it explodes further, only to crash.

I thought that i had made a workaround, but it doesn’t work for long, and it falls apart again after adding more detail and making it look more natural. As with the tutorial, is says to scale points with alt-s. I scale the roots to zero and its fine until I need to apply shape keys, where it just hard crashes and dies.

I think that the scaling might be the issue.

I’ll need to make a test where the ends are tapered to zero and see if that causes a similar issue.

Transforming 2D viewport coordinates after scaling the viewport (zoom in/out)

I’ve been getting started with personal experimentation and have been working on a project for a few days now using SDL2. It is a 2D game, and at this stage I have it rendering game objects in a fixed-size viewport that can navigate around the ‘game world’.

I’m not terribly well-versed in linear algebra yet, so it’s possible that the answer to this question is somewhere in that curriculum that I have yet to tackle.

The game space has its own coordinates, organized in the same way that they are on an SDL_Window. The “viewport” then has its own coordinates (indicated by it’s top left corner) in the game space. Game objects are then given transformed coordinates in the viewport’s own coordinate space, which corresponds to the SDL_Window‘s coordinate space i.e. they start at (0, 0) at the upper left, which is essentially an offset given the viewport’s coordinates, e.g.:

Entity x’s gamespace coordinates are (100, 200) and the viewport’s gamespace coordinates are (20, 20), the entity’s “viewport” coordinates would be (100 - 20, 200 - 20) or (80, 180).

I’ve started to think about implementing ‘zoom’ functionality. At the moment, all that means is that the viewport is scaled up or down (to certain size limits), and the game entity’s dimensions are scaled up or down correspondingly. What isn’t transformed are the coordinates.

Visually, this is the basic problem:

gamespace/viewport relationship

At maximum size, where the viewport’s dimensions are the same as the game space’s dimensions (they have the same aspect ratio), the positions of all objects in the viewport space would be the same as they are in the game space, but they would have to be positioned using completely different coordinates in the viewport space.

What are the mathematical techniques/principles I should be studying to figure this one out? Thank you!

Dell XPS 13 UHD Screen + Monitor application scaling issues

I am using Ubuntu 18.04 on a Dell XPS 13 (2018) that has a UHD Screen (3480 x 2160), I am then connecting to a UHD Dell 34″ Monitor (3440 x 1440) via a USB-C DisplayPort cable.

However the scaling is off on quite a few applications.

From the Screen Display application, the ‘Built-in display’ is scaled to 200% (this is the default that Ubuntu sets) and works well for the default when I am not connected to a monitor. Then the Dell Inc. 34″ screen settings has the scale at 100%.

With these scaling factors my terminal session windows look about correct and so I’m using this as a base.

However there are lots of things that don’t seem to match up with my most common applications:

  • Firefox
  • Chromium
  • KeypassXC (this has a QT application UI)
  • Gimp

These are the issues I’ve hit:

  1. The scaling of the title bars for FF,Chrome and Keypass on the monitor stays based on the in-built display (so scaled to 200% when the other applications are scaled to 100%)
  2. The scaling of the text inside the window remains huge
  3. Adjusting both the in-built and the monitor to 100% still leaves the applications with title bar heights that are scaled to 200% but the text within them is scaled to 100% and the text in the application is still scaled to 200%.

The only way to get things to match up correctly between screen and monitor is to set both to 200% but then everything looks huge on the monitor.

Screenshot 1 (built-in 200%, monitor 100%)

(Current) Best possible but the browser applications are all too big.

enter image description here

Screenshot 2 (built-in 300%, monitor 100%)

This shows the title text being based of the screen scaling and not the monitor scaling

enter image description here

Screenshot 3 (built-in 100%, monitor 100%)

The applications on the monitor still look incorrect and now Gnome applications look tiny on the built-in display.

enter image description here

How to properly use scaling on an external display (from MacBook Pro 2016)?

I have a MacBook Pro 2016 (with Thunderbolt 3 ports on macOS 10.13.6) and I need an external display.
I bought an ASUS VP28U (4K), connected it with an HDMI to USB-C adapter and, generally, it works. The problem is that everything is super-small, I guess because of the 4K.

Why doesn’t this display have any scaling option?
How can I adjust the scaling of an external display while still using the full 4K resolution quality?
The only options given to me were to reduce it to 1080p, with obvious results…

Am I making something wrong? Using the wrong cables? Missing some options?

Or is the display a bad one?
Anyone with experience with my same configuration may help in sharing his setup?

Thank you

Gnome 3.16 HiDPI scaling only accepts integers

I recently upgraded to Ubuntu 15.04 with Gnome 3.16, which is working really great on my machine (despite what I found on many forums around the web). Having a high DPI screen however (13.3″ with 1920×1080) I need to scale the entire system to use it. There is a setting for that in the TweakTool, but it only seems to accept integers as scaling factor.

enter image description here

Does anybody know about a workaround for this? Scaling by two is way too large for my screen. The value I want is closer to 1.2

Any help will be greatly appreciated!

How can I change windows scaling for different display resolution? (and rotation problem!!)

I really enjoy ElementaryOS and I want it to be my everyday operating system, but I have some issues…

I’m currently running 3 monitors: one 4K, and two more displays (lower resolution) in vertical position next to my 4K. So, I need to change the windows scaling of my 4K monitor because all the things are too small, and rotate my 2 external displays.

I tried, but, I think that the Display Settings are broken: I cannot apply the rotation – I can only change resolution and then click apply, with bugs of x,y,z positioning and more problems…
I updated and upgraded everything but I can’t fix the rotation problems.

How can I rotate my vertical displays and fix the windows scaling properties of the “big one”?

Thank you for your help

UP: I finally made it. I rotated both the screen. But I still can’t move them. That’s what it should look like (but I can’t click on “Apply”):

That's what it should look like (but I can't click on *

And... what it's now.

And… what it’s now.

Scaling keeps resetting after set keyframe in Blender action

I’m new to Blender animation. I’m working on an action for my animation. In this action, I scaled a bone like the photos below. But when I play action, it keeps the same scale and the values didn’t interpolate. When I move the cursor between frames, it also doesn’t make any action.

What did I miss here guys ?

enter image description here

enter image description here

Scaling Magento 2 on multiple containers in production with generated code

I’m working on some auto-scaling Kubernetes infrastructure to run Magento 2, and I noticed that when I start new containers, I can’t have the generated/ directory automatically compiled as part of the container image build—it seems like it needs a working Magento installation (which I’m not guaranteed to have when building the container) to compile.

So currently what I’m doing is, when a new container starts up (e.g. when autoscaling, or when updating code, and new containers are replacing old ones):

  • Check if Magento is installed.
  • If it is installed, run:
    • bin/magento module:enable --all
    • bin/magento setup:di:compile

This seems to work okay, and the new container works just like the old/existing ones—if I don’t do the compilation step, I just get lots of fatal exceptions until I do the compilation.

But my question is this: is there some other/better way of handling the generated/ directory when you want to run Magento on multiple hosts/containers?

Should I share the generated/ directory via NFS like I do for var/? It seems that reading code out of that directory would be a lot slower with NFS… and maybe the extra minute or so it takes to start a new container is worth the tradeoff to have each container compile/optimize it’s own DI code (vs. sharing the directory with other existing containers).