diff options
Diffstat (limited to 'release/scripts/startup')
7 files changed, 79 insertions, 30 deletions
diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py index 8e95d2b9ac1..46cf07be0f5 100644 --- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py +++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py @@ -75,10 +75,12 @@ class PlayRenderedAnim(Operator): def execute(self, context): import subprocess + from shlex import quote scene = context.scene rd = scene.render prefs = context.user_preferences + fps_final = rd.fps / rd.fps_base preset = prefs.filepaths.animation_player_preset player_path = prefs.filepaths.animation_player @@ -112,7 +114,7 @@ class PlayRenderedAnim(Operator): file = rd.frame_path(frame=scene.frame_start, preview=scene.use_preview_range) file = bpy.path.abspath(file) # expand '//' if not os.path.exists(file): - self.report({'WARNING'}, "File %r not found" % file) + self.report({'WARNING'}, f"File {file!r} not found") path_valid = False # one last try for full range if we used preview range @@ -120,7 +122,7 @@ class PlayRenderedAnim(Operator): file = rd.frame_path(frame=scene.frame_start, preview=False) file = bpy.path.abspath(file) # expand '//' if not os.path.exists(file): - self.report({'WARNING'}, "File %r not found" % file) + self.report({'WARNING'}, f"File {file!r} not found") cmd = [player_path] # extra options, fps controls etc. @@ -131,31 +133,34 @@ class PlayRenderedAnim(Operator): frame_start = scene.frame_start frame_end = scene.frame_end if preset == 'INTERNAL': - opts = ["-a", - "-f", str(rd.fps), str(rd.fps_base), - "-s", str(frame_start), - "-e", str(frame_end), - "-j", str(scene.frame_step), - file] + opts = [ + "-a", + "-f", str(rd.fps), str(rd.fps_base), + "-s", str(frame_start), + "-e", str(frame_end), + "-j", str(scene.frame_step), + file, + ] cmd.extend(opts) elif preset == 'DJV': - opts = [file, "-playback_speed", "%d" % int(rd.fps / rd.fps_base)] + opts = [file, "-playback_speed", str(int(fps_final))] cmd.extend(opts) elif preset == 'FRAMECYCLER': - opts = [file, "%d-%d" % (scene.frame_start, scene.frame_end)] + opts = [file, f"{scene.frame_start:d}-{scene.frame_end:d}"] cmd.extend(opts) elif preset == 'RV': - opts = ["-fps", str(rd.fps), "-play", "[ %s ]" % file] + opts = ["-fps", str(rd.fps), "-play", f"[ {file} ]"] cmd.extend(opts) elif preset == 'MPLAYER': opts = [] if is_movie: opts.append(file) else: - opts += [("mf://%s" % file.replace("#", "?")), - "-mf", - "fps=%.4f" % (rd.fps / rd.fps_base), - ] + opts += [ + ("mf://" + file.replace("#", "?")), + "-mf", + f"fps={fps_final:4f}" + ] opts += ["-loop", "0", "-really-quiet", "-fs"] cmd.extend(opts) @@ -163,7 +168,7 @@ class PlayRenderedAnim(Operator): cmd.append(file) # launch it - print("Executing command:\n %r" % " ".join(cmd)) + print("Executing command:\n ", " ".join(quote(c) for c in cmd)) # workaround for boost 1.46, can be eventually removed. bug: [#32350] env_copy = os.environ.copy() @@ -174,9 +179,11 @@ class PlayRenderedAnim(Operator): try: subprocess.Popen(cmd, env=env_copy) except Exception as e: - self.report({'ERROR'}, - "Couldn't run external animation player with command " - "%r\n%s" % (" ".join(cmd), str(e))) + self.report( + {'ERROR'}, + "Couldn't run external animation player with command " + f"{cmd!r}\n{e!s}", + ) return {'CANCELLED'} return {'FINISHED'} diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py index 10709676b85..3b5f21d616e 100644 --- a/release/scripts/startup/bl_ui/properties_data_camera.py +++ b/release/scripts/startup/bl_ui/properties_data_camera.py @@ -242,7 +242,7 @@ class DATA_PT_camera_dof_aperture(CameraButtonsPanel, Panel): cam = context.camera dof_options = cam.gpu_dof - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) if context.engine == 'BLENDER_EEVEE': col = flow.column() diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 17034689528..63b708ae059 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -50,7 +50,7 @@ class OBJECT_PT_transform(ObjectButtonsPanel, Panel): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) ob = context.object @@ -106,7 +106,7 @@ class OBJECT_PT_delta_transform(ObjectButtonsPanel, Panel): def draw(self, context): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=True, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=True, align=False) ob = context.object @@ -136,7 +136,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel, Panel): def draw(self, context): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) ob = context.object @@ -222,7 +222,7 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel): def draw(self, context): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) obj = context.object obj_type = obj.type @@ -285,7 +285,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel): row.prop(ob, "dupli_type", expand=True) layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) if ob.dupli_type == 'FRAMES': diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py index 7683c953340..3b01015047f 100644 --- a/release/scripts/startup/bl_ui/properties_physics_field.py +++ b/release/scripts/startup/bl_ui/properties_physics_field.py @@ -212,7 +212,7 @@ class PHYSICS_PT_collision_particle(PhysicButtonsPanel, Panel): md = context.collision layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) coll = md.settings @@ -252,7 +252,7 @@ class PHYSICS_PT_collision_softbody(PhysicButtonsPanel, Panel): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) md = context.collision coll = md.settings diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 0260864cfb3..22c1f17217e 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -120,7 +120,7 @@ class DopesheetFilterPopoverBase: # datablock filters layout.label("Include From Types:") - flow = layout.grid_flow(row_major=True, num_columns=2, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=2, even_rows=False, align=False) flow.prop(dopesheet, "show_scenes", text="Scenes") flow.prop(dopesheet, "show_worlds", text="Worlds") diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 19516fda301..94a8bef0b88 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -579,11 +579,53 @@ class INFO_MT_help(Menu): layout.operator("wm.splash", icon='BLENDER') +class TOPBAR_MT_file_specials(Menu): + bl_label = "File Context Menu" + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'INVOKE_AREA' + layout.operator("wm.link", text="Link", icon='LINK_BLEND') + layout.operator("wm.append", text="Append", icon='APPEND_BLEND') + + layout.separator() + + layout.menu("INFO_MT_file_import", icon='IMPORT') + layout.menu("INFO_MT_file_export", icon='EXPORT') + + +class TOPBAR_MT_window_specials(Menu): + bl_label = "Window Context Menu" + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'EXEC_AREA' + + layout.operator("wm.window_new") + + layout.operator_context = 'INVOKE_AREA' + + layout.operator("screen.area_dupli") + + layout.separator() + + layout.operator("screen.area_split", text="Horizontal Split").direction = 'HORIZONTAL' + layout.operator("screen.area_split", text="Vertical Split").direction = 'VERTICAL' + + layout.separator() + + layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES') + + classes = ( TOPBAR_HT_upper_bar, TOPBAR_HT_lower_bar, TOPBAR_PT_pivot_point, TOPBAR_PT_snapping, + TOPBAR_MT_file_specials, + TOPBAR_MT_window_specials, INFO_MT_editor_menus, INFO_MT_file, INFO_MT_file_import, diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 6645a1b12ef..8a76963d4a1 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -3658,7 +3658,7 @@ class VIEW3D_PT_shading_lighting(Panel): sub = row.column() sub.operator('wm.studiolight_userpref_show', emboss=False, text="", icon='PREFERENCES') if shading.selected_studio_light.orientation == 'WORLD': - layout.row().prop(shading, "studiolight_rot_z") + layout.row().prop(shading, "studiolight_rotate_z") elif shading.light == 'MATCAP': row = layout.row() @@ -3673,7 +3673,7 @@ class VIEW3D_PT_shading_lighting(Panel): sub = row.column() sub.operator('wm.studiolight_userpref_show', emboss=False, text="", icon='PREFERENCES') if shading.selected_studio_light.orientation == 'WORLD': - layout.row().prop(shading, "studiolight_rot_z") + layout.row().prop(shading, "studiolight_rotate_z") layout.row().prop(shading, "studiolight_background_alpha") layout.prop(shading, "use_scene_light") |