Skip to content

Transform your 3D texturing workflow with the power of generative AI, directly within Blender!

modify to respect blender guidlines

sakalondf82ef5825b72
diff --git a/stablegen/installer.py b/installer.py
similarity index 100%
rename from stablegen/installer.py
rename to installer.py
diff --git a/stablegen/blender_manifest.toml b/stablegen/blender_manifest.toml
index cb8a271..cf7ad91 100644
--- a/stablegen/blender_manifest.toml
+++ b/stablegen/blender_manifest.toml
@@ -1,23 +1,38 @@
schema_version = "1.0.0"
id = "stablegen"
-version = "0.0.1"
+version = "0.0.2"
name = "StableGen"
-tagline = "Seamless AI Multi-View Texturing Powered by SDXL"
+tagline = "AI-Powered Texturing"
maintainer = "Ondrej Sakala <[email protected]>"
type = "add-on"
blender_version_min = "4.2.0"
website = "https://github.com/sakalond/StableGen"
-tags = ["Object", "UV", "Mesh", "Material", "Bake", "Render"]
+tags = ["Material", "Paint", "UV"]
license = ["SPDX:GPL-3.0-or-later"]
-copyright = [
-"2024 Ondrej Sakala",
-]
platforms = ["windows-x64", "linux-x64"]
[permissions]
-network = "Connects to ComfyUI server for AI texture generation"
-files = "Saves generated textures and intermediate images to disk"
\ No newline at end of file
+network = "Connects to a local ComfyUI server for AI texture generation"
+files = "Saves generated textures, intermediate files, exported GIFs and videos"
+
+wheels = [
+ "./wheels/websocket_client-1.8.0-py3-none-any.whl",
+ "./wheels/websockets-15.0.1-py3-none-any.whl",
+ "./wheels/imageio-2.37.0-py3-none-any.whl",
+
+ # Windows specific
+
+ "./wheels/imageio_ffmpeg-0.6.0-py3-none-win_amd64.whl",
+ "./wheels/opencv_python_headless-4.11.0.86-cp37-abi3-win_amd64.whl",
+ "./wheels/pillow-11.2.1-cp311-cp311-win_amd64.whl",
+
+ # Linux specific
+
+ "./wheels/imageio_ffmpeg-0.6.0-py3-none-manylinux2014_x86_64.whl",
+ "./wheels/opencv_python_headless-4.11.0.86-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
+ "./wheels/pillow-11.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
+]
\ No newline at end of file
diff --git a/stablegen/generator.py b/stablegen/generator.py
index 6b32a9b..ca92d0c 100644
--- a/stablegen/generator.py
+++ b/stablegen/generator.py
@@ -13,16 +13,12 @@ import math
from PIL import Image
from .util.helpers import prompt_text, prompt_text_img2img # pylint: disable=relative-beyond-top-level
-from .util import install_testing # pylint: disable=relative-beyond-top-level
from .render_tools import export_emit_image, export_visibility, export_canny, bake_texture, prepare_baking, unwrap # pylint: disable=relative-beyond-top-level
from .utils import get_last_material_index, get_generation_dirs, get_file_path, get_dir_path, remove_empty_dirs # pylint: disable=relative-beyond-top-level
from .project import project_image # pylint: disable=relative-beyond-top-level
-try:
- import websocket
-except ImportError:
- install_testing.install()
- import websocket
+# Import wheels
+import websocket
def redraw_ui(context):
"""Redraws the UI to reflect changes in the operator's progress and status."""
@@ -104,6 +100,8 @@ class ComfyUIGenerate(bpy.types.Operator):
return False
if not addon_prefs.server_address:
return False
+ if bpy.app.online_access == False: # Check if online access is disabled
+ return False
return True
def execute(self, context):
diff --git a/stablegen/render_tools.py b/stablegen/render_tools.py
index c829ce4..11084b5 100644
--- a/stablegen/render_tools.py
+++ b/stablegen/render_tools.py
@@ -9,21 +9,15 @@ import mathutils
from mathutils import Matrix
import blf
from .utils import get_file_path, get_dir_path, remove_empty_dirs
-from .util import install_testing
import tempfile
import shutil
-try:
- import cv2
- import imageio
- import imageio_ffmpeg
-except ImportError or ModuleNotFoundError:
- install_testing.install()
- import imageio
- import imageio_ffmpeg
- import cv2
-import urllib.parse
from PIL import Image
+# Import wheels
+import cv2
+import imageio
+import imageio_ffmpeg
+
def apply_uv_inpaint_texture(context, obj, baked_image_path):
"""
diff --git a/stablegen/stablegen.py b/stablegen/stablegen.py
index 8b9023b..8a684ac 100755
--- a/stablegen/stablegen.py
+++ b/stablegen/stablegen.py
@@ -172,9 +172,7 @@ class StableGenPanel(bpy.types.Panel):
if width_mode == 'narrow':
cam_tools_row = layout.row()
cam_tools_row.operator("object.collect_camera_prompts", text="Collect Camera Prompts", icon="FILE_TEXT")
-
- if not hasattr(scene, 'generation_status'):
- scene.generation_status = 'idle'
+
addon_prefs = context.preferences.addons[__package__].preferences
config_error_message = None
@@ -195,7 +193,10 @@ class StableGenPanel(bpy.types.Panel):
else:
action_row.enabled = True
- if scene.generation_status == 'idle':
+ if not bpy.app.online_access:
+ action_row.operator("object.test_stable", text="Enable online access in preferences", icon="ERROR")
+ action_row.enabled = False
+ elif scene.generation_status == 'idle':
action_row.operator("object.test_stable", text="Generate", icon="PLAY")
elif scene.generation_status == 'running':
action_row.operator("object.test_stable", text="Cancel Generation", icon="CANCEL")
diff --git a/stablegen/util/install_testing.py b/stablegen/util/install_testing.py
deleted file mode 100644
index 84dbe5e..0000000
--- a/stablegen/util/install_testing.py
+++ /dev/null
@@ -1,36 +0,0 @@
-"""Install requirements in Blenders interpreter if not already installed."""
-import sys
-import subprocess
-import bpy
-import site
-
-def install():
- """
- Install pip and websocket-client in Blenders interpreter if not already installed.
- :return: None
- """
- python = sys.executable
-
- print('Installing websocket-client and websockets in Blender interpreter...')
- print('Python:', python)
-
- # Get directory for packages
- packages_dir = bpy.utils.user_resource('SCRIPTS', path='modules', create=True)
- if packages_dir not in sys.path:
- sys.path.append(packages_dir)
- site.addsitedir(packages_dir)
-
- try:
- import websocket #NOTE: websocket-client (https://github.com/websocket-client/websocket-client)
- import websockets
- import imageio
- import imageio_ffmpeg
- import cv2
- except ImportError or ModuleNotFoundError:
- subprocess.check_call([python, '-m', 'ensurepip'])
- subprocess.check_call([python, '-m', 'pip', 'install', '--upgrade', '--target', packages_dir, 'pip'])
- subprocess.check_call([python, '-m', 'pip', 'install', '--target', packages_dir, 'websocket-client'])
- subprocess.check_call([python, '-m', 'pip', 'install', '--target', packages_dir, 'websockets'])
- subprocess.check_call([python, '-m', 'pip', 'install', '--target', packages_dir, 'imageio'])
- subprocess.check_call([python, '-m', 'pip', 'install', '--target', packages_dir, 'imageio-ffmpeg'])
- subprocess.check_call([python, '-m', 'pip', 'install', '--target', packages_dir, 'opencv-python'])