STEAM GROUP
Blender Source Tools BleST
STEAM GROUP
Blender Source Tools BleST
315
IN-GAME
1,880
ONLINE
Founded
8 November, 2013
All Discussions > Bug Reports > Topic Details
Plat 16 Jul, 2022 @ 9:37pm
"Compile All Now" and "Compile all on export" don't work in 3.2.3
In the "Source Engine QC Complies" (sic, a typo, probably worth changing to "Compilables") section, there's a checkbox "Compile all on export" and a button "Compile All Now". I'm not sure if they ever worked, but on Blender 3.2 with addon version of 3.2.3 they don't.

I looked through the code and put together a fix that makes both of those functionalities work again, at least on my machine. The changes involve editing export_smd.py.
The file with my edits applied: https://pastebin.com/g4yvXZ02

Performed edits and rationale as follows.
The button "Compile All Now" tries to call for the compiler function, providing a wildcard string "*" as the filepath. That's the "all" part in the button name. On line 89 in the current addon file, the compilation function runs a handful of checks to make sure that it's been passed something that can be interpreted as a filepath or a list of filepaths. On line 91, it checks if the path it's been passed has a __getitem__ method - probably to check if what it's been passed is some special object. Unfortunately, a string (our wildcard of "*") has a __getitem__ magic method, but it won't be returning any valid filepaths. That's why the button doesn't work. Making a special check for our wildcard allows the compilation function to actually figure out that it hasn't received a valid filepath and to gather QC files for compilation itself via a getQCs() function.

On Line 229, the export function will attempt to call the compilation function compileQCs() (the one we've discussed in a previous paragraph), but it'll try to pass an instance of itself to that function for whatever reason as its self argument. Later on, the compileQCs() will attempt to call a method, getQCs(), of its class, but since its caller gave itself as its self argument, it tries to call a method from there. My solution is to remove the passing of anything when compileQCs() is called (line 229), and also to make compileQCs() a class method with a @classmethod decorator after line 82. This allows the exporter to cleanly call the compiler method.
< >
Showing 1-1 of 1 comments
Artfunkel 18 Jul, 2022 @ 1:28pm 
Thank you for investigating! I've fixed both issues now. Looks like __getitem__ was added to the Python string type since I wrote that code! The other issue is a cheeky hack that I wrote a very long time ago and then broke earlier this year. I'm not going to refactor that into something good right now, I'll just patch it up.
< >
Showing 1-1 of 1 comments
Per page: 1530 50

All Discussions > Bug Reports > Topic Details