mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-01-22 22:36:03 +00:00
Anim Editor: Added smart angle property to particles
This commit is contained in:
@@ -562,6 +562,28 @@ AnimationEditor::SidePanes.add_property(:particle_pane, :spawn_quantity, {
|
||||
}
|
||||
})
|
||||
|
||||
AnimationEditor::SidePanes.add_property(:particle_pane, :angle_override, {
|
||||
:new => proc { |pane, editor|
|
||||
values = {
|
||||
:none => _INTL("None"),
|
||||
:initial_angle_to_focus => _INTL("Initial angle to focus"),
|
||||
:always_point_at_focus => _INTL("Always point at focus")
|
||||
}
|
||||
pane.add_labelled_dropdown_list(:angle_override, _INTL("Smart angle"), values, :none)
|
||||
},
|
||||
:refresh_value => proc { |control, editor|
|
||||
focus = editor.anim[:particles][editor.particle_index][:focus]
|
||||
if !GameData::Animation::FOCUS_TYPES_WITH_USER.include?(focus) &&
|
||||
!GameData::Animation::FOCUS_TYPES_WITH_TARGET.include?(focus)
|
||||
editor.anim[:particles][editor.particle_index][:angle_override] = :none
|
||||
control.value = :none
|
||||
control.disable
|
||||
else
|
||||
control.enable
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
AnimationEditor::SidePanes.add_property(:particle_pane, :opposing_label, {
|
||||
:new => proc { |pane, editor|
|
||||
pane.add_label(:opposing_label, _INTL("If on opposing side..."))
|
||||
|
||||
@@ -497,7 +497,23 @@ class AnimationEditor::Canvas < Sprite
|
||||
# Set various other properties
|
||||
spr.zoom_x = values[:zoom_x] / 100.0
|
||||
spr.zoom_y = values[:zoom_y] / 100.0
|
||||
spr.angle = values[:angle]
|
||||
case particle[:angle_override]
|
||||
when :initial_angle_to_focus
|
||||
target_x = (focus_xy.length == 2) ? focus_xy[1][0] : focus_xy[0][0]
|
||||
target_x += offset_xy[0]
|
||||
target_y = (focus_xy.length == 2) ? focus_xy[1][1] : focus_xy[0][1]
|
||||
target_y += offset_xy[1]
|
||||
spr.angle = AnimationPlayer::Helper.initial_angle_between(particle, focus_xy, offset_xy)
|
||||
when :always_point_at_focus
|
||||
target_x = (focus_xy.length == 2) ? focus_xy[1][0] : focus_xy[0][0]
|
||||
target_x += offset_xy[0]
|
||||
target_y = (focus_xy.length == 2) ? focus_xy[1][1] : focus_xy[0][1]
|
||||
target_y += offset_xy[1]
|
||||
spr.angle = AnimationPlayer::Helper.angle_between(spr.x, spr.y, target_x, target_y)
|
||||
else
|
||||
spr.angle = 0
|
||||
end
|
||||
spr.angle += values[:angle]
|
||||
spr.mirror = values[:flip]
|
||||
spr.mirror = !spr.mirror if relative_to_index >= 0 && relative_to_index.odd? && particle[:foe_flip]
|
||||
spr.blend_type = values[:blending]
|
||||
|
||||
Reference in New Issue
Block a user