Skip to content

Commit

Permalink
Fix Blender Host
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyprien CAILLOT committed Dec 5, 2024
1 parent 0334f6e commit e2b971f
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 17 deletions.
22 changes: 10 additions & 12 deletions src/quadpype/hosts/blender/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
ILoadHost
)
from quadpype.client import get_asset_by_name
from quadpype.lib import filter_profiles
from quadpype.pipeline import (
schema,
get_current_asset_name,
Expand All @@ -29,7 +28,8 @@
deregister_creator_plugin_path,
AVALON_CONTAINER_ID,
Anatomy,
get_current_project_name
get_current_project_name,
get_current_task_name
)

from quadpype.pipeline.context_tools import get_template_data_from_session
Expand Down Expand Up @@ -284,19 +284,17 @@ def set_frame_range(data):
fps = data.get("fps")

# Should handles be included, defined by settings
task_name = get_current_task_name()
settings = get_project_settings(get_current_project_name())
task_type = data.get("taskType")
include_handles_settings = settings["blender"]["include_handles"]
current_task = data.get("tasks").get(task_name)

include_handles = include_handles_settings["include_handles_default"]
profile = filter_profiles(
include_handles_settings["profiles"],
key_values={
"task_types": task_type,
"task_names": data["name"]
}
)
if profile:
include_handles = profile["include_handles"]
for item in include_handles_settings["profiles"]:
if current_task["type"] in item["task_type"]:
include_handles = item["include_handles"]
break

if include_handles:
frame_start -= int(data.get("handleStart", 0))
frame_end += int(data.get("handleEnd", 0))
Expand Down
5 changes: 1 addition & 4 deletions src/quadpype/hosts/blender/plugins/create/create_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import bpy

from quadpype.lib import version_up
from quadpype.pipeline.context_tools import version_up_current_workfile
from quadpype.hosts.blender.api import plugin, lib
from quadpype.hosts.blender.api.render_lib import prepare_rendering
from quadpype.hosts.blender.api.workio import save_file
Expand Down Expand Up @@ -40,9 +39,7 @@ def create(
# settings. Even the validator to check that the file is saved will
# detect the file as saved, even if it isn't. The only solution for
# now it is to force the file to be saved.
if not bpy.data.filepath:
version_up_current_workfile()
else:
if bpy.data.filepath:
filepath = version_up(bpy.data.filepath)
save_file(filepath, copy=False)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import bpy

from quadpype.hosts.blender.api.plugin import BlenderCreator
from quadpype.pipeline import CreatedInstance, AutoCreator
from quadpype.client import get_asset_by_name
from quadpype.hosts.blender.api.pipeline import (
Expand Down
4 changes: 4 additions & 0 deletions src/quadpype/settings/defaults/project_settings/blender.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
},
"set_resolution_startup": true,
"set_frames_startup": true,
"include_handles": {
"include_handles_default": false,
"profiles": []
},
"imageio": {
"activate_host_color_management": true,
"ocio_config": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,44 @@
}
}
]
},
{
"type": "dict",
"key": "include_handles",
"collapsible": true,
"label": "Include/Exclude Handles in default playback & render range",
"children": [
{
"type": "label",
"label": "WARNING: Do not add the same task in multiple items of the include/exclude list below."
},
{
"key": "include_handles_default",
"label": "Include handles by default",
"type": "boolean"
},
{
"type": "list",
"key": "profiles",
"label": "Include/exclude handles by task type",
"use_label_wrap": true,
"object_type": {
"type": "dict",
"children": [
{
"type": "task-types-enum",
"key": "task_type",
"label": "Task types"
},
{
"type": "boolean",
"key": "include_handles",
"label": "Include handles"
}
]
}
}
]
},
{
"type": "schema_template",
Expand Down

0 comments on commit e2b971f

Please sign in to comment.