Skip to content

Commit

Permalink
Merge branch 'master-BF'
Browse files Browse the repository at this point in the history
I adapted UPBGE version format following Blender format (i.e 0.3.0a ->
0.30.1)
Additionally, I added UPBGE icon for About.
  • Loading branch information
lordloki committed May 31, 2020
2 parents 3abec5f + ba71182 commit bcdbaca
Show file tree
Hide file tree
Showing 100 changed files with 825 additions and 776 deletions.
15 changes: 7 additions & 8 deletions build_files/buildbot/buildbot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,26 @@ def __init__(self, builder):
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):
Expand Down
2 changes: 1 addition & 1 deletion build_files/buildbot/slave_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 5 additions & 28 deletions build_files/cmake/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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]+")
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion build_files/cmake/packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
7 changes: 3 additions & 4 deletions build_files/utils/make_source_archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 5 additions & 16 deletions doc/python_api/sphinx_doc_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,32 +403,21 @@ def handle_args():

# -------------------------------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----------------------------------

Expand Down
8 changes: 1 addition & 7 deletions doc/python_api/sphinx_doc_gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 3 additions & 4 deletions doc/python_api/sphinx_doc_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions intern/cycles/blender/blender_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,13 @@ void BlenderSession::create_session()

void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsgraph)
{
/* Update data, scene and depsgraph pointers. These can change after undo. */
this->b_data = b_data;
this->b_depsgraph = b_depsgraph;
this->b_scene = b_depsgraph.scene_eval();
if (sync) {
sync->reset(this->b_data, this->b_scene);
}

if (preview_osl) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
Expand Down
8 changes: 8 additions & 0 deletions intern/cycles/blender/blender_sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ BlenderSync::~BlenderSync()
{
}

void BlenderSync::reset(BL::BlendData &b_data, BL::Scene &b_scene)
{
/* Update data and scene pointers in case they change in session reset,
* for example after undo. */
this->b_data = b_data;
this->b_scene = b_scene;
}

/* Sync */

void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d)
Expand Down
2 changes: 2 additions & 0 deletions intern/cycles/blender/blender_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class BlenderSync {
Progress &progress);
~BlenderSync();

void reset(BL::BlendData &b_data, BL::Scene &b_scene);

/* sync */
void sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d);
void sync_data(BL::RenderSettings &b_render,
Expand Down
4 changes: 2 additions & 2 deletions intern/ghost/GHOST_C-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
***************************************************************************************/

/**
* Returns the state of a modifier key (ouside the message queue).
* Returns the state of a modifier key (outside the message queue).
* \param systemhandle The handle to the system
* \param mask The modifier key state to retrieve.
* \param isDown Pointer to return modifier state in.
Expand All @@ -446,7 +446,7 @@ extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
int *isDown);

/**
* Returns the state of a mouse button (ouside the message queue).
* Returns the state of a mouse button (outside the message queue).
* \param systemhandle The handle to the system
* \param mask The button state to retrieve.
* \param isDown Pointer to return button state in.
Expand Down
4 changes: 2 additions & 2 deletions intern/ghost/GHOST_ISystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,15 @@ class GHOST_ISystem {
***************************************************************************************/

/**
* Returns the state of a modifier key (ouside the message queue).
* Returns the state of a modifier key (outside the message queue).
* \param mask The modifier key state to retrieve.
* \param isDown The state of a modifier key (true == pressed).
* \return Indication of success.
*/
virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const = 0;

/**
* Returns the state of a mouse button (ouside the message queue).
* Returns the state of a mouse button (outside the message queue).
* \param mask The button state to retrieve.
* \param isDown Button state.
* \return Indication of success.
Expand Down
10 changes: 5 additions & 5 deletions intern/ghost/intern/GHOST_System.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,15 @@ class GHOST_System : public GHOST_ISystem {
***************************************************************************************/

/**
* Returns the state of a modifier key (ouside the message queue).
* Returns the state of a modifier key (outside the message queue).
* \param mask The modifier key state to retrieve.
* \param isDown The state of a modifier key (true == pressed).
* \return Indication of success.
*/
GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const;

/**
* Returns the state of a mouse button (ouside the message queue).
* Returns the state of a mouse button (outside the message queue).
* \param mask The button state to retrieve.
* \param isDown Button state.
* \return Indication of success.
Expand All @@ -247,8 +247,8 @@ class GHOST_System : public GHOST_ISystem {
***************************************************************************************/

/**
* Sets 3D mouse deadzone
* \param deadzone: Deadzone of the 3D mouse (both for rotation and pan) relative to full range
* Sets 3D mouse dead-zone
* \param deadzone: Dead-zone of the 3D mouse (both for rotation and pan) relative to full range.
*/
void setNDOFDeadZone(float deadzone);
#endif
Expand Down Expand Up @@ -295,7 +295,7 @@ class GHOST_System : public GHOST_ISystem {
virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const = 0;

/**
* Returns the state of the mouse buttons (ouside the message queue).
* Returns the state of the mouse buttons (outside the message queue).
* \param buttons The state of the buttons.
* \return Indication of success.
*/
Expand Down
2 changes: 1 addition & 1 deletion intern/ghost/intern/GHOST_SystemCocoa.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class GHOST_SystemCocoa : public GHOST_System {
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const;

/**
* Returns the state of the mouse buttons (ouside the message queue).
* Returns the state of the mouse buttons (outside the message queue).
* \param buttons The state of the buttons.
* \return Indication of success.
*/
Expand Down
3 changes: 2 additions & 1 deletion intern/ghost/intern/GHOST_SystemWayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ GHOST_IWindow *GHOST_SystemWayland::createWindow(const char *title,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
const bool exclusive,
const bool /*is_dialog*/,
const bool is_dialog,
const GHOST_IWindow *parentWindow)
{
GHOST_WindowWayland *window = new GHOST_WindowWayland(
Expand All @@ -1540,6 +1540,7 @@ GHOST_IWindow *GHOST_SystemWayland::createWindow(const char *title,
state,
parentWindow,
type,
is_dialog,
((glSettings.flags & GHOST_glStereoVisual) != 0),
exclusive);

Expand Down
2 changes: 1 addition & 1 deletion intern/ghost/intern/GHOST_SystemWin32.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class GHOST_SystemWin32 : public GHOST_System {
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const;

/**
* Returns the state of the mouse buttons (ouside the message queue).
* Returns the state of the mouse buttons (outside the message queue).
* \param buttons The state of the buttons.
* \return Indication of success.
*/
Expand Down

1 comment on commit bcdbaca

@youle31
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks!

Please sign in to comment.