commit ab7506c35cba6b107d7410d3b0799ec1d40bd5d2 Author: yemiancheng Date: Sun Jul 14 20:08:10 2024 +0800 build(core): init diff --git a/.github/workflows/publish_to_comfy.yml b/.github/workflows/publish_to_comfy.yml new file mode 100644 index 0000000..b278ccd --- /dev/null +++ b/.github/workflows/publish_to_comfy.yml @@ -0,0 +1,21 @@ +name: Publish to Comfy registry +on: + workflow_dispatch: + push: + branches: + - main + paths: + - "pyproject.toml" + +jobs: + publish-node: + name: Publish Custom Node to registry + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Publish Custom Node + uses: Comfy-Org/publish-node-action@main + with: + ## Add your own personal access token to your Github Repository secrets and reference it here. + personal_access_token: ${{ secrets.COMFY_REGISTRY_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..10a149b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +models +__pycache__ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..93e7c96 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 ymc-github + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e7b5ddd --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +
+

ymc-node-as-x-type

+

+ 🤖 some comfyui custom nodes to set it as known type. +

+ +
+ +## Features + +- feat(core): node to set it as any type +- feat(core): node to set it as image type +- feat(core): node to set it as model type +- feat(core): node to set it as clip type +- feat(core): node to set it as vae type +- feat(core): node to set it as conditioning type +- feat(core): node to set it as latent type +- feat(core): node to set it as string type +- feat(core): node to set it as int type +- feat(core): node to set it as float type +- feat(core): node to set it as number type + +## Install + +```bash +# cd to comfyui/custom_nodes +git clone https://github.com/ymc-github/ymc-node-as-x-type +``` + +- **deps will be installed automatically** if requirements in requirements.txtnot installed when comfyui up + +## Usage + +- you can find it in search box : double click + typing `set it as` +- you can find it in right mouse menu : `YMC/LINK` +- you can find it in right mouse menu : `YMC/as_x_type` (as alias) + +## Based-on + +- pypi package [yors_comfyui_node_setup](https://pypi.org/project/yors_comfyui_node_setup/) +- pypi package [yors_comfyui_node_as_x_type](https://pypi.org/project/yors_comfyui_node_as_x_type/) + +## Published to Comfy registry + +- get more details in [publish_to_comfy.yml](.github/workflows/publish_to_comfy.yml) + +- [docs for publishing to comfy registey](https://docs.comfy.org/registry/overview) + +## Author + +ymc-github + +## License + +MIT diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..edf96e7 --- /dev/null +++ b/__init__.py @@ -0,0 +1,31 @@ +# v1 +# from yors_comfyui_node_setup import entry,node_install_requirements # global + +# # install requirements +# node_install_requirements(__file__) + +# # export comfyui node vars +# __all__,NODE_CLASS_MAPPINGS,NODE_DISPLAY_NAME_MAPPINGS,NODE_MENU_NAMES = entry(__name__,__file__) + +# v2 +from yors_comfyui_node_setup import node_install_requirements,entry_pre_import,entry_import,get_all_classs_in_sys,register_node_list_local + +# install requirements +node_install_requirements(__file__) + +# gen __all__ +__all__ = entry_pre_import(__name__,__file__) + +# import moudle with __all__ +entry_import(__name__,__all__) + +# get class after importing moudle with __all__ +this_module_all_classes = get_all_classs_in_sys(__name__) + +# register node with default category +# NODE_CLASS_MAPPINGS,NODE_DISPLAY_NAME_MAPPINGS,NODE_MENU_NAMES = register_node_list(this_module_all_classes,False) + +# addtional register node with custom category +NODE_CLASS_MAPPINGS,NODE_DISPLAY_NAME_MAPPINGS,NODE_MENU_NAMES = register_node_list_local(this_module_all_classes,True,"YMC/as_x_type") +# print(NODE_CLASS_MAPPINGS,NODE_DISPLAY_NAME_MAPPINGS,NODE_MENU_NAMES) +print("\n".join(NODE_MENU_NAMES)) \ No newline at end of file diff --git a/nodes.py b/nodes.py new file mode 100644 index 0000000..00ce71f --- /dev/null +++ b/nodes.py @@ -0,0 +1,21 @@ +# 1. define yors comfyui nodes here +# ... + +# ucase 1.1: +from yors_comfyui_node_as_x_type import * # import all yors comfyui nodes from it + +# ucase 1.2: +# from yors_comfyui_node_as_x_type import NodeSetItAsImage # import some yors comfyui nodes from it + + +# 2. reset yors comfyui nodes category (it will be used set rmb in yors_comfyui_node_setup) +# from yors_comfyui_node_reset_rmb import reset_rmb +# reset_rmb(__name__,"YMC/as_x_type") // danger! + +# 3. set nodes category alias +# to set the right mouse menu as your likes. + +import yors_comfyui_node_as_x_type as base +from yors_comfyui_node_setup import get_sys_module,set_node_class_category_alias +this_py_module = get_sys_module(__name__) +set_node_class_category_alias(base,this_py_module,"YMC/as_x_type",True) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1021d1e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[project] +name = "ymc-node-as-x-type" +description = "some comfyui custom nodes to set it as known type" +version = "0.1.0" +license = "LICENSE" + +[project.urls] +Repository = "https://github.com/ymc-github/ymc-node-as-x-type" +# Used by Comfy Registry https://comfyregistry.org + +[tool.comfy] +PublisherId = "ymc-github" +DisplayName = "ymc-node-as-x-type" +Icon = "" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..666a8eb --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +yors_comfyui_node_setup +yors_comfyui_node_as_x_type \ No newline at end of file