From 5ed7781eb73157f2de21f848a828b321637926b6 Mon Sep 17 00:00:00 2001 From: hgn Date: Thu, 14 Apr 2022 14:40:16 +0100 Subject: [PATCH] .cc --- .gitignore | 3 +++ __init__.py | 28 +++++++++++++++++++++------- config.py | 5 +++++ nbvtf/librgbcx.cc | 24 ++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 nbvtf/librgbcx.cc diff --git a/.gitignore b/.gitignore index 1a9d358..e8c83fa 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ !.gitignore !*.c +!*.cc +!*.cpp +!*.hpp !*.h !*.py diff --git a/__init__.py b/__init__.py index 53149b6..c5fb285 100644 --- a/__init__.py +++ b/__init__.py @@ -89,11 +89,11 @@ def cxr_ui(_,context): blf.draw(0,ln[:-1]) py += 16 - if CXR_PREVIEW_OPERATOR.LASTERR != None: - blf.position(0,2,80,0) - blf.size(0,50,48) - blf.color(0,1.0,0.2,0.2,0.9) - blf.draw(0,"This is a stoopid error\nWIthiuawdnaw") + #if CXR_PREVIEW_OPERATOR.LASTERR != None: + # blf.position(0,2,80,0) + # blf.size(0,50,48) + # blf.color(0,1.0,0.2,0.2,0.9) + # blf.draw(0,"Invalid geometry") # Something is off with TIMER, # this forces the viewport to redraw before we can continue with our @@ -1565,6 +1565,11 @@ class CXR_COMPILER_CHAIN(bpy.types.Operator): for brush in sceneinfo['geo']: for ms in brush['object'].material_slots: a_materials.add( ms.material ) + if ms.material.cxr_data.shader == 'VertexLitGeneric': + errmat = ms.material.name + errnam = brush['object'].name + print( F"Vertex shader {errmat} used on {errnam}") + return {'CANCELLED'} for ent in sceneinfo['entities']: if isinstance(ent['object'],bpy.types.Collection): continue @@ -1580,6 +1585,13 @@ class CXR_COMPILER_CHAIN(bpy.types.Operator): for obj in hero['collection'].objects: for ms in obj.material_slots: a_materials.add( ms.material ) + if ms.material.cxr_data.shader == 'LightMappedGeneric' or \ + ms.material.cxr_data.shader == 'WorldVertexTransition': + + errmat = ms.material.name + errnam = obj.name + print( F"Lightmapped shader {errmat} used on {errnam}") + return {'CANCELLED'} # Collect images for mat in a_materials: @@ -1663,16 +1675,17 @@ class CXR_COMPILER_CHAIN(bpy.types.Operator): "w": 25, "colour": (0.9,0.5,0.5,1.0), "exec": "vvis", - "jobs": [[settings[F'exe_vvis']] + args], + "jobs": [[settings[F'exe_vvis']] + ['-fast'] + args ], "cwd": directory }] + vrad_opt = settings.opt_vrad.split() static.JOBINFO += [{ "title": "VRAD", "w": 25, "colour": (0.9,0.2,0.3,1.0), "exec": "vrad", - "jobs": [[settings[F'exe_vrad']] + args], + "jobs": [[settings[F'exe_vrad']] + vrad_opt + args ], "cwd": directory }] @@ -1772,6 +1785,7 @@ class CXR_INTERFACE(bpy.types.Panel): box.prop(settings, "exe_vbsp") box.prop(settings, "exe_vvis") box.prop(settings, "exe_vrad") + box.prop(settings, "opt_vrad") box = box.box() row = box.row() diff --git a/config.py b/config.py index 364363d..438c044 100644 --- a/config.py +++ b/config.py @@ -251,5 +251,10 @@ cxr_entities = \ { "TeamNum": {"type": "int", "default": 0 } } + }, + "func_detail": + { + "allow": ('MESH',), + "keyvalues": {} } } diff --git a/nbvtf/librgbcx.cc b/nbvtf/librgbcx.cc new file mode 100644 index 0000000..ae6e72c --- /dev/null +++ b/nbvtf/librgbcx.cc @@ -0,0 +1,24 @@ +#include +#include +#include + +#define RGBCX_IMPLEMENTATION +#include "rgbcx.h" + +extern "C" +{ + void rgbcx__init(void) + { + rgbcx::init(); + } + + void rgbcx__encode_bc1( uint32_t level, void* pDst, const uint8_t* pPixels, int allow_3color, int use_transparent_texels_for_black ) + { + rgbcx::encode_bc1( level, pDst, pPixels, allow_3color, use_transparent_texels_for_black ); + } + + void rgbcx__encode_bc3( uint32_t level, void* pDst, const uint8_t* pPixels ) + { + rgbcx::encode_bc3( level, pDst, pPixels ); + } +} -- 2.25.1