generated from stilobique/BlenderTemplate
Compare commits
33 Commits
main
..
a9564255da
| Author | SHA1 | Date | |
|---|---|---|---|
| a9564255da | |||
| 0821574902 | |||
| 4fa3170b93 | |||
| 940bc14d77 | |||
| d20a7d2198 | |||
| e380e894d7 | |||
| 30531affba | |||
| ebbb80a2da | |||
| 9cbe89e4b8 | |||
| 814e158eb5 | |||
| 9ed89657c3 | |||
| 9758304066 | |||
| 61e3bcaaf3 | |||
| 7418be4196 | |||
| 4f539912eb | |||
| 1f7d5b40e8 | |||
| 57379a0ff6 | |||
| c000fae4a8 | |||
| e959960e42 | |||
| 4852d57ef6 | |||
| 5585c8916c | |||
| 70cb0e0069 | |||
| 6f43ae733b | |||
| d1b2c0b4a9 | |||
| 6cf3d224d2 | |||
| 15df44a0eb | |||
| 649b19a33d | |||
| f9628eda0f | |||
| 85f5f3c931 | |||
| e9858cb55c | |||
| aec4ee2a99 | |||
| fe4f12424b | |||
| 1e867a553e |
@@ -1,25 +0,0 @@
|
|||||||
import sys
|
|
||||||
import os
|
|
||||||
import pathlib
|
|
||||||
|
|
||||||
from pylint import lint
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
folder: str = ''
|
|
||||||
for v in sys.argv:
|
|
||||||
if '--module=' in v:
|
|
||||||
folder = v.replace('--module=', '')
|
|
||||||
|
|
||||||
if folder is False:
|
|
||||||
print(f'Module folder not set.')
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
run = lint.Run([f'--rcfile={pathlib.Path(os.getcwd(), "linter", ".pylintrc")}', folder],
|
|
||||||
do_exit=False)
|
|
||||||
|
|
||||||
if run.linter.stats.fatal or run.linter.stats.error:
|
|
||||||
print('Pylint failed.')
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
sys.exit(0)
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import glob
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
def get_folder_name():
|
|
||||||
addon = glob.glob(os.getcwd() + "/*/__init__.py", recursive=True)
|
|
||||||
|
|
||||||
return os.path.basename(os.path.dirname(addon[0]))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
name = get_folder_name()
|
|
||||||
|
|
||||||
# Keep the print value, it's request to output a string value available
|
|
||||||
print(name)
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
import os
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
class SetupVersion:
|
|
||||||
def __init__(self, version: str, folder: str):
|
|
||||||
self.addon_file = Path(os.getcwd(), folder, '__init__.py')
|
|
||||||
self.tag = self.conform_tag_to_blender(version)
|
|
||||||
self.update_addon_init()
|
|
||||||
|
|
||||||
def update_addon_init(self):
|
|
||||||
"""Simple function to update the bl_info to set the Git tag release"""
|
|
||||||
regex, update = r'[0-9]{1,2}\, [0-9]{1,2}\, [0-9]{1,2}', ''
|
|
||||||
|
|
||||||
try:
|
|
||||||
with open(self.addon_file, "r") as f:
|
|
||||||
i = 0
|
|
||||||
lines = f.readlines()
|
|
||||||
for line in lines:
|
|
||||||
if ' \'version\':' in line:
|
|
||||||
print('Actual set : ', line)
|
|
||||||
line = re.sub(regex, self.tag, line)
|
|
||||||
lines[i] = line
|
|
||||||
update = lines
|
|
||||||
print('Update version : ', line)
|
|
||||||
break
|
|
||||||
i += 1
|
|
||||||
|
|
||||||
with open(self.addon_file, 'w') as f:
|
|
||||||
f.writelines(update)
|
|
||||||
|
|
||||||
except FileNotFoundError as exception:
|
|
||||||
print(f'Can\'t find a file :\n\t{exception}')
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def conform_tag_to_blender(version):
|
|
||||||
"""This function convert all '.' with a coma and remove the alphabetic entry, to be ready with blender 'bl
|
|
||||||
info' value """
|
|
||||||
version = re.sub(r'\.', ', ', version)
|
|
||||||
version = version.replace('v', '')
|
|
||||||
|
|
||||||
return version
|
|
||||||
|
|
||||||
|
|
||||||
class SetupError(Exception):
|
|
||||||
"""No tag or folder name valid"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
tag, name = '', ''
|
|
||||||
|
|
||||||
for value in sys.argv:
|
|
||||||
if '--tag' in value:
|
|
||||||
tag = value.replace('--tag=', '')
|
|
||||||
print(f'[UpdateVersion] Set the tag {tag}')
|
|
||||||
|
|
||||||
if 'name' in value:
|
|
||||||
name = value.replace('--name=', '')
|
|
||||||
print(f'[UpdateVersion] Set the folder {name}')
|
|
||||||
|
|
||||||
try:
|
|
||||||
if not tag or not name:
|
|
||||||
raise SetupError
|
|
||||||
else:
|
|
||||||
print(f'[UpdateVersion] Set the tag {tag}, for "{name}"')
|
|
||||||
bump = SetupVersion(tag, name)
|
|
||||||
|
|
||||||
except SetupError:
|
|
||||||
print(SetupError.__doc__)
|
|
||||||
sys.exit(1)
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
name: Create base release
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
outputs:
|
|
||||||
version_type:
|
|
||||||
description: "Give the bump type for this release"
|
|
||||||
value: ${{ jobs.init-release-data.outputs.version_type }}
|
|
||||||
version_number:
|
|
||||||
description: "String about the tag version, integer only"
|
|
||||||
value: ${{ jobs.init-release-data.outputs.version_number }}
|
|
||||||
version_draft:
|
|
||||||
description: "Boolean if the release are draft or not"
|
|
||||||
value: ${{ jobs.init-release-data.outputs.version_draft }}
|
|
||||||
version_name:
|
|
||||||
description: "Number version with a prefix v."
|
|
||||||
value: v${{ jobs.init-release-data.outputs.version_name }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
init-release-data:
|
|
||||||
name: Initialize all data about the package
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
version_type: ${{ steps.bump_setup.outputs.type }}
|
|
||||||
version_number: ${{ steps.semantic_setup.outputs.version }}
|
|
||||||
version_draft: ${{ steps.semantic_setup.outputs.draft }}
|
|
||||||
version_name: ${{ steps.semantic_setup.outputs.version }}
|
|
||||||
steps:
|
|
||||||
- name: Get the Semantic tag Version
|
|
||||||
id: get_semantic_setup
|
|
||||||
uses: oprypin/find-latest-tag@v1.1.0
|
|
||||||
with:
|
|
||||||
repository: ${{ github.repository }}
|
|
||||||
releases-only: true
|
|
||||||
prefix: 'v'
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: From all use case, get the Tag version
|
|
||||||
id: semantic_setup
|
|
||||||
run: |
|
|
||||||
tag=${{ steps.get_semantic_setup.outputs.tag }}
|
|
||||||
if [ "${{ github.event.action }}" == "closed" ]; then
|
|
||||||
echo "Close the pull request, get the previous tag"
|
|
||||||
echo "::set-output name=version::${tag:1}"
|
|
||||||
echo "::set-output name=draft::false"
|
|
||||||
elif [ "${{ github.event.action }}" == "opened" ]; then
|
|
||||||
echo "Create a new tag from a new pull request"
|
|
||||||
echo "::set-output name=version::${{ steps.new_semantic_setup.outputs.version }}"
|
|
||||||
echo "::set-output name=draft::true"
|
|
||||||
else
|
|
||||||
echo "Update the pull request, keep the tag value"
|
|
||||||
echo "::set-output name=version::${tag:1}"
|
|
||||||
echo "::set-output name=draft::true"
|
|
||||||
fi
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
name: Pylinter
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
push:
|
|
||||||
branches-ignore:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
unit-test:
|
|
||||||
name: Python Linter
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@main
|
|
||||||
- uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: "3.10"
|
|
||||||
- name: Install the linter app and set package name
|
|
||||||
id: config
|
|
||||||
run: |
|
|
||||||
echo "::set-output name=folder::$(python '.github/package.py')"
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
python -m pip install -r linter/requirements_linter.txt
|
|
||||||
- name: Execute Pylint
|
|
||||||
run: |
|
|
||||||
cd ${{ github.workspace }}
|
|
||||||
python '${{ github.workspace }}/.github/lint.py' --module=${{ steps.config.outputs.folder }}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
name: Package Blender Plugin
|
|
||||||
|
|
||||||
# How to start the Github Action
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
num_version:
|
|
||||||
description: 'Get the desired number version'
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: '0.0.0'
|
|
||||||
name_version:
|
|
||||||
description: 'The release name used'
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: 'v0.0.0'
|
|
||||||
draft_version:
|
|
||||||
description: 'Info about the release, publish or a draft'
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: 'false'
|
|
||||||
|
|
||||||
|
|
||||||
# Execute this command
|
|
||||||
jobs:
|
|
||||||
make-archive:
|
|
||||||
name: Make Addon Package
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@main
|
|
||||||
|
|
||||||
- name: Setup package variable
|
|
||||||
id: folder
|
|
||||||
run: |
|
|
||||||
echo "::set-output name=folder::$(python '.github/package.py')"
|
|
||||||
echo "::set-output name=package::$(python '.github/package.py').zip"
|
|
||||||
|
|
||||||
# Update the bl info version, update the init file and push if needed
|
|
||||||
- name: Change version number in the bl info addon data
|
|
||||||
run: python '.github/version.py' --tag=${{ inputs.num_version }} --name=${{ steps.folder.outputs.folder }}
|
|
||||||
|
|
||||||
- name: Commit the previous update
|
|
||||||
uses: actions-js/push@v1.3
|
|
||||||
if: ${{ github.event.action }} == 'opened'
|
|
||||||
with:
|
|
||||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
author_name: Moderlab
|
|
||||||
author_email: a.vaillant@moderlab.com
|
|
||||||
message: '[Bot] Bump to ${{ inputs.num_version }} version.'
|
|
||||||
branch: develop
|
|
||||||
force: true
|
|
||||||
|
|
||||||
# Make an archive with the plugin source only
|
|
||||||
- name: Create zip archive release
|
|
||||||
run: |
|
|
||||||
cd '${{ github.workspace }}'
|
|
||||||
zip -r '${{ github.workspace }}/releases/${{ steps.folder.outputs.package }}' ${{ steps.folder.outputs.folder }}
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: ${{ steps.folder.outputs.folder }}
|
|
||||||
path: ${{ github.workspace }}/releases/${{ steps.folder.outputs.package }}
|
|
||||||
|
|
||||||
- name: Update the github release
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
uses: johnwbyrd/update-release@v1.0.0
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
files: '${{ github.workspace }}/releases/${{ steps.folder.outputs.package }}'
|
|
||||||
release: ${{ inputs.name_version }}
|
|
||||||
tag: ${{ inputs.name_version }}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
name: Package Blender Plugin
|
|
||||||
|
|
||||||
# How to start the Github Action
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
name_version:
|
|
||||||
description: 'The release name used'
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: 'v0.0.0'
|
|
||||||
|
|
||||||
|
|
||||||
# Execute this command
|
|
||||||
jobs:
|
|
||||||
make-archive:
|
|
||||||
name: Make Addon Package
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@main
|
|
||||||
|
|
||||||
- name: Setup package variable
|
|
||||||
id: folder
|
|
||||||
run: |
|
|
||||||
echo "::set-output name=folder::$(python '.github/package.py')_preset"
|
|
||||||
echo "::set-output name=package::$(python '.github/package.py')_preset.zip"
|
|
||||||
|
|
||||||
# Make an archive with the plugin source only
|
|
||||||
- name: Create zip archive release
|
|
||||||
run: |
|
|
||||||
cd '${{ github.workspace }}/presets'
|
|
||||||
zip -r '../releases/${{ steps.folder.outputs.package }}' '.'
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: ${{ steps.folder.outputs.folder }}
|
|
||||||
path: ${{ github.workspace }}/releases/${{ steps.folder.outputs.package }}
|
|
||||||
|
|
||||||
- name: Update the github release
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
uses: johnwbyrd/update-release@v1.0.0
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
files: '${{ github.workspace }}/releases/${{ steps.folder.outputs.package }}'
|
|
||||||
release: ${{ inputs.name_version }}
|
|
||||||
tag: ${{ inputs.name_version }}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
name: Create addon release
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
[main]
|
|
||||||
types:
|
|
||||||
[edited, synchronize, closed]
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
init-release-data:
|
|
||||||
name: Initialize all data about the package
|
|
||||||
uses: Moderlab-Production/BlenderTemplate/.github/workflows/initialize_data.yml@main
|
|
||||||
|
|
||||||
unit-test:
|
|
||||||
uses: Moderlab-Production/BlenderTemplate/.github/workflows/unit_test.yml@main
|
|
||||||
|
|
||||||
py-linter:
|
|
||||||
uses: Moderlab-Production/BlenderTemplate/.github/workflows/linter.yml@main
|
|
||||||
|
|
||||||
release-package-addon:
|
|
||||||
name: Generate archive package addon
|
|
||||||
needs:
|
|
||||||
- init-release-data
|
|
||||||
- unit-test
|
|
||||||
- py-linter
|
|
||||||
uses: Moderlab-Production/BlenderTemplate/.github/workflows/package_addon.yml@main
|
|
||||||
with:
|
|
||||||
num_version: ${{ needs.init-release-data.outputs.version_number }}
|
|
||||||
name_version: ${{ needs.init-release-data.outputs.version_name }}
|
|
||||||
draft_version: ${{ needs.init-release-data.outputs.version_draft }}
|
|
||||||
|
|
||||||
release-package-preset:
|
|
||||||
name: Generate archive package preset
|
|
||||||
needs:
|
|
||||||
- init-release-data
|
|
||||||
- unit-test
|
|
||||||
- py-linter
|
|
||||||
uses: Moderlab-Production/BlenderTemplate/.github/workflows/package_preset.yml@main
|
|
||||||
with:
|
|
||||||
name_version: ${{ needs.init-release-data.outputs.version_name }}
|
|
||||||
|
|
||||||
publish-release:
|
|
||||||
name: Publish the Github Release
|
|
||||||
needs:
|
|
||||||
- init-release-data
|
|
||||||
- release-package-addon
|
|
||||||
- release-package-preset
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Update/Publish the release
|
|
||||||
uses: tubone24/update_release@v1.3.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
TAG_NAME: ${{ needs.init-release-data.outputs.version_name }}
|
|
||||||
with:
|
|
||||||
release_name: ${{ needs.init-release-data.outputs.version_name }}
|
|
||||||
body: ''
|
|
||||||
prerelease: ${{ needs.init-release-data.outputs.version_draft }}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
name: Create addon release
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
[main]
|
|
||||||
types:
|
|
||||||
[opened]
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
init-release:
|
|
||||||
name: Generate the release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Setup bump release
|
|
||||||
id: bump_setup
|
|
||||||
run: |
|
|
||||||
if [ ${{ contains(github.event.pull_request.labels.*.name, 'release:major') }} == true ]; then
|
|
||||||
echo "::set-output name=type::major"
|
|
||||||
elif [ ${{ contains(github.event.pull_request.labels.*.name, 'release:minor') }} == true ]; then
|
|
||||||
echo "::set-output name=type::minor"
|
|
||||||
else
|
|
||||||
echo "::set-output name=type::patch"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- uses: actions/checkout@main
|
|
||||||
|
|
||||||
- name: Create new Semantic Version
|
|
||||||
uses: zwaldowski/semver-release-action@v2
|
|
||||||
id: new_semantic_setup
|
|
||||||
with:
|
|
||||||
bump: ${{ steps.bump_setup.outputs.type }}
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
dry_run: true
|
|
||||||
prefix: v
|
|
||||||
|
|
||||||
- name: Make the github release
|
|
||||||
uses: ncipollo/release-action@v1.10.0
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
prerelease: true
|
|
||||||
tag: ${{ steps.new_semantic_setup.outputs.version_tag }}
|
|
||||||
|
|
||||||
unit-test:
|
|
||||||
uses: Moderlab-Production/BlenderTemplate/.github/workflows/unit_test.yml@main
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
name: Unit Test
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
push:
|
|
||||||
branches-ignore:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
unit-test:
|
|
||||||
name: Unit Test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@main
|
|
||||||
- uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: "3.10"
|
|
||||||
- name: Setup python to execute all Unit Test
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
python -m pip install -r tests/requirements.txt
|
|
||||||
|
|
||||||
- name: Start all Unit Test
|
|
||||||
run: |
|
|
||||||
cd ${{ github.workspace }}
|
|
||||||
python tests/main.py
|
|
||||||
-15
@@ -7,24 +7,9 @@
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
**/__pycache__/
|
**/__pycache__/
|
||||||
|
|
||||||
|
|
||||||
# Unit Test #
|
|
||||||
*.zip
|
|
||||||
tests/blender/**
|
|
||||||
tests/blender/*.dmg
|
|
||||||
!tests/blender/.keep
|
|
||||||
|
|
||||||
### Blender ###
|
### Blender ###
|
||||||
*.blend1
|
*.blend1
|
||||||
|
|
||||||
### Unreal ###
|
|
||||||
tests/unreal_sample/DerivedDataCache
|
|
||||||
tests/unreal_sample/Intermediate
|
|
||||||
tests/unreal_sample/Saved
|
|
||||||
|
|
||||||
# Secret file
|
|
||||||
**/token.txt
|
|
||||||
|
|
||||||
# Virtual Environment
|
# Virtual Environment
|
||||||
**/venv/**
|
**/venv/**
|
||||||
venv/
|
venv/
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import bpy
|
||||||
|
|
||||||
|
from .ui.export import GRAOU_PT_panel
|
||||||
|
from .operators.outline import ConfigBlendScene
|
||||||
|
from .operators.exports import ExportForFange
|
||||||
|
from .operators.misc import MakeBasicCollision
|
||||||
|
from .operators.lighting import ConfigLighting
|
||||||
|
from .preference import GRAOU_AddonPreference
|
||||||
|
from .properties.main import FangeProperties
|
||||||
|
|
||||||
|
bl_info = {
|
||||||
|
'name': 'Fange Pipeline',
|
||||||
|
'description': 'Pipeline about the game project "Fange"',
|
||||||
|
'author': 'Graou Studio, Aurelien Vaillant',
|
||||||
|
'version': (0, 0, 1),
|
||||||
|
'blender': (4, 1, 0),
|
||||||
|
'doc_url': "",
|
||||||
|
'tracker_url': "",
|
||||||
|
'support': "COMMUNITY",
|
||||||
|
'category': 'Graou Studio',
|
||||||
|
}
|
||||||
|
|
||||||
|
modules_class = [
|
||||||
|
# Main operators property
|
||||||
|
ExportForFange, MakeBasicCollision, ConfigBlendScene, ConfigLighting,
|
||||||
|
# UI
|
||||||
|
GRAOU_PT_panel,
|
||||||
|
# Preference
|
||||||
|
GRAOU_AddonPreference, FangeProperties
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def register():
|
||||||
|
for cls in modules_class:
|
||||||
|
bpy.utils.register_class(cls)
|
||||||
|
|
||||||
|
bpy.types.Scene.graou_props = bpy.props.PointerProperty(type=FangeProperties)
|
||||||
|
|
||||||
|
|
||||||
|
def unregister():
|
||||||
|
for cls in reversed(modules_class):
|
||||||
|
bpy.utils.unregister_class(cls)
|
||||||
|
|
||||||
|
del bpy.types.Scene.graou_props
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
register()
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
import bpy
|
||||||
|
|
||||||
|
from ..properties.models import FangeProject
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
class ExportForFange(bpy.types.Operator):
|
||||||
|
"""Export a building for fange.
|
||||||
|
Requiert your blend file are write on your hard-drive."""
|
||||||
|
bl_idname = 'graou.building_export'
|
||||||
|
bl_label = 'Easily export a building asset'
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.coll_layout = bpy.data.collections.get('Placeholder')
|
||||||
|
self.path = FangeProject()
|
||||||
|
self.asset = self.get_asset_name()
|
||||||
|
self.category = self.get_asset_type()
|
||||||
|
|
||||||
|
self.instance_type_dict = {}
|
||||||
|
self.temp_copy = {}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
col = bpy.data.collections.get('Placeholder')
|
||||||
|
|
||||||
|
if col is not None and bpy.data.is_saved:
|
||||||
|
return True
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
bpy.ops.object.select_all(action='DESELECT')
|
||||||
|
|
||||||
|
# Make a check if the file are saved on the disk
|
||||||
|
if not bpy.data.is_saved:
|
||||||
|
self.report({'ERROR'}, 'Your blend file is not saved.')
|
||||||
|
return {'CANCELLED'}
|
||||||
|
|
||||||
|
if not self.category:
|
||||||
|
self.report({'ERROR'}, 'Can\'t find the asset category.')
|
||||||
|
return {'CANCELLED'}
|
||||||
|
|
||||||
|
if not len(self.coll_layout.children):
|
||||||
|
self.report({'WARNING'}, 'No children collection, nothing can be exported.')
|
||||||
|
return {'CANCELLED'}
|
||||||
|
|
||||||
|
for coll in self.coll_layout.children:
|
||||||
|
print(f'[Pipeline] Update "{coll.name}" mesh')
|
||||||
|
child = bpy.data.collections.get(coll.name)
|
||||||
|
|
||||||
|
for ob in child.all_objects:
|
||||||
|
print(f'\tLook "{ob.name}", his type are "{type(ob.data)}"')
|
||||||
|
# TODO Support another type object, not only SM/SK
|
||||||
|
if ob.type == 'MESH' or 'EMPTY' or 'CURVE':
|
||||||
|
print(f'[Pipeline] Check ob {ob.name} and is type {type(ob)}')
|
||||||
|
ob.select_set(True)
|
||||||
|
|
||||||
|
if ob.type == 'EMPTY':
|
||||||
|
if ob.instance_type != 'NONE':
|
||||||
|
self.instance_type_dict[ob.name] = ob.instance_type
|
||||||
|
ob.instance_type = 'NONE'
|
||||||
|
|
||||||
|
if ob.type == 'CURVE':
|
||||||
|
# Make a new objet with the Geo
|
||||||
|
bpy.ops.object.convert(target='CURVE')
|
||||||
|
|
||||||
|
abs_export = self.category.joinpath(self.asset, "Meshes")
|
||||||
|
if not abs_export.exists():
|
||||||
|
abs_export.mkdir(parents=True)
|
||||||
|
|
||||||
|
if coll.name != 'Socket':
|
||||||
|
asset_name = f"SM_{coll.name}.fbx"
|
||||||
|
else:
|
||||||
|
asset_name = f"{coll.name}.fbx"
|
||||||
|
|
||||||
|
# TODO Use the preset system
|
||||||
|
bpy.ops.export_scene.fbx(filepath=abs_export.joinpath(asset_name).as_posix(),
|
||||||
|
use_selection=True,
|
||||||
|
use_visible=False,
|
||||||
|
use_active_collection=False,
|
||||||
|
global_scale=1.0,
|
||||||
|
apply_unit_scale=True,
|
||||||
|
apply_scale_options='FBX_SCALE_NONE',
|
||||||
|
use_space_transform=True,
|
||||||
|
bake_space_transform=True,
|
||||||
|
object_types={'MESH', 'EMPTY'},
|
||||||
|
use_mesh_modifiers=True,
|
||||||
|
use_mesh_modifiers_render=True,
|
||||||
|
mesh_smooth_type='OFF',
|
||||||
|
colors_type='SRGB',
|
||||||
|
prioritize_active_color=False,
|
||||||
|
use_subsurf=False,
|
||||||
|
use_mesh_edges=False,
|
||||||
|
use_tspace=False,
|
||||||
|
use_triangles=False,
|
||||||
|
use_custom_props=False,
|
||||||
|
add_leaf_bones=True,
|
||||||
|
primary_bone_axis='Y',
|
||||||
|
secondary_bone_axis='X',
|
||||||
|
use_armature_deform_only=False,
|
||||||
|
armature_nodetype='NULL',
|
||||||
|
bake_anim=False,
|
||||||
|
bake_anim_use_all_bones=True,
|
||||||
|
bake_anim_use_nla_strips=True,
|
||||||
|
bake_anim_use_all_actions=True,
|
||||||
|
bake_anim_force_startend_keying=True,
|
||||||
|
bake_anim_step=1.0,
|
||||||
|
bake_anim_simplify_factor=1.0,
|
||||||
|
path_mode='AUTO',
|
||||||
|
embed_textures=False,
|
||||||
|
batch_mode='OFF',
|
||||||
|
use_batch_own_dir=True,
|
||||||
|
axis_forward='X',
|
||||||
|
axis_up='Y'
|
||||||
|
)
|
||||||
|
|
||||||
|
print(f'[Pipeline] Export here "{abs_export}"')
|
||||||
|
bpy.ops.object.select_all(action='DESELECT')
|
||||||
|
|
||||||
|
self.set_instance_type()
|
||||||
|
|
||||||
|
self.report({'INFO'}, 'Placeholder exported')
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
def get_asset_type(self) -> Path:
|
||||||
|
"""Look the file path, to understand if the asset are a Character, Buildings or Props"""
|
||||||
|
abs_blend_path = Path(bpy.data.filepath)
|
||||||
|
print(f'[Pipeline] Get blend file path "{abs_blend_path}"')
|
||||||
|
print(f'[Pipeline] Convert to List "{abs_blend_path.parts}"')
|
||||||
|
|
||||||
|
if 'Buildings' in abs_blend_path.parts:
|
||||||
|
print(f'[Pipeline] Export here "{self.path.buildings}"')
|
||||||
|
return self.path.buildings
|
||||||
|
|
||||||
|
elif 'Pros' in abs_blend_path.parts:
|
||||||
|
print(f'[Pipeline] Export here "{self.path.props}"')
|
||||||
|
return self.path.props
|
||||||
|
|
||||||
|
elif 'Characters' in abs_blend_path.parts:
|
||||||
|
print(f'[Pipeline] Export here "{self.path.characters}"')
|
||||||
|
return self.path.characters
|
||||||
|
|
||||||
|
else:
|
||||||
|
print(f'[Pipeline] Can\'t find asset category')
|
||||||
|
return Path()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_asset_name() -> str:
|
||||||
|
"""From the .blend file, return the blend name."""
|
||||||
|
abs_blend_path = Path(bpy.data.filepath)
|
||||||
|
return abs_blend_path.stem
|
||||||
|
|
||||||
|
def set_instance_type(self):
|
||||||
|
for key, value in self.instance_type_dict.items():
|
||||||
|
ob = bpy.data.objects.get(key)
|
||||||
|
ob.instance_type = value
|
||||||
|
|
||||||
|
self.instance_type_dict.clear()
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import bpy
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigLighting(bpy.types.Operator):
|
||||||
|
"""Add or conform a lighting build"""
|
||||||
|
bl_idname = 'graou.lighting'
|
||||||
|
bl_label = 'Config or update a lighting'
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
# Look if a light object are in the scene to clear
|
||||||
|
self.clear_light_on_scene()
|
||||||
|
|
||||||
|
r = self.get_blend_resources_file()
|
||||||
|
print(f'[Pipeline] Get file resource {r}')
|
||||||
|
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_blend_resources_file():
|
||||||
|
"""Get the blend file shared with the addon"""
|
||||||
|
addon_folder = Path(bpy.utils.user_resource('SCRIPTS'))
|
||||||
|
print(f'[Pipeline] Get addon folder "{addon_folder}"')
|
||||||
|
addon_name = str(bpy.context.preferences.addons[__name__.split(".")[0]])
|
||||||
|
print(f'[Pipeline] The addon name "{addon_name}"')
|
||||||
|
|
||||||
|
return addon_folder.joinpath("addons", addon_name, "resources").as_posix()
|
||||||
|
|
||||||
|
def get_world(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_light_collection(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def clear_light_on_scene(self):
|
||||||
|
bpy.ops.object.select_all(action='DESELECT')
|
||||||
|
|
||||||
|
for ob in bpy.data.objects:
|
||||||
|
if ob.type == 'LIGHT' and self.find_collection(ob):
|
||||||
|
ob.select_set(True)
|
||||||
|
bpy.ops.object.delete()
|
||||||
|
|
||||||
|
else:
|
||||||
|
ob.select_set(False)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def find_collection(ob, name='Lighting'):
|
||||||
|
"""Check if an object are attached with the Lighting collection"""
|
||||||
|
for collection in ob.users_collection:
|
||||||
|
if collection.name == name:
|
||||||
|
return True
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import bpy
|
||||||
|
|
||||||
|
|
||||||
|
class MakeBasicCollision(bpy.types.Operator):
|
||||||
|
"""From selected mesh, make a collision object"""
|
||||||
|
bl_idname = 'graou.make_collision'
|
||||||
|
bl_label = 'Generate a collision from selected mesh'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return bpy.context.object
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
# TODO
|
||||||
|
return {'FINISHED'}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
import bpy
|
||||||
|
|
||||||
|
from ..properties.models import Outline
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigBlendScene(bpy.types.Operator):
|
||||||
|
"""
|
||||||
|
This operator init a news blend file, or update it.
|
||||||
|
|
||||||
|
Prepare a set of collection (from the models in `properties/models/Outline`.
|
||||||
|
|
||||||
|
Hierarchy design give that:
|
||||||
|
- Placeholder
|
||||||
|
| ${StaticMesh}
|
||||||
|
| Socket (Optional)
|
||||||
|
- Icon
|
||||||
|
- Game Object
|
||||||
|
"""
|
||||||
|
bl_idname = 'graou.build_scene'
|
||||||
|
bl_label = 'Config or update the outline'
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._outline = Outline()
|
||||||
|
|
||||||
|
# Main property
|
||||||
|
self._settings = bpy.context.scene.graou_props
|
||||||
|
self._socket = self._settings.socket_collection
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
for key, value in self._outline.collections.items():
|
||||||
|
collection = bpy.data.collections.get(key)
|
||||||
|
|
||||||
|
# Make the collection if this item not exist
|
||||||
|
if collection is None:
|
||||||
|
collection = bpy.data.collections.new(value.name)
|
||||||
|
context.scene.collection.children.link(collection)
|
||||||
|
|
||||||
|
# Check if the color are correctly setup, if not update-it
|
||||||
|
if collection.color_tag is not value.color:
|
||||||
|
collection.color_tag = value.color
|
||||||
|
|
||||||
|
# Check child collection color
|
||||||
|
if collection.children:
|
||||||
|
for child in collection.children:
|
||||||
|
if isinstance(child, bpy.types.Collection):
|
||||||
|
child.color_tag = value.color
|
||||||
|
|
||||||
|
# Set or update socket collection
|
||||||
|
if self._socket:
|
||||||
|
self.set_socket_collection()
|
||||||
|
else:
|
||||||
|
self.del_socket_collection()
|
||||||
|
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
def set_socket_collection(self):
|
||||||
|
"""Make or update the socket collection"""
|
||||||
|
col_socket = bpy.data.collections.get(self._outline.socket.name)
|
||||||
|
col_placeholder = self._outline.get_placeholder_collection
|
||||||
|
col_game_object = self._outline.get_game_object_collection
|
||||||
|
|
||||||
|
if col_socket is None:
|
||||||
|
col_socket = bpy.data.collections.new(self._outline.socket.name)
|
||||||
|
|
||||||
|
# Attach to Placeholder and Game Icon if they collection exist
|
||||||
|
if col_placeholder.children.get(self._outline.socket.name) is None:
|
||||||
|
col_placeholder.children.link(col_socket)
|
||||||
|
|
||||||
|
if col_game_object.children.get(self._outline.socket.name) is None:
|
||||||
|
col_game_object.children.link(col_socket)
|
||||||
|
|
||||||
|
# Set the COLOR Tag
|
||||||
|
col_socket.color_tag = self._outline.socket.color
|
||||||
|
|
||||||
|
def del_socket_collection(self):
|
||||||
|
"""Remove the socket collection, however, if the collection doesn't exist, terminate the function"""
|
||||||
|
socket = bpy.data.collections.get(self._outline.socket.name)
|
||||||
|
if socket is not None:
|
||||||
|
bpy.data.collections.remove(socket)
|
||||||
|
|
||||||
|
|
||||||
|
class SetCollectionSocket(bpy.types.Operator):
|
||||||
|
"""Configure a/the collection with socket param"""
|
||||||
|
bl_idname = 'graou.collection.socket_setup'
|
||||||
|
bl_label = 'Set param to be socket functional'
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.socket = bpy.data.collections.get('Socket')
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
# TODO
|
||||||
|
return {'FINISHED'}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import bpy
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
def check_game_project():
|
||||||
|
"""Define the unity game project"""
|
||||||
|
unity_game_project = Path("W:\\", "Graou Studio", "Game Projects", "Fange Prototype", "Fange Prototype.sln")
|
||||||
|
if unity_game_project.exists():
|
||||||
|
return unity_game_project.parent.as_posix()
|
||||||
|
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
class GRAOU_AddonPreference(bpy.types.AddonPreferences):
|
||||||
|
"""
|
||||||
|
Configuration about the Fange pipeline
|
||||||
|
"""
|
||||||
|
bl_idname = __package__.split(".")[0]
|
||||||
|
|
||||||
|
project_path: bpy.props.StringProperty(
|
||||||
|
name='Fange Unity project',
|
||||||
|
description='Select your Unity game project',
|
||||||
|
default=check_game_project(),
|
||||||
|
subtype='FILE_PATH',
|
||||||
|
)
|
||||||
|
|
||||||
|
subdir_graph: bpy.props.StringProperty(
|
||||||
|
name='Subdir about assets folder',
|
||||||
|
default=r'Assets\Graph',
|
||||||
|
subtype='DIR_PATH',
|
||||||
|
)
|
||||||
|
|
||||||
|
subdir_props: bpy.props.StringProperty(
|
||||||
|
name='The props subdir',
|
||||||
|
default='Props',
|
||||||
|
subtype='DIR_PATH',
|
||||||
|
)
|
||||||
|
|
||||||
|
subdir_buildings: bpy.props.StringProperty(
|
||||||
|
name='The buildings subdir',
|
||||||
|
default='Buildings',
|
||||||
|
subtype='DIR_PATH',
|
||||||
|
)
|
||||||
|
|
||||||
|
subdir_characters: bpy.props.StringProperty(
|
||||||
|
name='The characters subdir',
|
||||||
|
default='Characters',
|
||||||
|
subtype='DIR_PATH',
|
||||||
|
)
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
layout.label(text='Config all setup about the pipeline.')
|
||||||
|
layout.prop(self, 'project_path')
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import bpy
|
||||||
|
|
||||||
|
|
||||||
|
class FangeProperties(bpy.types.PropertyGroup):
|
||||||
|
|
||||||
|
socket_collection: bpy.props.BoolProperty(
|
||||||
|
name='State Socket use',
|
||||||
|
description='Use the socket collection setup',
|
||||||
|
default=False
|
||||||
|
)
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
import bpy
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
|
||||||
|
class FangeProject:
|
||||||
|
"""
|
||||||
|
This object is a model to give all Unity project path.
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
self._pref = bpy.context.preferences.addons[__name__.split(".")[0]].preferences
|
||||||
|
|
||||||
|
self._project_path = Path(self._pref.project_path)
|
||||||
|
self._subdir_path = Path(self._pref.subdir_graph)
|
||||||
|
|
||||||
|
self._building_path = Path(self._pref.subdir_buildings)
|
||||||
|
self._props_path = Path(self._pref.subdir_props)
|
||||||
|
self._characters_path = Path(self._pref.subdir_characters)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def buildings(self):
|
||||||
|
"""Get the buildings project path, on absolute"""
|
||||||
|
return self._project_path.joinpath(self._subdir_path, self._building_path)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def props(self):
|
||||||
|
return self._project_path.joinpath(self._subdir_path, self._props_path)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def characters(self):
|
||||||
|
return self._project_path.joinpath(self._subdir_path, self._characters_path)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Collection:
|
||||||
|
name: str
|
||||||
|
color: str
|
||||||
|
|
||||||
|
|
||||||
|
class Outline:
|
||||||
|
"""
|
||||||
|
Model about the Outline config.
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
self._collections = {
|
||||||
|
'Placeholder': Collection(name='Placeholder', color='COLOR_01'),
|
||||||
|
'Icon': Collection(name='Icon', color='COLOR_04'),
|
||||||
|
'Game Object': Collection(name='Game Object', color='COLOR_05')
|
||||||
|
}
|
||||||
|
|
||||||
|
self._socket = Collection(name='Socket', color='NONE')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def collections(self) -> [str]:
|
||||||
|
"""Returns all collections in a dict"""
|
||||||
|
return self._collections
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_placeholder_collection(self):
|
||||||
|
return bpy.data.collections.get(self.collections['Placeholder'].name)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_icon_collection(self):
|
||||||
|
return bpy.data.collections.get(self.collections['Icon'].name)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_game_object_collection(self):
|
||||||
|
return bpy.data.collections.get(self.collections['Game Object'].name)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def socket(self) -> Collection:
|
||||||
|
return self._socket
|
||||||
Binary file not shown.
@@ -0,0 +1,46 @@
|
|||||||
|
import bpy
|
||||||
|
# import os
|
||||||
|
|
||||||
|
# from pathlib import Path
|
||||||
|
#
|
||||||
|
# preview_collection = {}
|
||||||
|
# icon_sauropod_path = Path(os.path.dirname(os.path.abspath(__file__)), "icons")
|
||||||
|
#
|
||||||
|
# pcoll = bpy.utils.previews.new()
|
||||||
|
#
|
||||||
|
# for entry in os.scandir(icon_sauropod_path):
|
||||||
|
# if entry.name.endswith(".png"):
|
||||||
|
# name = os.path.splitext(entry.name)[0]
|
||||||
|
# print(f'[Pipeline] Add icon "{name}"')
|
||||||
|
# pcoll.load(name.upper(), entry.path, "IMAGE")
|
||||||
|
|
||||||
|
|
||||||
|
class GRAOU_PT_panel(bpy.types.Panel):
|
||||||
|
bl_idname = 'GRAOU_PT_MAIN'
|
||||||
|
bl_space_type = 'VIEW_3D'
|
||||||
|
bl_region_type = 'UI'
|
||||||
|
bl_label = 'Pipeline'
|
||||||
|
bl_category = 'Graou Studio'
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
|
||||||
|
# layout.label(text='Graou Pipeline', icon_value=pcoll["GRAOU"].icon_id)
|
||||||
|
|
||||||
|
col = layout.column(align=True)
|
||||||
|
col.label(text='Main Config:')
|
||||||
|
col.operator('graou.build_scene', text='Init Scene', icon='OUTLINER')
|
||||||
|
col.prop(context.scene.graou_props, 'socket_collection', text='Use socket', toggle=True)
|
||||||
|
col.operator('graou.lighting', text='Set basic lighting', icon='OUTLINER_OB_LIGHT')
|
||||||
|
|
||||||
|
layout.separator()
|
||||||
|
|
||||||
|
layout.label(text='Asset:')
|
||||||
|
layout.operator('graou.make_collision', text='Generate collision', icon='MOD_PHYSICS')
|
||||||
|
|
||||||
|
layout.separator()
|
||||||
|
|
||||||
|
layout.label(text='Export scene:')
|
||||||
|
box = layout.box()
|
||||||
|
box.label(text='Sanity Check')
|
||||||
|
layout.operator('graou.building_export', text='Export Placeholder', icon='EXPORT')
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
@@ -0,0 +1,28 @@
|
|||||||
|
import bpy
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
def get_export_preset():
|
||||||
|
"""
|
||||||
|
Select a FBX preset you want use.
|
||||||
|
"""
|
||||||
|
# TODO Subdir need to be exposed
|
||||||
|
fbx_preset_paths = bpy.utils.preset_paths(r"operator\export_scene.fbx")
|
||||||
|
# TODO Preset name need to be exposed
|
||||||
|
fbx_preset = Path(fbx_preset_paths[0], "sm-unity-building.py")
|
||||||
|
|
||||||
|
if fbx_preset_paths:
|
||||||
|
print(f'[Pipeline] Get the preset path "{fbx_preset}"')
|
||||||
|
|
||||||
|
return fbx_preset
|
||||||
|
|
||||||
|
else:
|
||||||
|
print(f'[Pipeline] Preset folder not found')
|
||||||
|
|
||||||
|
|
||||||
|
def apply_mesh_and_join():
|
||||||
|
"""
|
||||||
|
This function make a new mesh with all selected asset.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import bpy
|
|
||||||
|
|
||||||
bl_info = {
|
|
||||||
'name': 'Addon Name',
|
|
||||||
'description': 'Add your description',
|
|
||||||
'author': 'Moderlab, Aurelien Vaillant, Nicolas Salles, Jeremy Duchesne',
|
|
||||||
'version': (0, 0, 0),
|
|
||||||
'blender': (3, 0, 0),
|
|
||||||
'doc_url': "",
|
|
||||||
'tracker_url': "",
|
|
||||||
'support': "COMMUNITY",
|
|
||||||
'category': 'Moderlab',
|
|
||||||
}
|
|
||||||
|
|
||||||
modules_class = [
|
|
||||||
# Main Property
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def register():
|
|
||||||
for cls in modules_class:
|
|
||||||
bpy.utils.register_class(cls)
|
|
||||||
|
|
||||||
|
|
||||||
def unregister():
|
|
||||||
for cls in reversed(modules_class):
|
|
||||||
bpy.utils.unregister_class(cls)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
register()
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
REM Make a dev plugin install
|
||||||
|
SET plugin_name=Fange Pipeline
|
||||||
|
|
||||||
|
mklink /D "C:\Users\Aurelien\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\%plugin_name%" "W:\Graou Studio\Tools\Blender-Fange-Pipeline\%plugin_name%"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="install-dev" type="BatchConfigurationType" factoryName="Batch">
|
||||||
|
<module name="Blender-Fange-Pipeline" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<option name="SCRIPT_NAME" value="./dev/install-dev.cmd" />
|
||||||
|
<option name="PARAMETERS" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import bpy
|
||||||
|
op = bpy.context.active_operator
|
||||||
|
|
||||||
|
#op.filepath = 'W:\\Graou Studio\\Game Projects\\Fange Prototype\\Assets\\Graph\\Buildings\\'
|
||||||
|
op.use_selection = True
|
||||||
|
op.use_visible = False
|
||||||
|
op.use_active_collection = False
|
||||||
|
op.global_scale = 1.0
|
||||||
|
op.apply_unit_scale = True
|
||||||
|
op.apply_scale_options = 'FBX_SCALE_NONE'
|
||||||
|
op.use_space_transform = True
|
||||||
|
op.bake_space_transform = True
|
||||||
|
op.object_types = {'MESH', 'EMPTY'}
|
||||||
|
op.use_mesh_modifiers = True
|
||||||
|
op.use_mesh_modifiers_render = True
|
||||||
|
op.mesh_smooth_type = 'OFF'
|
||||||
|
op.colors_type = 'SRGB'
|
||||||
|
op.prioritize_active_color = False
|
||||||
|
op.use_subsurf = False
|
||||||
|
op.use_mesh_edges = False
|
||||||
|
op.use_tspace = False
|
||||||
|
op.use_triangles = False
|
||||||
|
op.use_custom_props = False
|
||||||
|
op.add_leaf_bones = True
|
||||||
|
op.primary_bone_axis = 'Y'
|
||||||
|
op.secondary_bone_axis = 'X'
|
||||||
|
op.use_armature_deform_only = False
|
||||||
|
op.armature_nodetype = 'NULL'
|
||||||
|
op.bake_anim = False
|
||||||
|
op.bake_anim_use_all_bones = True
|
||||||
|
op.bake_anim_use_nla_strips = True
|
||||||
|
op.bake_anim_use_all_actions = True
|
||||||
|
op.bake_anim_force_startend_keying = True
|
||||||
|
op.bake_anim_step = 1.0
|
||||||
|
op.bake_anim_simplify_factor = 1.0
|
||||||
|
op.path_mode = 'AUTO'
|
||||||
|
op.embed_textures = False
|
||||||
|
op.batch_mode = 'OFF'
|
||||||
|
op.use_batch_own_dir = True
|
||||||
|
op.axis_forward = 'X'
|
||||||
|
op.axis_up = 'Y'
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import bpy
|
||||||
|
op = bpy.context.active_operator
|
||||||
|
|
||||||
|
#op.filepath = 'W:\\Graou Studio\\Game Projects\\Fange Prototype\\Assets\\Graph\\Characters\\'
|
||||||
|
op.use_selection = True
|
||||||
|
op.use_visible = False
|
||||||
|
op.use_active_collection = False
|
||||||
|
op.global_scale = 1.0
|
||||||
|
op.apply_unit_scale = True
|
||||||
|
op.apply_scale_options = 'FBX_SCALE_NONE'
|
||||||
|
op.use_space_transform = True
|
||||||
|
op.bake_space_transform = True
|
||||||
|
op.object_types = {'MESH'}
|
||||||
|
op.use_mesh_modifiers = True
|
||||||
|
op.use_mesh_modifiers_render = True
|
||||||
|
op.mesh_smooth_type = 'OFF'
|
||||||
|
op.colors_type = 'SRGB'
|
||||||
|
op.prioritize_active_color = False
|
||||||
|
op.use_subsurf = False
|
||||||
|
op.use_mesh_edges = False
|
||||||
|
op.use_tspace = False
|
||||||
|
op.use_triangles = False
|
||||||
|
op.use_custom_props = False
|
||||||
|
op.add_leaf_bones = True
|
||||||
|
op.primary_bone_axis = 'Y'
|
||||||
|
op.secondary_bone_axis = 'X'
|
||||||
|
op.use_armature_deform_only = False
|
||||||
|
op.armature_nodetype = 'NULL'
|
||||||
|
op.bake_anim = False
|
||||||
|
op.bake_anim_use_all_bones = True
|
||||||
|
op.bake_anim_use_nla_strips = True
|
||||||
|
op.bake_anim_use_all_actions = True
|
||||||
|
op.bake_anim_force_startend_keying = True
|
||||||
|
op.bake_anim_step = 1.0
|
||||||
|
op.bake_anim_simplify_factor = 1.0
|
||||||
|
op.path_mode = 'AUTO'
|
||||||
|
op.embed_textures = False
|
||||||
|
op.batch_mode = 'OFF'
|
||||||
|
op.use_batch_own_dir = True
|
||||||
|
op.axis_forward = 'X'
|
||||||
|
op.axis_up = 'Y'
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import bpy
|
||||||
|
op = bpy.context.active_operator
|
||||||
|
|
||||||
|
#op.filepath = 'D:\\Users\\Aurelien\\Documents\\untitled.fbx'
|
||||||
|
op.use_selection = True
|
||||||
|
op.use_visible = False
|
||||||
|
op.use_active_collection = False
|
||||||
|
op.global_scale = 1.0
|
||||||
|
op.apply_unit_scale = True
|
||||||
|
op.apply_scale_options = 'FBX_SCALE_NONE'
|
||||||
|
op.use_space_transform = True
|
||||||
|
op.bake_space_transform = True
|
||||||
|
op.object_types = {'MESH'}
|
||||||
|
op.use_mesh_modifiers = True
|
||||||
|
op.use_mesh_modifiers_render = True
|
||||||
|
op.mesh_smooth_type = 'OFF'
|
||||||
|
op.colors_type = 'SRGB'
|
||||||
|
op.prioritize_active_color = False
|
||||||
|
op.use_subsurf = False
|
||||||
|
op.use_mesh_edges = False
|
||||||
|
op.use_tspace = False
|
||||||
|
op.use_triangles = False
|
||||||
|
op.use_custom_props = False
|
||||||
|
op.add_leaf_bones = True
|
||||||
|
op.primary_bone_axis = 'Y'
|
||||||
|
op.secondary_bone_axis = 'X'
|
||||||
|
op.use_armature_deform_only = False
|
||||||
|
op.armature_nodetype = 'NULL'
|
||||||
|
op.bake_anim = False
|
||||||
|
op.bake_anim_use_all_bones = True
|
||||||
|
op.bake_anim_use_nla_strips = True
|
||||||
|
op.bake_anim_use_all_actions = True
|
||||||
|
op.bake_anim_force_startend_keying = True
|
||||||
|
op.bake_anim_step = 1.0
|
||||||
|
op.bake_anim_simplify_factor = 1.0
|
||||||
|
op.path_mode = 'AUTO'
|
||||||
|
op.embed_textures = False
|
||||||
|
op.batch_mode = 'OFF'
|
||||||
|
op.use_batch_own_dir = True
|
||||||
|
op.axis_forward = 'X'
|
||||||
|
op.axis_up = 'Y'
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import bpy
|
||||||
|
op = bpy.context.active_operator
|
||||||
|
|
||||||
|
#op.filepath = 'W:\\Graou Studio\\Game Projects\\Fange Prototype\\Assets\\Graph\\'
|
||||||
|
op.use_selection = True
|
||||||
|
op.use_visible = False
|
||||||
|
op.use_active_collection = False
|
||||||
|
op.global_scale = 1.5
|
||||||
|
op.apply_unit_scale = True
|
||||||
|
op.apply_scale_options = 'FBX_SCALE_NONE'
|
||||||
|
op.use_space_transform = True
|
||||||
|
op.bake_space_transform = True
|
||||||
|
op.object_types = {'MESH'}
|
||||||
|
op.use_mesh_modifiers = True
|
||||||
|
op.use_mesh_modifiers_render = True
|
||||||
|
op.mesh_smooth_type = 'OFF'
|
||||||
|
op.colors_type = 'SRGB'
|
||||||
|
op.prioritize_active_color = False
|
||||||
|
op.use_subsurf = False
|
||||||
|
op.use_mesh_edges = False
|
||||||
|
op.use_tspace = False
|
||||||
|
op.use_triangles = False
|
||||||
|
op.use_custom_props = False
|
||||||
|
op.add_leaf_bones = True
|
||||||
|
op.primary_bone_axis = 'Y'
|
||||||
|
op.secondary_bone_axis = 'X'
|
||||||
|
op.use_armature_deform_only = False
|
||||||
|
op.armature_nodetype = 'NULL'
|
||||||
|
op.bake_anim = False
|
||||||
|
op.bake_anim_use_all_bones = True
|
||||||
|
op.bake_anim_use_nla_strips = True
|
||||||
|
op.bake_anim_use_all_actions = True
|
||||||
|
op.bake_anim_force_startend_keying = True
|
||||||
|
op.bake_anim_step = 1.0
|
||||||
|
op.bake_anim_simplify_factor = 1.0
|
||||||
|
op.path_mode = 'AUTO'
|
||||||
|
op.embed_textures = False
|
||||||
|
op.batch_mode = 'OFF'
|
||||||
|
op.use_batch_own_dir = True
|
||||||
|
op.axis_forward = 'X'
|
||||||
|
op.axis_up = 'Y'
|
||||||
@@ -1,40 +1,10 @@
|
|||||||
[](https://www.python.org/downloads/release/python-3102/)
|
[](https://www.python.org/downloads/release/python-3102/)
|
||||||

|

|
||||||
|
|
||||||
# Blender Addon
|
# Fange Pipeline
|
||||||
This repository is a toolbox to create a new blender addon. To used-it, clone this repository and rename the folder "blender_addon_folder" with your addon name.
|
This addon control a bridge with Blender and Unity
|
||||||
It's important to change some files :
|
|
||||||
- [x] Update the file "tests/main.py", line 29, set your addon name.
|
|
||||||
```python
|
|
||||||
# Prepare Blender and Unreal dependency
|
|
||||||
generate_archive(archives, 'blender_addon_folder')
|
|
||||||
```
|
|
||||||
- [x] You can remove the folder "presets" and disable the workflow (`.github/workflows/pr_main.yml`, line 38 and 53)
|
|
||||||
|
|
||||||
|
# Todo Features
|
||||||
> ⚠️ It's more easy to use the "_" with your addon folder name, the "-" character can be problematic with python use.
|
- [ ] Linter check
|
||||||
|
- [ ] Unity Test
|
||||||
All features covered with this template are :
|
- [ ] Release
|
||||||
- [x] Generate addon release (.zip archive)
|
|
||||||
- [x] Generate preset release (.zip archive)
|
|
||||||
- [x] Update addon version (bl info) with tag name
|
|
||||||
- [x] Execute unit test with Github Action (check if the addon can be installed with blender)
|
|
||||||
- [x] Configuration with Pycharm to test locally
|
|
||||||
|
|
||||||
|
|
||||||
## Unit Test
|
|
||||||
All unit tests call docker image [stilobique/blender](https://hub.docker.com/repository/docker/stilobique/blender). It's a simple ubuntu image with blender compile.
|
|
||||||
If you want change the blender version tested, edit the `main.py` inside the `tests` folder ; change the tag version with your requested tag.
|
|
||||||
|
|
||||||
`````python
|
|
||||||
class Container(enum.Enum):
|
|
||||||
"""Enumerate about the Geometry node"""
|
|
||||||
BLENDER = ContainerObject(name='Blender', image='stilobique/blender', tag='3.1.2')
|
|
||||||
`````
|
|
||||||
|
|
||||||
|
|
||||||
# Addons/Plugins dependency
|
|
||||||
Update json file `tests/dependency.json` with name, archive and repository Github path. Each entry require `archive
|
|
||||||
name`, the repository url path '{owner}/{repo}' and optional parameter if the release needed to be a prerelease.
|
|
||||||
|
|
||||||
> ⛔ The `moderlab_plugin` need to be on last entry.
|
|
||||||
@@ -1,11 +1,4 @@
|
|||||||
{
|
{
|
||||||
"blender": {
|
"blender": {
|
||||||
"moderlab_type": ["moderlab_type.zip", "Moderlab-Production/BlenderObjectType", "prerelease"],
|
|
||||||
"moderlab_pie": ["moderlab_plugin.zip", "Moderlab-Production/BlenderPieMenu"],
|
|
||||||
"moderlab_plugin": ["moderlab_plugin.zip", "Moderlab-Production/BlenderPlugin"]
|
|
||||||
},
|
|
||||||
"unreal": {
|
|
||||||
"unreal-pipeline": ["unreal-moderlab-pipeline.zip", "Moderlab-Production/UnrealPipeline"],
|
|
||||||
"unreal-type": ["Moderlab-Unreal-Type.zip", "Moderlab-Production/UnrealType"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user