Merge branch 'blender-v2.83-release'

This commit is contained in:
Brecht Van Lommel 2020-05-29 18:05:04 +02:00
commit c93a88413d
31 changed files with 142 additions and 201 deletions

View File

@ -78,27 +78,26 @@ class VersionInfo:
blender_h = os.path.join(builder.blender_dir, "source", "blender", "blenkernel", "BKE_blender_version.h")
version_number = int(self._parse_header_file(blender_h, 'BLENDER_VERSION'))
self.version = "%d.%d" % (version_number // 100, version_number % 100)
self.version_char = self._parse_header_file(blender_h, 'BLENDER_VERSION_CHAR')
version_number_patch = int(self._parse_header_file(blender_h, 'BLENDER_VERSION_PATCH'))
version_numbers = (version_number // 100, version_number % 100, version_number_patch)
self.short_version = "%d.%02d" % (version_numbers[0], version_numbers[1])
self.version = "%d.%02d.%d" % version_numbers
self.version_cycle = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE')
self.version_cycle_number = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE_NUMBER')
self.hash = self._parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1]
if self.version_cycle == "release":
# Final release
self.full_version = self.version + self.version_char
self.full_version = self.version
self.is_development_build = False
elif self.version_cycle == "rc":
# Release candidate
version_cycle = self.version_cycle + self.version_cycle_number
if len(self.version_char) == 0:
self.full_version = self.version + version_cycle
else:
self.full_version = self.version + self.version_char + '-' + version_cycle
self.full_version = self.version + version_cycle
self.is_development_build = False
else:
# Development build
self.full_version = self.version + self.version_char + '-' + self.hash
self.full_version = self.version + '-' + self.hash
self.is_development_build = True
def _parse_header_file(self, filename, define):

View File

@ -167,7 +167,7 @@ def pack_linux(builder):
buildbot_utils.call(builder.command_prefix + ['strip', '--strip-all', blender_executable])
print("Stripping python...")
py_target = os.path.join(builder.install_dir, info.version)
py_target = os.path.join(builder.install_dir, info.short_version)
buildbot_utils.call(builder.command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';'])
# Construct package name

View File

@ -756,8 +756,7 @@ function(get_blender_version)
# - BLENDER_VERSION (major.minor)
# - BLENDER_VERSION_MAJOR
# - BLENDER_VERSION_MINOR
# - BLENDER_SUBVERSION (used for internal versioning mainly)
# - BLENDER_VERSION_CHAR (a, b, c, ...or empty string)
# - BLENDER_VERSION_PATCH
# - BLENDER_VERSION_CYCLE (alpha, beta, rc, release)
# So cmake depends on BKE_blender.h, beware of inf-loops!
@ -767,25 +766,15 @@ function(get_blender_version)
file(STRINGS ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h _contents REGEX "^#define[ \t]+BLENDER_.*$")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION[ \t]+([0-9]+).*" "\\1" _out_version "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_SUBVERSION[ \t]+([0-9]+).*" "\\1" _out_subversion "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CHAR[ \t]+([a-z]+).*" "\\1" _out_version_char "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_PATCH[ \t]+([0-9]+).*" "\\1" _out_version_patch "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CYCLE[ \t]+([a-z]+).*" "\\1" _out_version_cycle "${_contents}")
if(NOT ${_out_version} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION")
endif()
if(NOT ${_out_subversion} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_SUBVERSION")
endif()
# clumsy regex, only single char are ok but it could be unset
string(LENGTH "${_out_version_char}" _out_version_char_len)
if(NOT _out_version_char_len EQUAL 1)
set(_out_version_char "")
elseif(NOT ${_out_version_char} MATCHES "[a-z]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CHAR")
if(NOT ${_out_version_patch} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_PATCH")
endif()
if(NOT ${_out_version_cycle} MATCHES "[a-z]+")
@ -795,23 +784,11 @@ function(get_blender_version)
math(EXPR _out_version_major "${_out_version} / 100")
math(EXPR _out_version_minor "${_out_version} % 100")
# for packaging, alpha to numbers
string(COMPARE EQUAL "${_out_version_char}" "" _out_version_char_empty)
if(${_out_version_char_empty})
set(_out_version_char_index "0")
else()
set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z)
list(FIND _char_ls ${_out_version_char} _out_version_char_index)
math(EXPR _out_version_char_index "${_out_version_char_index} + 1")
endif()
# output vars
set(BLENDER_VERSION "${_out_version_major}.${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_VERSION_MAJOR "${_out_version_major}" PARENT_SCOPE)
set(BLENDER_VERSION_MINOR "${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_SUBVERSION "${_out_subversion}" PARENT_SCOPE)
set(BLENDER_VERSION_CHAR "${_out_version_char}" PARENT_SCOPE)
set(BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index}" PARENT_SCOPE)
set(BLENDER_VERSION_PATCH "${_out_version_patch}" PARENT_SCOPE)
set(BLENDER_VERSION_CYCLE "${_out_version_cycle}" PARENT_SCOPE)
endfunction()

View File

@ -7,7 +7,7 @@ set(PROJECT_VENDOR "Blender Foundation")
set(MAJOR_VERSION ${BLENDER_VERSION_MAJOR})
set(MINOR_VERSION ${BLENDER_VERSION_MINOR})
set(PATCH_VERSION ${BLENDER_VERSION_CHAR_INDEX})
set(PATCH_VERSION ${BLENDER_VERSION_PATCH})
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
set(CPACK_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION})

View File

@ -7,15 +7,14 @@ BASE_DIR="$PWD"
blender_srcdir=$(dirname -- $0)/../..
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_patch=$(grep "BLENDER_VERSION_PATCH\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100).$blender_version_patch
if [ "$blender_version_cycle" = "release" ] ; then
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char
SUBMODULE_EXCLUDE="^\(release/scripts/addons_contrib\)$"
else
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)_$blender_subversion
VERSION=$VERSION-$blender_version_cycle
SUBMODULE_EXCLUDE="^$" # dummy regex
fi

View File

@ -403,32 +403,21 @@ MODULE_GROUPING = {
# -------------------------------BLENDER----------------------------------------
blender_version_strings = [str(v) for v in bpy.app.version]
is_release = bpy.app.version_cycle in {"rc", "release"}
# converting bytes to strings, due to T30154
BLENDER_REVISION = str(bpy.app.build_hash, 'utf_8')
if is_release:
# '2.62a'
BLENDER_VERSION_DOTS = ".".join(blender_version_strings[:2]) + bpy.app.version_char
else:
# '2.62.1'
BLENDER_VERSION_DOTS = ".".join(blender_version_strings)
# '2.83.0 Beta' or '2.83.0' or '2.83.1'
BLENDER_VERSION_DOTS = bpy.app.version_string
if BLENDER_REVISION != "Unknown":
# '2.62a SHA1' (release) or '2.62.1 SHA1' (non-release)
# SHA1 Git hash
BLENDER_VERSION_HASH = BLENDER_REVISION
else:
# Fallback: Should not be used
BLENDER_VERSION_HASH = "Hash Unknown"
if is_release:
# '2_62a_release'
BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]), bpy.app.version_char)
else:
# '2_62_1'
BLENDER_VERSION_PATH = "_".join(blender_version_strings)
# '2_83'
BLENDER_VERSION_PATH = "%d_%d" % (bpy.app.version[0], bpy.app.version[1])
# --------------------------DOWNLOADABLE FILES----------------------------------

View File

@ -36,16 +36,10 @@ fi
blender_srcdir=$(dirname -- $0)/../..
blender_version_header="$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h"
blender_version=$(grep "BLENDER_VERSION\s" "$blender_version_header" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_version_header" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_version_header" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_version_header" | awk '{print $3}')
unset blender_version_header
if [ "$blender_version_cycle" = "release" ] ; then
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release"
else
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion
fi
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)
SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION

View File

@ -127,11 +127,10 @@ def main():
" f.write('%d\\n' % is_release)\n"
" f.write('%d\\n' % is_beta)\n"
" f.write('%s\\n' % branch)\n"
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char))\n"
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" f.write('%d.%d\\n' % (bpy.app.version[0], bpy.app.version[1]))\n"
" f.write('%d.%d\\n' % (bpy.app.version[0], bpy.app.version[1]))\n"
" if (is_release or is_beta) else '%s\\n' % branch)\n"
" f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" if is_release else '%d_%d_%d' % bpy.app.version)\n"
" f.write('%d_%d' % (bpy.app.version[0], bpy.app.version[1]))\n"
)
get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
"--python-expr", getver_script, "--", getver_file)

View File

@ -31,8 +31,8 @@
#include "BLO_readfile.h" /* own include */
const UserDef U_default = {
.versionfile = BLENDER_VERSION,
.subversionfile = BLENDER_SUBVERSION,
.versionfile = BLENDER_FILE_VERSION,
.subversionfile = BLENDER_FILE_SUBVERSION,
.flag = (USER_AUTOSAVE | USER_TOOLTIPS | USER_SAVE_PREVIEWS | USER_RELPATHS |
USER_RELEASECONFIRM | USER_SCRIPT_AUTOEXEC_DISABLE | USER_NONEGFRAMES),
.dupflag = USER_DUP_MESH | USER_DUP_CURVE | USER_DUP_SURF | USER_DUP_FONT | USER_DUP_MBALL |

View File

@ -1106,8 +1106,8 @@ class WM_OT_doc_view(Operator):
doc_id: doc_id
if bpy.app.version_cycle in {"release", "rc", "beta"}:
_prefix = ("https://docs.blender.org/api/%d.%d%s" %
(bpy.app.version[0], bpy.app.version[1], bpy.app.version_char))
_prefix = ("https://docs.blender.org/api/%d.%d" %
(bpy.app.version[0], bpy.app.version[1]))
else:
_prefix = ("https://docs.blender.org/api/master")

View File

@ -34,12 +34,6 @@ void BKE_blender_free(void);
void BKE_blender_globals_init(void);
void BKE_blender_globals_clear(void);
void BKE_blender_version_string(char *version_str,
size_t maxncpy,
short version,
short subversion,
bool v_prefix,
bool include_subversion);
void BKE_blender_userdef_data_swap(struct UserDef *userdef_dst, struct UserDef *userdef_src);
void BKE_blender_userdef_data_set(struct UserDef *userdef);

View File

@ -30,22 +30,26 @@ extern "C" {
*
* \note Use #STRINGIFY() rather than defining with quotes.
*/
/* Blender major and minor version. */
#define BLENDER_VERSION 290
#define BLENDER_SUBVERSION 4
/** Several breakages with 280, e.g. collections vs layers. */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
/** Used by packaging tools. */
/** Can be left blank, otherwise a,b,c... etc with no quotes. */
#define BLENDER_VERSION_CHAR
/** alpha/beta/rc/release, docs use this. */
/* Blender patch version for bugfix releases. */
#define BLENDER_VERSION_PATCH 0
/** Blender release cycle stage: alpha/beta/rc/release. */
#define BLENDER_VERSION_CYCLE alpha
/** Optionally set to 1,2,... for example to get alpha1 or rc2. */
#define BLENDER_VERSION_CYCLE_NUMBER
/** Defined in from blender.c */
extern char versionstr[];
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 4
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file
* was written with too new a version. */
#define BLENDER_FILE_MIN_VERSION 280
#define BLENDER_FILE_MIN_SUBVERSION 0
/** User readable version string. */
const char *BKE_blender_version_string(void);
#ifdef __cplusplus
}

View File

@ -87,7 +87,7 @@ enum {
typedef struct Main {
struct Main *next, *prev;
char name[1024]; /* 1024 = FILE_MAX */
short versionfile, subversionfile; /* see BLENDER_VERSION, BLENDER_SUBVERSION */
short versionfile, subversionfile; /* see BLENDER_FILE_VERSION, BLENDER_FILE_SUBVERSION */
short minversionfile, minsubversionfile;
uint64_t build_commit_timestamp; /* commit's timestamp from buildinfo */
char build_hash[16]; /* hash from buildinfo */

View File

@ -66,7 +66,7 @@
Global G;
UserDef U;
char versionstr[48] = "";
static char blender_version_string[48] = "";
/* ********** free ********** */
@ -102,26 +102,43 @@ void BKE_blender_free(void)
free_nodesystem();
}
void BKE_blender_version_string(char *version_str,
size_t maxncpy,
short version,
short subversion,
bool v_prefix,
bool include_subversion)
static void blender_version_init()
{
const char *prefix = v_prefix ? "v" : "";
if (include_subversion && subversion > 0) {
BLI_snprintf(
version_str, maxncpy, "%s%d.%02d.%d", prefix, version / 100, version % 100, subversion);
const char *version_cycle = "";
if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "alpha")) {
version_cycle = " Alpha";
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "beta")) {
version_cycle = " Beta";
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "rc")) {
version_cycle = " Release Candidate";
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "release")) {
version_cycle = "";
}
else {
BLI_snprintf(version_str, maxncpy, "%s%d.%02d", prefix, version / 100, version % 100);
BLI_assert(!"Invalid Blender version cycle");
}
BLI_snprintf(blender_version_string,
ARRAY_SIZE(blender_version_string),
"%d.%02d.%d%s",
BLENDER_VERSION / 100,
BLENDER_VERSION % 100,
BLENDER_VERSION_PATCH,
version_cycle);
}
const char *BKE_blender_version_string()
{
return blender_version_string;
}
void BKE_blender_globals_init(void)
{
blender_version_init();
memset(&G, 0, sizeof(Global));
U.savetime = 1;
@ -130,9 +147,6 @@ void BKE_blender_globals_init(void)
strcpy(G.ima, "//");
BKE_blender_version_string(
versionstr, sizeof(versionstr), BLENDER_VERSION, BLENDER_SUBVERSION, true, true);
#ifndef WITH_PYTHON_SECURITY /* default */
G.f |= G_FLAG_SCRIPT_AUTOEXEC;
#else

View File

@ -415,8 +415,9 @@ static void setup_app_blend_file_data(bContext *C,
static int handle_subversion_warning(Main *main, ReportList *reports)
{
if (main->minversionfile > BLENDER_VERSION ||
(main->minversionfile == BLENDER_VERSION && main->minsubversionfile > BLENDER_SUBVERSION)) {
if (main->minversionfile > BLENDER_FILE_VERSION ||
(main->minversionfile == BLENDER_FILE_VERSION &&
main->minsubversionfile > BLENDER_FILE_SUBVERSION)) {
BKE_reportf(reports,
RPT_ERROR,
"File written by newer Blender binary (%d.%d), expect loss of data!",

View File

@ -4007,12 +4007,12 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
fg.globalf = G.f;
BLI_strncpy(fg.filename, mainvar->name, sizeof(fg.filename));
sprintf(subvstr, "%4d", BLENDER_SUBVERSION);
sprintf(subvstr, "%4d", BLENDER_FILE_SUBVERSION);
memcpy(fg.subvstr, subvstr, 4);
fg.subversion = BLENDER_SUBVERSION;
fg.minversion = BLENDER_MINVERSION;
fg.minsubversion = BLENDER_MINSUBVERSION;
fg.subversion = BLENDER_FILE_SUBVERSION;
fg.minversion = BLENDER_FILE_MIN_VERSION;
fg.minsubversion = BLENDER_FILE_MIN_SUBVERSION;
#ifdef WITH_BUILDINFO
{
extern unsigned long build_commit_timestamp;
@ -4066,7 +4066,7 @@ static bool write_file_handle(Main *mainvar,
"BLENDER%c%c%.3d",
(sizeof(void *) == 8) ? '-' : '_',
(ENDIAN_ORDER == B_ENDIAN) ? 'V' : 'v',
BLENDER_VERSION);
BLENDER_FILE_VERSION);
mywrite(wd, buf, 12);

View File

@ -65,6 +65,7 @@ void OVERLAY_extra_cache_init(OVERLAY_Data *vedata)
OVERLAY_PassList *psl = vedata->psl;
OVERLAY_TextureList *txl = vedata->txl;
OVERLAY_PrivateData *pd = vedata->stl->pd;
const bool is_select = DRW_state_is_select();
DRWState state_blend = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA;
DRW_PASS_CREATE(psl->extra_blend_ps, state_blend | pd->clipping_state);
@ -108,7 +109,7 @@ void OVERLAY_extra_cache_init(OVERLAY_Data *vedata)
/* Sorted by shader to avoid state changes during render. */
{
format = formats->instance_extra;
sh = OVERLAY_shader_extra();
sh = OVERLAY_shader_extra(is_select);
grp = DRW_shgroup_create(sh, extra_ps);
DRW_shgroup_uniform_block_persistent(grp, "globalsBlock", G_draw.block_ubo);
@ -179,7 +180,7 @@ void OVERLAY_extra_cache_init(OVERLAY_Data *vedata)
cb->groundline = BUF_INSTANCE(grp, format, DRW_cache_groundline_get());
}
{
sh = OVERLAY_shader_extra_wire(false);
sh = OVERLAY_shader_extra_wire(false, is_select);
grp = DRW_shgroup_create(sh, extra_ps);
DRW_shgroup_uniform_block_persistent(grp, "globalsBlock", G_draw.block_ubo);
@ -188,7 +189,7 @@ void OVERLAY_extra_cache_init(OVERLAY_Data *vedata)
cb->extra_lines = BUF_LINE(grp, formats->wire_extra);
}
{
sh = OVERLAY_shader_extra_wire(true);
sh = OVERLAY_shader_extra_wire(true, is_select);
cb->extra_wire = grp = DRW_shgroup_create(sh, extra_ps);
DRW_shgroup_uniform_block_persistent(grp, "globalsBlock", G_draw.block_ubo);

View File

@ -590,9 +590,9 @@ GPUShader *OVERLAY_shader_edit_mesh_skin_root(void);
GPUShader *OVERLAY_shader_edit_mesh_vert(void);
GPUShader *OVERLAY_shader_edit_particle_strand(void);
GPUShader *OVERLAY_shader_edit_particle_point(void);
GPUShader *OVERLAY_shader_extra(void);
GPUShader *OVERLAY_shader_extra(bool is_select);
GPUShader *OVERLAY_shader_extra_groundline(void);
GPUShader *OVERLAY_shader_extra_wire(bool use_object);
GPUShader *OVERLAY_shader_extra_wire(bool use_object, bool is_select);
GPUShader *OVERLAY_shader_extra_loose_point(void);
GPUShader *OVERLAY_shader_extra_point(void);
GPUShader *OVERLAY_shader_facing(void);

View File

@ -164,8 +164,10 @@ typedef struct OVERLAY_Shaders {
GPUShader *edit_particle_strand;
GPUShader *edit_particle_point;
GPUShader *extra;
GPUShader *extra_select;
GPUShader *extra_groundline;
GPUShader *extra_wire[2];
GPUShader *extra_wire_select;
GPUShader *extra_point;
GPUShader *extra_lightprobe_grid;
GPUShader *extra_loose_point;
@ -797,23 +799,24 @@ GPUShader *OVERLAY_shader_edit_particle_point(void)
return sh_data->edit_particle_point;
}
GPUShader *OVERLAY_shader_extra(void)
GPUShader *OVERLAY_shader_extra(bool is_select)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg];
OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
if (!sh_data->extra) {
sh_data->extra = GPU_shader_create_from_arrays({
GPUShader **sh = (is_select) ? &sh_data->extra_select : &sh_data->extra;
if (!*sh) {
*sh = GPU_shader_create_from_arrays({
.vert = (const char *[]){sh_cfg->lib,
datatoc_common_globals_lib_glsl,
datatoc_common_view_lib_glsl,
datatoc_extra_vert_glsl,
NULL},
.frag = (const char *[]){datatoc_common_view_lib_glsl, datatoc_extra_frag_glsl, NULL},
.defs = (const char *[]){sh_cfg->def, NULL},
.defs = (const char *[]){sh_cfg->def, (is_select) ? "#define SELECT_EDGES\n" : NULL, NULL},
});
}
return sh_data->extra;
return *sh;
}
GPUShader *OVERLAY_shader_extra_grid(void)
@ -855,12 +858,13 @@ GPUShader *OVERLAY_shader_extra_groundline(void)
return sh_data->extra_groundline;
}
GPUShader *OVERLAY_shader_extra_wire(bool use_object)
GPUShader *OVERLAY_shader_extra_wire(bool use_object, bool is_select)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg];
OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
if (!sh_data->extra_wire[use_object]) {
GPUShader **sh = (is_select) ? &sh_data->extra_wire_select : &sh_data->extra_wire[use_object];
if (!*sh) {
char colorids[1024];
/* NOTE: define all ids we need here. */
BLI_snprintf(colorids,
@ -875,7 +879,7 @@ GPUShader *OVERLAY_shader_extra_wire(bool use_object)
TH_TRANSFORM,
TH_WIRE,
TH_CAMERA_PATH);
sh_data->extra_wire[use_object] = GPU_shader_create_from_arrays({
*sh = GPU_shader_create_from_arrays({
.vert = (const char *[]){sh_cfg->lib,
datatoc_common_globals_lib_glsl,
datatoc_common_view_lib_glsl,
@ -884,11 +888,12 @@ GPUShader *OVERLAY_shader_extra_wire(bool use_object)
.frag = (const char *[]){datatoc_common_view_lib_glsl, datatoc_extra_wire_frag_glsl, NULL},
.defs = (const char *[]){sh_cfg->def,
colorids,
(is_select) ? "#define SELECT_EDGES\n" : "",
(use_object) ? "#define OBJECT_WIRE \n" : NULL,
NULL},
});
}
return sh_data->extra_wire[use_object];
return *sh;
}
GPUShader *OVERLAY_shader_extra_loose_point(void)

View File

@ -221,10 +221,12 @@ void main()
/* Convert to screen position [0..sizeVp]. */
edgePos = edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy;
#ifdef SELECT_EDGES
/* HACK: to avoid loosing sub pixel object in selections, we add a bit of randomness to the
* wire to at least create one fragment that will pass the occlusion query. */
/* TODO(fclem) Limit this workaround to selection. It's not very noticeable but still... */
gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0);
#endif
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance(world_pos);

View File

@ -17,10 +17,12 @@ void main()
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
#ifdef SELECT_EDGES
/* HACK: to avoid loosing sub pixel object in selections, we add a bit of randomness to the
* wire to at least create one fragment that will pass the occlusion query. */
/* TODO(fclem) Limit this workaround to selection. It's not very noticeable but still... */
gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0);
#endif
stipple_coord = stipple_start = screen_position(gl_Position);
@ -39,6 +41,10 @@ void main()
}
#endif
#ifdef SELECT_EDGES
finalColor.a = 0.0; /* No Stipple */
#endif
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance(world_pos);
#endif

View File

@ -438,7 +438,7 @@ static const char *footer_string(ViewLayer *view_layer)
"%s%s | %s",
memstr,
gpumemstr,
versionstr);
BKE_blender_version_string());
return view_layer->footer_str;

View File

@ -52,7 +52,7 @@ static OArchive create_archive(std::ostream *ostream,
abc_metadata.set(Alembic::Abc::kApplicationNameKey, "Blender");
abc_metadata.set(Alembic::Abc::kUserDescriptionKey, scene_name);
abc_metadata.set("blender_version", versionstr);
abc_metadata.set("blender_version", std::string("v") + BKE_blender_version_string());
abc_metadata.set("FramesPerTimeUnit", std::to_string(scene_fps));
time_t raw_time;

View File

@ -243,20 +243,13 @@ int DocumentExporter::exportCurrentScene()
#ifdef WITH_BUILDINFO
BLI_snprintf(version_buf,
sizeof(version_buf),
"Blender %d.%02d.%d commit date:%s, commit time:%s, hash:%s",
BLENDER_VERSION / 100,
BLENDER_VERSION % 100,
BLENDER_SUBVERSION,
"Blender %s commit date:%s, commit time:%s, hash:%s",
BKE_blender_version_string(),
build_commit_date,
build_commit_time,
build_hash);
#else
BLI_snprintf(version_buf,
sizeof(version_buf),
"Blender %d.%02d.%d",
BLENDER_VERSION / 100,
BLENDER_VERSION % 100,
BLENDER_SUBVERSION);
BLI_snprintf(version_buf, sizeof(version_buf), "Blender %s", BKE_blender_version_string());
#endif
asset.getContributor().mAuthoringTool = version_buf;
asset.add();

View File

@ -91,7 +91,8 @@ static void export_startjob(void *customdata, short *stop, short *do_update, flo
usd_stage->SetMetadata(pxr::UsdGeomTokens->upAxis, pxr::VtValue(pxr::UsdGeomTokens->z));
usd_stage->SetMetadata(pxr::UsdGeomTokens->metersPerUnit,
pxr::VtValue(scene->unit.scale_length));
usd_stage->GetRootLayer()->SetDocumentation(std::string("Blender ") + versionstr);
usd_stage->GetRootLayer()->SetDocumentation(std::string("Blender v") +
BKE_blender_version_string());
// Set up the stage for animated data.
if (data->params.export_animation) {

View File

@ -327,7 +327,7 @@ typedef struct Library {
/* Temp data needed by read/write code. */
int temp_index;
/** See BLENDER_VERSION, BLENDER_SUBVERSION, needed for do_versions. */
/** See BLENDER_FILE_VERSION, BLENDER_FILE_SUBVERSION, needed for do_versions. */
short versionfile, subversionfile;
} Library;

View File

@ -82,10 +82,10 @@ extern char build_system[];
static PyTypeObject BlenderAppType;
static PyStructSequence_Field app_info_fields[] = {
{"version", "The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"},
{"version", "The Blender version as a tuple of 3 numbers. eg. (2, 83, 1)"},
{"version_string", "The Blender version formatted as a string"},
{"version_char", "The Blender version character (for minor releases)"},
{"version_cycle", "The release status of this build alpha/beta/rc/release"},
{"version_char", "Deprecated, always an empty string"},
{"binary_path",
"The location of Blender's executable, useful for utilities that open new instances"},
{"background",
@ -160,12 +160,12 @@ static PyObject *make_app_info(void)
#define SetBytesItem(str) PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str))
#define SetObjItem(obj) PyStructSequence_SET_ITEM(app_info, pos++, obj)
SetObjItem(PyC_Tuple_Pack_I32(BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));
SetObjItem(PyUnicode_FromFormat(
"%d.%02d (sub %d)", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));
SetObjItem(
PyC_Tuple_Pack_I32(BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_VERSION_PATCH));
SetStrItem(BKE_blender_version_string());
SetStrItem(STRINGIFY(BLENDER_VERSION_CHAR));
SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE));
SetStrItem("");
SetStrItem(BKE_appdir_program_path());
SetObjItem(PyBool_FromLong(G.background));
SetObjItem(PyBool_FromLong(G.factory_startup));

View File

@ -96,39 +96,6 @@ static void wm_block_splash_add_label(uiBlock *block, const char *label, int x,
UI_block_emboss_set(block, UI_EMBOSS);
}
static void get_version_string(char *ver, const int max_length)
{
/* Version number. */
const char *version_cycle = NULL;
if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "alpha")) {
version_cycle = " Alpha";
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "beta")) {
version_cycle = " Beta";
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "rc")) {
version_cycle = " Release Candidate";
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "release")) {
version_cycle = STRINGIFY(BLENDER_VERSION_CHAR);
}
const char *version_cycle_number = "";
if (strlen(STRINGIFY(BLENDER_VERSION_CYCLE_NUMBER))) {
version_cycle_number = " " STRINGIFY(BLENDER_VERSION_CYCLE_NUMBER);
}
BLI_snprintf(ver,
max_length,
"%d.%d.%d%s%s",
BLENDER_VERSION / 100,
BLENDER_VERSION % 100,
BLENDER_SUBVERSION,
version_cycle,
version_cycle_number);
}
#ifndef WITH_HEADLESS
static void wm_block_splash_image_roundcorners_add(ImBuf *ibuf)
{
@ -252,9 +219,8 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *UNUSE
UI_but_func_set(but, wm_block_close, block, NULL);
UI_block_func_set(block, wm_block_splash_refreshmenu, block, NULL);
char version_buf[256] = "\0";
get_version_string(version_buf, sizeof(version_buf));
wm_block_splash_add_label(block, version_buf, splash_width, splash_height - 13.0 * U.dpi_fac);
wm_block_splash_add_label(
block, BKE_blender_version_string(), splash_width, splash_height - 13.0 * U.dpi_fac);
const int layout_margin_x = U.dpi_fac * 26;
uiLayout *layout = UI_block_layout(block,
@ -332,9 +298,7 @@ static uiBlock *wm_block_create_about(bContext *C, ARegion *region, void *UNUSED
uiItemL_ex(layout, "Blender", ICON_NONE, true, false);
/* Version. */
char str_buf[256] = "\0";
get_version_string(str_buf, sizeof(str_buf));
uiItemL(layout, str_buf, ICON_NONE);
uiItemL(layout, BKE_blender_version_string(), ICON_NONE);
uiItemS_ex(layout, 3.0f);
@ -342,6 +306,7 @@ static uiBlock *wm_block_create_about(bContext *C, ARegion *region, void *UNUSED
extern char build_hash[], build_commit_date[], build_commit_time[], build_branch[];
char str_buf[256] = "\0";
BLI_snprintf(str_buf, sizeof(str_buf), "Date: %s %s", build_commit_date, build_commit_time);
uiItemL(layout, str_buf, ICON_NONE);

View File

@ -943,8 +943,8 @@ elseif(APPLE)
set_target_properties(blender PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${OSX_APP_SOURCEDIR}/Contents/Info.plist
MACOSX_BUNDLE_SHORT_VERSION_STRING "${BLENDER_VERSION}${BLENDER_VERSION_CHAR}"
MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION}${BLENDER_VERSION_CHAR} ${BLENDER_DATE}")
MACOSX_BUNDLE_SHORT_VERSION_STRING "${BLENDER_VERSION}.${BLENDER_VERSION_PATCH}"
MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION}.${BLENDER_VERSION_PATCH} ${BLENDER_DATE}")
# Gather the date in finder-style
execute_process(COMMAND date "+%m/%d/%Y/%H:%M"

View File

@ -460,7 +460,7 @@ static void arg_py_context_restore(bContext *C, struct BlendePyContextStore *c_p
static void print_version_full(void)
{
printf(BLEND_VERSION_STRING_FMT);
printf("Blender %s\n", BKE_blender_version_string());
# ifdef BUILD_DATE
printf("\tbuild date: %s\n", build_date);
printf("\tbuild time: %s\n", build_time);
@ -481,13 +481,13 @@ static void print_version_short(void)
# ifdef BUILD_DATE
/* NOTE: We include built time since sometimes we need to tell broken from
* working built of the same hash. */
printf(BLEND_VERSION_FMT " (hash %s built %s %s)\n",
BLEND_VERSION_ARG,
printf("Blender %s (hash %s built %s %s)\n",
BKE_blender_version_string(),
build_hash,
build_date,
build_time);
# else
printf(BLEND_VERSION_STRING_FMT);
printf("Blender %s\n", BKE_blender_version_string());
# endif
}
@ -513,7 +513,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo
{
bArgs *ba = (bArgs *)data;
printf(BLEND_VERSION_STRING_FMT);
printf("Blender %s\n", BKE_blender_version_string());
printf("Usage: blender [args ...] [file] [args ...]\n\n");
printf("Render Options:\n");
@ -907,7 +907,7 @@ static const char arg_handle_debug_mode_set_doc[] =
static int arg_handle_debug_mode_set(int UNUSED(argc), const char **UNUSED(argv), void *data)
{
G.debug |= G_DEBUG; /* std output printf's */
printf(BLEND_VERSION_STRING_FMT);
printf("Blender %s\n", BKE_blender_version_string());
MEM_set_memory_debug();
# ifndef NDEBUG
BLI_mempool_set_memory_debug();

View File

@ -55,10 +55,8 @@ extern struct ApplicationState app_state; /* creator.c */
/* for the callbacks: */
#ifndef WITH_PYTHON_MODULE
# define BLEND_VERSION_FMT "Blender %d.%02d (sub %d)"
# define BLEND_VERSION_ARG BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION
/* pass directly to printf */
# define BLEND_VERSION_STRING_FMT BLEND_VERSION_FMT "\n", BLEND_VERSION_ARG
# define BLEND_VERSION_FMT "Blender %d.%02d.%d"
# define BLEND_VERSION_ARG BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_VERSION_PATCH
#endif
#ifdef WITH_BUILDINFO_HEADER