mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Added blendScene family
This commit is contained in:
parent
585df83135
commit
aaafb9ccf2
5 changed files with 57 additions and 4 deletions
51
openpype/hosts/blender/plugins/create/create_blendScene.py
Normal file
51
openpype/hosts/blender/plugins/create/create_blendScene.py
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
"""Create a Blender scene asset."""
|
||||
|
||||
import bpy
|
||||
|
||||
from openpype.pipeline import get_current_task_name
|
||||
from openpype.hosts.blender.api import plugin, lib, ops
|
||||
from openpype.hosts.blender.api.pipeline import AVALON_INSTANCES
|
||||
|
||||
|
||||
class CreateBlendScene(plugin.Creator):
|
||||
"""Generic group of assets"""
|
||||
|
||||
name = "blendScene"
|
||||
label = "Blender Scene"
|
||||
family = "blendScene"
|
||||
icon = "cubes"
|
||||
|
||||
def process(self):
|
||||
""" Run the creator on Blender main thread"""
|
||||
mti = ops.MainThreadItem(self._process)
|
||||
ops.execute_in_main_thread(mti)
|
||||
|
||||
def _process(self):
|
||||
# Get Instance Container or create it if it does not exist
|
||||
instances = bpy.data.collections.get(AVALON_INSTANCES)
|
||||
if not instances:
|
||||
instances = bpy.data.collections.new(name=AVALON_INSTANCES)
|
||||
bpy.context.scene.collection.children.link(instances)
|
||||
|
||||
# Create instance object
|
||||
asset = self.data["asset"]
|
||||
subset = self.data["subset"]
|
||||
name = plugin.asset_name(asset, subset)
|
||||
asset_group = bpy.data.objects.new(name=name, object_data=None)
|
||||
asset_group.empty_display_type = 'SINGLE_ARROW'
|
||||
instances.objects.link(asset_group)
|
||||
self.data['task'] = get_current_task_name()
|
||||
lib.imprint(asset_group, self.data)
|
||||
|
||||
# Add selected objects to instance
|
||||
if (self.options or {}).get("useSelection"):
|
||||
bpy.context.view_layer.objects.active = asset_group
|
||||
selected = lib.get_selection()
|
||||
for obj in selected:
|
||||
if obj.parent in selected:
|
||||
obj.select_set(False)
|
||||
continue
|
||||
selected.append(asset_group)
|
||||
bpy.ops.object.parent_set(keep_transform=True)
|
||||
|
||||
return asset_group
|
||||
|
|
@ -20,7 +20,7 @@ from openpype.hosts.blender.api.pipeline import (
|
|||
class BlendLoader(plugin.AssetLoader):
|
||||
"""Load assets from a .blend file."""
|
||||
|
||||
families = ["model", "rig", "layout", "camera"]
|
||||
families = ["model", "rig", "layout", "camera", "blendScene"]
|
||||
representations = ["blend"]
|
||||
|
||||
label = "Append Blend"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class ExtractBlend(publish.Extractor):
|
|||
|
||||
label = "Extract Blend"
|
||||
hosts = ["blender"]
|
||||
families = ["model", "camera", "rig", "action", "layout"]
|
||||
families = ["model", "camera", "rig", "action", "layout", "blendScene"]
|
||||
optional = True
|
||||
|
||||
def process(self, instance):
|
||||
|
|
|
|||
|
|
@ -137,7 +137,8 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
"mvUsdOverride",
|
||||
"simpleUnrealTexture",
|
||||
"online",
|
||||
"uasset"
|
||||
"uasset",
|
||||
"blendScene"
|
||||
]
|
||||
|
||||
default_template_name = "publish"
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@
|
|||
"camera",
|
||||
"rig",
|
||||
"action",
|
||||
"layout"
|
||||
"layout",
|
||||
"blendScene"
|
||||
]
|
||||
},
|
||||
"ExtractFBX": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue