diff --git a/__init__.py b/__init__.py index 5d24d69a..a11be386 100644 --- a/__init__.py +++ b/__init__.py @@ -16,7 +16,7 @@ "author": "Dream Textures contributors", "description": "Use Stable Diffusion to generate unique textures straight from the shader editor.", "blender": (3, 1, 0), - "version": (0, 2, 0), + "version": (0, 3, 0), "location": "Image Editor -> Sidebar -> Dream", "category": "Paint" } diff --git a/generator_process/actions/load_model.py b/generator_process/actions/load_model.py index b930fa4a..76a66da0 100644 --- a/generator_process/actions/load_model.py +++ b/generator_process/actions/load_model.py @@ -137,7 +137,7 @@ def _convert_pipe(cache, model, pipe, model_class, half_precision, scheduler, ** if model_class.__name__ not in { # some tasks are not supported by auto pipeline 'DreamTexturesDepth2ImgPipeline', - 'StableDiffusionUpscalePipeline' + 'StableDiffusionUpscalePipeline', }: pipe = model_class.from_pipe(pipe, **kwargs) scheduler.create(pipe) diff --git a/generator_process/actions/prompt_to_image.py b/generator_process/actions/prompt_to_image.py index d1405acd..9b9fdada 100644 --- a/generator_process/actions/prompt_to_image.py +++ b/generator_process/actions/prompt_to_image.py @@ -51,7 +51,7 @@ def prompt_to_image( device = self.choose_device(optimizations) # Stable Diffusion pipeline w/ caching - if device == "cuda" and (optimizations.cpu_offloading(device) or torch.cuda.mem_get_info()[1] > 20 * 1024**3 * (1 if optimizations.can_use_half(device) else 2)): + if sdxl_refiner_model is not None and device == "cuda" and (optimizations.cpu_offloading(device) or torch.cuda.mem_get_info()[1] > 20 * 1024**3 * (1 if optimizations.can_use_half(device) else 2)): pipe, refiner = self.load_model(diffusers.AutoPipelineForText2Image, model, optimizations, scheduler, sdxl_refiner_model=sdxl_refiner_model) else: pipe = self.load_model(diffusers.AutoPipelineForText2Image, model, optimizations, scheduler) diff --git a/operators/project.py b/operators/project.py index fc275617..da27e214 100644 --- a/operators/project.py +++ b/operators/project.py @@ -31,22 +31,24 @@ def _validate_projection(context): if len(context.selected_objects) == 0: - def fix_selection(context, layout): - if context.object.mode != 'OBJECT': - layout.operator("object.mode_set", text="Switch to Object Mode", icon="OBJECT_DATAMODE").mode = 'OBJECT' - layout.operator("object.select_by_type", text="Select All Meshes", icon="RESTRICT_SELECT_OFF").type = 'MESH' + def object_mode_operator(operator): + operator.mode = 'OBJECT' + def select_by_type_operator(operator): + operator.type = 'MESH' raise FixItError( """No objects selected Select at least one object to project onto.""", - fix_selection + FixItError.RunOperator("Switch to Object Mode", "object.mode_set", object_mode_operator) + if context.object.mode != 'OBJECT' + else FixItError.RunOperator("Select All Meshes", "object.select_by_type", select_by_type_operator) ) if context.object is not None and context.object.mode != 'EDIT': - def fix_mode(_, layout): - layout.operator("object.mode_set", text="Switch to Edit Mode", icon="EDITMODE_HLT").mode = 'EDIT' + def fix_mode(operator): + operator.mode = 'EDIT' raise FixItError( """Enter edit mode In edit mode, select the faces to project onto.""", - fix_mode + FixItError.RunOperator("Switch to Edit Mode", "object.mode_set", fix_mode) ) has_selection = False for obj in context.selected_objects: @@ -63,7 +65,7 @@ def fix_mode(_, layout): raise FixItError( """No faces selected. Select at least one face to project onto.""", - lambda ctx, layout: None + FixItError.RunOperator("Select All Faces", "mesh.select_all", lambda _: None) ) def dream_texture_projection_panels(): diff --git a/property_groups/dream_prompt.py b/property_groups/dream_prompt.py index c184c21b..3e3eb238 100644 --- a/property_groups/dream_prompt.py +++ b/property_groups/dream_prompt.py @@ -285,7 +285,6 @@ def generate_args(self, context, iteration=0, init_image=None, control_images=No net.conditioning_scale ) for i, net in enumerate(self.control_nets) - if net.control_image is not None ] ) diff --git a/requirements/linux-rocm.txt b/requirements/linux-rocm.txt index fdb81b33..6c01b37d 100644 --- a/requirements/linux-rocm.txt +++ b/requirements/linux-rocm.txt @@ -1,4 +1,4 @@ -diffusers==0.20.2 +git+https://github.com/huggingface/diffusers.git@d1222064669a758c476014fb7a09e24a0c907222 invisible-watermark transformers accelerate diff --git a/requirements/mac-mps-cpu.txt b/requirements/mac-mps-cpu.txt index 9ff3e201..8823a335 100644 --- a/requirements/mac-mps-cpu.txt +++ b/requirements/mac-mps-cpu.txt @@ -1,4 +1,4 @@ -diffusers==0.20.2 +git+https://github.com/huggingface/diffusers.git@d1222064669a758c476014fb7a09e24a0c907222 invisible-watermark transformers accelerate diff --git a/requirements/win-dml.txt b/requirements/win-dml.txt index c5b4c36d..4802a5fe 100644 --- a/requirements/win-dml.txt +++ b/requirements/win-dml.txt @@ -1,4 +1,4 @@ -diffusers==0.20.2 +git+https://github.com/huggingface/diffusers.git@d1222064669a758c476014fb7a09e24a0c907222 invisible-watermark transformers accelerate diff --git a/requirements/win-linux-cuda.txt b/requirements/win-linux-cuda.txt index 4022fb6c..dfb64cb6 100644 --- a/requirements/win-linux-cuda.txt +++ b/requirements/win-linux-cuda.txt @@ -1,4 +1,4 @@ -diffusers==0.20.2 +git+https://github.com/huggingface/diffusers.git@d1222064669a758c476014fb7a09e24a0c907222 invisible-watermark transformers accelerate diff --git a/version.py b/version.py index ff049fa8..7f0dae1d 100644 --- a/version.py +++ b/version.py @@ -1,4 +1,4 @@ -VERSION = (0, 2, 0) +VERSION = (0, 3, 0) def version_tag(version): return f"{version[0]}.{version[1]}.{version[2]}"