Repository: ynput/OpenPype
Issue: Maya: Frame range reset on render creation

**Running version**
3.15.1-nightly.2

**Describe the bug**
When creating a render instance in Maya, the frame range is reset, which seems like unexpected behaviour. Frame range changes should be explicitly executed by the user and not implicit when creating.

**To Reproduce**
1. Launch Maya.
2. Set frame range to something else than what it was at launch.
3. Create render instance.



[cuID:[OP-4883](https://app.clickup.com/t/863g04cta)]

Changed files:
openpype/hosts/maya/api/lib.py, openpype/hosts/maya/api/lib_rendersettings.py

diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py
index a670737b66..aa1e501578 100644
--- a/openpype/hosts/maya/api/lib.py
+++ b/openpype/hosts/maya/api/lib.py
@@ -2099,29 +2099,40 @@ def get_frame_range():
     }
 
 
-def reset_frame_range():
-    """Set frame range to current asset"""
+def reset_frame_range(playback=True, render=True, fps=True):
+    """Set frame range to current asset
 
-    fps = convert_to_maya_fps(
-        float(legacy_io.Session.get("AVALON_FPS", 25))
-    )
-    set_scene_fps(fps)
+    Args:
+        playback (bool, Optional): Whether to set the maya timeline playback
+            frame range. Defaults to True.
+        render (bool, Optional): Whether to set the maya render frame range.
+            Defaults to True.
+        fps (bool, Optional): Whether to set scene FPS. Defaults to True.
+    """
+
+    if fps:
+        fps = convert_to_maya_fps(
+            float(legacy_io.Session.get("AVALON_FPS", 25))
+        )
+        set_scene_fps(fps)
 
     frame_range = get_frame_range()
 
     frame_start = frame_range["frameStart"] - int(frame_range["handleStart"])
     frame_end = frame_range["frameEnd"] + int(frame_range["handleEnd"])
 
-    cmds.playbackOptions(minTime=frame_start)
-    cmds.playbackOptions(maxTime=frame_end)
-    cmds.playbackOptions(animationStartTime=frame_start)
-    cmds.playbackOptions(animationEndTime=frame_end)
-    cmds.playbackOptions(minTime=frame_start)
-    cmds.playbackOptions(maxTime=frame_end)
-    cmds.currentTime(frame_start)
-
-    cmds.setAttr("defaultRenderGlobals.startFrame", frame_start)
-    cmds.setAttr("defaultRenderGlobals.endFrame", frame_end)
+    if playback:
+        cmds.playbackOptions(minTime=frame_start)
+        cmds.playbackOptions(maxTime=frame_end)
+        cmds.playbackOptions(animationStartTime=frame_start)
+        cmds.playbackOptions(animationEndTime=frame_end)
+        cmds.playbackOptions(minTime=frame_start)
+        cmds.playbackOptions(maxTime=frame_end)
+        cmds.currentTime(frame_start)
+
+    if render:
+        cmds.setAttr("defaultRenderGlobals.startFrame", frame_start)
+        cmds.setAttr("defaultRenderGlobals.endFrame", frame_end)
 
 
 def reset_scene_resolution():
diff --git a/openpype/hosts/maya/api/lib_rendersettings.py b/openpype/hosts/maya/api/lib_rendersettings.py
index 7d44d4eaa6..eaa728a2f6 100644
--- a/openpype/hosts/maya/api/lib_rendersettings.py
+++ b/openpype/hosts/maya/api/lib_rendersettings.py
@@ -158,7 +158,7 @@ class RenderSettings(object):
         cmds.setAttr(
             "defaultArnoldDriver.mergeAOVs", multi_exr)
         self._additional_attribs_setter(additional_options)
-        reset_frame_range()
+        reset_frame_range(playback=False, fps=False, render=True)
 
     def _set_redshift_settings(self, width, height):
         """Sets settings for Redshift."""