Skip to content

Commit

Permalink
Merge branch '214-restructure-add-on' into 'main'
Browse files Browse the repository at this point in the history
Resolve "Restructure add-on"

Closes #214

See merge request blender/public-projects/shotmanager-addon!121
  • Loading branch information
jatubi committed Nov 14, 2022
2 parents e262c2b + 766ad04 commit f59bf9c
Show file tree
Hide file tree
Showing 137 changed files with 1,303 additions and 1,042 deletions.
10 changes: 7 additions & 3 deletions .vscode/settings.shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
"editor.formatOnSave": true,
"python.pythonPath": ".venv\\Scripts\\python.exe",
"python.formatting.provider": "black",
"editor.defaultFormatter": null,
"python.formatting.blackArgs": [
"--line-length",
"120"
"120",
"--skip-string-normalization",
"1"
],
"python.testing.unittestArgs": [
"-v",
Expand All @@ -18,10 +21,11 @@
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"--max-line-length=120",
"--ignore=E402,E203,E501,W503,F722,F821",
"--ignore=E402,E203,E266,W503,F722,F821,BLK100,E501",
"--exclude=.git,.history,.venv,.vscode,__pycache__"
],
"python.linting.enabled": true,
"python.linting.lintOnSave": true,
"spellright.language": [
"en",
"fr"
Expand All @@ -33,5 +37,5 @@
],
"gitlab.instanceUrl": "https://gitlab-ncsa.ubisoft.org/",
"blender.addon.sourceDirectory": "./shotmanager",
"restructuredtext.confPath": "${​​​​​​​​workspaceFolder}​​​​​​​​\\docs"
"esbonio.sphinx.confDir": "${​​​​​​​​workspaceFolder}​​​​​​​​\\docs"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
-----
## 2.1.43 (2022-11-14)
- Fixed internet connection pooling on Linux
- Added a Check Connection operator in the Preferences panel, in Debug

-----
## 2.1.41 (2022-11-10)
- Display info if Blender is running in admin mode

-----
## 2.1.40 (2022-11-08)
- Code refactor to introduce the function config.getAddonProps() to get props

-----
## 2.1.32 (2022-10-21)
- Continuous editing stabilization and exposition of properties
Expand Down
75 changes: 63 additions & 12 deletions resources/wkzipaddon/wkzipaddon.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@
(eg: /shotmanager), right click to display the menu then pick wkzipaddon.py.
This script will be ran and it will create an archive, cleaned from the .pyc, ready to
be installed in Blender.
Working notes:
- When the terms "beta" or "pre-release" are found in the warning tag of the bl_info then
they are added at the end of the zip file name
"""


import zipfile
import os
from os.path import basename

# from os.path import basename
import sys
from pathlib import Path

Expand All @@ -27,8 +32,8 @@ def main():

# to use for debug in VSC:
# pathArr = [
# "self",
# "Z:\\EvalSofts\\Blender\\DevPython\\WkZipAddon\\WkSamples\\myAddon_Addon\\myaddon",
# "self",
# "Z:\\EvalSofts\\Blender\\DevPython\\WkZipAddon\\WkSamples\\myAddon_Addon\\myaddon",
# ]

# "Z:\\EvalSofts\\Blender\\DevPython\\WkZipAddon\\WkSamples\\toto.py",
Expand Down Expand Up @@ -56,15 +61,26 @@ def main():
# get the zip file name from the add-on declaration
###################################################

def _isLineCommented(line):
lineStr = str(line)
commentCharFound = False
currentChar = " "
for c in lineStr:
if " " != c:
if "#" == c:
return True
break
return False

def _getAddonCategory(init_file):
nameStr = ""
with open(init_file) as fp:
line = fp.readline()
versionFound = False
while line and not versionFound:
keywordFound = False
while line and not keywordFound:
if -1 != line.find('"category":'):
print(f"Line : {line.strip()}")
versionFound = True
keywordFound = True
startInd = line.find(":")
nameStr = line[startInd + 1 :]
startInd = nameStr.find('"')
Expand All @@ -81,11 +97,11 @@ def _getAddonName(init_file):
nameStr = ""
with open(init_file) as fp:
line = fp.readline()
versionFound = False
while line and not versionFound:
keywordFound = False
while line and not keywordFound:
if -1 != line.find('"name":'):
print(f"Line : {line.strip()}")
versionFound = True
keywordFound = True
startInd = line.find(":")
nameStr = line[startInd + 1 :]
startInd = nameStr.find('"')
Expand All @@ -103,11 +119,11 @@ def _getAddonVersion(init_file):
versionStr = ""
with open(init_file) as fp:
line = fp.readline()
versionFound = False
while line and not versionFound:
keywordFound = False
while line and not keywordFound:
if -1 != line.find('"version":'):
print(f"Line : {line.strip()}")
versionFound = True
keywordFound = True
startInd = line.find("(")
endInd = line.find(")")
numbers = line[startInd + 1 : endInd]
Expand All @@ -119,6 +135,33 @@ def _getAddonVersion(init_file):
line = fp.readline()
return versionStr

def _getAddonWarning(init_file):
nameStr = ""
warningType = ""
with open(init_file) as fp:
line = fp.readline()
keywordFound = False
while line and not keywordFound:
if -1 != line.find('"warning":') and not _isLineCommented(line):
print(f"Line : {line.strip()}")
keywordFound = True
startInd = line.find(":")
nameStr = line[startInd + 1 :]
startInd = nameStr.find('"')
nameStr = nameStr[startInd + 1 :]
endInd = nameStr.find('"')
nameStr = nameStr[0:endInd]
if "beta" in nameStr.lower():
warningType = "BETA"
elif "pre-release" in nameStr.lower():
warningType = "PRERELEASE"

# nameStr = nameStr.replace(" ", "-")
print(f"warning nameStr : {nameStr}")
else:
line = fp.readline()
return warningType

p = Path(pathArr[1])
output_dir = ""
output_dir = str(p.parent) + "\\"
Expand All @@ -138,6 +181,7 @@ def _getAddonVersion(init_file):
categStr = _getAddonCategory(init_file)
nameStr = _getAddonName(init_file)
versionStr = _getAddonVersion(init_file)
warningType = _getAddonWarning(init_file)

# if the category appears at the start of the name it is removed
categInd = nameStr.find(categStr)
Expand All @@ -158,6 +202,13 @@ def _getAddonVersion(init_file):
zip_file += str(p.stem)
if "" != versionStr:
zip_file += "_" + versionStr

if "" != warningType:
if "BETA" == warningType:
zip_file += "_Beta"
elif "PRERELEASE" == warningType:
zip_file += "_Pre-Release"

zip_file += ".zip"

outString += f"\n\nOutput Zip file: {zip_file}"
Expand Down

0 comments on commit f59bf9c

Please sign in to comment.