LogicAndTrick / sledge

An open source alternative to Valve's Hammer Editor for the Goldsource engine. (No longer in development)
https://logicandtrick.github.io/sledge/
BSD 3-Clause "New" or "Revised" License
304 stars 82 forks source link

Feature: Texture Import and Material Designer #76

Open ChristopherHaws opened 10 years ago

ChristopherHaws commented 10 years ago

I would love to see a feature for creating textures (VTF) from regular image files (tga, png, bmp, etc.). Along with this I would love the ability to design materials (VMT) within the editor.

LogicAndTrick commented 10 years ago

There's definitely plans (in my head) for functionality like this (for both WAD and VTF/VMT), though I'm undecided how I should implement them. There's two ways I can think of:

  1. Implement texture editors directly into Sledge and do everything in the editor
  2. Implement as separate tools and get the editor to put file watchers on the texture folders/packages and refresh when it detects a change

There's a few positives and negatives...

Option 1 would be easier to code in the long term but would require the Sledge texture editors to be pretty much feature-complete before they can be included. It also makes the editor more bloated and annoys users who only want the texture tools and have to open up the full editor to modify some textures.

Option 2 would require some tricky file watcher stuff but would allow users to use an alternative editor if they want (e.g. VTFEdit, Wally, Notepad...), while the map editor would still be able to update when it detects a change in the file. This means that the texture editors can be developed separately to the map editor and distributed as standalone executables for people who don't want to open the editor just to create/modify some textures. It does cause problems if the alternative editors put a lock on the file, though. I have a strong suspicion that Wally might lock WADs while you're working on them...

I may be wrong but I don't think that HLLib has write support for WAD files, so this feature would also require a managed lib to read and write the WAD format. VTFs are easier as VTFLib has write support and VMTs are just text files.

ChristopherHaws commented 10 years ago

I think that the best approach might be a hybrid of both of your points. I picture it working similar to Unity's editor, where you can make changes outside of the application and the application will automatically pick up those changes or you can make changes directly within the application. One nice feature also is that you can define which applications you wish to use for editing and Unity will automatically open the appropriate files in the external editor.

While VTFEdit is a very handy tool, I also feel that the UI is a bit cumbersome, not to mention it doesn't really support editing (unless you consider a notepad like interface editing).

If you are unfamiliar with Unity, here is a quick and dirty explanation. In Unity you have two important items (similar to Source): Textures and Materials. Both Textures and Materials can be viewed in the Project window as shown below: image

When you select a Texture, the Inspector changes to show all of the properties on that Texture that you can modify as well as a handy preview screen. image

If you select a Material, the Inspector changes to show all of the properties of a Material file: image

I picture this perhaps existing as another document within the main window of Sledge. The idea is to use external programs when they are needed (ie Photoshop or GIMP) and have the development process happen in one unified application. This to me is what Hammer is missing most. Their pretty poor attempt was to have the "Open Source" button within the Textures windows (which is actually a Materials window).

LogicAndTrick commented 10 years ago

That'd be a pretty cool feature to have. It's a complex chain of functionality, though:

I like the idea of opening the interface in a new document tab, that would make it quite easy to use. As a bonus I don't think it would be too hard to abstract most of the parts away and offer the texture compiler as a standalone tool as well as the Sledge-integrated version, so people can use the same functionality without having to start up the full editor.