Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script for converting .props.txt material files to .json files #288

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JediKnightChan
Copy link

Later versions of UE have enabled-by-default Python support, which allows to automatically create material instances and set references to them on meshes. However, .props.txt files generated by umodel are in difficult format, which doesn't allow python programmers to work with them easily. This script allows to convert .props.txt file into a human- and python-readable JSON format.

@cmbasnett
Copy link

I would love for this functionality to just be native to the program instead of requiring a script to do this. It's not a safe assumption that the user has Python installed. I would imagine this PR is not likely to be accepted for this reason.

@gildor2
Copy link
Owner

gildor2 commented Dec 12, 2022

I would love for this functionality to just be native to the program instead of requiring a script to do this. It's not a safe assumption that the user has Python installed. I would imagine this PR is not likely to be accepted for this reason.

It's easy to save json directly from UModel, this format is very simple. I just chose the txt because it's more "readable". The question is - how useful this would be. And of course having external Python script adds some flexibility to the json schema, for those who knows how to use the provided data.

@cmbasnett
Copy link

cmbasnett commented Dec 13, 2022

JSON is equally readable in my opinion and, most importantly, is highly portable. Virtually every language has mature libraries for JSON parsing, many of them built-in. Right now, the user has to write a little script to parse the .props.txt files. Even though it's ostensibly a simple format, there's no format specification so it, so I don't have confidence that my parsing won't suddenly break if it encounters a situation I didn't expect.

I have another couple suggestions while we're on the subject of these properties files.

I would like to have it so that the property files are written out for Texture materials as well. For some reason, Texture materials do not export the properties files, but all others do.

My next suggestion would be to include the type name of the material inside the props file itself. I'm writing a program right now that is converting these .props.txt files into Blender shader graphs. I have to look at the parent directory in order to determine the type. This is extremely brittle because, for example, a user changing the name of a folder suddenly transforms the meaning of all the files within it.

@gildor2
Copy link
Owner

gildor2 commented Dec 14, 2022

Why props could be useful for textures? It's easy to add, but it will result in probably too many files in exported folders, and in my opinion - useless files. Textures doesn't have many useful settings, plus UModel doesn't read them all - just those which are needed for rendering (e.g. size, pixel format etc).

@cmbasnett
Copy link

cmbasnett commented Dec 15, 2022

Why props could be useful for textures? It's easy to add, but it will result in probably too many files in exported folders, and in my opinion - useless files. Textures doesn't have many useful settings, plus UModel doesn't read them all - just those which are needed for rendering (e.g. size, pixel format etc).

As I mentioned above, I'm making an addon for Blender that will transform UE1/UE2 materials into Blender shader graphs. Getting all the other information about the textures makes it possible to replicate the materials accurately in Blender (for example, the detail material, UV extension mode etc.). At the very least it should be an option that can be enabled. For a normal user I understand that it's too many useless files to write out, but for power users it's very useful.

@cmbasnett
Copy link

@JediKnightChan This script fails if there is a line like this in the props.txt file:

InternalTime[2] = { -377957057, 1081185574 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants