How to get zoom of editor camera via code?

Godot Version

4.2

Question

Means you want to add zoom in/out system in your game or editor by codes?

I believe the question is, when making an addon, how to get the current zoom level of the editor window. I’m not entirely sure but I did have to use a similar code before when working with shader values, take a look here, it’s C# but I imagine it might help you:

SetZoom(Engine.IsEditorHint()
			? GetViewport().GlobalCanvasTransform.Y.Y
			: GetViewport().CanvasTransform.Y.Y);

If I remember correctly, it is GetViewport().GlobalCanvasTransform

1 Like

No, I want to get the zoom value in the editor (I indicated it in the screenshot). I don’t need a zoom in/out system in the game. I remember digging through plugin-related documentation for a long time ago and kind of even found something I needed now, but I can’t find it now.