Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix depth projection with ControlNet #717

Merged
merged 1 commit into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions operators/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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():
Expand Down
1 change: 0 additions & 1 deletion property_groups/dream_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
)

Expand Down