-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 735faf4
Showing
280 changed files
with
437,786 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
|
||
# Created by https://www.toptal.com/developers/gitignore/api/python,visualstudiocode | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=python,visualstudiocode | ||
|
||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
pytestdebug.log | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
doc/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
pythonenv* | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# profiling data | ||
.prof | ||
|
||
### VisualStudioCode ### | ||
.vscode/* | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
*.code-workspace | ||
|
||
### VisualStudioCode Patch ### | ||
# Ignore all local history of files | ||
.history | ||
.ionide | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/python,visualstudiocode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Measures Addon For Blender | ||
|
||
<div style="text-align: center"> | ||
<img src="screenshots/headerimage.jpg" width="80%"> | ||
</div> | ||
|
||
This Blender addon is intended to accelearate the creation of measures for an Avatar. | ||
|
||
## Running locally | ||
The plugin requires the following tools to run: | ||
|
||
- [Blender 2.9+](https://www.blender.org/download/) | ||
- [Visual Studio Code](https://code.visualstudio.com/) | ||
- [Python for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-python.python) | ||
- [Blender Development](https://marketplace.visualstudio.com/items?itemName=JacquesLucke.blender-development) | ||
|
||
Follow the instructions of the Blender Development plugin setup to connect to your instance of Blender. | ||
|
||
## Installing in Blender | ||
If you simply want to test how the addon works, get the latest version of the addon from the releases page. | ||
|
||
Inside Blender go to: `Edit > Preferences`, go the the `Add-ons` section in the left menu, hit the `Install...` button and select the file you donwloaded. | ||
|
||
Now at the top of the section in the search box if you type `Measures` the plugin should appear. | ||
|
||
<div style="text-align: center"> | ||
<img src="screenshots/plugininstalled.jpg" width="80%"> | ||
</div> | ||
|
||
## Useful Links: | ||
- [Blender Python API docs](https://docs.blender.org/api/current/) | ||
- [Blender Python Tutorial, Youtube series by Darkfall](https://www.youtube.com/watch?v=cyt0O7saU4Q&list=PLFtLHTf5bnym_wk4DcYIMq1DkjqB7kDb-&index=1) | ||
- [Blender Python Addon Development with ST3, Udemy Course](https://www.udemy.com/course/st3-addon-course/) | ||
|
||
More coming soon... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
bl_info = { | ||
"name": "Measures Library", | ||
"author": "Albert Rodriguez", | ||
"description": "Tools to take measures for Avatar", | ||
"blender": (2, 80, 0), | ||
"version": (0, 0, 1), | ||
"location": "View3D > Toolshelf", | ||
"warning": "", | ||
"category": "Add measures", | ||
"wiki_url": "" | ||
} | ||
|
||
|
||
def register(): | ||
from .addon.register import register_addon | ||
register_addon() | ||
|
||
|
||
def unregister(): | ||
from .addon.register import unregister_addon | ||
unregister_addon() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# import bpy | ||
|
||
# from .main_menu import GEM_MT_Main_Menu | ||
|
||
# TODO: Add menus here when required | ||
classes = [] | ||
|
||
|
||
def register_menus(): | ||
from bpy.utils import register_class | ||
for cls in classes: | ||
register_class(cls) | ||
|
||
|
||
def unregister_menus(): | ||
from bpy.utils import unregister_class | ||
for cls in reversed(classes): | ||
unregister_class(cls) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from .measures_operator import MEASURES_OT | ||
|
||
classes = ( | ||
MEASURES_OT, | ||
) | ||
|
||
|
||
def register_operators(): | ||
from bpy.utils import register_class | ||
for cls in classes: | ||
register_class(cls) | ||
|
||
|
||
def unregister_operators(): | ||
from bpy.utils import unregister_class | ||
for cls in reversed(classes): | ||
unregister_class(cls) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import bpy | ||
import bmesh | ||
|
||
|
||
class MEASURES_OT(bpy.types.Operator): | ||
bl_label = "Create Measure" | ||
bl_idname = 'measures.create' | ||
|
||
def execute(self, context): | ||
print('Measures Operator executed') | ||
|
||
dg = context.evaluated_depsgraph_get() | ||
scene = context.scene | ||
ob = scene.objects.get("Avatar") | ||
plane = scene.objects.get("Plane") | ||
|
||
if plane and ob: | ||
pmw = plane.matrix_world | ||
face = plane.data.polygons[0] | ||
plane_co = pmw @ face.center | ||
plane_no = pmw @ (face.center + face.normal) - plane_co | ||
bm = bmesh.new() | ||
bm.from_object(ob, dg) | ||
bmesh.ops.transform(bm, | ||
verts=bm.verts, | ||
matrix=ob.matrix_world) | ||
|
||
x = bmesh.ops.bisect_plane(bm, | ||
geom=bm.faces[:] + bm.edges[:] + bm.verts[:], | ||
clear_inner=True, | ||
clear_outer=True, | ||
plane_co=plane_co, | ||
plane_no=plane_no | ||
) | ||
|
||
# new object | ||
me = bpy.data.meshes.new("Bisect") | ||
bm.to_mesh(me) | ||
ob = bpy.data.objects.new("Bisect", me) | ||
context.collection.objects.link(ob) | ||
|
||
return {'FINISHED'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from .measures_panel import MeasuresMainPanel | ||
|
||
classes = [MeasuresMainPanel] | ||
|
||
|
||
def register_panels(): | ||
from bpy.utils import register_class | ||
for cls in classes: | ||
register_class(cls) | ||
|
||
|
||
def unregister_panels(): | ||
from bpy.utils import unregister_class | ||
for cls in reversed(classes): | ||
unregister_class(cls) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import bpy | ||
|
||
|
||
class MeasuresMainPanel(bpy.types.Panel): | ||
"""Creates a Panel in the 3D view for Measures""" | ||
bl_label = "Measures Library" | ||
bl_idname = "MEASURES_PT_MAINPANEL" | ||
bl_space_type = 'VIEW_3D' | ||
bl_region_type = 'UI' | ||
bl_category = 'Measures Library' | ||
# bl_options = {'DEFAULT_CLOSED'} | ||
# bl_parent_id = 'PT_PARENTPANEL' -> you need to give id aka bl_idname | ||
|
||
def draw(self, context): | ||
layout = self.layout | ||
layout.scale_y = 1.2 | ||
|
||
row = layout.row() | ||
row.label(text="Adjust the plane to the Avatar", icon="MOD_TINT") | ||
|
||
plane = bpy.context.scene.objects.get("Plane") | ||
row = layout.row() | ||
col = layout.column() | ||
col.prop(plane, "location") | ||
|
||
# TODO: | ||
# https://blender.stackexchange.com/questions/123044/how-to-scale-an-object-via-a-slider-in-python | ||
row = layout.row() | ||
col = layout.column() | ||
col.prop(plane, "scale") | ||
|
||
row = layout.row() | ||
col = layout.column() | ||
col.prop(plane, "rotation_euler") | ||
|
||
row = layout.row() | ||
row.operator('measures.create') | ||
|
||
# row = layout.row() | ||
# row.label(text="Active object is: " + obj.name) | ||
# row = layout.row() | ||
# row.prop(obj, "name") | ||
|
||
# row = layout.row() | ||
# row.operator("mesh.primitive_cube_add") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO: Register properties |
Oops, something went wrong.