From: hgn Date: Thu, 14 Apr 2022 06:49:36 +0000 (+0100) Subject: fix for image resizing bad request X-Git-Url: https://skaterift.com/git/?a=commitdiff_plain;ds=sidebyside;h=82ec133bda63d2d86bee82d7e130ede44882528c;p=convexer.git fix for image resizing bad request --- diff --git a/__init__.py b/__init__.py index 0932670..53149b6 100644 --- a/__init__.py +++ b/__init__.py @@ -154,7 +154,7 @@ def cxr_jobs_update_graph(jobs): else: colour = colourwait px = (cur + (i)*sfsub) * sf - px1 = (cur + (i+1.0)*sfsub) * sf - 0.003 + px1 = (cur + (i+1.0)*sfsub) * sf i += 1 verts += [(px,0), (px, h), (px1, 0.0), (px1,h)] @@ -979,6 +979,8 @@ def cxr_export_vmf(sceneinfo, output_vmf): def _buildsolid( cmd ): nonlocal m + + print( F"{vmfinfo.brush_count} :: {cmd['object'].name}" ) baked = mesh_cxr_format( cmd['object'] ) world = libcxr_decompose.call( baked, None ) @@ -1596,89 +1598,92 @@ class CXR_COMPILER_CHAIN(bpy.types.Operator): # Convexer jobs static.JOBID = 0 static.JOBINFO = [] - - static.JOBINFO += [{ - "title": "Convexer", - "w": 20, - "colour": (1.0,0.3,0.1,1.0), - "exec": cxr_export_vmf, - "jobs": [(sceneinfo,output_vmf)] - }] - if len(image_jobs) > 0: - static.JOBINFO += [{ - "title": "Textures", - "w": 40, - "colour": (0.1,1.0,0.3,1.0), - "exec": compile_image, - "jobs": image_jobs - }] - - # FBX stage - - if len(sceneinfo['heros']) > 0: - static.JOBINFO += [{ - "title": "Batches", - "w": 25, - "colour": (0.5,0.5,1.0,1.0), - "exec": cxr_export_modelsrc, - "jobs": [(h['collection'], h['origin'], asset_dir, \ - settings.project_name, h['transform']) for h in \ - sceneinfo['heros']] + if settings.comp_vmf: + static.JOBINFO += [{ + "title": "Convexer", + "w": 20, + "colour": (1.0,0.3,0.1,1.0), + "exec": cxr_export_vmf, + "jobs": [(sceneinfo,output_vmf)] }] - # VBSP stage + if settings.comp_textures: + if len(image_jobs) > 0: + static.JOBINFO += [{ + "title": "Textures", + "w": 40, + "colour": (0.1,1.0,0.3,1.0), + "exec": compile_image, + "jobs": image_jobs + }] + game = 'z:'+settings.subdir.replace('/','\\') args = [ \ '-game', game, settings.project_name ] + + # FBX stage + if settings.comp_models: + if len(sceneinfo['heros']) > 0: + static.JOBINFO += [{ + "title": "Batches", + "w": 25, + "colour": (0.5,0.5,1.0,1.0), + "exec": cxr_export_modelsrc, + "jobs": [(h['collection'], h['origin'], asset_dir, \ + settings.project_name, h['transform']) for h in \ + sceneinfo['heros']] + }] - if len(qc_jobs) > 0: + if len(qc_jobs) > 0: + static.JOBINFO += [{ + "title": "StudioMDL", + "w": 20, + "colour": (0.8,0.1,0.1,1.0), + "exec": "studiomdl", + "jobs": [[settings[F'exe_studiomdl']] + [\ + '-nop4', '-game', game, qc] for qc in qc_jobs], + "cwd": asset_dir + }] + + # VBSP stage + if settings.comp_compile: static.JOBINFO += [{ - "title": "StudioMDL", - "w": 20, - "colour": (0.8,0.1,0.1,1.0), - "exec": "studiomdl", - "jobs": [[settings[F'exe_studiomdl']] + [\ - '-nop4', '-game', game, qc] for qc in qc_jobs], - "cwd": asset_dir + "title": "VBSP", + "w": 25, + "colour": (0.1,0.2,1.0,1.0), + "exec": "vbsp", + "jobs": [[settings[F'exe_vbsp']] + args], + "cwd": directory + }] + + static.JOBINFO += [{ + "title": "VVIS", + "w": 25, + "colour": (0.9,0.5,0.5,1.0), + "exec": "vvis", + "jobs": [[settings[F'exe_vvis']] + args], + "cwd": directory + }] + + static.JOBINFO += [{ + "title": "VRAD", + "w": 25, + "colour": (0.9,0.2,0.3,1.0), + "exec": "vrad", + "jobs": [[settings[F'exe_vrad']] + args], + "cwd": directory }] - static.JOBINFO += [{ - "title": "VBSP", - "w": 25, - "colour": (0.1,0.2,1.0,1.0), - "exec": "vbsp", - "jobs": [[settings[F'exe_vbsp']] + args], - "cwd": directory - }] - - static.JOBINFO += [{ - "title": "VVIS", - "w": 25, - "colour": (0.9,0.5,0.5,1.0), - "exec": "vvis", - "jobs": [[settings[F'exe_vvis']] + args], - "cwd": directory - }] - - static.JOBINFO += [{ - "title": "VRAD", - "w": 25, - "colour": (0.9,0.2,0.3,1.0), - "exec": "vrad", - "jobs": [[settings[F'exe_vrad']] + args], - "cwd": directory - }] - - static.JOBINFO += [{ - "title": "CXR", - "w": 5, - "colour": (0.0,1.0,0.4,1.0), - "exec": cxr_patchmap, - "jobs": [(F"{directory}/{settings.project_name}.bsp",\ - F"{settings.subdir}/maps/{settings.project_name}.bsp")] - }] + static.JOBINFO += [{ + "title": "CXR", + "w": 5, + "colour": (0.0,1.0,0.4,1.0), + "exec": cxr_patchmap, + "jobs": [(F"{directory}/{settings.project_name}.bsp",\ + F"{settings.subdir}/maps/{settings.project_name}.bsp")] + }] static.USER_EXIT=False static.TIMER=wm.event_timer_add(0.1,window=context.window) @@ -1767,6 +1772,13 @@ class CXR_INTERFACE(bpy.types.Panel): box.prop(settings, "exe_vbsp") box.prop(settings, "exe_vvis") box.prop(settings, "exe_vrad") + + box = box.box() + row = box.row() + row.prop(settings,"comp_vmf") + row.prop(settings,"comp_textures") + row.prop(settings,"comp_models") + row.prop(settings,"comp_compile") text = "Compile" if CXR_COMPILER_CHAIN.TIMER == None else "Cancel" row = box.row() @@ -2076,6 +2088,10 @@ class CXR_SCENE_SETTINGS(bpy.types.PropertyGroup): image_quality: bpy.props.IntProperty(name="Texture Quality (0-18)",\ default=8, min=0, max=18 ) + comp_vmf: bpy.props.BoolProperty(name="VMF",default=True) + comp_models: bpy.props.BoolProperty(name="Models",default=True) + comp_textures: bpy.props.BoolProperty(name="Textures",default=True) + comp_compile: bpy.props.BoolProperty(name="Compile",default=True) classes = [ CXR_RELOAD, CXR_DEV_OPERATOR, CXR_INTERFACE, \ CXR_MATERIAL_PANEL, CXR_IMAGE_SETTINGS,\ diff --git a/nbvtf/nbvtf.h b/nbvtf/nbvtf.h index e6318c0..111ba9e 100644 --- a/nbvtf/nbvtf.h +++ b/nbvtf/nbvtf.h @@ -768,12 +768,15 @@ int nbvtf_convert( const char *src, int w, int h, int mipmap, return 0; } - // Image size needs retargeting + // Image size needs to be made smaller if( (w && h) && ( x > w || y > h ) ) + { nbvtf_downscale( data, x, y, w, h, data ); + x = w; + y = h; + } - int status = nbvtf_write( data, w, h, mipmap, format, qual, - usr_flags, dest ); + int status = nbvtf_write( data, x,y, mipmap, format, qual, usr_flags, dest ); stbi_image_free( data );