diff --git a/sjplayer/src/sjplayer/ScheduledController.d b/sjplayer/src/sjplayer/ScheduledController.d index 9b9cd49..808723d 100644 --- a/sjplayer/src/sjplayer/ScheduledController.d +++ b/sjplayer/src/sjplayer/ScheduledController.d @@ -70,8 +70,13 @@ class ScheduledController( case map_name: return mixin("target_."~code); } - default: return super.GetVariable(name); + default: } + static if (MatrixModificationAvailable) { + const value = matrix_factory_.GetValueByName(name); + if (!value.isNull) return value.get; + } + return super.GetVariable(name); } override void SetParameter(ref in Parameter param, ref in VarStore vars) { switch (param.name) { diff --git a/sjplayer/src/sjplayer/util/MatrixFactory.d b/sjplayer/src/sjplayer/util/MatrixFactory.d index 11a99eb..7c3c40e 100644 --- a/sjplayer/src/sjplayer/util/MatrixFactory.d +++ b/sjplayer/src/sjplayer/util/MatrixFactory.d @@ -1,6 +1,8 @@ /// License: MIT module sjplayer.util.MatrixFactory; +import std.typecons; + import gl4d; /// @@ -17,6 +19,20 @@ struct MatrixFactory { return m; } + /// + Nullable!float GetValueByName(string name) const { + switch (name) { + case "scale_x": return Nullable!float(scale.x); + case "scale_y": return Nullable!float(scale.y); + case "rotation_x": return Nullable!float(rotation.x); + case "rotation_y": return Nullable!float(rotation.y); + case "rotation_z": return Nullable!float(rotation.z); + case "translation_x": return Nullable!float(translation.x); + case "translation_y": return Nullable!float(translation.y); + default: return Nullable!float.init; + } + } + /// vec3 scale = vec3(1, 1, 1); ///