Jump to content


Photo

Blender TDM Material Manager Plugin - updated to version 2.2.2


28 replies to this topic

#1 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 26 November 2017 - 08:05 PM

*
POPULAR

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.

addon_panel.gif

 

Download:

http://catmanofiowa....rialManager.zip

edit 13th January: version 2.2.2

 

Readme:

http://catmanofiowa....M/MMReadme.html

 

It'll be interesting to see how this is in the wild.


Edited by R Soul, 12 January 2018 - 07:13 PM.

  • Bikerdude, AluminumHaste, HMart and 4 others like this

#2 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 27 November 2017 - 02:47 PM

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.



#3 LDAsh

LDAsh

    Member

  • Member
  • PipPip
  • 89 posts

Posted 28 November 2017 - 01:13 AM

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....terial_List.zip



#4 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 01 December 2017 - 07:07 PM

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 by R Soul, 01 December 2017 - 07:07 PM.


#5 Tinkerer

Tinkerer

    Member

  • Member
  • PipPip
  • 10 posts

Posted 02 December 2017 - 11:37 AM

...

 

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 by Tinkerer, 02 December 2017 - 11:38 AM.


#6 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 02 December 2017 - 01:00 PM

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.



#7 Tinkerer

Tinkerer

    Member

  • Member
  • PipPip
  • 10 posts

Posted 02 December 2017 - 03:19 PM

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?

 

 



#8 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 02 December 2017 - 06:50 PM

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.



#9 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 06 December 2017 - 07:09 PM

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).



#10 Tinkerer

Tinkerer

    Member

  • Member
  • PipPip
  • 10 posts

Posted 07 December 2017 - 07:55 AM

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 by Tinkerer, 07 December 2017 - 07:56 AM.


#11 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 09 December 2017 - 07:16 PM

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....rialManager.zip

 

Readme:

http://catmanofiowa....M/MMReadme.html


Edited by R Soul, 09 December 2017 - 07:17 PM.


#12 Tinkerer

Tinkerer

    Member

  • Member
  • PipPip
  • 10 posts

Posted 10 December 2017 - 10:20 AM

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.

 



#13 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 10 December 2017 - 01:02 PM

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.



#14 Tinkerer

Tinkerer

    Member

  • Member
  • PipPip
  • 10 posts

Posted 10 December 2017 - 04:05 PM

C:\dm_textures\architecture\windows

C:\dm_textures\MTR

 

About zip, perhaps it's possible with regular python?

https://docs.python....#module-zipfile ?

 



#15 Petike the Taffer

Petike the Taffer

    Member

  • Member
  • PipPip
  • 326 posts

Posted 10 December 2017 - 05:13 PM

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.



#16 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 11 December 2017 - 05:07 PM

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 by R Soul, 11 December 2017 - 05:08 PM.


#17 Tinkerer

Tinkerer

    Member

  • Member
  • PipPip
  • 10 posts

Posted 12 December 2017 - 05:49 AM

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.



#18 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 12 December 2017 - 06:49 PM

Thanks for the suggestion. See the attachments for my textures and materials.

Attached Files


Edited by R Soul, 12 December 2017 - 06:49 PM.


#19 Tinkerer

Tinkerer

    Member

  • Member
  • PipPip
  • 10 posts

Posted 13 December 2017 - 10:46 AM

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.



#20 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 15 December 2017 - 07:03 PM

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.



#21 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 17 December 2017 - 12:08 PM

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 by R Soul, 17 December 2017 - 07:20 PM.


#22 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 22 December 2017 - 08:57 PM

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 by R Soul, 22 December 2017 - 08:57 PM.


#23 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 139 posts

Posted 24 December 2017 - 03:02 PM

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.


  • nbohr1more likes this

#24 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1569 posts

Posted 26 December 2017 - 12:10 PM

I shall test this my friend, havent used lwo before (usually stick to ase), so this sounds pretty good.


  • nbohr1more likes this

#25 Bikerdude

Bikerdude

    Mod hero

  • Member
  • PipPipPipPipPip
  • 20083 posts

Posted 27 December 2017 - 09:59 AM

@Rsoul, you should get Arcturus in on this as he heavily into Blender.





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users