リビジョン | fec8c45c962b3fb50e6e0739bbb603c22f0796f9 (tree) |
---|---|
日時 | 2013-11-09 21:18:06 |
作者 | HMML <hmml3939@gmai...> |
コミッター | HMML |
Save UI state to project file by ICanSavePlugin interface.
@@ -7,16 +7,29 @@ using MikuMikuMoving.Plugin; | ||
7 | 7 | using MikuMikuPlugin; |
8 | 8 | using DxMath; |
9 | 9 | using System.Diagnostics; |
10 | +using System.IO; | |
11 | +using System.Xml.Serialization; | |
12 | +using System.Reflection; | |
10 | 13 | |
11 | 14 | namespace MMM_GraphEditor |
12 | 15 | { |
13 | - public class GraphEditor : IResidentPlugin, IHaveUserControl | |
16 | + public class GraphEditor : IResidentPlugin, IHaveUserControl, ICanSavePlugin | |
14 | 17 | { |
15 | - protected GraphEditorControl control { get; set; } | |
18 | + public class Config | |
19 | + { | |
20 | + public bool[] render_flags = { true, true, true, true, true, true }; | |
21 | + public bool[] edit_flags = { true, true, false }; | |
22 | + public int euler_rot_order = 0; | |
23 | + public bool track_marker = true; | |
24 | + public bool track_yzero = false; | |
25 | + } | |
16 | 26 | |
27 | + | |
28 | + protected GraphEditorControl control { get; set; } | |
17 | 29 | private const string func_label = "Editor"; |
18 | 30 | private int refresh_counter = 0; |
19 | 31 | public int refresh_div = 10; |
32 | + public Config config; | |
20 | 33 | |
21 | 34 | public void Disabled() |
22 | 35 | { |
@@ -30,6 +43,7 @@ namespace MMM_GraphEditor | ||
30 | 43 | |
31 | 44 | public void Initialize() |
32 | 45 | { |
46 | + this.config = new Config(); | |
33 | 47 | } |
34 | 48 | |
35 | 49 | public void Update(float Frame, float ElapsedTime) |
@@ -88,7 +102,57 @@ namespace MMM_GraphEditor | ||
88 | 102 | public System.Windows.Forms.UserControl CreateControl() |
89 | 103 | { |
90 | 104 | this.control = new GraphEditorControl(); |
105 | + this.control.config = this.config; | |
106 | + this.control.UpdateUIStateByConfig(); | |
91 | 107 | return this.control; |
92 | 108 | } |
109 | + | |
110 | + /// <summary> | |
111 | + /// プロジェクトへプラグインデータを保存する。 | |
112 | + /// プロジェクトが保存されたときに呼び出されます。 | |
113 | + /// なお、気持ち悪いかもしれませんがStreamは外でDisposeされます。 | |
114 | + /// </summary> | |
115 | + /// <returns></returns> | |
116 | + public Stream OnSaveProject() | |
117 | + { | |
118 | + MemoryStream stream = new MemoryStream(); | |
119 | + XmlSerializer serializer = new XmlSerializer(typeof(Config)); | |
120 | + serializer.Serialize(stream, config); | |
121 | + return stream; | |
122 | + } | |
123 | + | |
124 | + /// <summary> | |
125 | + /// プロジェクトからプラグインデータを読み込む。 | |
126 | + /// プロジェクトがロードされたときに呼び出されます。 | |
127 | + /// なお、気持ち悪いかもしれませんがStreamは外でDisposeされます。 | |
128 | + /// </summary> | |
129 | + /// <param name="stream">データStream</param> | |
130 | + public void OnLoadProject(Stream stream) | |
131 | + { | |
132 | + XmlSerializer serializer = new XmlSerializer(typeof(Config)); | |
133 | + | |
134 | + try | |
135 | + { | |
136 | + Config loadconf = (Config)serializer.Deserialize(stream); | |
137 | + Type t = typeof(Config); | |
138 | + foreach (MemberInfo m in t.GetMembers()) | |
139 | + { | |
140 | + if (m.MemberType != MemberTypes.Field) continue; | |
141 | + FieldInfo f = t.GetField(m.Name, BindingFlags.Public | BindingFlags.Instance); | |
142 | + f.SetValue(this.config, f.GetValue(loadconf)); | |
143 | + } | |
144 | + control.UpdateUIStateByConfig(); | |
145 | + } | |
146 | + catch (Exception) | |
147 | + { | |
148 | + // ignore | |
149 | + return; | |
150 | + } | |
151 | + finally | |
152 | + { | |
153 | + //やらなくてもいいですが、まあ一応。 | |
154 | + stream.Seek(0, SeekOrigin.Begin); | |
155 | + } | |
156 | + } | |
93 | 157 | } |
94 | 158 | } |
@@ -28,7 +28,35 @@ namespace MMM_GraphEditor | ||
28 | 28 | { |
29 | 29 | base.OnLoad(e); |
30 | 30 | this.Dock = System.Windows.Forms.DockStyle.Fill; |
31 | + UpdateUIStateByConfig(); | |
32 | + } | |
31 | 33 | |
34 | + public void UpdateUIStateByConfig() | |
35 | + { | |
36 | + chk_track_merker.Checked = config.track_marker; | |
37 | + chk_track_yzero.Checked = config.track_yzero; | |
38 | + chk_edit_pos.Checked = config.edit_flags[GraphPort.IDX_EDIT_POS]; | |
39 | + chk_edit_pos_ip.Checked = config.edit_flags[GraphPort.IDX_EDIT_POS_IP]; | |
40 | + chk_edit_rot.Checked = config.edit_flags[GraphPort.IDX_EDIT_ROT]; | |
41 | + chk_plot_pos_x.Checked = config.render_flags[GraphPort.IDX_POS_X]; | |
42 | + chk_plot_pos_y.Checked = config.render_flags[GraphPort.IDX_POS_Y]; | |
43 | + chk_plot_pos_z.Checked = config.render_flags[GraphPort.IDX_POS_Z]; | |
44 | + chk_plot_rot_x.Checked = config.render_flags[GraphPort.IDX_ROT_R]; | |
45 | + chk_plot_rot_y.Checked = config.render_flags[GraphPort.IDX_ROT_P]; | |
46 | + chk_plot_rot_z.Checked = config.render_flags[GraphPort.IDX_ROT_Y]; | |
47 | + radio_zxy.Checked = radio_xzy.Checked = radio_xyz.Checked = false; | |
48 | + switch (config.euler_rot_order) | |
49 | + { | |
50 | + case 1: | |
51 | + radio_xyz.Checked = true; | |
52 | + break; | |
53 | + case 2: | |
54 | + radio_xzy.Checked = true; | |
55 | + break; | |
56 | + default: | |
57 | + radio_zxy.Checked = true; | |
58 | + break; | |
59 | + } | |
32 | 60 | } |
33 | 61 | |
34 | 62 | protected override void OnResize(System.EventArgs e) |
@@ -50,19 +78,19 @@ namespace MMM_GraphEditor | ||
50 | 78 | this.components = new System.ComponentModel.Container(); |
51 | 79 | this.btn_plus = new System.Windows.Forms.Button(); |
52 | 80 | this.btn_minus = new System.Windows.Forms.Button(); |
53 | - this.btn_pos_x = new System.Windows.Forms.CheckBox(); | |
54 | - this.btn_pos_y = new System.Windows.Forms.CheckBox(); | |
55 | - this.btn_pos_z = new System.Windows.Forms.CheckBox(); | |
56 | - this.btn_rot_x = new System.Windows.Forms.CheckBox(); | |
57 | - this.btn_rot_y = new System.Windows.Forms.CheckBox(); | |
58 | - this.btn_rot_z = new System.Windows.Forms.CheckBox(); | |
81 | + this.chk_plot_pos_x = new System.Windows.Forms.CheckBox(); | |
82 | + this.chk_plot_pos_y = new System.Windows.Forms.CheckBox(); | |
83 | + this.chk_plot_pos_z = new System.Windows.Forms.CheckBox(); | |
84 | + this.chk_plot_rot_x = new System.Windows.Forms.CheckBox(); | |
85 | + this.chk_plot_rot_y = new System.Windows.Forms.CheckBox(); | |
86 | + this.chk_plot_rot_z = new System.Windows.Forms.CheckBox(); | |
59 | 87 | this.radio_zxy = new System.Windows.Forms.RadioButton(); |
60 | - this.radio_zyx = new System.Windows.Forms.RadioButton(); | |
88 | + this.radio_xyz = new System.Windows.Forms.RadioButton(); | |
61 | 89 | this.radio_xzy = new System.Windows.Forms.RadioButton(); |
62 | 90 | this.btn_center = new System.Windows.Forms.Button(); |
63 | 91 | this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); |
64 | - this.chk_lock_horiz = new System.Windows.Forms.CheckBox(); | |
65 | - this.chk_lock_virt = new System.Windows.Forms.CheckBox(); | |
92 | + this.chk_track_merker = new System.Windows.Forms.CheckBox(); | |
93 | + this.chk_track_yzero = new System.Windows.Forms.CheckBox(); | |
66 | 94 | this.chk_edit_pos = new System.Windows.Forms.CheckBox(); |
67 | 95 | this.chk_edit_pos_ip = new System.Windows.Forms.CheckBox(); |
68 | 96 | this.chk_edit_rot = new System.Windows.Forms.CheckBox(); |
@@ -100,89 +128,89 @@ namespace MMM_GraphEditor | ||
100 | 128 | this.btn_minus.UseVisualStyleBackColor = true; |
101 | 129 | this.btn_minus.Click += new System.EventHandler(this.btn_minus_Click); |
102 | 130 | // |
103 | - // btn_pos_x | |
104 | - // | |
105 | - this.btn_pos_x.Appearance = System.Windows.Forms.Appearance.Button; | |
106 | - this.btn_pos_x.Checked = true; | |
107 | - this.btn_pos_x.CheckState = System.Windows.Forms.CheckState.Checked; | |
108 | - this.btn_pos_x.Location = new System.Drawing.Point(0, 156); | |
109 | - this.btn_pos_x.Name = "btn_pos_x"; | |
110 | - this.btn_pos_x.Size = new System.Drawing.Size(18, 23); | |
111 | - this.btn_pos_x.TabIndex = 10; | |
112 | - this.btn_pos_x.Text = "X"; | |
113 | - this.btn_pos_x.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
114 | - this.btn_pos_x.UseVisualStyleBackColor = true; | |
115 | - this.btn_pos_x.CheckedChanged += new System.EventHandler(this.btn_pos_x_CheckedChanged); | |
116 | - // | |
117 | - // btn_pos_y | |
118 | - // | |
119 | - this.btn_pos_y.Appearance = System.Windows.Forms.Appearance.Button; | |
120 | - this.btn_pos_y.Checked = true; | |
121 | - this.btn_pos_y.CheckState = System.Windows.Forms.CheckState.Checked; | |
122 | - this.btn_pos_y.Location = new System.Drawing.Point(17, 156); | |
123 | - this.btn_pos_y.Name = "btn_pos_y"; | |
124 | - this.btn_pos_y.Size = new System.Drawing.Size(18, 23); | |
125 | - this.btn_pos_y.TabIndex = 11; | |
126 | - this.btn_pos_y.Text = "Y"; | |
127 | - this.btn_pos_y.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
128 | - this.btn_pos_y.UseVisualStyleBackColor = true; | |
129 | - this.btn_pos_y.CheckedChanged += new System.EventHandler(this.btn_pos_y_CheckedChanged); | |
130 | - // | |
131 | - // btn_pos_z | |
132 | - // | |
133 | - this.btn_pos_z.Appearance = System.Windows.Forms.Appearance.Button; | |
134 | - this.btn_pos_z.Checked = true; | |
135 | - this.btn_pos_z.CheckState = System.Windows.Forms.CheckState.Checked; | |
136 | - this.btn_pos_z.Location = new System.Drawing.Point(34, 156); | |
137 | - this.btn_pos_z.Name = "btn_pos_z"; | |
138 | - this.btn_pos_z.Size = new System.Drawing.Size(18, 23); | |
139 | - this.btn_pos_z.TabIndex = 12; | |
140 | - this.btn_pos_z.Text = "Z"; | |
141 | - this.btn_pos_z.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
142 | - this.btn_pos_z.UseVisualStyleBackColor = true; | |
143 | - this.btn_pos_z.CheckedChanged += new System.EventHandler(this.btn_pos_z_CheckedChanged); | |
144 | - // | |
145 | - // btn_rot_x | |
146 | - // | |
147 | - this.btn_rot_x.Appearance = System.Windows.Forms.Appearance.Button; | |
148 | - this.btn_rot_x.Checked = true; | |
149 | - this.btn_rot_x.CheckState = System.Windows.Forms.CheckState.Checked; | |
150 | - this.btn_rot_x.Location = new System.Drawing.Point(0, 205); | |
151 | - this.btn_rot_x.Name = "btn_rot_x"; | |
152 | - this.btn_rot_x.Size = new System.Drawing.Size(18, 23); | |
153 | - this.btn_rot_x.TabIndex = 13; | |
154 | - this.btn_rot_x.Text = "X"; | |
155 | - this.btn_rot_x.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
156 | - this.btn_rot_x.UseVisualStyleBackColor = true; | |
157 | - this.btn_rot_x.CheckedChanged += new System.EventHandler(this.btn_rot_x_CheckedChanged); | |
158 | - // | |
159 | - // btn_rot_y | |
160 | - // | |
161 | - this.btn_rot_y.Appearance = System.Windows.Forms.Appearance.Button; | |
162 | - this.btn_rot_y.Checked = true; | |
163 | - this.btn_rot_y.CheckState = System.Windows.Forms.CheckState.Checked; | |
164 | - this.btn_rot_y.Location = new System.Drawing.Point(16, 205); | |
165 | - this.btn_rot_y.Name = "btn_rot_y"; | |
166 | - this.btn_rot_y.Size = new System.Drawing.Size(18, 23); | |
167 | - this.btn_rot_y.TabIndex = 14; | |
168 | - this.btn_rot_y.Text = "Y"; | |
169 | - this.btn_rot_y.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
170 | - this.btn_rot_y.UseVisualStyleBackColor = true; | |
171 | - this.btn_rot_y.CheckedChanged += new System.EventHandler(this.btn_rot_y_CheckedChanged); | |
172 | - // | |
173 | - // btn_rot_z | |
174 | - // | |
175 | - this.btn_rot_z.Appearance = System.Windows.Forms.Appearance.Button; | |
176 | - this.btn_rot_z.Checked = true; | |
177 | - this.btn_rot_z.CheckState = System.Windows.Forms.CheckState.Checked; | |
178 | - this.btn_rot_z.Location = new System.Drawing.Point(34, 205); | |
179 | - this.btn_rot_z.Name = "btn_rot_z"; | |
180 | - this.btn_rot_z.Size = new System.Drawing.Size(18, 23); | |
181 | - this.btn_rot_z.TabIndex = 15; | |
182 | - this.btn_rot_z.Text = "Z"; | |
183 | - this.btn_rot_z.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
184 | - this.btn_rot_z.UseVisualStyleBackColor = true; | |
185 | - this.btn_rot_z.CheckedChanged += new System.EventHandler(this.btn_rot_z_CheckedChanged); | |
131 | + // chk_plot_pos_x | |
132 | + // | |
133 | + this.chk_plot_pos_x.Appearance = System.Windows.Forms.Appearance.Button; | |
134 | + this.chk_plot_pos_x.Checked = true; | |
135 | + this.chk_plot_pos_x.CheckState = System.Windows.Forms.CheckState.Checked; | |
136 | + this.chk_plot_pos_x.Location = new System.Drawing.Point(0, 156); | |
137 | + this.chk_plot_pos_x.Name = "chk_plot_pos_x"; | |
138 | + this.chk_plot_pos_x.Size = new System.Drawing.Size(18, 23); | |
139 | + this.chk_plot_pos_x.TabIndex = 10; | |
140 | + this.chk_plot_pos_x.Text = "X"; | |
141 | + this.chk_plot_pos_x.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
142 | + this.chk_plot_pos_x.UseVisualStyleBackColor = true; | |
143 | + this.chk_plot_pos_x.CheckedChanged += new System.EventHandler(this.btn_pos_x_CheckedChanged); | |
144 | + // | |
145 | + // chk_plot_pos_y | |
146 | + // | |
147 | + this.chk_plot_pos_y.Appearance = System.Windows.Forms.Appearance.Button; | |
148 | + this.chk_plot_pos_y.Checked = true; | |
149 | + this.chk_plot_pos_y.CheckState = System.Windows.Forms.CheckState.Checked; | |
150 | + this.chk_plot_pos_y.Location = new System.Drawing.Point(17, 156); | |
151 | + this.chk_plot_pos_y.Name = "chk_plot_pos_y"; | |
152 | + this.chk_plot_pos_y.Size = new System.Drawing.Size(18, 23); | |
153 | + this.chk_plot_pos_y.TabIndex = 11; | |
154 | + this.chk_plot_pos_y.Text = "Y"; | |
155 | + this.chk_plot_pos_y.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
156 | + this.chk_plot_pos_y.UseVisualStyleBackColor = true; | |
157 | + this.chk_plot_pos_y.CheckedChanged += new System.EventHandler(this.btn_pos_y_CheckedChanged); | |
158 | + // | |
159 | + // chk_plot_pos_z | |
160 | + // | |
161 | + this.chk_plot_pos_z.Appearance = System.Windows.Forms.Appearance.Button; | |
162 | + this.chk_plot_pos_z.Checked = true; | |
163 | + this.chk_plot_pos_z.CheckState = System.Windows.Forms.CheckState.Checked; | |
164 | + this.chk_plot_pos_z.Location = new System.Drawing.Point(34, 156); | |
165 | + this.chk_plot_pos_z.Name = "chk_plot_pos_z"; | |
166 | + this.chk_plot_pos_z.Size = new System.Drawing.Size(18, 23); | |
167 | + this.chk_plot_pos_z.TabIndex = 12; | |
168 | + this.chk_plot_pos_z.Text = "Z"; | |
169 | + this.chk_plot_pos_z.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
170 | + this.chk_plot_pos_z.UseVisualStyleBackColor = true; | |
171 | + this.chk_plot_pos_z.CheckedChanged += new System.EventHandler(this.btn_pos_z_CheckedChanged); | |
172 | + // | |
173 | + // chk_plot_rot_x | |
174 | + // | |
175 | + this.chk_plot_rot_x.Appearance = System.Windows.Forms.Appearance.Button; | |
176 | + this.chk_plot_rot_x.Checked = true; | |
177 | + this.chk_plot_rot_x.CheckState = System.Windows.Forms.CheckState.Checked; | |
178 | + this.chk_plot_rot_x.Location = new System.Drawing.Point(0, 205); | |
179 | + this.chk_plot_rot_x.Name = "chk_plot_rot_x"; | |
180 | + this.chk_plot_rot_x.Size = new System.Drawing.Size(18, 23); | |
181 | + this.chk_plot_rot_x.TabIndex = 13; | |
182 | + this.chk_plot_rot_x.Text = "X"; | |
183 | + this.chk_plot_rot_x.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
184 | + this.chk_plot_rot_x.UseVisualStyleBackColor = true; | |
185 | + this.chk_plot_rot_x.CheckedChanged += new System.EventHandler(this.btn_rot_x_CheckedChanged); | |
186 | + // | |
187 | + // chk_plot_rot_y | |
188 | + // | |
189 | + this.chk_plot_rot_y.Appearance = System.Windows.Forms.Appearance.Button; | |
190 | + this.chk_plot_rot_y.Checked = true; | |
191 | + this.chk_plot_rot_y.CheckState = System.Windows.Forms.CheckState.Checked; | |
192 | + this.chk_plot_rot_y.Location = new System.Drawing.Point(16, 205); | |
193 | + this.chk_plot_rot_y.Name = "chk_plot_rot_y"; | |
194 | + this.chk_plot_rot_y.Size = new System.Drawing.Size(18, 23); | |
195 | + this.chk_plot_rot_y.TabIndex = 14; | |
196 | + this.chk_plot_rot_y.Text = "Y"; | |
197 | + this.chk_plot_rot_y.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
198 | + this.chk_plot_rot_y.UseVisualStyleBackColor = true; | |
199 | + this.chk_plot_rot_y.CheckedChanged += new System.EventHandler(this.btn_rot_y_CheckedChanged); | |
200 | + // | |
201 | + // chk_plot_rot_z | |
202 | + // | |
203 | + this.chk_plot_rot_z.Appearance = System.Windows.Forms.Appearance.Button; | |
204 | + this.chk_plot_rot_z.Checked = true; | |
205 | + this.chk_plot_rot_z.CheckState = System.Windows.Forms.CheckState.Checked; | |
206 | + this.chk_plot_rot_z.Location = new System.Drawing.Point(34, 205); | |
207 | + this.chk_plot_rot_z.Name = "chk_plot_rot_z"; | |
208 | + this.chk_plot_rot_z.Size = new System.Drawing.Size(18, 23); | |
209 | + this.chk_plot_rot_z.TabIndex = 15; | |
210 | + this.chk_plot_rot_z.Text = "Z"; | |
211 | + this.chk_plot_rot_z.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
212 | + this.chk_plot_rot_z.UseVisualStyleBackColor = true; | |
213 | + this.chk_plot_rot_z.CheckedChanged += new System.EventHandler(this.btn_rot_z_CheckedChanged); | |
186 | 214 | // |
187 | 215 | // radio_zxy |
188 | 216 | // |
@@ -197,16 +225,16 @@ namespace MMM_GraphEditor | ||
197 | 225 | this.radio_zxy.UseVisualStyleBackColor = true; |
198 | 226 | this.radio_zxy.CheckedChanged += new System.EventHandler(this.rot_axis_radio_changed); |
199 | 227 | // |
200 | - // radio_zyx | |
228 | + // radio_xyz | |
201 | 229 | // |
202 | - this.radio_zyx.AutoSize = true; | |
203 | - this.radio_zyx.Location = new System.Drawing.Point(0, 252); | |
204 | - this.radio_zyx.Name = "radio_zyx"; | |
205 | - this.radio_zyx.Size = new System.Drawing.Size(56, 16); | |
206 | - this.radio_zyx.TabIndex = 21; | |
207 | - this.radio_zyx.Text = "X-Y-Z"; | |
208 | - this.radio_zyx.UseVisualStyleBackColor = true; | |
209 | - this.radio_zyx.CheckedChanged += new System.EventHandler(this.rot_axis_radio_changed); | |
230 | + this.radio_xyz.AutoSize = true; | |
231 | + this.radio_xyz.Location = new System.Drawing.Point(0, 252); | |
232 | + this.radio_xyz.Name = "radio_xyz"; | |
233 | + this.radio_xyz.Size = new System.Drawing.Size(56, 16); | |
234 | + this.radio_xyz.TabIndex = 21; | |
235 | + this.radio_xyz.Text = "X-Y-Z"; | |
236 | + this.radio_xyz.UseVisualStyleBackColor = true; | |
237 | + this.radio_xyz.CheckedChanged += new System.EventHandler(this.rot_axis_radio_changed); | |
210 | 238 | // |
211 | 239 | // radio_xzy |
212 | 240 | // |
@@ -231,30 +259,32 @@ namespace MMM_GraphEditor | ||
231 | 259 | this.btn_center.UseVisualStyleBackColor = true; |
232 | 260 | this.btn_center.Click += new System.EventHandler(this.btn_center_Click); |
233 | 261 | // |
234 | - // chk_lock_horiz | |
235 | - // | |
236 | - this.chk_lock_horiz.Appearance = System.Windows.Forms.Appearance.Button; | |
237 | - this.chk_lock_horiz.Checked = true; | |
238 | - this.chk_lock_horiz.CheckState = System.Windows.Forms.CheckState.Checked; | |
239 | - this.chk_lock_horiz.Location = new System.Drawing.Point(0, 41); | |
240 | - this.chk_lock_horiz.Name = "chk_lock_horiz"; | |
241 | - this.chk_lock_horiz.Size = new System.Drawing.Size(51, 23); | |
242 | - this.chk_lock_horiz.TabIndex = 4; | |
243 | - this.chk_lock_horiz.Text = "マーカー"; | |
244 | - this.toolTip1.SetToolTip(this.chk_lock_horiz, "常にマーカーを中央に維持"); | |
245 | - this.chk_lock_horiz.UseVisualStyleBackColor = true; | |
246 | - // | |
247 | - // chk_lock_virt | |
248 | - // | |
249 | - this.chk_lock_virt.Appearance = System.Windows.Forms.Appearance.Button; | |
250 | - this.chk_lock_virt.Location = new System.Drawing.Point(0, 67); | |
251 | - this.chk_lock_virt.Name = "chk_lock_virt"; | |
252 | - this.chk_lock_virt.Size = new System.Drawing.Size(51, 23); | |
253 | - this.chk_lock_virt.TabIndex = 5; | |
254 | - this.chk_lock_virt.Text = "Yゼロ"; | |
255 | - this.chk_lock_virt.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
256 | - this.toolTip1.SetToolTip(this.chk_lock_virt, "常に縦軸に0を維持"); | |
257 | - this.chk_lock_virt.UseVisualStyleBackColor = true; | |
262 | + // chk_track_merker | |
263 | + // | |
264 | + this.chk_track_merker.Appearance = System.Windows.Forms.Appearance.Button; | |
265 | + this.chk_track_merker.Checked = true; | |
266 | + this.chk_track_merker.CheckState = System.Windows.Forms.CheckState.Checked; | |
267 | + this.chk_track_merker.Location = new System.Drawing.Point(0, 41); | |
268 | + this.chk_track_merker.Name = "chk_track_merker"; | |
269 | + this.chk_track_merker.Size = new System.Drawing.Size(51, 23); | |
270 | + this.chk_track_merker.TabIndex = 4; | |
271 | + this.chk_track_merker.Text = "マーカー"; | |
272 | + this.toolTip1.SetToolTip(this.chk_track_merker, "常にマーカーを中央に維持"); | |
273 | + this.chk_track_merker.UseVisualStyleBackColor = true; | |
274 | + this.chk_track_merker.CheckedChanged += new System.EventHandler(this.chk_track_merker_CheckedChanged); | |
275 | + // | |
276 | + // chk_track_yzero | |
277 | + // | |
278 | + this.chk_track_yzero.Appearance = System.Windows.Forms.Appearance.Button; | |
279 | + this.chk_track_yzero.Location = new System.Drawing.Point(0, 67); | |
280 | + this.chk_track_yzero.Name = "chk_track_yzero"; | |
281 | + this.chk_track_yzero.Size = new System.Drawing.Size(51, 23); | |
282 | + this.chk_track_yzero.TabIndex = 5; | |
283 | + this.chk_track_yzero.Text = "Yゼロ"; | |
284 | + this.chk_track_yzero.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |
285 | + this.toolTip1.SetToolTip(this.chk_track_yzero, "常に縦軸に0を維持"); | |
286 | + this.chk_track_yzero.UseVisualStyleBackColor = true; | |
287 | + this.chk_track_yzero.CheckedChanged += new System.EventHandler(this.chk_track_yzero_CheckedChanged); | |
258 | 288 | // |
259 | 289 | // chk_edit_pos |
260 | 290 | // |
@@ -387,18 +417,18 @@ namespace MMM_GraphEditor | ||
387 | 417 | this.Controls.Add(this.label3); |
388 | 418 | this.Controls.Add(this.label2); |
389 | 419 | this.Controls.Add(this.label1); |
390 | - this.Controls.Add(this.chk_lock_virt); | |
391 | - this.Controls.Add(this.chk_lock_horiz); | |
420 | + this.Controls.Add(this.chk_track_yzero); | |
421 | + this.Controls.Add(this.chk_track_merker); | |
392 | 422 | this.Controls.Add(this.btn_center); |
393 | 423 | this.Controls.Add(this.radio_xzy); |
394 | - this.Controls.Add(this.radio_zyx); | |
424 | + this.Controls.Add(this.radio_xyz); | |
395 | 425 | this.Controls.Add(this.radio_zxy); |
396 | - this.Controls.Add(this.btn_rot_z); | |
397 | - this.Controls.Add(this.btn_rot_y); | |
398 | - this.Controls.Add(this.btn_rot_x); | |
399 | - this.Controls.Add(this.btn_pos_z); | |
400 | - this.Controls.Add(this.btn_pos_y); | |
401 | - this.Controls.Add(this.btn_pos_x); | |
426 | + this.Controls.Add(this.chk_plot_rot_z); | |
427 | + this.Controls.Add(this.chk_plot_rot_y); | |
428 | + this.Controls.Add(this.chk_plot_rot_x); | |
429 | + this.Controls.Add(this.chk_plot_pos_z); | |
430 | + this.Controls.Add(this.chk_plot_pos_y); | |
431 | + this.Controls.Add(this.chk_plot_pos_x); | |
402 | 432 | this.Controls.Add(this.btn_minus); |
403 | 433 | this.Controls.Add(this.btn_plus); |
404 | 434 | this.Controls.Add(this.graphPanelOuter); |
@@ -419,19 +449,19 @@ namespace MMM_GraphEditor | ||
419 | 449 | public GraphPanel graphPanelInnner; |
420 | 450 | public GraphPort graphPort1; |
421 | 451 | public FrameRuler frameRuler1; |
422 | - private CheckBox btn_pos_x; | |
423 | - private CheckBox btn_pos_y; | |
424 | - private CheckBox btn_pos_z; | |
425 | - private CheckBox btn_rot_x; | |
426 | - private CheckBox btn_rot_y; | |
427 | - private CheckBox btn_rot_z; | |
452 | + private CheckBox chk_plot_pos_x; | |
453 | + private CheckBox chk_plot_pos_y; | |
454 | + private CheckBox chk_plot_pos_z; | |
455 | + private CheckBox chk_plot_rot_x; | |
456 | + private CheckBox chk_plot_rot_y; | |
457 | + private CheckBox chk_plot_rot_z; | |
428 | 458 | private RadioButton radio_zxy; |
429 | - private RadioButton radio_zyx; | |
459 | + private RadioButton radio_xyz; | |
430 | 460 | private RadioButton radio_xzy; |
431 | 461 | private Button btn_center; |
432 | 462 | private ToolTip toolTip1; |
433 | - public CheckBox chk_lock_horiz; | |
434 | - public CheckBox chk_lock_virt; | |
463 | + public CheckBox chk_track_merker; | |
464 | + public CheckBox chk_track_yzero; | |
435 | 465 | private Label label1; |
436 | 466 | private Label label2; |
437 | 467 | private Label label3; |
@@ -23,6 +23,7 @@ namespace MMM_GraphEditor | ||
23 | 23 | |
24 | 24 | private MikuMikuPlugin.Scene scene; |
25 | 25 | private long lastMarkerPos = 0; |
26 | + public GraphEditor.Config config; | |
26 | 27 | |
27 | 28 | public MikuMikuPlugin.Scene Scene |
28 | 29 | { |
@@ -62,51 +63,47 @@ namespace MMM_GraphEditor | ||
62 | 63 | |
63 | 64 | private void btn_pos_x_CheckedChanged(object sender, EventArgs e) |
64 | 65 | { |
65 | - graphPort1.render_flags[GraphPort.IDX_POS_X] = btn_pos_x.Checked; | |
66 | + config.render_flags[GraphPort.IDX_POS_X] = chk_plot_pos_x.Checked; | |
66 | 67 | } |
67 | 68 | |
68 | 69 | private void btn_pos_y_CheckedChanged(object sender, EventArgs e) |
69 | 70 | { |
70 | - graphPort1.render_flags[GraphPort.IDX_POS_Y] = btn_pos_y.Checked; | |
71 | + config.render_flags[GraphPort.IDX_POS_Y] = chk_plot_pos_y.Checked; | |
71 | 72 | } |
72 | 73 | |
73 | 74 | private void btn_pos_z_CheckedChanged(object sender, EventArgs e) |
74 | 75 | { |
75 | - graphPort1.render_flags[GraphPort.IDX_POS_Z] = btn_pos_z.Checked; | |
76 | + config.render_flags[GraphPort.IDX_POS_Z] = chk_plot_pos_z.Checked; | |
76 | 77 | } |
77 | 78 | |
78 | 79 | private void btn_rot_x_CheckedChanged(object sender, EventArgs e) |
79 | 80 | { |
80 | - graphPort1.render_flags[GraphPort.IDX_ROT_R] = btn_rot_x.Checked; | |
81 | + config.render_flags[GraphPort.IDX_ROT_R] = chk_plot_rot_x.Checked; | |
81 | 82 | } |
82 | 83 | |
83 | 84 | private void btn_rot_y_CheckedChanged(object sender, EventArgs e) |
84 | 85 | { |
85 | - graphPort1.render_flags[GraphPort.IDX_ROT_P] = btn_rot_y.Checked; | |
86 | + config.render_flags[GraphPort.IDX_ROT_P] = chk_plot_rot_y.Checked; | |
86 | 87 | } |
87 | 88 | |
88 | 89 | private void btn_rot_z_CheckedChanged(object sender, EventArgs e) |
89 | 90 | { |
90 | - graphPort1.render_flags[GraphPort.IDX_ROT_Y] = btn_rot_z.Checked; | |
91 | + config.render_flags[GraphPort.IDX_ROT_Y] = chk_plot_rot_z.Checked; | |
91 | 92 | } |
92 | 93 | |
93 | 94 | private void rot_axis_radio_changed(object sender, EventArgs e) |
94 | 95 | { |
95 | 96 | if (radio_zxy.Checked) |
96 | 97 | { |
97 | - graphPort1.default_rot_type = 0; | |
98 | + config.euler_rot_order = 0; | |
98 | 99 | } |
99 | - else if (radio_zyx.Checked) | |
100 | + else if (radio_xyz.Checked) | |
100 | 101 | { |
101 | - graphPort1.default_rot_type = 1; | |
102 | + config.euler_rot_order = 1; | |
102 | 103 | } |
103 | 104 | else if (radio_xzy.Checked) |
104 | 105 | { |
105 | - graphPort1.default_rot_type = 2; | |
106 | - } | |
107 | - else | |
108 | - { | |
109 | - graphPort1.default_rot_type = -1; | |
106 | + config.euler_rot_order = 2; | |
110 | 107 | } |
111 | 108 | } |
112 | 109 |
@@ -117,18 +114,28 @@ namespace MMM_GraphEditor | ||
117 | 114 | |
118 | 115 | private void chk_edit_pos_CheckedChanged(object sender, EventArgs e) |
119 | 116 | { |
120 | - graphPort1.edit_flags[GraphPort.IDX_EDIT_POS] = chk_edit_pos.Checked; | |
117 | + | |
118 | + config.edit_flags[GraphPort.IDX_EDIT_POS] = chk_edit_pos.Checked; | |
121 | 119 | } |
122 | - | |
123 | 120 | private void chk_edit_pos_ip_CheckedChanged(object sender, EventArgs e) |
124 | 121 | { |
125 | - graphPort1.edit_flags[GraphPort.IDX_EDIT_POS_IP] = chk_edit_pos_ip.Checked; | |
122 | + config.edit_flags[GraphPort.IDX_EDIT_POS_IP] = chk_edit_pos_ip.Checked; | |
126 | 123 | |
127 | 124 | } |
128 | 125 | |
129 | 126 | private void chk_edit_rot_CheckedChanged(object sender, EventArgs e) |
130 | 127 | { |
131 | - graphPort1.edit_flags[GraphPort.IDX_EDIT_ROT] = chk_edit_rot.Checked; | |
128 | + config.edit_flags[GraphPort.IDX_EDIT_ROT] = chk_edit_rot.Checked; | |
129 | + } | |
130 | + | |
131 | + private void chk_track_merker_CheckedChanged(object sender, EventArgs e) | |
132 | + { | |
133 | + config.track_marker = chk_track_merker.Checked; | |
134 | + } | |
135 | + | |
136 | + private void chk_track_yzero_CheckedChanged(object sender, EventArgs e) | |
137 | + { | |
138 | + config.track_yzero = chk_track_yzero.Checked; | |
132 | 139 | } |
133 | 140 | |
134 | 141 | } |
@@ -120,4 +120,7 @@ | ||
120 | 120 | <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
121 | 121 | <value>17, 17</value> |
122 | 122 | </metadata> |
123 | + <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | |
124 | + <value>17, 17</value> | |
125 | + </metadata> | |
123 | 126 | </root> |
\ No newline at end of file |
@@ -50,7 +50,6 @@ namespace MMM_GraphEditor | ||
50 | 50 | public static float Graph_PenSize = 2f; |
51 | 51 | public static Pen Ip_Pen = Pens.Black; |
52 | 52 | public float ip_mark_size = 4f; |
53 | - public int default_rot_type = 0; | |
54 | 53 | public Point cur_mouse_pos = new Point(0, 0); |
55 | 54 | public static Color[] Graph_Colors = { Color.Red, Color.Green, Color.Blue, Color.DeepPink, Color.YellowGreen, Color.DodgerBlue }; |
56 | 55 | public static Brush[] Graph_Brushes = { Brushes.Red, Brushes.Green, Brushes.Blue, |
@@ -83,14 +82,28 @@ namespace MMM_GraphEditor | ||
83 | 82 | public Bone target_bone = null; |
84 | 83 | public Quaternion target_local_rot; |
85 | 84 | public Quaternion target_local_rot_rev; |
86 | - public bool[] render_flags = { true, true, true, true, true, true }; | |
87 | - public bool[] edit_flags = { true, true, false }; | |
88 | 85 | public const int IDX_EDIT_POS = 0; |
89 | 86 | public const int IDX_EDIT_POS_IP = 1; |
90 | 87 | public const int IDX_EDIT_ROT = 2; |
91 | 88 | public bool ip_val_limit = true; |
92 | 89 | GraphPoint key_pointed = null; |
93 | 90 | |
91 | + public bool[] render_flags | |
92 | + { | |
93 | + get { return config.render_flags; } | |
94 | + } | |
95 | + public bool[] edit_flags | |
96 | + { | |
97 | + get { return config.edit_flags; } | |
98 | + } | |
99 | + public int euler_rot_order | |
100 | + { | |
101 | + get { return config.euler_rot_order; } | |
102 | + } | |
103 | + public GraphEditor.Config config | |
104 | + { | |
105 | + get { return MainControl.config; } | |
106 | + } | |
94 | 107 | |
95 | 108 | /// <summary> |
96 | 109 | /// 使用中のリソースをすべてクリーンアップします。 |
@@ -280,7 +293,7 @@ namespace MMM_GraphEditor | ||
280 | 293 | |
281 | 294 | Quaternion rot = scene.MarkerPosition == fd.FrameNumber ? target_layer.CurrentLocalMotion.Rotation : fd.Quaternion; |
282 | 295 | rot = Rot_World2Local(rot); |
283 | - int rot_type = getRotType(); | |
296 | + int rot_type = euler_rot_order; | |
284 | 297 | Vector3 erot = Quaternion2Euler(rot, rot_type); |
285 | 298 | Trace.WriteLine("Euler Rot: " + erot.ToString()); |
286 | 299 | foreach (int i in RPY) |
@@ -621,25 +634,6 @@ namespace MMM_GraphEditor | ||
621 | 634 | return m; |
622 | 635 | } |
623 | 636 | |
624 | - public int getRotType() | |
625 | - { | |
626 | - return default_rot_type; | |
627 | - } | |
628 | - | |
629 | - public String rotTypeName(int rot_type) | |
630 | - { | |
631 | - switch (rot_type) | |
632 | - { | |
633 | - case 0: | |
634 | - return "Z-X-Y"; | |
635 | - case 1: | |
636 | - return "X-Y-Z"; | |
637 | - case 2: | |
638 | - return "X-Z-Y"; | |
639 | - } | |
640 | - return "Unknown"; | |
641 | - } | |
642 | - | |
643 | 637 | #region コンポーネント デザイナーで生成されたコード |
644 | 638 | |
645 | 639 | /// <summary> |
@@ -270,9 +270,9 @@ namespace MMM_GraphEditor | ||
270 | 270 | public void centerMarker() |
271 | 271 | { |
272 | 272 | if (MainControl == null) return; |
273 | - if (MainControl.chk_lock_horiz.Checked) | |
273 | + if (config.track_marker) | |
274 | 274 | centerMarkerHorizonal(); |
275 | - if ( MainControl.chk_lock_virt.Checked) | |
275 | + if (config.track_yzero) | |
276 | 276 | centerMarkerVirtical(); |
277 | 277 | } |
278 | 278 |