Skip to content

Commit

Permalink
Merge branch 'develop' into enhancement/usd_allow_custom_aov_identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
MustafaJafar authored Dec 12, 2024
2 parents 8d46759 + 072ffcb commit 4ef6e6e
Show file tree
Hide file tree
Showing 25 changed files with 543 additions and 52 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/assign_pr_to_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: 🔸Auto assign pr
on:
workflow_dispatch:
inputs:
pr_number:
type: string
description: "Run workflow for this PR number"
required: true
project_id:
type: string
description: "Github Project Number"
required: true
default: "16"
pull_request:
types:
- opened

env:
GH_TOKEN: ${{ github.token }}

jobs:
get-pr-repo:
runs-on: ubuntu-latest
outputs:
pr_repo_name: ${{ steps.get-repo-name.outputs.repo_name || github.event.pull_request.head.repo.full_name }}

# INFO `github.event.pull_request.head.repo.full_name` is not available on manual triggered (dispatched) runs
steps:
- name: Get PR repo name
if: ${{ github.event_name == 'workflow_dispatch' }}
id: get-repo-name
run: |
repo_name=$(gh pr view ${{ inputs.pr_number }} --json headRepository,headRepositoryOwner --repo ${{ github.repository }} | jq -r '.headRepositoryOwner.login + "/" + .headRepository.name')
echo "repo_name=$repo_name" >> $GITHUB_OUTPUT
auto-assign-pr:
needs:
- get-pr-repo
if: ${{ needs.get-pr-repo.outputs.pr_repo_name == github.repository }}
uses: ynput/ops-repo-automation/.github/workflows/pr_to_project.yml@main
with:
repo: "${{ github.repository }}"
project_id: ${{ inputs.project_id != '' && fromJSON(inputs.project_id) || 16 }}
pull_request_number: ${{ github.event.pull_request.number || fromJSON(inputs.pr_number) }}
secrets:
# INFO fallback to default `github.token` is required for PRs from forks
# INFO organization secrets won't be available to forks
token: ${{ secrets.YNPUT_BOT_TOKEN || github.token}}
18 changes: 18 additions & 0 deletions .github/workflows/validate_pr_labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 🔎 Validate PR Labels
on:
pull_request:
types:
- opened
- edited
- labeled
- unlabeled

jobs:
validate-type-label:
uses: ynput/ops-repo-automation/.github/workflows/validate_pr_labels.yml@main
with:
repo: "${{ github.repository }}"
pull_request_number: ${{ github.event.pull_request.number }}
query_prefix: "type: "
secrets:
token: ${{ secrets.YNPUT_BOT_TOKEN }}
8 changes: 8 additions & 0 deletions client/ayon_houdini/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ def containerise(name,
"namespace": namespace,
"loader": str(loader),
"representation": context["representation"]["id"],
"project_name": context["project"]["name"]
}

lib.imprint(container, data)
Expand Down Expand Up @@ -285,6 +286,13 @@ def parse_container(container):
pass
data[name] = value

# Support project name in container as optional attribute
for name in ["project_name"]:
parm = container.parm(name)
if not parm:
continue
data[name] = parm.eval()

# Backwards compatibility pre-schemas for containers
data["schema"] = data.get("schema", "openpype:container-1.0")

Expand Down
25 changes: 25 additions & 0 deletions client/ayon_houdini/plugins/create/create_alembic_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Creator plugin for creating alembic camera products."""
from ayon_houdini.api import plugin
from ayon_core.pipeline import CreatorError
from ayon_core.lib import EnumDef

import hou

Expand All @@ -14,10 +15,16 @@ class CreateAlembicCamera(plugin.HoudiniCreator):
product_type = "camera"
icon = "camera"

# Default render target
render_target = "local"

def create(self, product_name, instance_data, pre_create_data):
import hou

instance_data.update({"node_type": "alembic"})
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
creator_attributes["render_target"] = pre_create_data["render_target"]

instance = super(CreateAlembicCamera, self).create(
product_name,
Expand Down Expand Up @@ -54,3 +61,21 @@ def get_network_categories(self):
hou.ropNodeTypeCategory(),
hou.objNodeTypeCategory()
]

def get_instance_attr_defs(self):
render_target_items = {
"local": "Local machine rendering",
"local_no_render": "Use existing frames (local)",
"farm": "Farm Rendering",
}

return [
EnumDef("render_target",
items=render_target_items,
label="Render target",
default=self.render_target)
]

def get_pre_create_attr_defs(self):
attrs = super().get_pre_create_attr_defs()
return attrs + self.get_instance_attr_defs()
20 changes: 15 additions & 5 deletions client/ayon_houdini/plugins/create/create_arnold_ass.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Creator plugin for creating Arnold ASS files."""
from ayon_houdini.api import plugin
from ayon_core.lib import BoolDef
from ayon_core.lib import EnumDef


class CreateArnoldAss(plugin.HoudiniCreator):
Expand All @@ -17,13 +17,16 @@ class CreateArnoldAss(plugin.HoudiniCreator):
# will override it by the value in the project settings
ext = ".ass"

# Default render target
render_target = "local"

def create(self, product_name, instance_data, pre_create_data):
import hou

instance_data.update({"node_type": "arnold"})
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
creator_attributes["farm"] = pre_create_data["farm"]
creator_attributes["render_target"] = pre_create_data["render_target"]

instance = super(CreateArnoldAss, self).create(
product_name,
Expand Down Expand Up @@ -57,10 +60,17 @@ def create(self, product_name, instance_data, pre_create_data):
self.lock_parameters(instance_node, to_lock)

def get_instance_attr_defs(self):
render_target_items = {
"local": "Local machine rendering",
"local_no_render": "Use existing frames (local)",
"farm": "Farm Rendering",
}

return [
BoolDef("farm",
label="Submitting to Farm",
default=False)
EnumDef("render_target",
items=render_target_items,
label="Render target",
default=self.render_target)
]

def get_pre_create_attr_defs(self):
Expand Down
20 changes: 15 additions & 5 deletions client/ayon_houdini/plugins/create/create_bgeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ayon_houdini.api import plugin
from ayon_core.pipeline import CreatorError
import hou
from ayon_core.lib import EnumDef, BoolDef
from ayon_core.lib import EnumDef


class CreateBGEO(plugin.HoudiniCreator):
Expand All @@ -13,6 +13,9 @@ class CreateBGEO(plugin.HoudiniCreator):
product_type = "pointcache"
icon = "gears"

# Default render target
render_target = "local"

def get_publish_families(self):
return ["pointcache", "bgeo"]

Expand All @@ -21,7 +24,7 @@ def create(self, product_name, instance_data, pre_create_data):
instance_data.update({"node_type": "geometry"})
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
creator_attributes["farm"] = pre_create_data["farm"]
creator_attributes["render_target"] = pre_create_data["render_target"]

instance = super(CreateBGEO, self).create(
product_name,
Expand Down Expand Up @@ -63,10 +66,17 @@ def create(self, product_name, instance_data, pre_create_data):
instance_node.setParms(parms)

def get_instance_attr_defs(self):
render_target_items = {
"local": "Local machine rendering",
"local_no_render": "Use existing frames (local)",
"farm": "Farm Rendering",
}

return [
BoolDef("farm",
label="Submitting to Farm",
default=False)
EnumDef("render_target",
items=render_target_items,
label="Render target",
default=self.render_target)
]

def get_pre_create_attr_defs(self):
Expand Down
43 changes: 40 additions & 3 deletions client/ayon_houdini/plugins/create/create_hda.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ def set_tool_submenu(hda_def,
# endregion


def promote_spare_parameters(node):
"""Promote spare parameters to HDA node type definition"""
ptg = node.parmTemplateGroup()
node.type().definition().setParmTemplateGroup(ptg)


class CreateHDA(plugin.HoudiniCreator):
"""Publish Houdini Digital Asset file."""

Expand Down Expand Up @@ -178,12 +184,27 @@ def create_instance_node(
if pre_create_data is None:
pre_create_data = {}

use_promote_spare_parameters = pre_create_data.get(
"use_promote_spare_parameters", True)

if self.selected_nodes:
# if we have `use selection` enabled, and we have some
# selected nodes ...
if self.selected_nodes[0].type().name() == "subnet":
to_hda = self.selected_nodes[0]
one_node_selected = len(self.selected_nodes) == 1
first_selected_node = self.selected_nodes[0]

# If only an HDA is selected, publish just that node as HDA.
if one_node_selected and first_selected_node.type().definition():
to_hda = first_selected_node
use_promote_spare_parameters = False

# If only a single subnet is selected, turn that into the HDA.
elif one_node_selected and first_selected_node.type().name() == "subnet":
to_hda = first_selected_node
to_hda.setName("{}_subnet".format(node_name), unique_name=True)

# Collapse all selected nodes into a subnet and turn that into
# the HDA.
else:
parent_node = self.selected_nodes[0].parent()
subnet = parent_node.collapseIntoSubnet(
Expand All @@ -202,6 +223,7 @@ def create_instance_node(

to_hda = parent_node.createNode(
"subnet", node_name="{}_subnet".format(node_name))

if not to_hda.type().definition():
# if node type has not its definition, it is not user
# created hda. We test if hda can be created from the node.
Expand All @@ -222,8 +244,17 @@ def create_instance_node(
name=type_name,
description=node_name,
hda_file_name="$HIP/{}.hda".format(node_name),
ignore_external_references=True
ignore_external_references=True,
min_num_inputs=0,
max_num_inputs=len(to_hda.inputs()) or 1,
)

if use_promote_spare_parameters:
# Similar to Houdini default behavior, when enabled this will
# promote spare parameters to type properties on initial
# creation of the HDA.
promote_spare_parameters(hda_node)

hda_node.layoutChildren()
elif self._check_existing(folder_path, node_name):
raise CreatorError(
Expand Down Expand Up @@ -279,6 +310,12 @@ def get_pre_create_attr_defs(self):
"'AYON/project_name/your_HDA_name'",
default=True,
label="Use Project as menu entry"),
BoolDef("use_promote_spare_parameters",
tooltip="Similar to Houdini default behavior, when "
"enabled this will promote spare parameters to "
"type properties on initial creation of the HDA.",
default=True,
label="Promote Spare Parameters"),
]

def get_dynamic_data(
Expand Down
20 changes: 15 additions & 5 deletions client/ayon_houdini/plugins/create/create_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"""

from ayon_houdini.api import plugin
from ayon_core.lib import BoolDef
from ayon_core.lib import EnumDef

import hou

Expand All @@ -24,14 +24,17 @@ class CreateModel(plugin.HoudiniCreator):
product_type = "model"
icon = "cube"

# Default render target
render_target = "local"

def get_publish_families(self):
return ["model", "abc"]

def create(self, product_name, instance_data, pre_create_data):
instance_data.update({"node_type": "alembic"})
creator_attributes = instance_data.setdefault(
"creator_attributes", dict())
creator_attributes["farm"] = pre_create_data["farm"]
creator_attributes["render_target"] = pre_create_data["render_target"]

instance = super(CreateModel, self).create(
product_name,
Expand Down Expand Up @@ -130,10 +133,17 @@ def get_obj_output(self, obj_node):
key=lambda node: node.evalParm('outputidx'))

def get_instance_attr_defs(self):
render_target_items = {
"local": "Local machine rendering",
"local_no_render": "Use existing frames (local)",
"farm": "Farm Rendering",
}

return [
BoolDef("farm",
label="Submitting to Farm",
default=False)
EnumDef("render_target",
items=render_target_items,
label="Render target",
default=self.render_target)
]

def get_pre_create_attr_defs(self):
Expand Down
Loading

0 comments on commit 4ef6e6e

Please sign in to comment.