mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Rearranged and renamed Animation Editor-related script files
This commit is contained in:
@@ -95,22 +95,22 @@ class UIControls::ControlsContainer
|
|||||||
add_text_box(id, value, true)
|
add_text_box(id, value, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_slider(id, min_value, max_value, value, has_label = false)
|
def add_number_slider(id, min_value, max_value, value, has_label = false)
|
||||||
add_control(id, UIControls::Slider.new(*control_size(has_label), @viewport, min_value, max_value, value), has_label)
|
add_control(id, UIControls::NumberSlider.new(*control_size(has_label), @viewport, min_value, max_value, value), has_label)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_labelled_slider(id, label, min_value, max_value, value)
|
def add_labelled_number_slider(id, label, min_value, max_value, value)
|
||||||
add_label(id, label)
|
add_label(id, label)
|
||||||
add_slider(id, min_value, max_value, value, true)
|
add_number_slider(id, min_value, max_value, value, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_value_box(id, min_value, max_value, value, has_label = false)
|
def add_number_text_box(id, min_value, max_value, value, has_label = false)
|
||||||
add_control(id, UIControls::ValueBox.new(*control_size(has_label), @viewport, min_value, max_value, value), has_label)
|
add_control(id, UIControls::NumberTextBox.new(*control_size(has_label), @viewport, min_value, max_value, value), has_label)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_labelled_value_box(id, label, min_value, max_value, value)
|
def add_labelled_number_text_box(id, label, min_value, max_value, value)
|
||||||
add_label(id, label)
|
add_label(id, label)
|
||||||
add_value_box(id, min_value, max_value, value, true)
|
add_number_text_box(id, min_value, max_value, value, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_button(id, button_text, has_label = false)
|
def add_button(id, button_text, has_label = false)
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class UIControls::Slider < UIControls::BaseControl
|
class UIControls::NumberSlider < UIControls::BaseControl
|
||||||
attr_reader :min_value
|
attr_reader :min_value
|
||||||
attr_reader :max_value
|
attr_reader :max_value
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class UIControls::ValueBox < UIControls::TextBox
|
class UIControls::NumberTextBox < UIControls::TextBox
|
||||||
attr_reader :min_value
|
attr_reader :min_value
|
||||||
attr_reader :max_value
|
attr_reader :max_value
|
||||||
|
|
||||||
@@ -17,10 +17,10 @@ class UIControls::List < UIControls::BaseControl
|
|||||||
|
|
||||||
def initialize(width, height, viewport, values = [])
|
def initialize(width, height, viewport, values = [])
|
||||||
super(width, height, viewport)
|
super(width, height, viewport)
|
||||||
@slider = UIControls::Scrollbar.new(LIST_X + width - UIControls::Scrollbar::SLIDER_WIDTH, LIST_Y, height, viewport)
|
@scrollbar = UIControls::Scrollbar.new(LIST_X + width - UIControls::Scrollbar::SLIDER_WIDTH, LIST_Y, height, viewport)
|
||||||
@slider.set_interactive_rects
|
@scrollbar.set_interactive_rects
|
||||||
@slider.range = ROW_HEIGHT
|
@scrollbar.range = ROW_HEIGHT
|
||||||
@slider.z = self.z + 1
|
@scrollbar.z = self.z + 1
|
||||||
@rows_count = (height / ROW_HEIGHT).floor # Number of rows visible at once
|
@rows_count = (height / ROW_HEIGHT).floor # Number of rows visible at once
|
||||||
@top_row = 0
|
@top_row = 0
|
||||||
@selected = -1
|
@selected = -1
|
||||||
@@ -28,28 +28,28 @@ class UIControls::List < UIControls::BaseControl
|
|||||||
end
|
end
|
||||||
|
|
||||||
def dispose
|
def dispose
|
||||||
@slider.dispose
|
@scrollbar.dispose
|
||||||
@slider = nil
|
@scrollbar = nil
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def x=(new_val)
|
def x=(new_val)
|
||||||
super(new_val)
|
super(new_val)
|
||||||
@slider.x = new_val + LIST_X + width - UIControls::Scrollbar::SLIDER_WIDTH
|
@scrollbar.x = new_val + LIST_X + width - UIControls::Scrollbar::SLIDER_WIDTH
|
||||||
end
|
end
|
||||||
|
|
||||||
def y=(new_val)
|
def y=(new_val)
|
||||||
super(new_val)
|
super(new_val)
|
||||||
@slider.y = new_val + LIST_Y
|
@scrollbar.y = new_val + LIST_Y
|
||||||
end
|
end
|
||||||
|
|
||||||
# Each value in @values is an array: [id, text].
|
# Each value in @values is an array: [id, text].
|
||||||
def values=(new_vals)
|
def values=(new_vals)
|
||||||
@values = new_vals
|
@values = new_vals
|
||||||
set_interactive_rects
|
set_interactive_rects
|
||||||
@slider.range = @values.length * ROW_HEIGHT
|
@scrollbar.range = @values.length * ROW_HEIGHT
|
||||||
if @slider.visible
|
if @scrollbar.visible
|
||||||
self.top_row = (@slider.position.to_f / ROW_HEIGHT).round
|
self.top_row = (@scrollbar.position.to_f / ROW_HEIGHT).round
|
||||||
else
|
else
|
||||||
self.top_row = 0
|
self.top_row = 0
|
||||||
end
|
end
|
||||||
@@ -60,7 +60,7 @@ class UIControls::List < UIControls::BaseControl
|
|||||||
def top_row=(val)
|
def top_row=(val)
|
||||||
old_val = @top_row
|
old_val = @top_row
|
||||||
@top_row = val
|
@top_row = val
|
||||||
if @slider.visible
|
if @scrollbar.visible
|
||||||
@top_row = @top_row.clamp(0, @values.length - @rows_count)
|
@top_row = @top_row.clamp(0, @values.length - @rows_count)
|
||||||
else
|
else
|
||||||
@top_row = 0
|
@top_row = 0
|
||||||
@@ -110,7 +110,7 @@ class UIControls::List < UIControls::BaseControl
|
|||||||
end
|
end
|
||||||
|
|
||||||
def repaint
|
def repaint
|
||||||
@slider.repaint if @slider.invalid?
|
@scrollbar.repaint if @scrollbar.invalid?
|
||||||
super if invalid?
|
super if invalid?
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ class UIControls::List < UIControls::BaseControl
|
|||||||
@captured_area = nil
|
@captured_area = nil
|
||||||
mouse_x, mouse_y = mouse_pos
|
mouse_x, mouse_y = mouse_pos
|
||||||
return if !mouse_x || !mouse_y
|
return if !mouse_x || !mouse_y
|
||||||
return if @slider.visible && (@slider.busy? || mouse_x >= @slider.x - self.x)
|
return if @scrollbar.visible && (@scrollbar.busy? || mouse_x >= @scrollbar.x - self.x)
|
||||||
# Check for mouse presses on rows
|
# Check for mouse presses on rows
|
||||||
mouse_y += @top_row * ROW_HEIGHT
|
mouse_y += @top_row * ROW_HEIGHT
|
||||||
@interactions.each_pair do |area, rect|
|
@interactions.each_pair do |area, rect|
|
||||||
@@ -168,7 +168,7 @@ class UIControls::List < UIControls::BaseControl
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
# Don't update the highlight if the mouse is using the scrollbar
|
# Don't update the highlight if the mouse is using the scrollbar
|
||||||
if @slider.visible && (@slider.busy? || mouse_x >= @slider.x - self.x)
|
if @scrollbar.visible && (@scrollbar.busy? || mouse_x >= @scrollbar.x - self.x)
|
||||||
invalidate if @hover_area
|
invalidate if @hover_area
|
||||||
@hover_area = nil
|
@hover_area = nil
|
||||||
return
|
return
|
||||||
@@ -193,12 +193,12 @@ class UIControls::List < UIControls::BaseControl
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
return if !self.visible
|
return if !self.visible
|
||||||
@slider.update
|
@scrollbar.update
|
||||||
super
|
super
|
||||||
# TODO: Disabled control stuff.
|
# TODO: Disabled control stuff.
|
||||||
# return if self.disabled
|
# return if self.disabled
|
||||||
# Refresh the list's position if changed by moving the slider
|
# Refresh the list's position if changed by moving the scrollbar
|
||||||
self.top_row = (@slider.position.to_f / ROW_HEIGHT).round
|
self.top_row = (@scrollbar.position.to_f / ROW_HEIGHT).round
|
||||||
# Set the selected row to the row the mouse is over, if clicked on
|
# Set the selected row to the row the mouse is over, if clicked on
|
||||||
if @captured_area
|
if @captured_area
|
||||||
@selected = @hover_area if @hover_area.is_a?(Integer)
|
@selected = @hover_area if @hover_area.is_a?(Integer)
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
MenuHandlers.add(:debug_menu, :create_animation_pbs_files, {
|
|
||||||
"name" => _INTL("Write all animation PBS files"),
|
|
||||||
"parent" => :files_menu,
|
|
||||||
"description" => _INTL("Write all animation PBS files."),
|
|
||||||
"effect" => proc {
|
|
||||||
Compiler.write_all_battle_animations
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -120,3 +120,16 @@ module Compiler
|
|||||||
Console.echo_h2(_INTL("Successfully rewrote all animation PBS files"), text: :green)
|
Console.echo_h2(_INTL("Successfully rewrote all animation PBS files"), text: :green)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# Debug menu function for writing all animation PBS files. Shouldn't need to be
|
||||||
|
# used, but it's here if you want it.
|
||||||
|
#===============================================================================
|
||||||
|
MenuHandlers.add(:debug_menu, :create_animation_pbs_files, {
|
||||||
|
"name" => _INTL("Write all animation PBS files"),
|
||||||
|
"parent" => :files_menu,
|
||||||
|
"description" => _INTL("Write all animation PBS files."),
|
||||||
|
"effect" => proc {
|
||||||
|
Compiler.write_all_battle_animations
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -22,8 +22,8 @@
|
|||||||
# while it's playing.
|
# while it's playing.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class AnimationEditor
|
class AnimationEditor
|
||||||
WINDOW_WIDTH = AnimationEditorLoadScreen::WINDOW_WIDTH
|
WINDOW_WIDTH = Settings::SCREEN_WIDTH + (32 * 10)
|
||||||
WINDOW_HEIGHT = AnimationEditorLoadScreen::WINDOW_HEIGHT
|
WINDOW_HEIGHT = Settings::SCREEN_HEIGHT + (32 * 10)
|
||||||
|
|
||||||
TOP_BAR_HEIGHT = 30
|
TOP_BAR_HEIGHT = 30
|
||||||
|
|
||||||
@@ -51,42 +51,39 @@ class AnimationEditor
|
|||||||
def initialize(anim_id, anim)
|
def initialize(anim_id, anim)
|
||||||
@anim_id = anim_id
|
@anim_id = anim_id
|
||||||
@anim = anim
|
@anim = anim
|
||||||
|
# Viewports
|
||||||
@viewport = Viewport.new(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT)
|
@viewport = Viewport.new(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT)
|
||||||
@viewport.z = 99999
|
@viewport.z = 99999
|
||||||
|
@canvas_viewport = Viewport.new(CANVAS_X, CANVAS_Y, CANVAS_WIDTH, CANVAS_HEIGHT)
|
||||||
|
@canvas_viewport.z = @viewport.z
|
||||||
|
# Background sprite
|
||||||
@screen_bitmap = BitmapSprite.new(WINDOW_WIDTH, WINDOW_HEIGHT, @viewport)
|
@screen_bitmap = BitmapSprite.new(WINDOW_WIDTH, WINDOW_HEIGHT, @viewport)
|
||||||
draw_editor_background
|
draw_editor_background
|
||||||
# Canvas
|
# Canvas
|
||||||
@canvas = Sprite.new(@viewport)
|
@canvas = AnimationEditor::Canvas.new(@canvas_viewport)
|
||||||
@canvas.x = CANVAS_X
|
# Play controls
|
||||||
@canvas.y = CANVAS_Y
|
@play_controls = AnimationEditor::PlayControls.new(
|
||||||
@canvas.bitmap = RPG::Cache.load_bitmap("Graphics/Battlebacks/", "field_bg")
|
PLAY_CONTROLS_X, PLAY_CONTROLS_Y, PLAY_CONTROLS_WIDTH, PLAY_CONTROLS_HEIGHT, @viewport
|
||||||
|
)
|
||||||
# Side panes
|
# Side panes
|
||||||
@commands_pane = UIControls::ControlsContainer.new(SIDE_PANE_X, SIDE_PANE_Y, SIDE_PANE_WIDTH, SIDE_PANE_HEIGHT)
|
@commands_pane = UIControls::ControlsContainer.new(SIDE_PANE_X, SIDE_PANE_Y, SIDE_PANE_WIDTH, SIDE_PANE_HEIGHT)
|
||||||
@se_pane = UIControls::ControlsContainer.new(SIDE_PANE_X, SIDE_PANE_Y, SIDE_PANE_WIDTH, SIDE_PANE_HEIGHT)
|
@se_pane = UIControls::ControlsContainer.new(SIDE_PANE_X, SIDE_PANE_Y, SIDE_PANE_WIDTH, SIDE_PANE_HEIGHT)
|
||||||
@particle_pane = UIControls::ControlsContainer.new(SIDE_PANE_X, SIDE_PANE_Y, SIDE_PANE_WIDTH, SIDE_PANE_HEIGHT)
|
@particle_pane = UIControls::ControlsContainer.new(SIDE_PANE_X, SIDE_PANE_Y, SIDE_PANE_WIDTH, SIDE_PANE_HEIGHT)
|
||||||
@keyframe_pane = UIControls::ControlsContainer.new(SIDE_PANE_X, SIDE_PANE_Y, SIDE_PANE_WIDTH, SIDE_PANE_HEIGHT)
|
@keyframe_pane = UIControls::ControlsContainer.new(SIDE_PANE_X, SIDE_PANE_Y, SIDE_PANE_WIDTH, SIDE_PANE_HEIGHT)
|
||||||
# TODO: Make more side panes for:
|
# TODO: Make more side panes for:
|
||||||
# - colour/tone editor (accessed from commands_pane via a
|
# - colour/tone editor (accessed from @commands_pane via a
|
||||||
# button; has Apply/Cancel buttons to only apply all its values at
|
# button; has Apply/Cancel buttons to only apply all its values at
|
||||||
# the end of editing them, although canvas will be updated in real
|
# the end of editing them, although canvas will be updated in real
|
||||||
# time to show the changes)
|
# time to show the changes)
|
||||||
# - particle properties (that don't change during the animation; name,
|
|
||||||
# focus...)
|
|
||||||
# - SE particle properties (depends on keyframe)
|
|
||||||
# - effects particle properties (depends on keyframe; for screen
|
# - effects particle properties (depends on keyframe; for screen
|
||||||
# shake, etc.)
|
# shake, etc.)
|
||||||
# - keyframe properties (shift all later particle commands forward/
|
|
||||||
# backward).
|
|
||||||
# Play controls
|
|
||||||
@play_controls = UIControls::AnimationPlayControls.new(
|
|
||||||
PLAY_CONTROLS_X, PLAY_CONTROLS_Y, PLAY_CONTROLS_WIDTH, PLAY_CONTROLS_HEIGHT, @viewport
|
|
||||||
)
|
|
||||||
# Timeline/particle list
|
# Timeline/particle list
|
||||||
@particle_list = UIControls::AnimationParticleList.new(
|
@particle_list = AnimationEditor::ParticleList.new(
|
||||||
PARTICLE_LIST_X, PARTICLE_LIST_Y, PARTICLE_LIST_WIDTH, PARTICLE_LIST_HEIGHT, @viewport
|
PARTICLE_LIST_X, PARTICLE_LIST_Y, PARTICLE_LIST_WIDTH, PARTICLE_LIST_HEIGHT, @viewport
|
||||||
)
|
)
|
||||||
@particle_list.set_interactive_rects
|
@particle_list.set_interactive_rects
|
||||||
@captured = nil
|
@captured = nil
|
||||||
|
set_canvas_contents
|
||||||
set_side_panes_contents
|
set_side_panes_contents
|
||||||
set_particle_list_contents
|
set_particle_list_contents
|
||||||
set_play_controls_contents
|
set_play_controls_contents
|
||||||
@@ -103,6 +100,7 @@ class AnimationEditor
|
|||||||
@play_controls.dispose
|
@play_controls.dispose
|
||||||
@particle_list.dispose
|
@particle_list.dispose
|
||||||
@viewport.dispose
|
@viewport.dispose
|
||||||
|
@canvas_viewport.dispose
|
||||||
end
|
end
|
||||||
|
|
||||||
def keyframe
|
def keyframe
|
||||||
@@ -115,18 +113,22 @@ class AnimationEditor
|
|||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def set_canvas_contents
|
||||||
|
@canvas.bg_name = "indoor1"
|
||||||
|
end
|
||||||
|
|
||||||
def set_commands_pane_contents
|
def set_commands_pane_contents
|
||||||
# :frame (related to graphic) - If the graphic is user's sprite/target's
|
# :frame (related to graphic) - If the graphic is user's sprite/target's
|
||||||
# sprite, make this instead a choice of front/back/same as the main sprite/
|
# sprite, make this instead a choice of front/back/same as the main sprite/
|
||||||
# opposite of the main sprite. Probably need two controls in the same space
|
# opposite of the main sprite. Probably need two controls in the same space
|
||||||
# and refresh_commands_pane makes the appropriate one visible.
|
# and refresh_commands_pane makes the appropriate one visible.
|
||||||
@commands_pane.add_labelled_value_box(:x, _INTL("X"), -128, CANVAS_WIDTH + 128, 64)
|
@commands_pane.add_labelled_number_text_box(:x, _INTL("X"), -128, CANVAS_WIDTH + 128, 64)
|
||||||
@commands_pane.add_labelled_value_box(:y, _INTL("Y"), -128, CANVAS_HEIGHT + 128, 96)
|
@commands_pane.add_labelled_number_text_box(:y, _INTL("Y"), -128, CANVAS_HEIGHT + 128, 96)
|
||||||
@commands_pane.add_labelled_checkbox(:visible, _INTL("Visible"), true)
|
@commands_pane.add_labelled_checkbox(:visible, _INTL("Visible"), true)
|
||||||
@commands_pane.add_labelled_slider(:opacity, _INTL("Opacity"), 0, 255, 255)
|
@commands_pane.add_labelled_number_slider(:opacity, _INTL("Opacity"), 0, 255, 255)
|
||||||
@commands_pane.add_labelled_value_box(:zoom_x, _INTL("Zoom X"), 0, 1000, 100)
|
@commands_pane.add_labelled_number_text_box(:zoom_x, _INTL("Zoom X"), 0, 1000, 100)
|
||||||
@commands_pane.add_labelled_value_box(:zoom_y, _INTL("Zoom Y"), 0, 1000, 100)
|
@commands_pane.add_labelled_number_text_box(:zoom_y, _INTL("Zoom Y"), 0, 1000, 100)
|
||||||
@commands_pane.add_labelled_value_box(:angle, _INTL("Angle"), -1080, 1080, 0)
|
@commands_pane.add_labelled_number_text_box(:angle, _INTL("Angle"), -1080, 1080, 0)
|
||||||
@commands_pane.add_labelled_checkbox(:flip, _INTL("Flip"), false)
|
@commands_pane.add_labelled_checkbox(:flip, _INTL("Flip"), false)
|
||||||
@commands_pane.add_labelled_dropdown_list(:blending, _INTL("Blending"), {
|
@commands_pane.add_labelled_dropdown_list(:blending, _INTL("Blending"), {
|
||||||
0 => _INTL("None"),
|
0 => _INTL("None"),
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
# TODO: Come up with a better name for this class. I'm not sure I want to merge
|
#===============================================================================
|
||||||
# this class with the editor class.
|
#
|
||||||
class AnimationEditorLoadScreen
|
#===============================================================================
|
||||||
WINDOW_WIDTH = Settings::SCREEN_WIDTH + (32 * 10)
|
class AnimationEditor::AnimationSelector
|
||||||
WINDOW_HEIGHT = Settings::SCREEN_HEIGHT + (32 * 10)
|
|
||||||
|
|
||||||
ANIMATIONS_LIST_X = 4
|
ANIMATIONS_LIST_X = 4
|
||||||
ANIMATIONS_LIST_Y = 4
|
ANIMATIONS_LIST_Y = 4
|
||||||
ANIMATIONS_LIST_WIDTH = 300
|
ANIMATIONS_LIST_WIDTH = 300
|
||||||
ANIMATIONS_LIST_HEIGHT = WINDOW_HEIGHT - (ANIMATIONS_LIST_Y * 2)
|
ANIMATIONS_LIST_HEIGHT = AnimationEditor::WINDOW_HEIGHT - (ANIMATIONS_LIST_Y * 2)
|
||||||
|
|
||||||
LOAD_BUTTON_WIDTH = 200
|
LOAD_BUTTON_WIDTH = 200
|
||||||
LOAD_BUTTON_HEIGHT = 48
|
LOAD_BUTTON_HEIGHT = 48
|
||||||
@@ -16,9 +14,9 @@ class AnimationEditorLoadScreen
|
|||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
generate_list
|
generate_list
|
||||||
@viewport = Viewport.new(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT)
|
@viewport = Viewport.new(0, 0, AnimationEditor::WINDOW_WIDTH, AnimationEditor::WINDOW_HEIGHT)
|
||||||
@viewport.z = 99999
|
@viewport.z = 99999
|
||||||
@screen_bitmap = BitmapSprite.new(WINDOW_WIDTH, WINDOW_HEIGHT, @viewport)
|
@screen_bitmap = BitmapSprite.new(AnimationEditor::WINDOW_WIDTH, AnimationEditor::WINDOW_HEIGHT, @viewport)
|
||||||
draw_editor_background
|
draw_editor_background
|
||||||
@load_animation_id = nil
|
@load_animation_id = nil
|
||||||
create_controls
|
create_controls
|
||||||
@@ -45,7 +43,7 @@ class AnimationEditorLoadScreen
|
|||||||
end
|
end
|
||||||
@animations.push([id, name])
|
@animations.push([id, name])
|
||||||
end
|
end
|
||||||
# TODO: For slider testing purposes.
|
# TODO: For scrollbar testing purposes.
|
||||||
rand(400).times do |i|
|
rand(400).times do |i|
|
||||||
@animations.push([42 + i, "Extra animation #{i + 1}"])
|
@animations.push([42 + i, "Extra animation #{i + 1}"])
|
||||||
end
|
end
|
||||||
@@ -53,7 +51,7 @@ class AnimationEditorLoadScreen
|
|||||||
|
|
||||||
def draw_editor_background
|
def draw_editor_background
|
||||||
# Fill the whole screen with white
|
# Fill the whole screen with white
|
||||||
@screen_bitmap.bitmap.fill_rect(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, Color.black)
|
@screen_bitmap.bitmap.fill_rect(0, 0, AnimationEditor::WINDOW_WIDTH, AnimationEditor::WINDOW_HEIGHT, Color.black)
|
||||||
# Outline around animations list
|
# Outline around animations list
|
||||||
areas = [
|
areas = [
|
||||||
[ANIMATIONS_LIST_X, ANIMATIONS_LIST_Y, ANIMATIONS_LIST_WIDTH, ANIMATIONS_LIST_HEIGHT],
|
[ANIMATIONS_LIST_X, ANIMATIONS_LIST_Y, ANIMATIONS_LIST_WIDTH, ANIMATIONS_LIST_HEIGHT],
|
||||||
@@ -138,6 +136,7 @@ class AnimationEditorLoadScreen
|
|||||||
screen = AnimationEditor.new(@load_animation_id, GameData::Animation.get(@load_animation_id).clone_as_hash)
|
screen = AnimationEditor.new(@load_animation_id, GameData::Animation.get(@load_animation_id).clone_as_hash)
|
||||||
screen.run
|
screen.run
|
||||||
@load_animation_id = nil
|
@load_animation_id = nil
|
||||||
|
break # TODO: For quickstart testing purposes.
|
||||||
# Refresh list of animations, in case the edited one changed its type,
|
# Refresh list of animations, in case the edited one changed its type,
|
||||||
# move, version or name
|
# move, version or name
|
||||||
generate_list
|
generate_list
|
||||||
@@ -155,26 +154,19 @@ class AnimationEditorLoadScreen
|
|||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Start
|
# Add to Debug menu.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def test_anim_editor
|
MenuHandlers.add(:debug_menu, :use_pc, {
|
||||||
|
"name" => _INTL("New Animation Editor"),
|
||||||
|
"parent" => :main,
|
||||||
|
"description" => _INTL("Open the new animation editor."),
|
||||||
|
"effect" => proc {
|
||||||
Graphics.resize_screen(AnimationEditor::WINDOW_WIDTH, AnimationEditor::WINDOW_HEIGHT)
|
Graphics.resize_screen(AnimationEditor::WINDOW_WIDTH, AnimationEditor::WINDOW_HEIGHT)
|
||||||
pbSetResizeFactor(1)
|
pbSetResizeFactor(1)
|
||||||
screen = AnimationEditorLoadScreen.new
|
screen = AnimationEditor::AnimationSelector.new
|
||||||
screen.run
|
screen.run
|
||||||
Graphics.resize_screen(Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT)
|
Graphics.resize_screen(Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT)
|
||||||
pbSetResizeFactor($PokemonSystem.screensize)
|
pbSetResizeFactor($PokemonSystem.screensize)
|
||||||
$game_map&.autoplay
|
$game_map&.autoplay
|
||||||
end
|
|
||||||
|
|
||||||
#===============================================================================
|
|
||||||
# Add to Debug menu
|
|
||||||
#===============================================================================
|
|
||||||
MenuHandlers.add(:debug_menu, :use_pc, {
|
|
||||||
"name" => "Test new animation editor",
|
|
||||||
"parent" => :main,
|
|
||||||
"description" => "Test new animation editor",
|
|
||||||
"effect" => proc {
|
|
||||||
test_anim_editor
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
#===============================================================================
|
||||||
module AnimationEditor::ParticleDataHelper
|
module AnimationEditor::ParticleDataHelper
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
@@ -97,7 +100,7 @@ module AnimationEditor::ParticleDataHelper
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
# Returns an array indicating where command diamonds and duration lines should
|
# Returns an array indicating where command diamonds and duration lines should
|
||||||
# be drawn in the AnimationParticleList.
|
# be drawn in the AnimationEditor::ParticleList.
|
||||||
def get_particle_commands_timeline(particle)
|
def get_particle_commands_timeline(particle)
|
||||||
ret = []
|
ret = []
|
||||||
durations = []
|
durations = []
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
#===============================================================================
|
||||||
|
# TODO
|
||||||
|
#===============================================================================
|
||||||
|
class AnimationEditor::Canvas < Sprite
|
||||||
|
attr_reader :bg_name
|
||||||
|
|
||||||
|
def initialize(viewport)
|
||||||
|
super
|
||||||
|
@bg_val = ""
|
||||||
|
# TODO: Add a second bg sprite for screen shake purposes.
|
||||||
|
player_base_pos = Battle::Scene.pbBattlerPosition(0)
|
||||||
|
@player_base = IconSprite.new(*player_base_pos, viewport)
|
||||||
|
@player_base.z = 1
|
||||||
|
foe_base_pos = Battle::Scene.pbBattlerPosition(1)
|
||||||
|
@foe_base = IconSprite.new(*foe_base_pos, viewport)
|
||||||
|
@foe_base.z = 1
|
||||||
|
@message_bar_sprite = Sprite.new(viewport)
|
||||||
|
@message_bar_sprite.z = 999
|
||||||
|
end
|
||||||
|
|
||||||
|
def dispose
|
||||||
|
@message_bar_sprite.dispose
|
||||||
|
@player_base.dispose
|
||||||
|
@foe_base.dispose
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def bg_name=(val)
|
||||||
|
return if @bg_name == val
|
||||||
|
@bg_name = val
|
||||||
|
# TODO: Come up with a better way to define the base filenames, based on
|
||||||
|
# which files actually exist.
|
||||||
|
self.bitmap = RPG::Cache.load_bitmap("Graphics/Battlebacks/", @bg_name + "_bg")
|
||||||
|
@player_base.setBitmap("Graphics/Battlebacks/" + @bg_name + "_base0")
|
||||||
|
@player_base.ox = @player_base.bitmap.width / 2
|
||||||
|
@player_base.oy = @player_base.bitmap.height
|
||||||
|
@foe_base.setBitmap("Graphics/Battlebacks/" + @bg_name + "_base1")
|
||||||
|
@foe_base.ox = @foe_base.bitmap.width / 2
|
||||||
|
@foe_base.oy = @foe_base.bitmap.height / 2
|
||||||
|
@message_bar_sprite.bitmap = RPG::Cache.load_bitmap("Graphics/Battlebacks/", @bg_name + "_message")
|
||||||
|
@message_bar_sprite.y = Settings::SCREEN_HEIGHT - @message_bar_sprite.height
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# TODO
|
# TODO
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class UIControls::AnimationPlayControls < UIControls::BaseControl
|
class AnimationEditor::PlayControls < UIControls::BaseControl
|
||||||
TEXT_OFFSET_Y = 5
|
TEXT_OFFSET_Y = 5
|
||||||
|
|
||||||
def initialize(x, y, width, height, viewport)
|
def initialize(x, y, width, height, viewport)
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
# scrollbar works, i.e. every visible @commands_sprites isn't redrawn each
|
# scrollbar works, i.e. every visible @commands_sprites isn't redrawn each
|
||||||
# time the horizontal scrollbar changes.
|
# time the horizontal scrollbar changes.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class UIControls::AnimationParticleList < UIControls::BaseControl
|
class AnimationEditor::ParticleList < UIControls::BaseControl
|
||||||
VIEWPORT_SPACING = 1
|
VIEWPORT_SPACING = 1
|
||||||
TIMELINE_HEIGHT = 24 - VIEWPORT_SPACING
|
TIMELINE_HEIGHT = 24 - VIEWPORT_SPACING
|
||||||
LIST_X = 0
|
LIST_X = 0
|
||||||
Reference in New Issue
Block a user