UI Icons: store icons in git as uncompressed pixmaps (D196)
this allows for updating icons without committing a new PNG each time (which is inefficient with git). The data files are converted into a PNG at builds time and used just as they were before.
This commit is contained in:
parent
08981f3a91
commit
4c9a3a53bd
|
@ -328,8 +328,8 @@ tbz:
|
|||
@echo "blender_archive.tar.bz2 written"
|
||||
|
||||
icons:
|
||||
"$(BLENDER_DIR)/release/datafiles/blender_icons.sh"
|
||||
"$(BLENDER_DIR)/release/datafiles/prvicons.sh"
|
||||
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
|
||||
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
|
29
SConstruct
29
SConstruct
|
@ -653,6 +653,27 @@ def data_to_c_simple(FILE_FROM):
|
|||
data_to_c(FILE_FROM, FILE_TO, VAR_NAME)
|
||||
|
||||
|
||||
def data_to_c_simple_icon(PATH_FROM):
|
||||
|
||||
# first handle import
|
||||
import sys
|
||||
path = "source/blender/datatoc"
|
||||
if path not in sys.path:
|
||||
sys.path.append(path)
|
||||
|
||||
# convert the pixmaps to a png
|
||||
import datatoc_icon
|
||||
|
||||
filename_only = os.path.basename(PATH_FROM)
|
||||
FILE_TO_PNG = os.path.join(env['DATA_SOURCES'], filename_only + ".png")
|
||||
FILE_TO = FILE_TO_PNG + ".c"
|
||||
argv = [PATH_FROM, FILE_TO_PNG]
|
||||
datatoc_icon.main_ex(argv)
|
||||
|
||||
# then the png to a c file
|
||||
data_to_c_simple(FILE_TO_PNG)
|
||||
|
||||
|
||||
if B.targets != ['cudakernels']:
|
||||
data_to_c("source/blender/compositor/operations/COM_OpenCLKernels.cl",
|
||||
B.root_build_dir + "data_headers/COM_OpenCLKernels.cl.h",
|
||||
|
@ -680,8 +701,12 @@ if B.targets != ['cudakernels']:
|
|||
data_to_c_simple("release/datafiles/bmonofont.ttf")
|
||||
|
||||
data_to_c_simple("release/datafiles/splash.png")
|
||||
data_to_c_simple("release/datafiles/blender_icons16.png")
|
||||
data_to_c_simple("release/datafiles/blender_icons32.png")
|
||||
|
||||
# data_to_c_simple("release/datafiles/blender_icons16.png")
|
||||
# data_to_c_simple("release/datafiles/blender_icons32.png")
|
||||
data_to_c_simple_icon("release/datafiles/blender_icons16")
|
||||
data_to_c_simple_icon("release/datafiles/blender_icons32")
|
||||
|
||||
data_to_c_simple("release/datafiles/prvicons.png")
|
||||
|
||||
data_to_c_simple("release/datafiles/brushicons/add.png")
|
||||
|
|
|
@ -831,6 +831,46 @@ macro(data_to_c_simple
|
|||
unset(_file_to_path)
|
||||
endmacro()
|
||||
|
||||
# macro for converting pixmap directory to a png and then a c file
|
||||
macro(data_to_c_simple_icons
|
||||
path_from
|
||||
list_to_add
|
||||
)
|
||||
|
||||
# Conversion steps
|
||||
# path_from -> _file_from -> _file_to
|
||||
# foo/*.dat -> foo.png -> foo.png.c
|
||||
|
||||
get_filename_component(_path_from_abs ${path_from} ABSOLUTE)
|
||||
# remove ../'s
|
||||
get_filename_component(_file_from ${CMAKE_CURRENT_BINARY_DIR}/${path_from}.png REALPATH)
|
||||
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${path_from}.png.c REALPATH)
|
||||
|
||||
list(APPEND ${list_to_add} ${_file_to})
|
||||
|
||||
get_filename_component(_file_to_path ${_file_to} PATH)
|
||||
|
||||
# ideally we wouldn't glob, but storing all names for all pixmaps is a bit heavy
|
||||
file(GLOB _icon_files "${path_from}/*.dat")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${_file_from} ${_file_to}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
|
||||
#COMMAND python3 ${CMAKE_SOURCE_DIR}/source/blender/datatoc/datatoc_icon.py ${_path_from_abs} ${_file_from}
|
||||
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc_icon ${_path_from_abs} ${_file_from}
|
||||
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${_file_from} ${_file_to}
|
||||
DEPENDS ${_icon_files} datatoc)
|
||||
|
||||
set_source_files_properties(${_file_from} ${_file_to} PROPERTIES GENERATED TRUE)
|
||||
|
||||
unset(_path_from_abs)
|
||||
unset(_file_from)
|
||||
unset(_file_to)
|
||||
unset(_file_to_path)
|
||||
unset(_icon_files)
|
||||
|
||||
endmacro()
|
||||
|
||||
# XXX Not used for now...
|
||||
macro(svg_to_png
|
||||
file_from
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 235 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue