-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support for blender scripting #29
Comments
You can call import os
import bpy
from blender_dds_addon.ui.export_dds import save_dds
tex = bpy.data.images.load(os.path.abspath("my_texture.png"))
save_dds(tex, "my_texture.dds", "BC1_UNORM")
bpy.data.images.remove(tex) |
I dont want to save the dds, just get the data to then write the bytes in a specific format into a file (which is handled by a few functions i already have). I have not looked too much into your plugin, so forgive me if this is already possible. |
You mean, you want to embed dds data into another file format, like game assets? import os
import tempfile
import bpy
from blender_dds_addon.ui.export_dds import save_dds
from blender_dds_addon.directx.dds import DDSHeader
tex = bpy.data.images.load(os.path.abspath("my_texture.png"))
with tempfile.TemporaryDirectory() as temp_dir:
temp_dds = os.path.join(temp_dir, "temp.dds")
save_dds(tex, temp_dds, "BC1_UNORM")
with open(temp_dds, 'rb') as f:
header = DDSHeader.read(f)
pixel_data = f.read() # compressed pixel data
bpy.data.images.remove(tex) |
I need to convert a PNG to a DDS file in my plugin for a custom export. It would be helpful if DDS integrates like a native file format supported by blender.
The text was updated successfully, but these errors were encountered: