Skip to content

kyouryuukunn/renpy-ActionEditor

Repository files navigation

With the introduction of 3Dstage in Ren'Py v7.46, this version has been discontinued. Now, ActionEditor3 is available https://github.com/kyouryuukunn/renpy-ActionEditor3

Ren'Py v7.4.6で導入された3Dstageに合せお本バヌゞョンは開発停止したした。 以埌のバヌゞョンではActionEditor3をご利甚ください。 https://github.com/kyouryuukunn/renpy-ActionEditor3

youtube sample Introduction https://www.youtube.com/watch?v=VMMBj4-7k_Q

Sample https://www.youtube.com/watch?v=lhA8Ib3iKE8

日本語マニュアルはドキュメント埌半にありたす。

This script adds the ability to simulate a 3D camera within Ren'Py, along with an in-game Action Editor and Image Viewer GUI to assist in animating the camera. To install, copy all files in the camera directory to your game directory.

Ren'Py http://www.renpy.org/

Action Editor

This allows you to adjusts coordinates of the simulated camera, 3D layers, and transform properties of images in real-time with a GUI. It can then generate a script based on these changes and place it on the clipboard for later pasting into Ren'Py scripts.

When config.developer is True, pressing action_editor (by default, "shift+P") will open the Action editor.

The Action Editor has the following features:

  • View and adjust the transform properties of images, camera coordinates, and 3D layer depth with bars
  • View and adjust the x and y coordinates of the camera with a mouse-positionable camera
  • Adjust the z coordinate of the camera with the mouse wheel.
  • Adjust the x,y coordinate of the camera with the keyboard(hjkl, HJKL).
  • Alternatively, each value can be adjusted with the keyboard without going back to the original script.
  • Add, delete, and edit keyframes on a timeline.
  • After setting up a scene with the desired look and animations, the Action Editor will generate a script and place it on your clipboard for pasting into your Ren'Py scripts. (v6.99 and later only)
  • Supported the concept of depth of field using blur after v7.40(gl2 or ANGLE2 is required). 1pixel blur is used where the distance from the focus position is dof. DOF is used to adjust the sharp range. Focus is used to adjust the focus position. You can adjust dof config in camera_config.rpy

Image Viewer

Press Shift+U to open Image Viewer and view all currently generated displayables.

Camera

With some limitations, Ren'Py can simulate 3D camera motion. This will let you achieve a parallax effect by placing sprites and assets on a 3D field. This script works by applying ATL transforms to all displayables on 3D layers in a manner that respects distance from a virtual camera.

To start using the 3D camera, set additional layers to be registered as 3D layers. If no layers are registered as 3D layers, this script will register the default master layer as a 3D layer.

To get started, add the layers you need. For example, add the following to options.rpy to add background, middle, and forward as regular 2D layers:

     config.layers = ['master', 'background', 'middle', 'forward', 'transient', 'screens', 'overlay']

Second, register any layers that you want to respect 3D motion as 3d layers by using :func:register_3d_layer. The z coordinates of these layers can be moved and can have their positions and transforms affected by the camera. If no layers are registered as 3D layers, the default master layer becomes the sole 3D layer:

     init python:
         register_3d_layer('background', 'middle', 'forward')

This sample script should give an idea of how the system works:

      label start:
          # Resets the camera and layers positions
          $ camera_reset()
          # Instantly sets layer distances from the camera
          $ layer_move("background", 2000)
          $ layer_move("middle", 1500)
          $ layer_move("forward", 1000)
          scene bg onlayer background
          # WARNING: The 'scene' command will reset the depth of whatever layer the image
          # is displayed on. Make sure you reset the depth after you call the 'scene' command.
          $ layer_move("background", 2000)
          show A onlayer middle
          show B onlayer forward
          with dissolve
          "Moves the camera to (1800, 0, 0) in 1 second."
          $ camera_move(1800, 0, 0, 0, 1)
          "Moves the camera to (0, 0, 1600) in 5 seconds."
          $ camera_move(0, 0, 1600, 0, 5)
          "Moves the camera to (0, 0, 0) instantaneously."
          $ camera_move(0, 0, 0)
          "Rotates the camera 180 degrees in 1 second.""
          $ camera_move(0, 0, 0, 180, 1)
          'Rotates the camera -180 degrees in 1 second and subsequently moves the camera to (-1800, 0, 500) in 1.5 seconds'
          $ camera_moves( ( (0, 0, 0, 0, 1, 'linear'), (-1800, 0, 500, 0, 1.5, 'linear') ) )
          'Continually moves the camera between (-1800, 0, 500) and (0, 0, 0), taking 0.5 seconds for the first move and 1 second for the second until the action is interrupted.'
          $ camera_moves( ( (0, 0, 0, 0, .5, 'linear'), (-1800, 0, 500, 0, 1, 'linear') ), loop=True)

There are some limitations to the 3D camera:

  • Only rotations perpindicular to the camera (Z rotations) can be performed due to the 3D camera relying on Ren'Py's existing transform system.

  • 3D camera motion applies its own transforms to 3D layers, so the show layer statement or :func:renpy.show_layer_at can't be used with registered 3D layers.

  • Layers still stack in the order they are registered, regardless of what their z coordinates are. In our above example, background will always be below the other layers because it was registered first, even if its z coordinate was at 0 and the forward layer's z coordinate was at 1000.

  • camera_move, camera_moves, layer_move, layer_moves, and all_moves can't play simultaneously within the same interaction. If multiple camera actions are called in the same interaction, only the last one will play out and earlier actions will be done instantenously before the last action is played.

  • DOF is simulated using blur for layers, so note the back layer is often seen through the front layer.

  • By default, the scene and hide statements use the master layer or a specified layer. If you use 3D layers preferentially, write code like below:

    init -1 python hide: def hide(name, layer='master'): for l in _3d_layers: if renpy.showing(name, l): renpy.hide(name, l) break else: renpy.hide(name, layer)

     config.hide = hide
    
     def scene(layer='master'):
    
     renpy.scene(layer)
     for l in _3d_layers:
         renpy.scene(l)
    
     config.scene = scene
    

Camera Functions

def register_3d_layer(*layers):
    """
     :doc: camera

     Register layers as 3D layers. Only 3D layers will be affected by camera
     movement and 3D layer transforms. This should be called in an init
     block. If no layers are registered as 3D layers, the 'master' layer
     will become a 3D layer by default.

     `layers`
          This should be a string or a group of strings naming registered layers.
     """

def camera_reset():
    """
     :doc: camera

     Resets the camera, 3D layers positions and the focus position, the depth of field.
     """

def camera_restore():
    """
     :doc: camera

     Safety method used internally to deal with unexpected camera behavior.

     """

def camera_move(x, y, z, rotate=0, duration=0, warper='linear', subpixel=True, loop=False, x_express=None, y_express=None, z_express=None, rotate_express=None, **kwargs):
    """
     :doc: camera

     Moves the camera to a given coordinate and rotation.

     `x`
          The x coordinate to move the camera to.
     `y`
          The y coordinate to move the camera to.
     `z`
          The z coordinate to move the camera to.
     `rotate`
          Rotation of the camera, perpindicular to the scene, in degrees.
     `duration`
          The time, in seconds, to complete the camera move. If no time is given,
          the move will happen instantaneously.
     `warper`
          A string that points to a registered ATL warper, like \'ease\'.
          If no warper is given, this will default to \'linear\'.
     `subpixel`
          If True, transforms caused by the 3D camera will be rendered with
          subpixel precision. This defaults to True.
     `loop`
          If true, the camera move will continually loop until another camera
          action interrupts. This defaults to False.
     `x_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the x coordinate of the camera.
     `y_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the y coordinate of the camera.
     `z_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the z coordinate of the camera.
     `rotate_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the rotation value of the camera.
     `<layer name>_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the coordinate of the given layer.
     """

def camera_relative_move(x, y, z, rotate=0, duration=0, warper='linear', subpixel=True, loop=False, x_express=None, y_express=None, z_express=None, rotate_express=None, **kwargs):
    """
     :doc: camera

     Move the coordinate and rotate of a camera relatively and apply transforms to all 3D layers.

     `x`
          the x coordinate of a camera relative to the current one.
     `y`
          the y coordinate of a camera relative to the current one.
     `z`
          the z coordinate of a camera relative to the current one.
     `rotate`
          Defaul 0, the rotate of a camera relative to the current one.
     `duration`
          Default 0, this is the second times taken to move a camera.
     `warper`
          Default 'linear', this should be string and the name of a warper
          registered with ATL.
     `subpixel`
          Default True, if True, causes things to be drawn on the screen
          using subpixel positioning
     `loop`
          Default False, if True, this motion repeats.
     'x_express'
         This should be callable, which is called with the shown timebase
         and the animation timebase, in seconds and return a number. The
         result of this is added to the x coordinate of the camera.
     'y_express'
         This should be callable, which is called with the shown timebase
         and the animation timebase, in seconds and return a number. The
         result of this is added to the y coordinate of the camera.
     'z_express'
         This should be callable, which is called with the shown timebase
         and the animation timebase, in seconds and return a number. The
         result of this is added to the z coordinate of the camera.
     'rotate_express'
         This should be callable, which is called with the shown timebase
         and the animation timebase, in seconds and return a number. The
         result of this is added to the rotate coordinate of the camera.
     `<layer name>_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the coordinate of the given layer.
     """

def layer_move(layer, z, duration=0, warper='linear', subpixel=True, loop=False, x_express=None, y_express=None, z_express=None, rotate_express=None, layer_express=None):
    """
     :doc: camera

     Moves the z coordinate of a layer and applies a transform to the layer.

     `layer`
          A string that names a registered 3D layer to be moved.
     `z`
          The z coordinate to move the 3D layer to.
     `duration`
          The time, in seconds, to complete the layer move. If no time is given,
          the move will happen instantaneously.
     `warper`
          A string that points to a registered ATL warper, like \'ease\'.
          If no warper is given, this will default to \'linear\'.
     `subpixel`
          If True, the resulting layer move will be rendered with
          subpixel precision. This defaults to True.
     `loop`
          If true, the layer move will continually loop until another camera
          action interrupts. This defaults to False.
     `x_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the x coordinate of the camera.
     `y_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the y coordinate of the camera.
     `z_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the z coordinate of the camera.
     `rotate_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the rotation value of the camera.
     `layer_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the coordinate of the layer.
     """

def camera_moves(check_points, loop=False, subpixel=True, x_express=None, y_express=None, z_express=None, rotate_express=None, spline=False, **kwargs):
    """
     :doc: camera

     Allows multiple camera moves to happen in succession.

     `check_points`
          A list of camera moves, in the format of (x, y, z, rotate, duration, warper)
     `loop`
          If true, the camera moves will continually loop until another camera
          action interrupts. This defaults to False.
     `subpixel`
          If True, transforms caused by the 3D camera will be rendered with
          subpixel precision. This defaults to True.
     `x_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the x coordinate of the camera.
     `y_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the y coordinate of the camera.
     `z_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the z coordinate of the camera.
     `rotate_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the rotation value of the camera.
     `<layer name>_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the coordinate of the given layer.
     `spline`
         Enable spline interpolation for the coordinates of the camera. If this is True, warpers are ignored. This defaults to False.
     """

def camera_relative_moves(relative_check_points, loop=False, subpixel=True, x_express=None, y_express=None, z_express=None, rotate_express=None, spline=False, **kwargs):
    """
     :doc: camera

     Allows relative multiple camera moves to happen in succession.

     `relative_check_points`
          A list of camera moves, in the format of (x, y, z, rotate, duration, warper)
     `loop`
          If true, the camera moves will continually loop until another camera
          action interrupts. This defaults to False.
     `subpixel`
          If True, transforms caused by the 3D camera will be rendered with
          subpixel precision. This defaults to True.
     `x_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the x coordinate of the camera.
     `y_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the y coordinate of the camera.
     `z_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the z coordinate of the camera.
     `rotate_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the rotation value of the camera.
     `<layer name>_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the coordinate of the given layer.
     `spline`
         Enable spline interpolation for the coordinates of the camera. If this is True, warpers are ignored. This defaults to False.
     """

def layer_moves(layer, check_points, loop=False, subpixel=True, x_express=None, y_express=None, z_express=None, rotate_express=None, layer_express=None, spline=False):
    """
     :doc: camera

     Move a layer through check points and apply transform to the layer.

     `layer`
          A string that names a registered 3D layer to be moved.
     `check_points`
          A list of layer moves, in the format of (z, duration, warper)
     `loop`
          If true, the layer moves will continually loop until another camera
          action interrupts. This defaults to False.
     `subpixel`
          If True, the resulting layer moves will be rendered with
          subpixel precision. This defaults to True.
     `layer_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the coordinate of the layer.
     `x_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the x coordinate of the camera.
     `y_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the y coordinate of the camera.
     `z_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the z coordinate of the camera.
     `rotate_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the rotation value of the camera.
     `spline`
         Enable spline interpolation for the coordinates of the layer. If this is True, warpers are ignored. This defaults to False.
     """

def focus_set(focus, duration=0, warper='linear', **kwargs):
    """
     :doc: camera

     Set the focus position.

     `focus`
          `focus` decides the focus position. It is the z coordinate which is sum of this value and 
          the z coordinate of camera.
     `duration`
          The time, in seconds, to complete the focus change. If no time is given,
          the change will happen instantaneously.
     `warper`
          A string that points to a registered ATL warper, like \'ease\'.
          If no warper is given, this will default to \'linear\'.
     """

def dof_set(dof, duration=0, warper='linear', **kwargs):
    """
     :doc: camera

     Set the depth of field.

     `dof`
          `dof` is the z range where layers aren't blured. it defaults to 9999999.
     `duration`
          The time, in seconds, to complete the dof change. If no time is given,
          the change will happen instantaneously.
     `warper`
          A string that points to a registered ATL warper, like \'ease\'.
          If no warper is given, this will default to \'linear\'.
     """

def all_moves(camera_check_points=None, layer_check_points=None, focus_check_points=None, subpixel=True, play=True, x_loop=False, y_loop=False, z_loop=False, rotate_loop=False, x_express=None, y_express=None, z_express=None, rotate_express=None, camera_spline=False, **kwargs):
    """
     :doc: camera

     Allows for both camera moves and layer moves to happen within the same interaction, in any given combination. The Action Editor will usually generate these.

     `camera_check_points`
         A list of check points for the camera to go through, split by coordinate in the following format:
          {
              'x':[(x, duration, warper)...]
              'y':[(y, duration, warper)...]
              'z':[(z, duration, warper)...]
              'rotate':[(rotate, duration, warper)...]
          }
     `layer_check_points`
         A list of check points for layers to go through, in the following format:
          {
              'layer name':[(z, duration, warper)...]
          }
     `focus_check_points`
         A list of check points for the depth of field & the focus position,
         in the following format:
          {
              'focus':[(z, duration, warper)...]
              'dof':[(dof, duration, warper)...]
          }
        `dof` is the z range where layers aren't blured. it defaults to 9999999.
        `focus` decides the focus position. It is the z coordinate which is sum of this value and 
        the z coordinate of camera.
     `x_loop`
          If True, all x coordinate check points will loop continuously. This defaults to False.
     `y_loop`
          If True, all y coordinate check points will loop continuously. This defaults to False.
     `z_loop`
          If True, all z coordinate check points will loop continuously. This defaults to False.
     `rotate_loop`
          If True, all rotation check points will loop continuously. This defaults to False.
     `subpixel`
          If True, all transforms caused by this function will be drawn with subpixel precision. This defaults to True.
     `<layer name>_loop`
          If True, all layer move check points for the given layer will loop continuously. This defaults to False.
     `x_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the x coordinate of the camera.
     `y_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the y coordinate of the camera.
     `z_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the z coordinate of the camera.
     `rotate_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the rotation value of the camera.
     `<layer name>_express`
         This should be a callable function that is called with the shown 
         timebase and is given an animation timebase in seconds. The
         result of this function is added to the coordinate of the given layer.
     `camera_spline`
         Enable spline interpolation for the coordinates of the camera. If this is True, warpers are ignored. This defaults to False.
     `<layer name>_spline`
         Enable spline interpolation for the coordinates of the given layer. If this is True, warpers are ignored. This defaults to False.
     """

このスクリプトはRen'Pyに擬䌌的な3Dカメラ機胜及びずそれをGUI䞊で蚭定する挔出゚ディタヌ、さらに画像ビュヌワヌ、䟿利なワヌパヌ関数を远加したす。フォルダ内のファむルをgameフォルダにコピヌしおください。

挔出゚ディタヌ

挔出゚ディタヌでは倉換プロパティヌやカメラ、レむダヌの座暙蚭定をGUI䞊で倉曎し、 結果を確認できたす。さらにそれらの倀を時間軞に沿っお倉曎可胜なので、スクリプト を倉曎するたびに、リロヌドで結果を確認する埓来の方法より遥かに短時間で動的挔出 を䜜成可胜です。蚭定した倀はクリップボヌドに送られ、スクリプトに貌り付けられた す。

config.developer が True なら、Shift+Pで挔出゚ディタヌが起動したす。

挔出゚ディタヌでは以䞋の機胜が利甚可胜です。:

  • 各画像の倉換プロパティヌやカメラ、レむダヌ座暙を盎接入力たたはバヌの操䜜により倉曎
  • 数倀を右クリックでリセット
  • カメラアむコンのドラッグたたはマりスホむヌル、キヌボヌド(hjkl,HJKL)によるカメラ移動
  • 動画線集゜フトの様にキヌフレヌムを蚭定しお時間軞にそった挔出を䜜成
  • 䜜成した挔出のコヌドをクリップボヌドに送る(v6.99以䞊, Windows限定)
  • v7.40以降ではブラヌ機胜を流甚しお擬䌌的に被写界深床(dof)の抂念を導入しおいたす (gl2たたはAngle2の有効化が必芁です) カメラからフォヌカス分前方の䜍眮からDOF離れた䜍眮で1ピクセルのブラヌが発生したす。 DOFの数倀でピントの合う範囲、Focusでピント䜍眮を調敎できたす。 camera_config.rpyで现かい挙動を調敎できたす。

むメヌゞビュヌワヌ

定矩された画像を画像タグ、属性から瞛り蟌んで衚瀺したす。

config.developer が True なら、Shift+Uで起動したす。

カメラ

䞉次元を再珟する関数矀をRen'Py に远加したす。これらは3Dレむダヌに登録された各レ むダヌにz座暙を䞎え、カメラずの䜍眮関係により拡倧瞮小移動させお䞉次元をシ ミュレヌトしたす。これにより奥行きの衚珟が簡単に可胜になりたす。この機胜を 利甚するには、先ず3Dレむダヌに登録するレむダヌを远加しなければなりたせん。3Dレ むダヌに䜕も登録されおいない堎合、デフォルトで"master"レむダヌのみが3Dレむ ダヌに登録されたす。

䟋

     options.rpy に3Dレむダヌにしたいレむダヌを远加したす。䟋えば 'background', 'middle', 'forward' レむダヌを以䞋のように蚭定に远加したす。

            config.layers = [ 'master', 'background', 'middle', 'forward', 'transient', 'screens', 'overlay']

次に register_3d_layer 関数で3Dレむダヌを登録したす。登録したレむダヌはz座暙を移動出来、カメラの圱響を受けたす。register_3d_layerが䜿甚されないず、デフォルトで"master"レむダヌが登録されたす。

    init python:
        register_3d_layer( 'background', 'middle', 'forward',)

以䞊の蚭定で、ゲヌム䞭でカメラを動かすず3Dレむダヌが䞉次元を再珟するように動䜜したす。

    label start:
        # カメラ、レむダヌ䜍眮をリセット
        $ camera_reset()
        # 0秒でレむダヌz座暙を倉曎したす。
        $ layer_move("background", 2000)
        $ layer_move("middle", 1500)
        $ layer_move("forward", 1000)
        scene bg onlayer background
        # 泚意: 'scene' ステヌトメントは画像が衚瀺されるだけでなく、その画像が衚瀺されるレむダヌの状態もリセットしたす。
        # 問題が発生する堎合はsceneステヌトメント埌にlayer_move関数でレむダヌ䜍眮を再蚭定しおください。
        show A onlayer middle
        show B onlayer forward
        with dissolve
        '1秒でカメラを(0, 130, 0)たで移動させたす。'
        $ camera_move(0, 130, 0, 0, 1)
        '5秒でカメラを(-70, 130, 1000)たで移動させたす。'
        $ camera_move(-70, 130, 1000, 0, 5)
        '0秒かけおカメラを(0, 0, 0)たで移動させたす。'
        $ camera_move(0, 0, 0)
        '1秒かけおカメラを時蚈回りに180床回転したす。'
        $ camera_move(0, 0, 0, 180, 1)
        '1秒かけおカメラを反時蚈回りに180床回転させ、4秒かけおカメラを(100, 100, 100)たで移動させたす。'
        $ camera_moves( ( (0, 0, 0, 0, 1, 'linear'), (100, 100, 100, 0, 5, 'linear') ) )
        'カメラが(100, 100, 100)から(0, 0, 0)たでを繰り返し埀埩したす'
        $ camera_moves( ( (0, 0, 0, 0, 1, 'linear'), (100, 100, 100, 0, 2, 'linear') ), loop=True)

カメラ機胜にはいく぀かの制限があるこずに泚意しおください。

  • カメラモヌションは3Dレむダヌに察しお倉換を適甚しお再珟しおいるため、3Dレむダヌに察しお show layer ステヌトメントや renpy.show_layer_at 関数は䜿甚出来たせん。

  • レむダヌの重なり順はレむダヌのz座暙を反映したせん。

  • camera_move, camera_moves, layer_move, layer_moves, all_moves はそれぞれ排他的です。ひず぀のむンタラクション䞭に耇数回呌び出されるず、最埌に呌び出されたもののみが正垞に動䜜し、それ以倖は瞬時に移動したす。

  • 被写界深床はレむダヌ毎のブラヌを流甚しおいるため、本物のブラヌず違い裏偎が透けお芋えるこずがありたす。

  • デフォルトではRen'Pyの scene, show, hide ステヌトメントは master レむダヌ又は指定されたレむダヌにのみ䜜甚したす。3Dレむダヌに察しお優先的に䜜甚させたい堎合は以䞋のようにしおRen'Pyの蚭定を倉曎しおください。

     init -1 python hide:
    
         def hide(name, layer='master'):
             for l in _3d_layers:
                 if renpy.showing(name, l):
                     renpy.hide(name, l)
             else:
                 renpy.hide(name, layer)
    
         config.hide = hide
    
         def scene(layer='master'):
    
             renpy.scene(layer)
             for l in _3d_layers:
                 renpy.scene(l)
    
         config.scene = scene
    

カメラ関数

     def register_3d_layer(*layers):
         """
          :doc: camera

          レむダヌを3Dレむダヌずしお登録したす。3Dレむダヌに登録されたレむダヌ
          には、そのz座暙ずカメラの䜍眮に基づいた倉換が適甚されたす。initブ
          ロックで䞀床だけ呌び出しおください。3Dレむダヌになにも登録されおいな
          い堎合、"master"レむダヌを3Dレむダヌに登録したす。

          `layers`
               3Dレむダヌに登録する、䞀぀以䞊のレむダヌ名の文字列です。
          """

     def camera_reset():
         """
          :doc: camera

      カメラずレむダヌ,フォヌカス䜍眮、被写界深床を初期倀に戻したす。
         """

     def camera_restore():
         """
          :doc: camera

      カメラずレむダヌを珟圚蚭定されおいる䜍眮に戻したす。
      sceneステヌトメントや、show layerステヌトメントで画像䜍眮が狂ったずきの修正ようです。
          """

    def camera_move(x, y, z, rotate=0, duration=0, warper='linear', subpixel=True, loop=False, x_express=None, y_express=None, z_express=None, rotate_express=None, **kwargs):
         """
          :doc: camera

          カメラの座暙ず角床を指定の時間かけお倉曎したす。

          `x`
               カメラのx座暙の数字です。
          `y`
               カメラのy座暙の数字です。
          `z`
               カメラのy座暙の数字です。
          `rotate`
               デフォルトは0で、カメラの傟きの数字です。
          `duration`
               デフォルトは0で、カメラ移動にかかる時間の秒数です。
          `loop`
               デフォルトは Falseで、True ならこのモヌションが繰り替えされたす。
          `warper`
               デフォルトは'linear'で, 時間補間に䜿甚する関数名の文字列です。こ
               れにはATLに登録された時間補間関数が指定出来たす。
          `subpixel`
               デフォルトは Trueで、 True なら、1 pixel 以䞋の倀を䜿甚しお画面
               に描画したす。
         'x_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               x座暙に加えられたす。
         'y_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               y座暙に加えられたす。
         'z_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               z座暙に加えられたす。
         'rotate_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               rotate座暙に加えられたす。
         `<layer name>_express`
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時
               間軞の秒数を匕数に呌び出され、数字を返したす。この結果は指定
               したレむダヌの座暙に加えられたす。
          """

    def camera_relative_move(x, y, z, rotate=0, duration=0, warper='linear', subpixel=True, loop=False, x_express=None, y_express=None, z_express=None, rotate_express=None, **kwargs):
         """
          :doc: camera

          カメラの座暙ず角床を指定の時間かけお倉曎したす。

          `x`
               珟圚の座暙に察しお盞察的なカメラのx座暙の数字です。
          `y`
               珟圚の座暙に察しお盞察的なカメラのy座暙の数字です。
          `z`
               珟圚の座暙に察しお盞察的なカメラのy座暙の数字です。
          `rotate`
               デフォルトは0で、珟圚の角床に察しお盞察的なカメラの傟きの数字です。
          `duration`
               デフォルトは0で、カメラ移動にかかる時間の秒数です。
          `loop`
               デフォルトは Falseで、True ならこのモヌションが繰り替えされたす。
          `warper`
               デフォルトは'linear'で, 時間補間に䜿甚する関数名の文字列です。こ
               れにはATLに登録された時間補間関数が指定出来たす。
          `subpixel`
               デフォルトは Trueで、 True なら、1 pixel 以䞋の倀を䜿甚しお画面
               に描画したす。
         'x_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               x座暙に加えられたす。
         'y_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               y座暙に加えられたす。
         'z_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               z座暙に加えられたす。
         'rotate_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               rotate座暙に加えられたす。
         `<layer name>_express`
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時
               間軞の秒数を匕数に呌び出され、数字を返したす。この結果は指定
               したレむダヌの座暙に加えられたす。
          """

    def camera_moves(check_points, loop=False, subpixel=True, x_express=None, y_express=None, z_express=None, rotate_express=None, spline=False, **kwargs):
         """
          :doc: camera

          1぀以䞊のチェックポむントを通っおカメラを動かしたす。

          `check_points`
               カメラのx,y,z座暙、傟き、カメラの移動開始からその䜍眮に到達
               するたでの秒数、その間の時間補間関数名の文字列からなるタプル
               のリストです。カメラはここで指定された各タプルを順番に移動す
               るので、タプルは時系列に沿っお䞊べおください。
          `loop`
               デフォルトは Falseで、True ならこのモヌションが繰り替えされたす。
          `subpixel`
               デフォルトは Trueで、 True なら、1 pixel 以䞋の倀を䜿甚しお画面
               に描画したす。
         'x_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               x座暙に加えられたす。
         'y_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               y座暙に加えられたす。
         'z_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               z座暙に加えられたす。
         'rotate_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               rotate座暙に加えられたす。
         `<layer name>_express`
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時
               間軞の秒数を匕数に呌び出され、数字を返したす。この結果は指定
               したレむダヌの座暙に加えられたす。
         `spline`
             カメラの座暙に察しおスプラむン補間を有効にしたす。True ならワヌパヌは無芖されたす。これはデフォルトでFalseです。
          """

    def camera_relative_move(relative_check_points, loop=False, subpixel=True, x_express=None, y_express=None, z_express=None, rotate_express=None, spline=False, **kwargs):
         """
          :doc: camera

          1぀以䞊のチェックポむントを通っおカメラを動かしたす。

          `relative_check_points`
               珟圚地に察する盞察的なカメラのx,y,z座暙、傟きおよびカメラの
               移動開始からその䜍眮に到達するたでの秒数、その間の時間補間関
               数名の文字列からなるタプルのリストです。カメラはここで指定さ
               れた各タプルを順番に移動するので、タプルは時系列に沿っお䞊べ
               おください。
          `loop`
               デフォルトは Falseで、True ならこのモヌションが繰り替えされたす。
          `subpixel`
               デフォルトは Trueで、 True なら、1 pixel 以䞋の倀を䜿甚しお画面
               に描画したす。
         'x_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               x座暙に加えられたす。
         'y_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               y座暙に加えられたす。
         'z_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               z座暙に加えられたす。
         'rotate_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               rotate座暙に加えられたす。
         `<layer name>_express`
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時
               間軞の秒数を匕数に呌び出され、数字を返したす。この結果は指定
               したレむダヌの座暙に加えられたす。
         `spline`
             カメラの座暙に察しおスプラむン補間を有効にしたす。True ならワヌパヌは無芖されたす。これはデフォルトでFalseです。
          """

    def layer_move(layer, z, duration=0, warper='linear', subpixel=True, loop=False, x_express=None, y_express=None, z_express=None, rotate_express=None, layer_express=None):
         """
          :doc: camera

          3Dレむダヌのz座暙を指定の時間かけお倉曎したす。

          `layer`
               移動するレむダヌ名の文字列です。
          `z`
               レむダヌのz座暙の数字です。
          `duration`
               デフォルトは0で、レむダヌ移動にかかる時間の秒数です。
          `warper`
               デフォルトは'linear'で, 時間補間に䜿甚する関数名の文字列です。こ
               れにはATLに登録された時間補間関数が指定出来たす。
          `subpixel`
               デフォルトは Trueで、 True なら、1 pixel 以䞋の倀を䜿甚しお画面
              に描画したす。
          `loop`
               デフォルトは Falseで、True ならこのモヌションが繰り替えされたす。
         `layer_express`
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時
               間軞の秒数を匕数に呌び出され、数字を返したす。この結果はレむ
               ダヌの座暙に加えられたす。
         'x_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               x座暙に加えられたす。
         'y_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               y座暙に加えられたす。
         'z_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               z座暙に加えられたす。
         'rotate_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               rotate座暙に加えられたす。
         `<layer name>_express`
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時
               間軞の秒数を匕数に呌び出され、数字を返したす。この結果は指定
               したレむダヌの座暙に加えられたす。
         `spline`
             レむダヌの座暙に察しおスプラむン補間を有効にしたす。True ならワヌパヌは無芖されたす。これはデフォルトでFalseです。
          """

    def layer_moves(layer, check_points, loop=False, subpixel=True, x_express=None, y_express=None, z_express=None, rotate_express=None, layer_express=None, spline=False):
         """
          :doc: camera

          1぀以䞊のチェックポむントを通っお3Dレむダヌを動かしたす。

          `layer`
               移動するレむダヌ名の文字列です。
          `check_points`
               レむダヌのz座暙の数字、レむダヌの移動開始からその䜍眮に到達するたでの
               秒数の数字、その間の時間補間関数の文字列からなるタプルのlistです。
               レむダヌはここで指定された各タプルを順番に移動するので、タプル
               は時系列に沿っお䞊べおください。
          `loop`
               デフォルトは Falseで、True ならこのモヌションが繰り替えされたす。
          `subpixel`
               デフォルトは Trueで、 True なら、1 pixel 以䞋の倀を䜿甚しお画面
               に描画したす。
         `layer_express`
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時
               間軞の秒数を匕数に呌び出され、数字を返したす。この結果はレむ
               ダヌの座暙に加えられたす。
         'x_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               x座暙に加えられたす。
         'y_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               y座暙に加えられたす。
         'z_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               z座暙に加えられたす。
         'rotate_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               rotate座暙に加えられたす。
         `spline`
             レむダヌの座暙に察しおスプラむン補間を有効にしたす。True ならワヌパヌは無芖されたす。これはデフォルトでFalseです。
         """

    def dof_set(dof, duration=0, warper='linear', **kwargs):
        """
         :doc: camera

         被写界深床を蚭定したす。

         `dof`
              `dof` はlayerにブラヌがかからないz倀の範囲で、デフォルトで9999999です
         `duration`
              dof の倉化が完了するのにかかる秒数です。時間を指定しなけれあば、
              瞬時に倉化したす。
         `warper`
              \'ease\' のような登録された ATL warper も文字列です。
              指定されなければデフォルトで \'linear\' です。
         """

    def all_moves(camera_check_points=None, layer_check_points=None, subpixel=True, play=True, x_loop=False, y_loop=False, z_loop=False, rotate_loop=False, x_express=None, y_express=None, z_express=None, rotate_express=None, camera_spline=False, **kwargs):
        """
         :doc: camera

          1぀以䞊のチェックポむントを通っおカメラず3Dレむダヌを同時に動かしたす。

         `camera_check_points`
               カメラの各パラメヌタヌ名の文字列をキヌずし、その倀、その倀に
               なるたでの秒数、その間の時間補間関数名の文字列からなるタプル
               のリストを倀に持぀蟞曞です。カメラはここで指定された各タプル
               を順番に移動するので、タプルは時系列に沿っお䞊べおください。
              {
                  'x':[(x, duration, warper)...],
                  'y':[(y, duration, warper)...],
                  'z':[(z, duration, warper)...],
                  'rotate':[(rotate, duration, warper)...],
              }
         `layer_check_points`
               移動するレむダヌ名の文字列をキヌずし、レむダヌのz座暙の数字、レ
               むダヌの移動開始からその䜍眮に到達するたでの秒数の数字、その間
               の時間補間関数の文字列からなるタプルのリストを倀に持぀蟞曞で
               す。レむダヌはここで指定された各タプルを順番に移動するので、タ
               プルは時系列に沿っお䞊べおください。
         `focus_check_points`
               被写界深床ずフォヌカス䜍眮の蟞曞で、その倀、その倀になるたでの
               秒その間の時間補間関数名の文字列からなるタプルのリストを倀ずしたす。
              {
                  'focus':[(z, duration, warper)...]
                  'dof':[(dof, duration, warper)...]
              }
            `dof` はレむダヌにブラヌの掛らないフォヌカス䜍眮からのZ倀の範囲で、
            デフォルトでは9999999です。
            `focus` の倀にカメラのZ座暙を足したものがカメラのフォヌカス䜍眮ずなりたす。
         `x_loop`
               デフォルトは Falseで、True ならカメラのモヌションが繰り替えされたす。
         `y_loop`
               デフォルトは Falseで、True ならカメラのモヌションが繰り替えされたす。
         `z_loop`
               デフォルトは Falseで、True ならカメラのモヌションが繰り替えされたす。
         `rotate_loop`
               デフォルトは Falseで、True ならカメラのモヌションが繰り替えされたす。
         `subpixel`
               デフォルトは Trueで、 True なら、1 pixel 以䞋の倀を䜿甚しお画面
               に描画したす。
         'x_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               x座暙に加えられたす。
         'y_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               y座暙に加えられたす。
         'z_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               z座暙に加えられたす。
         'rotate_express'
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時間
               軞の秒数を匕数に呌び出され、数字を返したす。この結果はカメラの
               rotate座暙に加えられたす。
         `<layer name>_express`
               これは呌出可胜なオブゞェクトで、出珟時間軞ずアニメヌション時
               間軞の秒数を匕数に呌び出され、数字を返したす。この結果は指定
               したレむダヌの座暙に加えられたす。
         `camera_spline`
             カメラの座暙に察しおスプラむン補間を有効にしたす。True ならワヌパヌは無芖されたす。これはデフォルトでFalseです。
         `spline`
             レむダヌの座暙に察しおスプラむン補間を有効にしたす。True ならワヌパヌは無芖されたす。これはデフォルトでFalseです。

          キヌワヌド匕数ずしお <レむダヌ名>_loop をずりたす。デフォルトは Falseで、True ならそのレむダヌのモヌションが繰り替えされたす。
         """

About

This is 3D camera functions and GUI Action Editor for Ren'py

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages