Skip to content

Commit 7138153

Browse files
committed
Feat: modify code
1 parent 7cc7e88 commit 7138153

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

tool/restart_blender.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,32 @@
55
from ..utils import PublicEvent
66

77

8-
def start_blender():
9-
"""Create a new Blender thread through subprocess"""
8+
def start_blender(step=1):
9+
"""Create a new Blender thread through subprocess
10+
11+
offset
12+
13+
-p, --window-geometry <sx> <sy> <w> <h>
14+
Open with lower left corner at <sx>, <sy> and width and height as <w>, <h>.
15+
https://docs.blender.org/manual/en/4.3/advanced/command_line/arguments.html#window-options
16+
"""
1017
import subprocess
1118
bpy.ops.wm.save_userpref()
12-
subprocess.Popen([bpy.app.binary_path])
19+
20+
args = [bpy.app.binary_path, ]
21+
22+
window = bpy.context.window
23+
offset = step * 20
24+
25+
args.append("-p")
26+
args.extend((
27+
str(window.x + offset),
28+
str(window.y - offset),
29+
str(window.width),
30+
str(window.height),
31+
))
32+
33+
subprocess.Popen(args)
1334

1435

1536
class RestartBlender(
@@ -45,8 +66,8 @@ def description(cls, context, properties):
4566

4667
@staticmethod
4768
def for_open(num):
48-
for _ in range(num):
49-
start_blender()
69+
for step in range(num):
70+
start_blender(step + 1)
5071

5172
def run_cmd(self, event: bpy.types.Event):
5273
self.set_event_key(event)

0 commit comments

Comments
 (0)