Skip to content

Commit 9980f60

Browse files
committed
Separated popuped window position and multiUV importing
1 parent 8fb5304 commit 9980f60

File tree

5 files changed

+58
-8
lines changed

5 files changed

+58
-8
lines changed

MySFformat/src/Mono3D.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,32 @@ public Mono3D()
172172
{
173173
Window.Title = "FLVER-X Viewer by Forsakensilver, press F to refresh, press F1 F2 F3 F4 F5: Change render mode Right click: check vertex info B: Toggle bone display M: Dummy display";
174174
Window.AllowUserResizing = true;
175+
175176
this.IsMouseVisible = true;
176177
graphics = new GraphicsDeviceManager(this);
177178
Content.RootDirectory = "Content";
178179
// string path = @"data\img\27.png";
179180
//test = Content.Load<Texture2D>(@"data\img\27.png");
180-
f = (Form)Form.FromHandle(Window.Handle);
181+
// --- Separate Popuped window ---
182+
// ORG: Window.Position = Window.Position + new Microsoft.Xna.Framework.Point(-300, 0);
183+
var screen = Screen.PrimaryScreen.WorkingArea;
184+
int viewerWidth = graphics.PreferredBackBufferWidth;
185+
int viewerHeight = graphics.PreferredBackBufferHeight;
186+
// 将窗口定位在屏幕的左侧。 (屏幕中心点 - 自身宽度 - 5像素间隙)
187+
int viewerX = screen.Left + (screen.Width / 2) - viewerWidth - 5;
188+
int viewerY = screen.Top + (screen.Height - viewerHeight) / 2;
189+
// 确保窗口不会跑到屏幕左边外面去
190+
if (viewerX < screen.Left)
191+
{
192+
viewerX = screen.Left;
193+
}
194+
if (viewerY < screen.Top)
195+
{
196+
viewerY = screen.Top;
197+
}
198+
Window.Position = new Microsoft.Xna.Framework.Point(viewerX, viewerY);
199+
f = (Form)Form.FromHandle(Window.Handle);
200+
// --- Separate Popuped window ---
181201

182202

183203

MySFformat/src/Program.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,11 @@ static partial class Program
147147
// NR->ER flver files porting- advanced cloth physics retain feature
148148
// Probably requires some shader to work properly? or just use M.reset
149149

150-
//X2 TODO List:
151-
// Multi-UV Exporting
152-
// Multi-UV Importing
150+
// [Done, Experimental] Multi-UV Exporting
151+
// [Done, Experimental] Multi-UV Importing
153152
// When showing up, make sure no window overlap
153+
154+
//X2.6 TODO List:
154155
// Strange Mesh Error problem
155156
// importing new skeletons without changing exisitng bones hierarchy
156157
// Core function: make sure tangent calculation is correct and useable

MySFformat/src/ProgramFbxImport.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ static void importFBX()
290290
var vit = m.Vertices[i];
291291
var channels = m.TextureCoordinateChannels[0];
292292

293-
var uv1 = new Vector3D();
293+
List<Vector3> tempUvs = new List<Vector3>();
294+
295+
var uv1 = new Vector3D(); // Basic fall back
294296
var uv2 = new Vector3D();
295297

296298
if (channels != null && m.TextureCoordinateChannelCount > 0)
@@ -299,8 +301,14 @@ static void importFBX()
299301
uv1.Y = 1 - uv1.Y;
300302
uv2 = getMyV3D(channels[i]);
301303
uv2.Y = 1 - uv2.Y;
304+
for (int j =0; j < m.TextureCoordinateChannelCount; j++) {
305+
var tempChan = m.TextureCoordinateChannels[j];
306+
tempUvs.Add(new Vector3(tempChan[i].X, 1f - tempChan[i].Y, 0));
307+
}
308+
while (tempUvs.Count < 2) { tempUvs.Add(new Vector3(uv1.X, uv1.Y, uv1.Z)); }
302309
}
303310

311+
304312
var normal = new Vector3D(0, 1, 0);
305313
if (m.HasNormals && m.Normals.Count > i)
306314
{
@@ -364,7 +372,7 @@ static void importFBX()
364372
}
365373

366374
FLVER.Vertex v = generateVertex(remappedPosition, uv1.toNumV3(), uv2.toNumV3(), remappedNormal, remappedTangent, tangentW);
367-
375+
if (tempUvs.Count > 1) { v.UVs = tempUvs; } // V2.6 Multi-UV Support
368376
if (m.HasBones)
369377
{
370378
for (int j = 0; j < verticesBoneIndices[i].Count && j < 4; j++)

MySFformat/src/ProgramFbxImportForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private void InitializeComponent()
8787
this.Text = "Import FBX Options";
8888
this.FormBorderStyle = FormBorderStyle.FixedDialog;
8989
this.StartPosition = FormStartPosition.CenterParent;
90-
this.ClientSize = new Size(500, 545);
90+
this.ClientSize = new Size(500, 575);
9191
this.MaximizeBox = false;
9292
this.MinimizeBox = false;
9393

MySFformat/src/ProgramNodesUI.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,30 @@ static void ShowEditorForm()
189189
Text = "FLVER Editor - " + Path.GetFileName(orgFileName),
190190
Size = new Size(800, 750),
191191
MinimumSize = new Size(640, 480),
192-
StartPosition = FormStartPosition.CenterScreen
192+
// Separate Popuped window
193+
StartPosition = FormStartPosition.Manual
194+
// ORG: StartPosition = FormStartPosition.CenterScreen
193195
};
194196

197+
// --- Separate Popuped window ---
198+
var screen = Screen.PrimaryScreen.WorkingArea;
199+
// 将窗口定位在屏幕的右侧。 (屏幕中心点 + 5像素间隙)
200+
int editorX = screen.Left + (screen.Width / 2) + 5;
201+
int editorY = screen.Top + (screen.Height - f.Height) / 2;
202+
203+
// 确保窗口不会跑到屏幕外
204+
if (editorX + f.Width > screen.Right)
205+
{
206+
editorX = screen.Right - f.Width;
207+
}
208+
if (editorY < screen.Top)
209+
{
210+
editorY = screen.Top;
211+
}
212+
213+
f.Location = new Point(editorX, editorY);
214+
// --- Separate Popuped window End ---
215+
195216
var serializer = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue };
196217

197218
// Create and add controls

0 commit comments

Comments
 (0)