Skip to content

Commit

Permalink
v2.0-beta1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mimaraka committed Feb 14, 2025
1 parent a81312e commit c31306c
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion curve_editor/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace curve_editor::global {
inline constexpr auto PLUGIN_VERSION = mkaul::Version{
mkaul::VersionNumber{2},
mkaul::PreviewType{mkaul::PreviewType::Type::Beta},
mkaul::VersionNumber{1}
mkaul::VersionNumber{1, 0, 1}
};
inline constexpr auto PLUGIN_DEVELOPER = "mimaraka";
inline constexpr auto PLUGIN_TRANSLATOR = "Deepdive";
Expand Down
3 changes: 3 additions & 0 deletions curve_editor/curve_base.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "curve_id_manager.hpp"
#include "enum.hpp"
#include <cereal/cereal.hpp>
#include <nlohmann/json.hpp>

Expand Down Expand Up @@ -45,6 +46,8 @@ namespace curve_editor {
virtual void set_locked(bool locked) noexcept { locked_ = locked; }
[[nodiscard]] virtual bool is_default() const noexcept = 0;
[[nodiscard]] auto get_id() const noexcept { return id_; }
// TODO: CurveTypeというenumにする
[[nodiscard]] constexpr virtual EditMode get_type() const noexcept = 0;
[[nodiscard]] constexpr virtual std::string get_name() const noexcept = 0;
[[nodiscard]] virtual std::string get_disp_name() const noexcept = 0;
[[nodiscard]] virtual nlohmann::json create_json() const noexcept;
Expand Down
2 changes: 1 addition & 1 deletion curve_editor/curve_bezier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace curve_editor {
[[nodiscard]] std::unique_ptr<GraphCurve> clone_graph() const noexcept override { return std::make_unique<BezierCurve>(*this); }
[[nodiscard]] std::unique_ptr<Curve> clone() const noexcept override { return clone_graph(); }

// カーブの名前を取得する
[[nodiscard]] constexpr EditMode get_type() const noexcept override { return EditMode::Bezier; }
[[nodiscard]] constexpr std::string get_name() const noexcept override { return global::CURVE_NAME_BEZIER; }
[[nodiscard]] std::string get_disp_name() const noexcept override { return global::string_table[global::StringTable::StringId::LabelEditModeBezier]; }

Expand Down
1 change: 1 addition & 0 deletions curve_editor/curve_bounce.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace curve_editor {
[[nodiscard]] std::unique_ptr<GraphCurve> clone_graph() const noexcept override { return std::make_unique<BounceCurve>(*this); }
[[nodiscard]] std::unique_ptr<Curve> clone() const noexcept override { return clone_graph(); }

[[nodiscard]] constexpr EditMode get_type() const noexcept override { return EditMode::Bounce; }
[[nodiscard]] constexpr std::string get_name() const noexcept override { return global::CURVE_NAME_BOUNCE; }
[[nodiscard]] std::string get_disp_name() const noexcept override { return global::string_table[global::StringTable::StringId::LabelEditModeBounce]; }

Expand Down
1 change: 1 addition & 0 deletions curve_editor/curve_elastic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace curve_editor {
[[nodiscard]] std::unique_ptr<GraphCurve> clone_graph() const noexcept override { return std::make_unique<ElasticCurve>(*this); }
[[nodiscard]] std::unique_ptr<Curve> clone() const noexcept override { return clone_graph(); }

[[nodiscard]] constexpr EditMode get_type() const noexcept override { return EditMode::Elastic; }
[[nodiscard]] constexpr std::string get_name() const noexcept override { return global::CURVE_NAME_ELASTIC; }
[[nodiscard]] std::string get_disp_name() const noexcept override { return global::string_table[global::StringTable::StringId::LabelEditModeElastic]; }

Expand Down
2 changes: 2 additions & 0 deletions curve_editor/curve_linear.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ namespace curve_editor {
[[nodiscard]] std::unique_ptr<GraphCurve> clone_graph() const noexcept override { return std::make_unique<LinearCurve>(*this); }
[[nodiscard]] std::unique_ptr<Curve> clone() const noexcept override { return clone_graph(); }

// TODO: CurveTypeに直す際にここも直す
[[nodiscard]] constexpr EditMode get_type() const noexcept override { return EditMode::Normal; }
[[nodiscard]] constexpr std::string get_name() const noexcept override { return global::CURVE_NAME_LINEAR; }
[[nodiscard]] std::string get_disp_name() const noexcept override { return global::string_table[global::StringTable::StringId::LabelCurveSegmentTypeLinear]; }

Expand Down
1 change: 1 addition & 0 deletions curve_editor/curve_normal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace curve_editor {
[[nodiscard]] std::unique_ptr<GraphCurve> clone_graph() const noexcept override { return std::make_unique<NormalCurve>(*this); }
[[nodiscard]] std::unique_ptr<Curve> clone() const noexcept override { return clone_graph(); }

[[nodiscard]] constexpr EditMode get_type() const noexcept override { return EditMode::Normal; }
[[nodiscard]] constexpr std::string get_name() const noexcept override { return global::CURVE_NAME_NORMAL; }
[[nodiscard]] std::string get_disp_name() const noexcept override { return global::string_table[global::StringTable::StringId::LabelEditModeNormal]; }

Expand Down
1 change: 1 addition & 0 deletions curve_editor/curve_script.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace curve_editor {

[[nodiscard]] std::unique_ptr<Curve> clone() const noexcept override { return std::make_unique<ScriptCurve>(*this); }

[[nodiscard]] constexpr EditMode get_type() const noexcept override { return EditMode::Script; }
[[nodiscard]] constexpr std::string get_name() const noexcept override { return global::CURVE_NAME_SCRIPT; }
[[nodiscard]] std::string get_disp_name() const noexcept override { return global::string_table[global::StringTable::StringId::LabelEditModeScript]; }
[[nodiscard]] double curve_function(double, double start, double) const noexcept override;
Expand Down
1 change: 1 addition & 0 deletions curve_editor/curve_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace curve_editor {
[[nodiscard]] std::unique_ptr<GraphCurve> clone_graph() const noexcept override { return std::make_unique<ValueCurve>(*this); }
[[nodiscard]] std::unique_ptr<Curve> clone() const noexcept override { return clone_graph(); }

[[nodiscard]] constexpr EditMode get_type() const noexcept override { return EditMode::Value; }
[[nodiscard]] constexpr std::string get_name() const noexcept override { return global::CURVE_NAME_VALUE; }
[[nodiscard]] std::string get_disp_name() const noexcept override { return global::string_table[global::StringTable::StringId::LabelEditModeValue]; }

Expand Down
13 changes: 2 additions & 11 deletions curve_editor/drag_and_drop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,7 @@ namespace curve_editor {

auto curve = global::id_manager.get_curve<NumericGraphCurve>(curve_id_);
if (curve) {
// TODO: get_type()を実装し次第変更
if (curve->get_name() == global::CURVE_NAME_BEZIER) {
mode = EditMode::Bezier;
}
else if (curve->get_name() == global::CURVE_NAME_ELASTIC) {
mode = EditMode::Elastic;
}
else if (curve->get_name() == global::CURVE_NAME_BOUNCE) {
mode = EditMode::Bounce;
}
mode = curve->get_type();
param = curve->encode();
}
else {
Expand Down Expand Up @@ -165,7 +156,7 @@ namespace curve_editor {
buttons_[idx].unhighlight();
}
for (const auto idx : track_idcs) {
buttons_[idx].highlight(p_render_target_);
buttons_[idx].highlight(p_render_target_, curve_id_);
}
track_idcs_buffer_ = track_idcs;
}
Expand Down
8 changes: 6 additions & 2 deletions curve_editor/trackbar_button.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "config.hpp"
#include "curve.hpp"
#include "trackbar_button.hpp"


Expand Down Expand Up @@ -37,7 +38,7 @@ namespace curve_editor {
return false;
}

void TrackbarButton::highlight(ID2D1DCRenderTarget* p_render_target) const noexcept {
void TrackbarButton::highlight(ID2D1DCRenderTarget* p_render_target, uint32_t curve_id) const noexcept {
constexpr float ROUND_RADIUS = 1.5f;
constexpr mkaul::ColorF COLOR_NORMAL{ 45, 140, 235 };
constexpr mkaul::ColorF COLOR_IGNORE_MID_POINT = { 243, 123, 52 };
Expand All @@ -52,8 +53,11 @@ namespace curve_editor {
static ID2D1SolidColorBrush* p_brush = nullptr;
RECT rect_wnd;

auto curve = global::id_manager.get_curve<Curve>(curve_id);
if (!curve) return;

// ApplyModeに応じた色の設定
switch (global::config.get_apply_mode(global::config.get_edit_mode())) {
switch (global::config.get_apply_mode(curve->get_type())) {
case ApplyMode::Normal:
color = COLOR_NORMAL;
break;
Expand Down
2 changes: 1 addition & 1 deletion curve_editor/trackbar_button.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace curve_editor {
auto track_idx() const noexcept { return track_idx_; }
bool is_hovered() const noexcept;
bool is_visible() const noexcept { return ::IsWindowVisible(hwnd_); }
void highlight(ID2D1DCRenderTarget* p_render_target) const noexcept;
void highlight(ID2D1DCRenderTarget* p_render_target, uint32_t curve_id) const noexcept;
void unhighlight() const noexcept;
};
} // namespace curve_editor

0 comments on commit c31306c

Please sign in to comment.