I am using this super simple script to open up a new window and turn it into UV window but currently the UV window is almost full screen so I wonder if there is a way to control the size of that new window? I could not find anything by doing some google search
import bpy
def main(context):
bpy.ops.wm.window_new() #open new window split
bpy.context.area.ui_type = 'UV' #turn it into UV window
class SimpleOperator(bpy.types.Operator):
"""Tooltip"""
bl_idname = "object.open_uv_window"
bl_label = "Open UV window"
def execute(self, context):
main(context)
return {'FINISHED'}
def menu_func(self, context):
self.layout.operator(SimpleOperator.bl_idname, text=SimpleOperator.bl_label)
# Register and add to the "object" menu (required to also use F3 search "Simple Object Operator" for quick access).
def register():
bpy.utils.register_class(SimpleOperator)
bpy.types.VIEW3D_MT_object.append(menu_func)
def unregister():
bpy.utils.unregister_class(SimpleOperator)
bpy.types.VIEW3D_MT_object.remove(menu_func)
if __name__ == "__main__":
register()
I couldnât find anything when I had this issue a few years ago and ended up giving up on it.
Then I found this repo: https://github.com/schroef/Custom-Preferences-Size
I havenât actually tested it yet, but it claims to do what youâre asking.
Hope it helps!
Thanks, I think I ran into this before as well but it seemed a bit hacky so I didnt give it a shot. I tried it this time and it seems to actually work. Only issue for me is that
`area.type = 'IMAGE EDITOR'`
Does not seem to recognize âUVâ as a mode so I cant make it open UV view. In my own script I used this command to change the mode into âUVâ .
Making the above change made it work for me: since you already grabbed the area you need, you can just use the area variable to switch to the UV editor directly.
I think the issue was that changing bpy.context.area to âUVâ might have been running in an area that didnât have âUVâ as a subtype, but by specifying that the area youâre changing is bpy.context.window_manager.windows[-1].screen.areas[0] Blender will know that it should be run only in the new screen youâve created which does have a âUVâ type.
I does work but there is a strange thing. It open us the UV window with the ârender resultâ active so I need to click to close it.
I simplified the code a lot basically this is enough for me to open up new window with 500px resolution and turn it UV mode. Only issue is that I would like it to be straight in the right mode without needing to click this X to close the render result