77from pathlib import Path
88from traceback import print_exc
99from ... utils import common
10+ from ... utils import game
1011from . smd import SMD
1112from . fbx import export_fbx
1213
1314
1415class Model :
15- def __init__ (self , game , model ):
16+ def __init__ (self , gamedef , model ):
1617 self .prefs = common .get_prefs (bpy .context )
1718 self .wine = Path (self .prefs .wine )
1819
19- self .game = Path (game .game )
20- self .bin = Path (game .bin )
20+ self .game = Path (gamedef .game )
21+ self .bin = Path (gamedef .bin )
2122 if model .static and model .static_prop_combine :
2223 self .modelsrc = self .game .parent .parent .joinpath ('content' , self .game .name , 'models' )
2324 else :
24- self .modelsrc = Path (game .modelsrc )
25- self .models = Path (game .models )
26- self .mapsrc = Path (game .mapsrc )
27- self .mesh_type = game .mesh_type
25+ self .modelsrc = Path (gamedef .modelsrc )
26+ self .models = Path (gamedef .models )
27+ self .mapsrc = Path (gamedef .mapsrc )
28+ self .mesh_type = gamedef .mesh_type
2829
2930 self .name = Path (model .name ).with_suffix ('' ).as_posix ()
3031 self .stem = common .clean_filename (Path (self .name ).stem )
@@ -34,7 +35,7 @@ def __init__(self, game, model):
3435 directory = self .modelsrc .joinpath (self .name )
3536 self .directory = common .verify_folder (directory )
3637
37- studiomdl = self . bin . joinpath ( 'studiomdl.exe' )
38+ studiomdl = game . get_studiomdl_path ( gamedef )
3839 quickmdl = self .bin .joinpath ('quickmdl.exe' )
3940 self .studiomdl = quickmdl if quickmdl .is_file () else studiomdl
4041 self .hlmv = self .bin .joinpath ('hlmv.exe' )
@@ -362,7 +363,7 @@ def view_model(self):
362363 # Use wine to run HLMV on Linux.
363364 # Wine tends to complain about the paths we feed HLMV.
364365 # So we use relatve paths working from the base directory of the game.
365- if (os .name == 'posix' ) and (self .studiomdl .suffix == '.exe' ):
366+ if (os .name == 'posix' ) and (self .hlmv .suffix == '.exe' ):
366367 cwd = self .game .parent
367368 args = [str (self .wine ), str (self .hlmv .relative_to (cwd )), '-game' ,
368369 str (self .game .relative_to (cwd )), str (mdl .relative_to (cwd ))]
0 commit comments