Jump to content
The Dark Mod Forums

Suggestion: Phase out long material names (or use an ID system)


R Soul
 Share

Recommended Posts

People who use Blender for object editing sometimes run into a problem with material names. It has a character limit of 63. That's usually fine but some existing TDM materials have names which are longer than that, so it becomes impossible to use them. An FM author can make a copy of the material with a shorter name, but that might be adding unnecesary complexity for people who are just making standalone objects to share.

I've been mounting a valiant campain on various Blender forums, and some of their LinkedIn posts, to get them to increase the limit, but to no avail. So it's time to take a different approach. Would it be feasible for TDM to rename long materials? The rendering system would have to intercept and replace calls to the original names, or something like that. I'm not sure if that would be an easy thing to implement or if it would set off a chain of complex events or coding etc.

Another possible approach could be a material ID sytem, so in Blender the material name could be WoodPlanks_4ACFB987B, which would correspond to something like TDM\long\path\to\material\WoodPlanks

That might even be beneficial for shorter material names, as even they are not user friendly to look at in some interfaces.

Edited by R Soul
Link to comment
Share on other sites

  • R Soul changed the title to Suggestion: Phase out long material names (or use an ID system)

I'm not 100% sure (have not tested it) but I have read a long time ago that the material names can be any size, even a single word, like this below 

ivyloose06
{
	qer_editorimage  textures/decals/ivyloose06_ed.jpg

	diffusemap 	textures/decals/ivyloose06_d.tga
	specularmap   	textures/decals/ivyloose06_s.tga
	bumpmap       	textures/decals/ivyloose06_local.tga
}

the name doesn't need to be a path, paths are relative anyway, (relative to the texture folder) and are only important for the textures inside the material itself. 

I think the material name written as a path "textures/somefolder/materialname" is used by the editor to create the folder structure in the media browser, that's all, if you don't give the editor (DR) a "path" it just puts the material in the main "textures" ones. 

Link to comment
Share on other sites

That's my understanding too, but a material hierarchy seems like a good thing to keep. And my suggestion is aimed at helping Blender users make use of existing materials, in which case the users have to deal with what they're given.

Link to comment
Share on other sites

I've experimented with giving models nonexistent material names (for example "virtual/stone") and then using a skin to provide the real texture name ("virtual/stone" would get mapped to "textures/darkmod/very_long_path_to/actual_stone_material").  I found it more useful when trying out different textures on modular-type pieces, but it would also get you around the name limit without having to create a duplicate material definition.

Link to comment
Share on other sites

The material paths will certainly remain as they are.
I think the question is more about the workaround for 63 character limit in Blender models.

Skins can probably do, although... won't you get a warning if your skin maps a nonexistent material name into something?

Maybe we can optionally write material mapping information in some other section of Blender file?
Like description or some kind of extra?
Then take it into account in converter.

Link to comment
Share on other sites

Posted (edited)

Something could be done. A few years ago I wrote an addon that looks at a Blender material's diffuse texture and scans the .mtr files to work out the TDM material name. Any name over 63 chars long gets saved in a custom property called FullName. An export script could look in there and do a swap. It's worth noting that my addon is not linked to any export process. Any user can make their own custom properties.

I think OrbWeaver did some unrelated modifications to some of the import/export scripts, but it's been a very long time since I've been here so I don't know the current state of that side of things.

Edited by R Soul
Link to comment
Share on other sites

I remember when the Blender limit was 19 characters. At least the developers of Blender have generously allowed us a whole 63 characters to play with, although why the hell anyone thinks it is acceptable to have hard-coded name length limits in 2022 is anyone's guess.

The aforementioned "skin trick" was something I came up with as well: each model had a material name like "sk/my_model" which then used a skin to map the model surfaces onto the real textures. But this is only useful for models which have their own custom texture; it is not so convenient if you want the model to use a regular, arbitrary Dark Mod texture.

I'll have to check the state of the import/export scripts. The custom property approach should certainly solve the problem and I'm sure it has been discussed before, but I don't recall if it actually made it into the code. Perhaps if it hasn't already been implemented, the time to do so is now, given that the 63-character limit is clearly causing problems for some people.

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recent Status Updates

    • Nort

      I want to be a fish, but I'm not a fish. My mom wants to be a fish too, and so she's killing herself eating plankton and sh***ng blood, and tells me to stop nagging her about taking her medication. I spent several hours today, just lying in bed, having anxiety over just existing, and not being a fish. You fish, you don't know how lucky you are. You can eat all the plankton you want. I tried eating plankton again yesterday, and I just got sick. I hate being a shark.
      · 0 replies
    • Nort

      I just gave myself vertigo. A pleasant kind of vertigo, like the world has been lifted off my shoulders. I'll explain:
      Yesterday I saw to my dismay, that I had made my entire map two - two - units too short on every level - that every set01 piece was sticking 2 units into the ceiling. That's basically 402 brushes that needs to be realigned (minus the ground floor brushes).
      I knew enough about selections to do all of that in a very tense five minutes, and it compiled without leaks. (Thank you so much, Dark Radiant devs, for making an editor with such care for precision that you can align hundreds of brushes perfectly at once (which is not something I can say for Valve's Hammer editor, which has some serious issues on that front, which actually made me just quit it in disgust).) However, the result is that the entire level has now been stretched a barely noticable 2 units, and it will take some getting used to psychologically.
      · 0 replies
    • Nort

      My workflow is basically running from a chain of disasters, eventually trying to seek shelter in former disasters. It's not ideal - it's just my life.
      When I abandoned my first map, it was out of a typical mental breakdown, and so I returned to find a skybox void where the kitchen door should have been (due to a misplaced visportal) and two overlapping brushes Z-fighting on the kitchen floor.
      I've now cleaned up the last bit of mess, by cleanly separating every floor into its own layer. Now I can finally work on each floor in peace.
      ...not that I really needed to. Once you get skilled enough, the orthographic messes, well, I'll let this video speak for itself:
       
      · 1 reply
    • Nort

      Beams, beams, beams...
      Support beams, and cross beams, and then beams to fixate the support beams to the cross beams. The more beams you have in a map, the better. There's walls, floors and ceilings, but the rest of the map is pretty much just beams. Beams makes a thief happy.
      · 0 replies
    • jaxa

      Embracer Group is Buying Square Enix Montréal, Eidos, and Crystal Dynamics for “Only” 300 Million USD: https://wccftech.com/embracer-group-square-enix-montreal-eidos-crystal-dynamics/
      · 1 reply
×
×
  • Create New...