Skip to content

Commit

Permalink
Added maya IHost
Browse files Browse the repository at this point in the history
  • Loading branch information
munkybutt committed Mar 30, 2024
1 parent 4c377c0 commit eb4990d
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 3 deletions.
2 changes: 1 addition & 1 deletion PYProjects/skin_plus_plus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _activate_host_():
current_host_interface = IHost()

elif "maya" in executable:
from .dccs.maya import Host
from .dccs.maya import IHost

current_host_interface = IHost()

Expand Down
Binary file not shown.
4 changes: 4 additions & 0 deletions PYProjects/skin_plus_plus/dccs/maya/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .core import IHost


__all__ = ("IHost",)
39 changes: 39 additions & 0 deletions PYProjects/skin_plus_plus/dccs/maya/core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from __future__ import annotations

import pathlib
import pymel.core as pm_core
import pymel.core.nodetypes as pm_ntypes

from .. import core
from pymel import versions


class IHost(core.IHost):

@property
def name(self) -> str:
return "maya"

@property
def api_name(self) -> str:
return "pymaya"

def _get_version_number(self) -> str:
version_number = str(versions.current())[:4]
return version_number

def get_current_file_path(self) -> pathlib.Path:
scene_name = pm_core.sceneName()
if not scene_name:
raise RuntimeError("File is not saved!")

return pathlib.Path(scene_name)

def get_selection(self) -> tuple[pm_ntypes.DagNode, ...]:
return tuple(pm_core.ls(selection=True))

def get_node_name(self, node: pm_ntypes.DagNode) -> str:
return node.name(stripNamespace=True)

def get_node_handle(self, node: pm_ntypes.DagNode) -> str:
return node.longName()
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ PYBIND11_MODULE(skin_plus_plus_pymaya, m) {

},
"Get Vertex Positions",
py::arg("name")
py::arg("name"),
py::arg("safeMode") = true
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
<TargetExt>.pyd</TargetExt>
<IncludePath>$(THIRD_PARTY_EIGEN);$(THIRD_PARTY_FMT)\include;$(ProjectDir);$(ProjectDir)..\skin_plus_plus_py\headers;$(ADSK_MAYA_SDK_2024)\include;$(PYTHON_310)\include;$(PYBIND11_310)\include;$(IncludePath)</IncludePath>
<LibraryPath>$(ADSK_MAYA_SDK_2024)\lib;$(PYTHON_310)\libs;$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)..\..\PYProjects\skin_plus_plus\dccs\maya\$(ProjectName)_2024\</OutDir>
<OutDir>$(SolutionDir)..\..\PYProjects\skin_plus_plus\dccs\maya\2024\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='2023-Debug|x64'">
<LinkIncremental>true</LinkIncremental>
Expand Down

0 comments on commit eb4990d

Please sign in to comment.