first step of pype's reorganization

This commit is contained in:
iLLiCiTiT 2020-05-25 18:20:02 +02:00
parent 19a46c7cd6
commit 15c0c10a5c
426 changed files with 517 additions and 530 deletions

View file

@ -4,7 +4,7 @@ import bpy
from avalon import api
from avalon.blender import Creator, lib
import pype.blender.plugin
import pype.hosts.blender.plugin
class CreateAction(Creator):
@ -19,7 +19,7 @@ class CreateAction(Creator):
asset = self.data["asset"]
subset = self.data["subset"]
name = pype.blender.plugin.asset_name(asset, subset)
name = pype.hosts.blender.plugin.asset_name(asset, subset)
collection = bpy.data.collections.new(name=name)
bpy.context.scene.collection.children.link(collection)
self.data['task'] = api.Session.get('AVALON_TASK')

View file

@ -4,7 +4,7 @@ import bpy
from avalon import api
from avalon.blender import Creator, lib
import pype.blender.plugin
import pype.hosts.blender.plugin
class CreateAnimation(Creator):
@ -19,7 +19,7 @@ class CreateAnimation(Creator):
asset = self.data["asset"]
subset = self.data["subset"]
name = pype.blender.plugin.asset_name(asset, subset)
name = pype.hosts.blender.plugin.asset_name(asset, subset)
collection = bpy.data.collections.new(name=name)
bpy.context.scene.collection.children.link(collection)
self.data['task'] = api.Session.get('AVALON_TASK')

View file

@ -4,7 +4,7 @@ import bpy
from avalon import api
from avalon.blender import Creator, lib
import pype.blender.plugin
import pype.hosts.blender.plugin
class CreateModel(Creator):
@ -19,7 +19,7 @@ class CreateModel(Creator):
asset = self.data["asset"]
subset = self.data["subset"]
name = pype.blender.plugin.asset_name(asset, subset)
name = pype.hosts.blender.plugin.asset_name(asset, subset)
collection = bpy.data.collections.new(name=name)
bpy.context.scene.collection.children.link(collection)
self.data['task'] = api.Session.get('AVALON_TASK')

View file

@ -4,7 +4,7 @@ import bpy
from avalon import api
from avalon.blender import Creator, lib
import pype.blender.plugin
import pype.hosts.blender.plugin
class CreateRig(Creator):
@ -19,7 +19,7 @@ class CreateRig(Creator):
asset = self.data["asset"]
subset = self.data["subset"]
name = pype.blender.plugin.asset_name(asset, subset)
name = pype.hosts.blender.plugin.asset_name(asset, subset)
collection = bpy.data.collections.new(name=name)
bpy.context.scene.collection.children.link(collection)
self.data['task'] = api.Session.get('AVALON_TASK')

View file

@ -7,12 +7,12 @@ from typing import Dict, List, Optional
from avalon import api, blender
import bpy
import pype.blender.plugin
import pype.hosts.blender.plugin
logger = logging.getLogger("pype").getChild("blender").getChild("load_action")
class BlendActionLoader(pype.blender.plugin.AssetLoader):
class BlendActionLoader(pype.hosts.blender.plugin.AssetLoader):
"""Load action from a .blend file.
Warning:
@ -42,8 +42,8 @@ class BlendActionLoader(pype.blender.plugin.AssetLoader):
libpath = self.fname
asset = context["asset"]["name"]
subset = context["subset"]["name"]
lib_container = pype.blender.plugin.asset_name(asset, subset)
container_name = pype.blender.plugin.asset_name(
lib_container = pype.hosts.blender.plugin.asset_name(asset, subset)
container_name = pype.hosts.blender.plugin.asset_name(
asset, subset, namespace
)
@ -149,7 +149,7 @@ class BlendActionLoader(pype.blender.plugin.AssetLoader):
assert libpath.is_file(), (
f"The file doesn't exist: {libpath}"
)
assert extension in pype.blender.plugin.VALID_EXTENSIONS, (
assert extension in pype.hosts.blender.plugin.VALID_EXTENSIONS, (
f"Unsupported file: {libpath}"
)

View file

@ -7,14 +7,14 @@ from typing import Dict, List, Optional
from avalon import api, blender
import bpy
import pype.blender.plugin
import pype.hosts.blender.plugin
logger = logging.getLogger("pype").getChild(
"blender").getChild("load_animation")
class BlendAnimationLoader(pype.blender.plugin.AssetLoader):
class BlendAnimationLoader(pype.hosts.blender.plugin.AssetLoader):
"""Load animations from a .blend file.
Warning:
@ -109,8 +109,8 @@ class BlendAnimationLoader(pype.blender.plugin.AssetLoader):
libpath = self.fname
asset = context["asset"]["name"]
subset = context["subset"]["name"]
lib_container = pype.blender.plugin.asset_name(asset, subset)
container_name = pype.blender.plugin.asset_name(
lib_container = pype.hosts.blender.plugin.asset_name(asset, subset)
container_name = pype.hosts.blender.plugin.asset_name(
asset, subset, namespace
)
@ -179,7 +179,7 @@ class BlendAnimationLoader(pype.blender.plugin.AssetLoader):
assert libpath.is_file(), (
f"The file doesn't exist: {libpath}"
)
assert extension in pype.blender.plugin.VALID_EXTENSIONS, (
assert extension in pype.hosts.blender.plugin.VALID_EXTENSIONS, (
f"Unsupported file: {libpath}"
)

View file

@ -7,12 +7,12 @@ from typing import Dict, List, Optional
from avalon import api, blender
import bpy
import pype.blender.plugin
import pype.hosts.blender.plugin
logger = logging.getLogger("pype").getChild("blender").getChild("load_model")
class BlendModelLoader(pype.blender.plugin.AssetLoader):
class BlendModelLoader(pype.hosts.blender.plugin.AssetLoader):
"""Load models from a .blend file.
Because they come from a .blend file we can simply link the collection that
@ -96,8 +96,8 @@ class BlendModelLoader(pype.blender.plugin.AssetLoader):
libpath = self.fname
asset = context["asset"]["name"]
subset = context["subset"]["name"]
lib_container = pype.blender.plugin.asset_name(asset, subset)
container_name = pype.blender.plugin.asset_name(
lib_container = pype.hosts.blender.plugin.asset_name(asset, subset)
container_name = pype.hosts.blender.plugin.asset_name(
asset, subset, namespace
)
@ -164,7 +164,7 @@ class BlendModelLoader(pype.blender.plugin.AssetLoader):
assert libpath.is_file(), (
f"The file doesn't exist: {libpath}"
)
assert extension in pype.blender.plugin.VALID_EXTENSIONS, (
assert extension in pype.hosts.blender.plugin.VALID_EXTENSIONS, (
f"Unsupported file: {libpath}"
)
@ -233,7 +233,7 @@ class BlendModelLoader(pype.blender.plugin.AssetLoader):
return True
class CacheModelLoader(pype.blender.plugin.AssetLoader):
class CacheModelLoader(pype.hosts.blender.plugin.AssetLoader):
"""Load cache models.
Stores the imported asset in a collection named after the asset.
@ -269,7 +269,7 @@ class CacheModelLoader(pype.blender.plugin.AssetLoader):
subset = context["subset"]["name"]
# TODO (jasper): evaluate use of namespace which is 'alien' to Blender.
lib_container = container_name = (
pype.blender.plugin.asset_name(asset, subset, namespace)
pype.hosts.blender.plugin.asset_name(asset, subset, namespace)
)
relative = bpy.context.preferences.filepaths.use_relative_paths

View file

@ -7,12 +7,12 @@ from typing import Dict, List, Optional
from avalon import api, blender
import bpy
import pype.blender.plugin
import pype.hosts.blender.plugin
logger = logging.getLogger("pype").getChild("blender").getChild("load_model")
class BlendRigLoader(pype.blender.plugin.AssetLoader):
class BlendRigLoader(pype.hosts.blender.plugin.AssetLoader):
"""Load rigs from a .blend file.
Because they come from a .blend file we can simply link the collection that
@ -108,8 +108,8 @@ class BlendRigLoader(pype.blender.plugin.AssetLoader):
libpath = self.fname
asset = context["asset"]["name"]
subset = context["subset"]["name"]
lib_container = pype.blender.plugin.asset_name(asset, subset)
container_name = pype.blender.plugin.asset_name(
lib_container = pype.hosts.blender.plugin.asset_name(asset, subset)
container_name = pype.hosts.blender.plugin.asset_name(
asset, subset, namespace
)
@ -178,7 +178,7 @@ class BlendRigLoader(pype.blender.plugin.AssetLoader):
assert libpath.is_file(), (
f"The file doesn't exist: {libpath}"
)
assert extension in pype.blender.plugin.VALID_EXTENSIONS, (
assert extension in pype.hosts.blender.plugin.VALID_EXTENSIONS, (
f"Unsupported file: {libpath}"
)

View file

@ -1,7 +1,7 @@
import os
import pype.api
import pype.blender.plugin
import pype.hosts.blender.plugin
import bpy
@ -61,7 +61,7 @@ class ExtractABC(pype.api.Extractor):
except:
continue
new_context = pype.blender.plugin.create_blender_context(active=selected[0], selected=selected)
new_context = pype.hosts.blender.plugin.create_blender_context(active=selected[0], selected=selected)
# We set the scale of the scene for the export
scene.unit_settings.scale_length = 0.01

View file

@ -3,7 +3,7 @@ from typing import List
import bpy
import pyblish.api
import pype.blender.action
import pype.hosts.blender.action
class ValidateMeshHasUvs(pyblish.api.InstancePlugin):
@ -14,7 +14,7 @@ class ValidateMeshHasUvs(pyblish.api.InstancePlugin):
families = ["model"]
category = "geometry"
label = "Mesh Has UV's"
actions = [pype.blender.action.SelectInvalidAction]
actions = [pype.hosts.blender.action.SelectInvalidAction]
optional = True
@staticmethod

View file

@ -3,7 +3,7 @@ from typing import List
import bpy
import pyblish.api
import pype.blender.action
import pype.hosts.blender.action
class ValidateMeshNoNegativeScale(pyblish.api.Validator):
@ -13,7 +13,7 @@ class ValidateMeshNoNegativeScale(pyblish.api.Validator):
hosts = ["blender"]
families = ["model"]
label = "Mesh No Negative Scale"
actions = [pype.blender.action.SelectInvalidAction]
actions = [pype.hosts.blender.action.SelectInvalidAction]
@staticmethod
def get_invalid(instance) -> List: