Popular Post R Soul 199 Posted November 27, 2017 Popular Post Report Share Posted November 27, 2017 (edited) When exporting from Blender to TDM in .lwo format, it's necessary to set the material names to textures/darkmod/,,,,something.If an object has a lot of textures it's going to be tedious to search the mtr files to get the right name. The same goes for applying textures to imported .lwo objects.I wrote this plugin to make that task much easier.Version 2.8.0Download:Go to the GitHub page: https://github.com/RSoul82/Blender-TDM-Material-ManagerRight click the .py file, then go to Save As and put it in some folder.(Or go to Clone or Download and save it as a zip file to your computer).The old version, for Blender 2.79, is here:https://github.com/RSoul82/Blender-TDM-Material-Manager/tree/Blender-2.79-archive(this is unlikely to be upgraded unless it causes serious problems)It'll be interesting to see how this is in the wild. Edited March 13, 2019 by R Soul 9 Quote Link to post Share on other sites
R Soul 199 Posted November 27, 2017 Author Report Share Posted November 27, 2017 A few hours after the first upload it occurred to me that I might have uploaded an older version of this (which didn't account for some situations), so I re-uploaded the file. To be sure you have the latest version, the zip file has a modified date/time of 27th November, 7:27 and the py file is 27th November 0:26. Quote Link to post Share on other sites
LDAsh 54 Posted November 28, 2017 Report Share Posted November 28, 2017 This seems really awesome, although admittedly I haven't tried it, still wish to thank you for the efforts. This is something that could be insanely useful for more than just TDM, with a couple of simple tweaks. Just wanted to point out a typo on the webpage - "A pre-made material-texture list can be downloaded from here" = does the 404 dance.URL should be - http://catmanofiowa.com/RSoul/TDM/TDM_Material_List.zip Quote Link to post Share on other sites
R Soul 199 Posted December 2, 2017 Author Report Share Posted December 2, 2017 (edited) I've made a minor update. I hadn't taken into account that some material name lines have comments in them, so these were being partially added to the material name. That's now been corrected. The download link is the same as before. The best way to replace an addon is vis User Preferences > search for addon (the letters TDM should reveal it), click on the Remove button and then Install From File. Edited December 2, 2017 by R Soul Quote Link to post Share on other sites
Tinkerer 0 Posted December 2, 2017 Report Share Posted December 2, 2017 (edited) ... It'll be interesting to see how this is in the wild. Recently i was playing around with darkradiant and blender. Saw this post and tried the plugin. Here's some feedback. First of all, good idea to try and make this stuff easier. However it's not working that well for me I'm afraid. The best result i got was that sometimes the correct textures got loaded. But it never changed the material names... I use blender 2.79. And the textures are in a root folder of the c: disk. Looking at the TDM materials i notice the following:some material names are too long for blender. You mention in the readme that there are some but in my tests i already discovered several so i wonder how many there are. Perhaps more than some, perhaps a lot?some material names don't follow the desired virtual folder convention but just use short names (many model materials it seems). Edited December 2, 2017 by Tinkerer Quote Link to post Share on other sites
R Soul 199 Posted December 2, 2017 Author Report Share Posted December 2, 2017 I'm not sure what to do about material names being too long. The short material names are probably skins. I'll look into those files and see what can be done. As for the other problems, please post some examples. Quote Link to post Share on other sites
Tinkerer 0 Posted December 2, 2017 Report Share Posted December 2, 2017 If you want to make it more user friendly you might want to check the length of the mat. name first and if it's too long name the mat. 'TOO LONG!. Just a thought... Short names. E.g. import dungeon/torturechair.lwo. You see it has two short material names. As for examples, dunno. I got a folder c:\dm_textures with the dds folders like stone, wood, roof etc. And also inside that map a MTR folder with the mat. files and your text file. That should work right? Quote Link to post Share on other sites
R Soul 199 Posted December 2, 2017 Author Report Share Posted December 2, 2017 I think most of these problems are caused by me thinking all material names start with 'textures/darkmod', and wanting to use the pre-generated list to simplify the code for the two main functions. I'm currently redoing the code for 'Load Textures' to take the objects material names and look in the mtr files themselves. The other one, assigning a material name based on the texture, may be harder due to having to go backwards through the file, but I've done hard things before. Quote Link to post Share on other sites
R Soul 199 Posted December 7, 2017 Author Report Share Posted December 7, 2017 I've updated this, and called is version 2 because of the changes. It no longer uses the simple material-texture list; it scans the mtr files each time. This is much more reliable. It makes it clear if a material name is too long, and puts the attempted name in a custom property so you can easily search for it in the original files and make a copy with a shorter name. If a texture is used by several materials, the addon will always stop at the first one it finds. You can now set the correct name and use a custom property to prevent that material being renamed again (see the readme). Quote Link to post Share on other sites
Tinkerer 0 Posted December 7, 2017 Report Share Posted December 7, 2017 (edited) OK, just tested this. Still doesn't work for me... First of all, the optional fields are not optional. Only when i gave those fields the same path as the default locations did i get some results.The results are that some textures got loaded. Only the materials that start with textures/darkmod got their textures loaded.The material names never changed. Now it could just be a problem with my setup. Someone else should test it as well to make sure.Let's assume it's your code though. I advise the following assuming you have not done so already.That is to use another system that has default settings for testing purposes. Perhaps use a virtual machine.Just install blender and don't change things. Perhaps use different folder names also. A different setup than you use now.This way you should be able to make sure it works like expected on another system. Edited December 7, 2017 by Tinkerer Quote Link to post Share on other sites
R Soul 199 Posted December 10, 2017 Author Report Share Posted December 10, 2017 (edited) The problem with the optional folders was a code error - I was checking the wrong variable. That's fixed. Regarding other problems, I didn't mention in my last post that the readme has been updated. Please use that to ensure you've extracted everything that's necessary. On my machine I tried the addon with those files in other locations and it worked fine. For the second update I've made an addition to the optional FM paths system: They no longer have to be blank. They can also begin with a semicolon, which has the same effect while allowing you to keep some text in there. I've also tweaked the error reporting, so if you still have problems it may be easier to see what it thinks it should be looking for. Links (same as in the first post)Download:http://catmanofiowa.com/RSoul/TDM/TDM_MaterialManager.zip Readme:http://catmanofiowa.com/RSoul/TDM/MMReadme.html Edited December 10, 2017 by R Soul Quote Link to post Share on other sites
Tinkerer 0 Posted December 10, 2017 Report Share Posted December 10, 2017 Getting similar results as before. I'm starting to think it's because my directory structure is different than yours.Already fixed one error i noticed in my folders. Perhaps there's more but i don't know.This part of the plugin requirements seems tedious and error prone.The most obvious solution seems to be... more work on your part. That is to also code the pk4 extraction part..The question of course is if you want to spend more time on it.I must say that i'm not very interested in testing this over and over again. And most people/users will want it to work immediately i think. It's meant to make life easier.So if they must first navigate all the pk4's and make sure everything gets extracted the right way... probably will be a barrier and gives room for error. Quote Link to post Share on other sites
R Soul 199 Posted December 10, 2017 Author Report Share Posted December 10, 2017 I must say that i'm not very interested in testing this over and over again. And most people/users will want it to work immediately i think. It's meant to make life easier. There's no obligation, but testing is for your benefit. Can you give me some examples of your folder setups?E.g. where is your copy of architecture\windows\warehouse_window_dark_d.dds?What about tdm_models_kitchen.mtr? There may be something in the path that is causing problems, but I don't know where to start. I already have a function that ensures paths are absolute, and that should ensure they are the right format (e.g. windows or linux) I had a look at extracting from the files, but while Blender can load zip files, it's not able to open pk4, which I assumed were just renamed zips. Quote Link to post Share on other sites
Tinkerer 0 Posted December 10, 2017 Report Share Posted December 10, 2017 C:\dm_textures\architecture\windowsC:\dm_textures\MTR About zip, perhaps it's possible with regular python?https://docs.python.org/3.6/library/zipfile.html#module-zipfile ? Quote Link to post Share on other sites
Petike the Taffer 517 Posted December 10, 2017 Report Share Posted December 10, 2017 Very cool plugin tool, R Soul. :-) I might make a blender model for the game in the near future, so this will definitely come in handy once it's thoroughly tested. Quote Female player character vocals (current mini-project, help/advice appreciated) Slovak localisation for TDM (my project) What I'm up to (sporadic updates) Stuff I've worked on at the wiki Partners in Crime (my FM series, in development) Link to post Share on other sites
R Soul 199 Posted December 11, 2017 Author Report Share Posted December 11, 2017 (edited) I must say that i'm not very interested in testing this over and over again. so this will definitely come in handy once it's thoroughly tested. Oh dear...any volunteers? Edited December 11, 2017 by R Soul Quote Link to post Share on other sites
Tinkerer 0 Posted December 12, 2017 Report Share Posted December 12, 2017 Oh dear...any volunteers?Well.. i was already testing it, remember. But it doesn't work for me and don't know what more to test. Although you could do this: generate a list of all the folders and files as it is on your system. I can compare that to what i have. In the mean time it is also good to know we can right click in DR in the media window and copy shader names and info. Quote Link to post Share on other sites
R Soul 199 Posted December 12, 2017 Author Report Share Posted December 12, 2017 (edited) Thanks for the suggestion. See the attachments for my textures and materials.TDM_Textures.txtTDM_Materials.txt Edited December 12, 2017 by R Soul Quote Link to post Share on other sites
Tinkerer 0 Posted December 13, 2017 Report Share Posted December 13, 2017 Alright, some improvement. I noticed you had a textures folder under props folder and i didn't. After fixing this most textures get loaded. Some that still not load are those in common. And i miss some sfx textures. Does loot/diamond.lwo work for you? However with most of that fixed, the other problem remains: mat. names are never changed. From what i can understand from your code and my debugging experiments, the set material code block is never executed. I think the findMaterial def returns nothing. This i conclude from reporting/printing the value of matFound and inserting a mat.name = 'test' before your block and that changed the mat name to my var. So, dunno what is going on. Hope this helps. Quote Link to post Share on other sites
R Soul 199 Posted December 16, 2017 Author Report Share Posted December 16, 2017 I had a look at the diamond object. The texture for that isn't in a standard place. The vast majority are in dds/textures/darkmod/... but a lot of the sfx textures are in textures\darkmod\sfx\. This makes the installation instructions more complicated. Currently it's tedious but fine if you're methodical (unless I missed something), but this new information annoys me. I also found that I'd made an incorrect assumption with texture extensions (dds if none specified in the mtr). I've now changed that to removing dds or tga from the reference, then looking for file.dds and then file.tga. I've also set up a warning message for the texture file not being found. Quote Link to post Share on other sites
R Soul 199 Posted December 17, 2017 Author Report Share Posted December 17, 2017 (edited) It turns out that Blender can handle the .pk4 files just fine. I don't know what I did wrong the last time I experimented, but I might have forgotten to check the file extensions, causing Blender to try to open the wrong file type. I will now have a look at making some file extraction functions to help with installation. edit:The texture extractor is working fine, and I'll make an mtr extractor soon. The next thing I need to consider is what to do about collision materials. So far I've been content to ignore them and just use material transparency. Edited December 18, 2017 by R Soul Quote Link to post Share on other sites
R Soul 199 Posted December 23, 2017 Author Report Share Posted December 23, 2017 (edited) Bump! I've implemented material and texture extraction features, so this should ensure all the necessary files are in place. See the first post. If that works, the remaining thing is collision materials. I didn't want to deal with them, but I think it may be necessary to make it complete. Edited December 23, 2017 by R Soul Quote Link to post Share on other sites
R Soul 199 Posted December 24, 2017 Author Report Share Posted December 24, 2017 Another bump. The addon now handles collision and shadow materials better than before - textures are now loaded when material names are set. When material names are set from the assigned texture, be aware that collision materials share the same texture, so there's no way to know the correct material name. You have to set them manually, but with the NoChange custom property you only have to do it once per object. Links in the first post. 1 Quote Link to post Share on other sites
RPGista 603 Posted December 26, 2017 Report Share Posted December 26, 2017 I shall test this my friend, havent used lwo before (usually stick to ase), so this sounds pretty good. 1 Quote Link to post Share on other sites
Bikerdude 3741 Posted December 27, 2017 Report Share Posted December 27, 2017 @Rsoul, you should get Arcturus in on this as he heavily into Blender. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.