Skip to content

Commit

Permalink
first release
Browse files Browse the repository at this point in the history
  • Loading branch information
icrdr committed Apr 15, 2024
1 parent 00a69e1 commit dce9627
Show file tree
Hide file tree
Showing 23 changed files with 956 additions and 348 deletions.
57 changes: 57 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# release title (appears, for example, in repo's sidebar)
# NOTE: $RESOLVED_VERSION == $MAJOR.$MINOR.$PATCH
name-template: "v$RESOLVED_VERSION"

# git tag to be used for the release
tag-template: "v$RESOLVED_VERSION"

# Release Notes template (keep it as is)
template: |
## What’s Changed
$CHANGES
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.

# Define which PR label will cause which kind of
# version bump (following semantic versioning).
# If no labels match, the default "patch".
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch

# Define which PR label will be listed in which
# category of changes in the Release Notes.
# If no labels match, the default is to be
# listed on the top, before the sections.
categories:
- title: "🚨 BREAKING CHANGES 🚨"
labels:
- "BREAKING CHANGE"
- title: "🚀 New Features"
labels:
- "feature"
- "enhancement"
- title: "🐛 Bug Fixes"
labels:
- "fix"
- "bug"
- title: "🛠️ Other Changes"
labels:
- "chore"
- "refactor"
- "documentation"
- "style"
- "test"
- "revert"
- "dependencies"
- "ci"
24 changes: 24 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release Drafter

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]

permissions:
contents: read

jobs:
update_release_draft:
permissions:
# write permission required to create a github release
contents: write
# write permission required for autolabeler
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72 changes: 72 additions & 0 deletions .github/workflows/upload-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Upload Assets to Release

on:
push:
branches:
- "release/*"

jobs:
# draft_release:
# name: Draft Release
# runs-on: ubuntu-latest
# outputs:
# upload_url: ${{ steps.draft_release.outputs.upload_url }}
# version: ${{ steps.set_env.outputs.version }}
# steps:
# - name: Set Version Env
# id: set_env
# run: |
# ref_name=${{ github.ref_name }}
# echo "version=${ref_name#release/}" >> "$GITHUB_OUTPUT"
# - name: Get release
# id: draft_release
# uses: cardinalby/[email protected]
# with:
# releaseName: Draft
# env:
# GITHUB_TOKEN: ${{ github.token }}

draft_release:
name: Draft Release
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
version: ${{ steps.set_env.outputs.version }}
steps:
- name: Set Version Env
id: set_env
run: |
ref_name=${{ github.ref_name }}
echo "version=${ref_name#release/}" >> "$GITHUB_OUTPUT"
- name: Draft Release ${{ steps.set_env.outputs.version }}
uses: release-drafter/release-drafter@v5
id: draft_release
with:
name: ${{ steps.set_env.outputs.version }}
tag: ${{ steps.set_env.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

upload_blender_addon:
name: Upload Blender Add-on
needs: draft_release
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Zip Add-on
run: |
zip -r package.zip bioxelnodes
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.draft_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./package.zip
asset_name: BioxelNodes_${{ needs.draft_release.outputs.version }}.zip
asset_content_type: application/zip
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# BioxelNodes
BioxelNodes is a blender add-on for better volume data visualization with cycles.

9 changes: 5 additions & 4 deletions mednodes/__init__.py → bioxelnodes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from .nodes import custom_nodes
from . import auto_load
from .dicom import MEDNODES_add_topbar_menu
from . import menu

import bpy


bl_info = {
"name": "MedNodes",
"name": "BiovelNodes",
"author": "Ma Nan",
"description": "",
"blender": (4, 0, 0),
Expand All @@ -21,12 +22,12 @@
def register():
auto_load.register()
custom_nodes.register()
bpy.types.TOPBAR_MT_file_import.prepend(MEDNODES_add_topbar_menu)
menu.create_menu()


def unregister():
try:
bpy.types.TOPBAR_MT_file_import.remove(MEDNODES_add_topbar_menu)
menu.remove_menu()
custom_nodes.unregister()
auto_load.unregister()
except RuntimeError:
Expand Down
3 changes: 3 additions & 0 deletions bioxelnodes/assets/Nodes.blend
Git LFS file not shown
2 changes: 1 addition & 1 deletion mednodes/auto_load.py → bioxelnodes/auto_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def iter_classes_in_module(module):

def get_register_base_types():
return set(getattr(bpy.types, name) for name in [
"Panel", "Operator", "PropertyGroup",
"Panel", "Operator", "PropertyGroup", "FileHandler",
"AddonPreferences", "Header", "Menu",
"Node", "NodeSocket", "NodeTree",
"UIList", "RenderEngine",
Expand Down
45 changes: 45 additions & 0 deletions bioxelnodes/convert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import bpy
from .utils import get_bioxels_obj


class ConvertToMesh(bpy.types.Operator):
bl_idname = "bioxelnodes.convert_to_mesh"
bl_label = "Bioxels To Mesh"
bl_description = "Convert Bioxels To Mesh."
bl_options = {'UNDO'}

def execute(self, context):
bioxels_objs = []
for obj in bpy.context.selected_objects:
bioxels_obj = get_bioxels_obj(obj)
if bioxels_obj:
bioxels_objs.append(bioxels_obj)

if len(bioxels_objs)==0:
self.report({"WARNING"}, "Cannot find any bioxels.")
return {'FINISHED'}

for bioxels_obj in bioxels_objs:
bpy.ops.mesh.primitive_cube_add(
size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
mesh_obj = bpy.context.active_object

mesh_obj.name = f"{bioxels_obj.parent.name}_Mesh"
bpy.ops.node.new_geometry_nodes_modifier()
modifier = mesh_obj.modifiers[0]
nodes = modifier.node_group.nodes
links = modifier.node_group.links

output_node = nodes.get("Group Output")
object_node = nodes.new("GeometryNodeObjectInfo")
realize_nodes = nodes.new("GeometryNodeRealizeInstances")
object_node.inputs[0].default_value = bioxels_obj
object_node.transform_space = 'RELATIVE'

links.new(object_node.outputs['Geometry'], realize_nodes.inputs[0])
links.new(realize_nodes.outputs[0], output_node.inputs[0])
bpy.ops.object.convert(target='MESH')
bpy.context.object.active_material_index = 1
bpy.ops.object.material_slot_remove()

return {'FINISHED'}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(
menu_items,
nodes_file,
root_label='CustomNodes',
root_icon=88
root_icon='NONE'
) -> None:
if not Path(nodes_file).is_file():
raise FileNotFoundError(Path(nodes_file).resolve().as_posix())
Expand All @@ -34,7 +34,7 @@ def add_node_menu(self, context):
if ('GeometryNodeTree' == bpy.context.area.spaces[0].tree_type):
layout = self.layout
layout.separator()
layout.menu(idname, icon_value=root_icon)
layout.menu(idname, icon=root_icon)

self.add_node_menu = add_node_menu

Expand Down Expand Up @@ -71,17 +71,20 @@ def draw(self, context):
elif item.get('menu_class'):
layout.menu(
item.get('menu_class').bl_idname,
icon_value=item.get('icon') or 0
icon=item.get('icon') or 'NONE'
)
else:
op = layout.operator(
'customnodes.add_custom_node', text=item.get('label'))
'customnodes.add_custom_node',
text=item.get('label'),
icon=item.get('icon') or 'NONE'
)
op.nodes_file = nodes_file
op.node_type = item['node_type']
op.node_label = item.get('label') or ""
op.node_description = item.get(
'node_description') or "Add Custom Node."
op.node_driver = item.get('node_driver') or ""
op.node_callback = item.get('node_callback') or ""

menu_classes.append(Menu)
return Menu
Expand All @@ -108,9 +111,7 @@ def add_node(self, node_tree, node_type: str):
op.nodes_file = self.nodes_file
op.node_type = item['node_type']
op.node_label = item.get('label') or ""
op.node_description = item.get(
'node_description') or "Add Custom Node."
op.node_driver = item.get('node_driver') or ""
op.node_callback = item.get('node_callback') or ""
return op.add_node(node_tree)
else:
raise RuntimeError("No custom node type found.")
Expand Down
Loading

0 comments on commit dce9627

Please sign in to comment.