Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit 7b2c7c5

Browse files
NicoMicoNicoMico
authored andcommitted
op
1 parent 9aa2156 commit 7b2c7c5

39 files changed

+1654
-22
lines changed

analysis/Firefly.ini

Lines changed: 1493 additions & 0 deletions
Large diffs are not rendered by default.

analysis/res/Button.dds

1.14 KB
Binary file not shown.

analysis/res/Button_Hover.dds

4.13 KB
Binary file not shown.

analysis/res/Menu.dds

788 KB
Binary file not shown.

analysis/res/Menu_Arrow.dds

9.13 KB
Binary file not shown.

analysis/res/Menu_Arrow_Hover.dds

2.39 KB
Binary file not shown.

analysis/res/Shapes.hlsl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// **** SHAPEKEYS SHADER ****
2+
// By: Cybertron, SinsOfSeven
3+
4+
struct VertexAttributes {
5+
float3 position;
6+
float3 normal;
7+
float4 tangent;
8+
};
9+
10+
RWStructuredBuffer<VertexAttributes> rw_buffer : register(u5);
11+
StructuredBuffer<VertexAttributes> base : register(t50);
12+
StructuredBuffer<VertexAttributes> shapekey : register(t51);
13+
14+
Texture1D<float4> IniParams : register(t120);
15+
#define key IniParams[88].x
16+
17+
[numthreads(1, 1, 1)]
18+
void main(uint3 threadID : SV_DispatchThreadID)
19+
{
20+
uint i = threadID.x;
21+
VertexAttributes diff;
22+
diff.position = shapekey[i].position - base[i].position;
23+
diff.normal = shapekey[i].normal - base[i].normal;
24+
diff.tangent = shapekey[i].tangent - base[i].tangent;
25+
rw_buffer[i].position += diff.position*key;
26+
rw_buffer[i].normal += diff.normal*key;
27+
rw_buffer[i].tangent += diff.tangent*key;
28+
}

analysis/res/Slider.dds

2.64 KB
Binary file not shown.

analysis/res/Slider_pink.dds

2.64 KB
Binary file not shown.

analysis/res/Slot.dds

4.14 KB
Binary file not shown.

analysis/res/Slot_Hover.dds

4.14 KB
Binary file not shown.

analysis/res/Slot_Hover_2.dds

4.14 KB
Binary file not shown.

analysis/res/anim.hlsl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// **** CYCLIC ANIMATION SHADER ****
2+
// Made by Zlevir
3+
4+
// Based on shapekey shader by Cybertron, SinsOfSeven
5+
6+
struct VertexAttributes {
7+
float3 position;
8+
float3 normal;
9+
float4 tangent;
10+
};
11+
12+
RWStructuredBuffer<VertexAttributes> rw_buffer : register(u5);
13+
StructuredBuffer<VertexAttributes> base : register(t50);
14+
StructuredBuffer<VertexAttributes> shapekey : register(t51);
15+
16+
Texture1D<float4> IniParams : register(t120);
17+
#define FREQ IniParams[88].x
18+
19+
[numthreads(1, 1, 1)]
20+
void main(uint3 threadID : SV_DispatchThreadID)
21+
{
22+
uint i = threadID.x;
23+
VertexAttributes diff;
24+
diff.position = shapekey[i].position - base[i].position ;
25+
diff.normal = shapekey[i].normal - base[i].normal;
26+
diff.tangent = shapekey[i].tangent - base[i].tangent;
27+
28+
// (0.5*(sin(TIME*(SPEED+1)*10)+1))
29+
rw_buffer[i].position += diff.position*(0.5*(sin(FREQ*30)+1));
30+
rw_buffer[i].normal += diff.normal*(0.5*(sin(FREQ*30)+1));
31+
rw_buffer[i].tangent += diff.tangent*(0.5*(sin(FREQ*30)+1));
32+
}

analysis/res/draw_2d.hlsl

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// **** RESPONSIVE UI SHADER ****
2+
// Contributors: SinsOfSeven
3+
// Ispired by VV_Mod_Maker
4+
5+
Texture1D<float4> IniParams : register(t120);
6+
7+
#define SIZE IniParams[87].xy
8+
#define OFFSET IniParams[87].zw
9+
10+
struct vs2ps {
11+
float4 pos : SV_Position0;
12+
float2 uv : TEXCOORD1;
13+
};
14+
15+
#ifdef VERTEX_SHADER
16+
void main(
17+
out vs2ps output,
18+
uint vertex : SV_VertexID)
19+
{
20+
float2 BaseCoord,Offset;
21+
Offset.x = OFFSET.x*2-1;
22+
Offset.y = (1-OFFSET.y)*2-1;
23+
BaseCoord.xy = float2((2*SIZE.x),(2*(-SIZE.y)));
24+
// Not using vertex buffers so manufacture our own coordinates.
25+
switch(vertex) {
26+
case 0:
27+
output.pos.xy = float2(BaseCoord.x+Offset.x, BaseCoord.y+Offset.y);
28+
output.uv = float2(1,0);
29+
break;
30+
case 1:
31+
output.pos.xy = float2(BaseCoord.x+Offset.x, 0+Offset.y);
32+
output.uv = float2(1,1);
33+
break;
34+
case 2:
35+
output.pos.xy = float2(0+Offset.x, BaseCoord.y+Offset.y);
36+
output.uv = float2(0,0);
37+
break;
38+
case 3:
39+
output.pos.xy = float2(0+Offset.x, 0+Offset.y);
40+
output.uv = float2(0,1);
41+
break;
42+
default:
43+
output.pos.xy = 0;
44+
output.uv = float2(0,0);
45+
break;
46+
};
47+
output.pos.zw = float2(0, 1);
48+
}
49+
#endif
50+
51+
#ifdef PIXEL_SHADER
52+
Texture2D<float4> tex : register(t100);
53+
54+
void main(vs2ps input, out float4 result : SV_Target0)
55+
{
56+
uint width, height;
57+
tex.GetDimensions(width, height);
58+
if (!width || !height) discard;
59+
input.uv.y = 1 - input.uv.y;
60+
result = tex.Load(int3(input.uv.xy * float2(width, height), 0));
61+
}
62+
#endif

analysis/res/item_balls.dds

10.7 KB
Binary file not shown.

analysis/res/item_boobs.dds

10.7 KB
Binary file not shown.

analysis/res/item_bra.dds

2.79 KB
Binary file not shown.

analysis/res/item_butt.dds

10.7 KB
Binary file not shown.

analysis/res/item_coat.dds

2.79 KB
Binary file not shown.

analysis/res/item_collar.dds

10.7 KB
Binary file not shown.

analysis/res/item_ears.dds

10.7 KB
Binary file not shown.

analysis/res/item_face_lmao_idk.dds

10.7 KB
Binary file not shown.

analysis/res/item_futa.dds

10.7 KB
Binary file not shown.

analysis/res/item_gloves.dds

2.79 KB
Binary file not shown.

analysis/res/item_leg.dds

10.7 KB
Binary file not shown.

analysis/res/item_panties.dds

2.79 KB
Binary file not shown.

analysis/res/item_plug.dds

2.79 KB
Binary file not shown.

analysis/res/item_plug_active.dds

10.7 KB
Binary file not shown.

analysis/res/item_pp.dds

10.7 KB
Binary file not shown.

analysis/res/item_thighs.dds

10.7 KB
Binary file not shown.

blender/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import bpy.props
55

66
# DBMT插件面板
7-
from .panel_unity.panel_ui import *
7+
from .panel.panel_ui import *
88

99
# 右键菜单
1010
from .rightclick_menu.mesh_operator import *
@@ -20,7 +20,7 @@
2020
"name": "DBMT-Blender-Plugin",
2121
"description": "DBMT的Blender插件 目前只支持3.6LTS版本",
2222
"blender": (3, 6, 0),
23-
"version": (1, 0, 1, 6),
23+
"version": (1, 0, 1, 7),
2424
"location": "View3D",
2525
"category": "Generic"
2626
}
@@ -29,7 +29,7 @@
2929
# 需要注册和取消注册的所有类
3030
register_classes = (
3131
# migoto
32-
MMTPathProperties,
32+
DBMTProperties,
3333
MMTPathOperator,
3434
MMTPanel,
3535

@@ -74,7 +74,7 @@ def register():
7474
bpy.utils.register_class(cls)
7575

7676
# 新建一个属性用来专门装MMT的路径
77-
bpy.types.Scene.mmt_props = bpy.props.PointerProperty(type=MMTPathProperties)
77+
bpy.types.Scene.mmt_props = bpy.props.PointerProperty(type=DBMTProperties)
7878

7979
# MMT数值保存的变量
8080
bpy.types.Scene.mmt_mmd_animation_mod_start_frame = bpy.props.IntProperty(name="Start Frame")

blender/animation_TMP/animation_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import struct
33
import bpy.props
44

5-
from ..panel_unity.panel_ui import *
5+
from ..panel.panel_ui import *
66
from datetime import datetime
77

88

File renamed without changes.
File renamed without changes.

blender/panel_unity/panel_ui.py renamed to blender/panel/panel_ui.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from ..unity.migoto_import import *
99

1010

11-
class MMTPathProperties(bpy.types.PropertyGroup):
11+
class DBMTProperties(bpy.types.PropertyGroup):
1212
path: bpy.props.StringProperty(
1313
name="主路径",
1414
description="选择DBMT的主路径",
@@ -22,6 +22,7 @@ class MMTPathProperties(bpy.types.PropertyGroup):
2222
default=False
2323
) # type: ignore
2424

25+
2526
def __init__(self) -> None:
2627
super().__init__()
2728
self.subtype = 'DIR_PATH'
@@ -54,10 +55,11 @@ def draw(self, context):
5455
layout.prop(props, "path")
5556

5657
# 获取DBMT.exe的路径
57-
dbmt_gui_exe_path = os.path.join(context.scene.mmt_props.path, "DBMT-GUI.exe")
58+
dbmt_gui_exe_path = os.path.join(props.path, "DBMT-GUI.exe")
5859
if not os.path.exists(dbmt_gui_exe_path):
5960
layout.label(text="错误:请选择DBMT-GUI.exe所在路径 ", icon='ERROR')
60-
61+
62+
main_json_path = props.path
6163
current_game = get_current_game_from_main_json()
6264
if current_game != "":
6365
layout.label(text="当前游戏: " + current_game)
@@ -69,7 +71,7 @@ def draw(self, context):
6971

7072
# 绘制一个CheckBox用来存储是否导出相同顶点数
7173
layout.separator()
72-
layout.prop(context.scene.mmt_props, "export_same_number", text="导出不改变顶点数")
74+
layout.prop(props, "export_same_number", text="导出不改变顶点数")
7375

7476
# 分隔符
7577
layout.separator()

blender/panel_unreal/__init__.py

Whitespace-only changes.

blender/unity/migoto_import.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,23 +303,29 @@ def import_3dmigoto_raw_buffers(operator, context, fmt_path:str, vb_path:str, ib
303303
obj['3DMigoto:OriginalVertexNumber'] = len(mesh.vertices)
304304
obj['3DMigoto:OriginalIndicesNumber'] = len(mesh.loops)
305305

306-
# Set auto_smooth 89° for unity game's perfect shadow.
307-
obj.data.use_auto_smooth = True
308-
# TODO Blender 4.1 remove auto_smooth_angle function.
309-
obj.data.auto_smooth_angle = math.radians(89)
306+
# get current gamename
307+
current_game = get_current_game_from_main_json(in_path=main_json_path)
310308

311-
# operator.report({'INFO'}, mesh_prefix)
309+
# unity games need auto smooth 89°
310+
if current_game in ["GI","HI3","HSR","ZZZ","Unity-CPU-PreSkinning","Naraka","Mecha","LiarsBar"]:
311+
# Set auto_smooth 89° for unity game's perfect shadow.
312+
obj.data.use_auto_smooth = True
313+
# TODO Blender 4.1 remove auto_smooth_angle function.
314+
obj.data.auto_smooth_angle = math.radians(89)
315+
316+
# auto texture
312317
create_material_with_texture(obj, mesh_name=mesh_name,directory= os.path.dirname(fmt_path))
313318

314-
# 重置旋转角度归零
315-
obj.rotation_euler[0] = 0.0 # X轴
316-
obj.rotation_euler[1] = 0.0 # Y轴
317-
obj.rotation_euler[2] = 0.0 # Z轴
319+
# ZZZ need reset rotation.
320+
if current_game not in ["GI","HI3","HSR"]:
321+
obj.rotation_euler[0] = 0.0 # X轴
322+
obj.rotation_euler[1] = 0.0 # Y轴
323+
obj.rotation_euler[2] = 0.0 # Z轴
318324

319325
# Flush every time export
320326
bpy.context.view_layer.update()
321327

322-
# Force flush make good user experience.
328+
# Force flush makes better user experience.
323329
bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
324330

325331
return obj

blender/unity/migoto_utils.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import bpy
77
import json
88

9+
main_json_path = ""
10+
911
from glob import glob
1012

1113
def matmul(a, b):
@@ -98,14 +100,19 @@ def format_size(fmt):
98100

99101

100102
# Read Main.json from DBMT folder and then get current game name.
101-
def get_current_game_from_main_json() ->str:
103+
def get_current_game_from_main_json(in_path="") ->str:
102104
current_game = ""
103-
main_setting_path = os.path.join(bpy.context.scene.mmt_props.path, "Configs\\Main.json")
105+
if in_path == "":
106+
in_path = bpy.context.scene.mmt_props.path
107+
108+
main_setting_path = os.path.join(in_path, "Configs\\Main.json")
109+
# print(main_setting_path)
104110
if os.path.exists(main_setting_path):
105111
main_setting_file = open(main_setting_path)
106112
main_setting_json = json.load(main_setting_file)
107113
main_setting_file.close()
108114
current_game = main_setting_json["GameName"]
115+
# print(current_game)
109116
return current_game
110117

111118

@@ -221,4 +228,6 @@ def get_model_prefix_from_fmt_file(fmt_file_path:str)->str:
221228
continue
222229
if line.startswith('prefix:'):
223230
return line.split(':')[1].strip()
224-
return ""
231+
return ""
232+
233+

0 commit comments

Comments
 (0)