mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 07:09:22 +00:00
display current commit in status bar
it works for users who symlinked their blenderbim/bim folders to git repository or installed blenderbim from release created from makefile https://i.imgur.com/mEBH9I7.png
This commit is contained in:
@@ -36,6 +36,7 @@ endif
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
VERSION:=`date '+%y%m%d'`
|
VERSION:=`date '+%y%m%d'`
|
||||||
|
LAST_COMMIT_HASH:=$(git rev-parse HEAD)
|
||||||
PYVERSION:=py310
|
PYVERSION:=py310
|
||||||
|
|
||||||
ifeq ($(PYVERSION), py39)
|
ifeq ($(PYVERSION), py39)
|
||||||
@@ -675,6 +676,7 @@ endif
|
|||||||
rm -rf dist/blenderbim/libs/site/packages/numpy.libs
|
rm -rf dist/blenderbim/libs/site/packages/numpy.libs
|
||||||
|
|
||||||
cd dist/blenderbim && $(SED) "s/999999/$(VERSION)/" __init__.py
|
cd dist/blenderbim && $(SED) "s/999999/$(VERSION)/" __init__.py
|
||||||
|
cd dist/blenderbim/bim && $(SED) "s/8888888/$(LAST_COMMIT_HASH)/" __init__.py
|
||||||
cd dist && zip -r blenderbim-$(VERSION)-$(PYVERSION)-$(PLATFORM).zip ./*
|
cd dist && zip -r blenderbim-$(VERSION)-$(PYVERSION)-$(PLATFORM).zip ./*
|
||||||
rm -rf dist/blenderbim
|
rm -rf dist/blenderbim
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
import bpy
|
import bpy
|
||||||
import bpy.utils.previews
|
import bpy.utils.previews
|
||||||
import blenderbim
|
import blenderbim
|
||||||
@@ -150,6 +151,7 @@ for mod in modules.values():
|
|||||||
addon_keymaps = []
|
addon_keymaps = []
|
||||||
icons = None
|
icons = None
|
||||||
is_registering = False
|
is_registering = False
|
||||||
|
last_commit_hash = "8888888"
|
||||||
|
|
||||||
|
|
||||||
def on_register(scene):
|
def on_register(scene):
|
||||||
@@ -209,6 +211,14 @@ def register():
|
|||||||
|
|
||||||
icons = icon_preview
|
icons = icon_preview
|
||||||
|
|
||||||
|
global last_commit_hash
|
||||||
|
try:
|
||||||
|
import git
|
||||||
|
path = Path(__file__).resolve().parent
|
||||||
|
repo = git.Repo(str(path), search_parent_directories=True)
|
||||||
|
last_commit_hash = repo.head.object.hexsha
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
global icons
|
global icons
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ from ifcopenshell.util.doc import (
|
|||||||
)
|
)
|
||||||
from . import ifc
|
from . import ifc
|
||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
|
import blenderbim.bim
|
||||||
from blenderbim.bim.helper import IfcHeaderExtractor
|
from blenderbim.bim.helper import IfcHeaderExtractor
|
||||||
from blenderbim.bim.prop import Attribute
|
from blenderbim.bim.prop import Attribute
|
||||||
|
|
||||||
@@ -542,7 +543,10 @@ class UIData:
|
|||||||
def draw_statusbar(self, context):
|
def draw_statusbar(self, context):
|
||||||
if not UIData.is_loaded:
|
if not UIData.is_loaded:
|
||||||
UIData.load()
|
UIData.load()
|
||||||
self.layout.label(text=f"BlenderBIM Add-on v{UIData.data['version']}")
|
text = f"BlenderBIM Add-on v{UIData.data['version']}"
|
||||||
|
if blenderbim.bim.last_commit_hash != "8888888":
|
||||||
|
text += f"@{blenderbim.bim.last_commit_hash[:7]}"
|
||||||
|
self.layout.label(text=text)
|
||||||
|
|
||||||
|
|
||||||
def draw_custom_context_menu(self, context):
|
def draw_custom_context_menu(self, context):
|
||||||
|
|||||||
Reference in New Issue
Block a user