Skip to content

Commit

Permalink
Add test backend addon
Browse files Browse the repository at this point in the history
  • Loading branch information
carson-katri committed Apr 28, 2023
1 parent 867755e commit a11bc18
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ def generate(
def register(cls):
from ...property_groups.dream_prompt import DreamPrompt
setattr(DreamPrompt, cls._attribute(), bpy.props.PointerProperty(type=cls))

@classmethod
def unregister(cls):
from ...property_groups.dream_prompt import DreamPrompt
delattr(DreamPrompt, cls._attribute())

@classmethod
def _id(cls) -> str:
Expand Down
33 changes: 33 additions & 0 deletions community_backends/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
bl_info = {
"name": "Test Backend",
"blender": (3, 1, 0),
"category": "Paint",
}

import bpy
from typing import List, Tuple
from dream_textures.api import *

class TestBackend(Backend):
name = "Test"
description = "A short description of this backend"

custom_optimization: bpy.props.BoolProperty(name="My Custom Optimization")

def list_models(self, context) -> List[Model]:
return []

def list_schedulers(self, context) -> List[str]:
return []

def generate(self, task: Task, model: Model, prompt: Prompt, size: Tuple[int, int] | None, seed: int, steps: int, guidance_scale: float, scheduler: str, seamless_axes: SeamlessAxes, step_preview_mode: StepPreviewMode, iterations: int, step_callback: StepCallback, callback: Callback):
raise NotImplementedError()

def draw_speed_optimizations(self, layout, context):
layout.prop(self, "custom_optimization")

def register():
bpy.utils.register_class(TestBackend)

def unregister():
bpy.utils.unregister_class(TestBackend)

0 comments on commit a11bc18

Please sign in to comment.