Skip to content

Commit

Permalink
Merge pull request #869 from mattyjams/pr/wrap_UFE_runTimeId_getters_…
Browse files Browse the repository at this point in the history
…to_Python

wrap UFE runtime ID getters for Maya and USD to Python
  • Loading branch information
Krystian Ligenza authored Oct 27, 2020
2 parents 0ded116 + ef8426b commit c082142
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 11 deletions.
1 change: 1 addition & 0 deletions lib/mayaUsd/ufe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ add_library(${UFE_PYTHON_TARGET_NAME} SHARED)
target_sources(${UFE_PYTHON_TARGET_NAME}
PRIVATE
module.cpp
wrapGlobal.cpp
wrapUtils.cpp
wrapNotice.cpp
)
Expand Down
1 change: 1 addition & 0 deletions lib/mayaUsd/ufe/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
PXR_NAMESPACE_USING_DIRECTIVE

TF_WRAP_MODULE {
TF_WRAP(Global);
TF_WRAP(Utils);
TF_WRAP(Notice);
}
30 changes: 30 additions & 0 deletions lib/mayaUsd/ufe/wrapGlobal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// Copyright 2020 Autodesk
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include <mayaUsd/ufe/Global.h>

#include <boost/python.hpp>

using namespace MayaUsd;
using namespace boost::python;


void
wrapGlobal()
{
def("getMayaRunTimeId", ufe::getMayaRunTimeId);

def("getUsdRunTimeId", ufe::getUsdRunTimeId);
}
20 changes: 13 additions & 7 deletions test/testUtils/mayaUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,21 @@
"""
Helper functions regarding Maya that will be used throughout the test.
"""
import maya.cmds as cmds
import sys, os
import re

from mayaUsd import lib as mayaUsdLib
from mayaUsd import ufe as mayaUsdUfe

from pxr import Usd
from pxr import UsdGeom

from maya import cmds

import ufe

from mayaUsd import lib as mayaUsdLib
from pxr import Usd, UsdGeom
import os
import re
import sys

mayaRuntimeID = 1
mayaSeparator = "|"

prRe = re.compile('Preview Release ([0-9]+)')
Expand Down Expand Up @@ -100,7 +105,8 @@ def createUfePathSegment(mayaPath):
"""
if not mayaPath.startswith("|world"):
mayaPath = "|world" + mayaPath
return ufe.PathSegment(mayaPath, mayaRuntimeID, mayaSeparator)
return ufe.PathSegment(mayaPath, mayaUsdUfe.getMayaRunTimeId(),
mayaSeparator)


def getMayaSelectionList():
Expand Down
10 changes: 6 additions & 4 deletions test/testUtils/usdUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
Helper functions regarding USD that will be used throughout the test.
"""

usdSeparator = '/'
usdRuntimeID = 2
import ufe
import mayaUsd.ufe

import ufe

usdSeparator = '/'


def createUfePathSegment(usdPath):
"""
Create an UFE path from a given usd path.
Expand All @@ -33,7 +35,7 @@ def createUfePathSegment(usdPath):
Returns :
PathSegment of the given usdPath
"""
return ufe.PathSegment(usdPath, usdRuntimeID, usdSeparator)
return ufe.PathSegment(usdPath, mayaUsd.ufe.getUsdRunTimeId(), usdSeparator)

def getPrimFromSceneItem(item):
rawItem = item.getRawAddress()
Expand Down

0 comments on commit c082142

Please sign in to comment.