Jump to content


Photo

Blender TDM Material Manager Plugin - updated to version 2.8.0 (Blender 2.80 update)


43 replies to this topic

#26 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 08 January 2018 - 04:44 PM

Updated to version 2.8.0, which is for Blender 2.80 and onwards.

 

The version for 2.79 is here:

https://github.com/R...er-2.79-archive

 

Download (for Blender 2.80):

Go to the GitHub page: https://github.com/R...aterial-Manager

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

 

Be aware that this file isn't synchronised with the one on my PC, and the latter is the one that gets uploaded to Github, not the other way round.


Edited by R Soul, 13 March 2019 - 06:11 PM.


#27 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 12 January 2018 - 07:16 PM

A tiny update, same links as above.

 

I found that the material name scanner woun't go to the first line in an .mtr file, so this wouldn't have found the extremely rare occurrence of the material you want being defined right at the start of the file. Most files begin with a comment. I discovered the bug due to writing some custom materials.


  • RPGista likes this

#28 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1664 posts

Posted 02 February 2018 - 09:57 AM

Thats brilliant work man, its a shame I cant seem to find any time to work on blender these past few months. Any help with setting up materials is such a blessing, its the single most annoying aspect of modeling for me, all the paths and materials and placing the textures here and there... 



#29 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 1984 posts

Posted 02 February 2018 - 10:25 AM

If there's one good remedy for that, it's using as few materials per mesh as possible. It's also very beneficial for performance.



#30 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 14 October 2018 - 06:48 PM

I've updated this addon. Now, when a texture is shared by multiple materials, it lists each of them as values of a set of custom properties. You can then paste the correct value to your Blender material name, and set the NoChange custom property to keep the chosen material.

 

It does this for collision textures too. You'll end up with 36 custom properties to choose from.

 

Same link as before, but reposting anyway:

Go to the GitHub page: https://github.com/R...aterial-Manager

Reinstalling it is very easy. Just download the above, in Blender go to User Preferences > Addons >Install from file. Select the zip file and it'll overwrite the previous version.


Edited by R Soul, 12 January 2019 - 08:12 AM.

  • Skaruts likes this

#31 Skaruts

Skaruts

    Member

  • Member
  • PipPip
  • 279 posts

Posted 14 October 2018 - 08:05 PM

I'm having a little issue with it finding me a wrong texture. The shader name is textures/darkmod/stone/brick/rough_big_blocks02 (copied from DR), but it chooses the texture from the file rough_big_blocks02_cornerstone_light.dds, instead of rough_big_blocks02.dds.

 

Meanwhile, is there a way to lock a texture so it doesn't change it when I load textures for new materials? 

 

EDIT: I just installed the new version, btw, but it still chooses that wrong texture.


Edited by Skaruts, 14 October 2018 - 08:07 PM.


#32 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 15 October 2018 - 12:42 PM

The material can be locked by giving it a custom property called NoChange with a value of 1.

 

I'll look in to the example you gave and see if it's a code bug or if it's an error that can't be avoided. I'll edit this post with my findings, unless there's another reply to this thread in the meantime.

 

edit: On my PC the correct texture is assigned. Does your 'extracted textures' folder have the same structure as the pk4 files. E.g. some_path/stone/brick, some_path/wood/panels etc?


Edited by R Soul, 15 October 2018 - 03:14 PM.


#33 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 12 January 2019 - 08:19 AM

I've uploaded the files on to Github which may make it easier for people to view, and to make suggestions etc. I don't have any auto-snyching going on, but I don't expect to be making any changes in the near future. See the first post.



#34 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7641 posts

Posted 21 January 2019 - 03:53 PM

Thanks for putting this on GitHub, that's a big improvement over ZIP files on download sites.

 

I'm happy to have a look at updating this for Blender 2.80, but I noticed that you haven't included a license with the code, which means that by default the code is "all rights reserved" and modifications (from other people) aren't allowed. Assuming this isn't the intention, would you mind choosing a license and putting it in a LICENSE file in the repository root? GitHub's default suggestions of either GNU GPL v3 or MIT seem pretty sensible, depending on whether you care about the "share-alike" protection or not.



#35 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 24 January 2019 - 02:10 PM

I've done that now. The master branch now has the GPL license. I also reuploaded the file addon in a "2.79 archive" branch to preserve that version while the master gets updated for 2.80. I recently thought about updating it but read about 2.80 not being finished yet, but if you're willing and able, then you have my sword.


Edited by R Soul, 24 January 2019 - 02:13 PM.

  • OrbWeaver likes this

#36 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7641 posts

Posted 25 January 2019 - 04:55 AM

Excellent, thanks. I might have a look at this next week, although don't let me discourage you if you were interested in working on Blender 2.80 support yourself — it is your project, after all.

 

You are right that Blender 2.80 is still in beta, but they are saying the API is mostly stable now, with only minor tweaks expected before release, so it should be fine for script developers to start updating their scripts to 2.80.



#37 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 25 January 2019 - 08:27 PM

Feel free to experiment as much as you want. I have another thing that's occupying me at the moment.



#38 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 09 March 2019 - 08:36 PM

I've begun the process of updating this to work in Blender 2.80. I've got the panel and buttons showing up and am working my way though the errors I get when I try to run things. Material textures seem to have a different structure. Google results may be sparse for now because it's so new, so advice/assistance welcome.

 

Current file on Github: https://github.com/R...aterial-Manager

 

edit: Because it's not ready, it's not quite in the Addon format (no 'info' at the start of the file) - it has to be run from Blender's text editor. The controls show up on the right (N menu, under a 'TDM' tab).

 

edit2: It set the correct name for test material I'd set up.


Edited by R Soul, 10 March 2019 - 04:02 PM.

  • RPGista likes this

#39 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7641 posts

Posted 11 March 2019 - 04:52 AM

I did actually make a start on the 2.8 update in my Gitlab repository, but did not post anything yet because it wasn't complete. You're welcome to pull changes from there if they would be useful. The script should now load as an Addon in 2.8, and I fixed a couple of the path-based operations to work on Linux (which I'm guessing is not the platform you're working on). I also moved the controls to the Materials panel rather than the Tools panel, since in my tests with 2.8 the Tools panel is far too narrow to contain all of the widgets (it's basically designed just for icon buttons in the new UI).

 

https://gitlab.com/o...aterial-manager



#40 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 11 March 2019 - 05:45 PM

Thanks. I've added your changes to my file (on GitHub).

 

Notable changes from 2.79 to 2.80:

The code for checking object visibility has changed

Reading mtr files would crash with one particular file, so I did something to do with encoding.

 

Now that I've got going and we're over the UI hurdle I'm happy to continue. So far I've made the assumption that the the texture is assigned via a material node called 'Image Texture' (the code checks for the file path not just the texture name).


Edited by R Soul, 11 March 2019 - 06:09 PM.


#41 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7641 posts

Posted 12 March 2019 - 11:57 AM

Now that I've got going and we're over the UI hurdle I'm happy to continue. So far I've made the assumption that the the texture is assigned via a material node called 'Image Texture' (the code checks for the file path not just the texture name).

 

That seems sensible. It looks like the default for new materials is Use Nodes enabled with a Principled BSDF shader, which can then have an Image Texture applied to various properties such as Base Color. The old-style system of assigning textures without nodes enabled seems like it has been removed altogether, and turning off nodes just gives an extremely primitive material settings panel that does not appear to have any support for texturing.



#42 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 12 March 2019 - 06:53 PM

It feels like the ability to load textures is close. The existing code still finds material slots. Each slot seems to contain the actual material (i.e. mat = slot_name.material). In case the user has turned off nodes, I use the code mat.use_nodes = True to ensure they're turned on.

 

if mat.node_tree.nodes.find('Image Texture') == -1:   will check if there isn't such a node, in which case it needs to be added

node_tree.nodes.new("ShaderNodeTexImage") adds an image node

 

That's it for now. Why does the day have to end when I'm getting somewhere?


  • RPGista likes this

#43 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 13 March 2019 - 06:06 PM

I think it's working. I got a texture loaded and assigned. Updating the screenshots meant I had to test the other features (e.g. overly long material names, duplicate materials etc) and the results were what I expected.

 

I also gave the Material file extractor a test to make sure the zip (pk4) system still works, and it seems fine.

 

https://github.com/R...aterial-Manager


Edited by R Soul, 13 March 2019 - 06:08 PM.

  • OrbWeaver and RPGista like this

#44 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1664 posts

Posted 14 March 2019 - 12:26 PM

Very cool, man. Thanks for this. Will give it a go.





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users