Skip to content

Commit

Permalink
Merge pull request #1756 from Autodesk/boudrey/MAYA-114246/shadingmode
Browse files Browse the repository at this point in the history
Boudrey/maya 114246/shadingmode
  • Loading branch information
Krystian Ligenza authored Oct 14, 2021
2 parents 3d4383a + 18532df commit 7475c4e
Show file tree
Hide file tree
Showing 30 changed files with 156 additions and 85 deletions.
2 changes: 1 addition & 1 deletion lib/mayaUsd/fileio/registryHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include <maya/MGlobal.h>

#include <boost/python.hpp>
#include <boost/python/import.hpp>

#include <map>
#include <vector>
Expand Down
1 change: 1 addition & 0 deletions lib/mayaUsd/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ target_sources(${PYTHON_TARGET_NAME}
wrapExportChaser.cpp
wrapImportChaser.cpp
wrapShadingUtil.cpp
wrapShadingMode.cpp
)

# -----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions lib/mayaUsd/python/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ TF_WRAP_MODULE
TF_WRAP(ExportChaser);
TF_WRAP(ImportChaser);
TF_WRAP(ShadingUtil);
TF_WRAP(ShadingMode);
}
6 changes: 5 additions & 1 deletion lib/mayaUsd/python/wrapAdaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@

#include <maya/MObject.h>

#include <boost/python.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>
#include <boost/python/make_constructor.hpp>
#include <boost/python/operators.hpp>
#include <boost/python/self.hpp>

using namespace boost::python;

Expand Down
4 changes: 3 additions & 1 deletion lib/mayaUsd/python/wrapBlockSceneModificationContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
//
#include <mayaUsd/utils/blockSceneModificationContext.h>

#include <boost/python.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>
#include <boost/python/return_arg.hpp>

#include <memory>

Expand Down
1 change: 0 additions & 1 deletion lib/mayaUsd/python/wrapColorSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <pxr/base/tf/pyResultConversions.h>
#include <pxr/pxr.h>

#include <boost/python.hpp>
#include <boost/python/def.hpp>

using namespace std;
Expand Down
3 changes: 2 additions & 1 deletion lib/mayaUsd/python/wrapConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

#include <maya/MObject.h>

#include <boost/python.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>

using namespace boost::python;

Expand Down
4 changes: 3 additions & 1 deletion lib/mayaUsd/python/wrapDiagnosticDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#include <pxr/pxr.h>

#include <boost/noncopyable.hpp>
#include <boost/python.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>
#include <boost/python/return_arg.hpp>

using namespace boost::python;

Expand Down
10 changes: 2 additions & 8 deletions lib/mayaUsd/python/wrapExportChaser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,11 @@
#include <mayaUsd/fileio/chaser/exportChaserRegistry.h>
#include <mayaUsd/fileio/registryHelper.h>

#include <pxr/base/tf/makePyConstructor.h>
#include <pxr/base/tf/pyContainerConversions.h>
#include <pxr/base/tf/pyEnum.h>
#include <pxr/base/tf/pyPolymorphic.h>
#include <pxr/base/tf/pyPtrHelpers.h>
#include <pxr/base/tf/pyResultConversions.h>
#include <pxr/base/tf/refPtr.h>

#include <boost/python.hpp>
#include <boost/python/args.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>
#include <boost/python/make_constructor.hpp>
#include <boost/python/wrapper.hpp>

PXR_NAMESPACE_USING_DIRECTIVE
Expand Down
12 changes: 2 additions & 10 deletions lib/mayaUsd/python/wrapImportChaser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,11 @@
#include <mayaUsd/fileio/chaser/importChaserRegistry.h>
#include <mayaUsd/fileio/registryHelper.h>

#include <pxr/base/tf/makePyConstructor.h>
#include <pxr/base/tf/pyContainerConversions.h>
#include <pxr/base/tf/pyEnum.h>
#include <pxr/base/tf/pyPolymorphic.h>
#include <pxr/base/tf/pyPtrHelpers.h>
#include <pxr/base/tf/pyResultConversions.h>
#include <pxr/base/tf/refPtr.h>

#include <maya/MFnDependencyNode.h>

#include <boost/python.hpp>
#include <boost/python/args.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>
#include <boost/python/make_constructor.hpp>
#include <boost/python/wrapper.hpp>

PXR_NAMESPACE_USING_DIRECTIVE
Expand Down
2 changes: 1 addition & 1 deletion lib/mayaUsd/python/wrapMeshWriteUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include <maya/MObject.h>
#include <maya/MStatus.h>

#include <boost/python.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>

#include <string>

Expand Down
6 changes: 2 additions & 4 deletions lib/mayaUsd/python/wrapOpenMaya.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
#include <maya/MDagPathArray.h>
#include <maya/MPlug.h>

#include <boost/python.hpp>
#include <boost/python/args.hpp>
#include <boost/python/def.hpp>
#include <boost/python/wrapper.hpp>
#include <boost/python/import.hpp>
#include <boost/python/to_python_converter.hpp>

PXR_NAMESPACE_USING_DIRECTIVE

Expand Down
35 changes: 3 additions & 32 deletions lib/mayaUsd/python/wrapPrimReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,13 @@
#include <mayaUsd/fileio/shading/shadingModeImporter.h>
#include <mayaUsd/fileio/shading/symmetricShaderReader.h>

#include <pxr/base/tf/makePyConstructor.h>
#include <pxr/base/tf/pyContainerConversions.h>
#include <pxr/base/tf/pyEnum.h>
#include <pxr/base/tf/pyPolymorphic.h>
#include <pxr/base/tf/pyPtrHelpers.h>
#include <pxr/base/tf/pyResultConversions.h>
#include <pxr/base/tf/refPtr.h>

#include <boost/python.hpp>
#include <boost/python/args.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>
#include <boost/python/make_constructor.hpp>
#include <boost/python/pure_virtual.hpp>
#include <boost/python/return_internal_reference.hpp>
#include <boost/python/wrapper.hpp>

Expand Down Expand Up @@ -323,31 +319,6 @@ void wrapPrimReader()
.staticmethod("Register");
}

void wrapShadingModeImportContext()
{
boost::python::class_<UsdMayaShadingModeImportContext>(
"ShadingModeImportContext", boost::python::no_init)
.def("GetCreatedObject", &UsdMayaShadingModeImportContext::GetCreatedObject)
// .def("AddCreatedObject",&UsdMayaShadingModeImportContext::AddCreatedObject) //
// overloads
.def("CreateShadingEngine", &UsdMayaShadingModeImportContext::CreateShadingEngine)
.def("GetShadingEngineName", &UsdMayaShadingModeImportContext::GetShadingEngineName)
.def("GetSurfaceShaderPlugName", &UsdMayaShadingModeImportContext::GetSurfaceShaderPlugName)
.def("GetVolumeShaderPlugName", &UsdMayaShadingModeImportContext::GetVolumeShaderPlugName)
.def(
"GetDisplacementShaderPlugName",
&UsdMayaShadingModeImportContext::GetDisplacementShaderPlugName)
.def("SetSurfaceShaderPlugName", &UsdMayaShadingModeImportContext::SetSurfaceShaderPlugName)
.def("SetVolumeShaderPlugName", &UsdMayaShadingModeImportContext::SetVolumeShaderPlugName)
.def(
"SetDisplacementShaderPlugName",
&UsdMayaShadingModeImportContext::SetDisplacementShaderPlugName)
.def(
"GetPrimReaderContext",
&UsdMayaShadingModeImportContext::GetPrimReaderContext,
boost::python::return_value_policy<boost::python::return_by_value>());
}

TF_REGISTRY_FUNCTION(TfEnum)
{
TF_ADD_ENUM_NAME(UsdMayaShaderReader::ContextSupport::Supported, "Supported");
Expand Down
10 changes: 3 additions & 7 deletions lib/mayaUsd/python/wrapPrimWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@
#include <mayaUsd/fileio/shaderWriterRegistry.h>
#include <mayaUsd/fileio/shading/symmetricShaderWriter.h>

#include <pxr/base/tf/makePyConstructor.h>
#include <pxr/base/tf/pyContainerConversions.h>
#include <pxr/base/tf/pyEnum.h>
#include <pxr/base/tf/pyPolymorphic.h>
#include <pxr/base/tf/pyPtrHelpers.h>
#include <pxr/base/tf/pyResultConversions.h>
#include <pxr/base/tf/refPtr.h>

#include <boost/python.hpp>
#include <boost/python/args.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>
#include <boost/python/make_constructor.hpp>
#include <boost/python/return_internal_reference.hpp>
#include <boost/python/wrapper.hpp>

PXR_NAMESPACE_USING_DIRECTIVE
Expand Down
1 change: 0 additions & 1 deletion lib/mayaUsd/python/wrapQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <pxr/base/tf/pyResultConversions.h>
#include <pxr/pxr.h>

#include <boost/python.hpp>
#include <boost/python/def.hpp>

using namespace std;
Expand Down
3 changes: 2 additions & 1 deletion lib/mayaUsd/python/wrapReadUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

#include <maya/MObject.h>

#include <boost/python.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>

using namespace boost::python;

Expand Down
3 changes: 2 additions & 1 deletion lib/mayaUsd/python/wrapRoundTripUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
#include <pxr/usd/usd/pyConversions.h>
#include <pxr/usd/usdGeom/primvar.h>

#include <boost/python.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>

using namespace std;
using namespace boost::python;
Expand Down
83 changes: 83 additions & 0 deletions lib/mayaUsd/python/wrapShadingMode.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//
// Copyright 2021 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/fileio/shading/shadingModeImporter.h>
#include <mayaUsd/fileio/shading/shadingModeRegistry.h>

#include <boost/python/class.hpp>
#include <boost/python/def.hpp>

PXR_NAMESPACE_USING_DIRECTIVE

class ShadingModeRegistry
{
public:
static void RegisterImportConversion(
const TfToken& materialConversion,
const TfToken& renderContext,
const TfToken& niceName,
const TfToken& description)
{
UsdMayaShadingModeRegistry::GetInstance().RegisterImportConversion(
materialConversion, renderContext, niceName, description);
}

static void RegisterExportConversion(
const TfToken& materialConversion,
const TfToken& renderContext,
const TfToken& niceName,
const TfToken& description)
{
UsdMayaShadingModeRegistry::GetInstance().RegisterExportConversion(
materialConversion, renderContext, niceName, description);
}
};

//----------------------------------------------------------------------------------------------------------------------
void wrapShadingModeImportContext()
{
boost::python::class_<UsdMayaShadingModeImportContext>(
"ShadingModeImportContext", boost::python::no_init)
.def("GetCreatedObject", &UsdMayaShadingModeImportContext::GetCreatedObject)
// .def("AddCreatedObject",&UsdMayaShadingModeImportContext::AddCreatedObject) //
// overloads
.def("CreateShadingEngine", &UsdMayaShadingModeImportContext::CreateShadingEngine)
.def("GetShadingEngineName", &UsdMayaShadingModeImportContext::GetShadingEngineName)
.def("GetSurfaceShaderPlugName", &UsdMayaShadingModeImportContext::GetSurfaceShaderPlugName)
.def("GetVolumeShaderPlugName", &UsdMayaShadingModeImportContext::GetVolumeShaderPlugName)
.def(
"GetDisplacementShaderPlugName",
&UsdMayaShadingModeImportContext::GetDisplacementShaderPlugName)
.def("SetSurfaceShaderPlugName", &UsdMayaShadingModeImportContext::SetSurfaceShaderPlugName)
.def("SetVolumeShaderPlugName", &UsdMayaShadingModeImportContext::SetVolumeShaderPlugName)
.def(
"SetDisplacementShaderPlugName",
&UsdMayaShadingModeImportContext::SetDisplacementShaderPlugName)
.def(
"GetPrimReaderContext",
&UsdMayaShadingModeImportContext::GetPrimReaderContext,
boost::python::return_value_policy<boost::python::return_by_value>());
}

//----------------------------------------------------------------------------------------------------------------------
void wrapShadingMode()
{
boost::python::class_<ShadingModeRegistry>("ShadingModeRegistry", boost::python::no_init)
.def("RegisterImportConversion", &ShadingModeRegistry::RegisterImportConversion)
.staticmethod("RegisterImportConversion")
.def("RegisterExportConversion", &ShadingModeRegistry::RegisterExportConversion)
.staticmethod("RegisterExportConversion");
}
2 changes: 1 addition & 1 deletion lib/mayaUsd/python/wrapShadingUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <mayaUsd/fileio/utils/shadingUtil.h>

#include <boost/python.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>

PXR_NAMESPACE_USING_DIRECTIVE
Expand Down
2 changes: 1 addition & 1 deletion lib/mayaUsd/python/wrapStageCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <pxr/base/tf/pyResultConversions.h>
#include <pxr/pxr.h>

#include <boost/python.hpp>
#include <boost/python/args.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>

using namespace std;
Expand Down
3 changes: 2 additions & 1 deletion lib/mayaUsd/python/wrapUsdUndoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
#include <pxr/pxr.h>
#include <pxr/usd/sdf/layer.h>

#include <boost/python.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>

#include <memory>

Expand Down
2 changes: 1 addition & 1 deletion lib/mayaUsd/python/wrapUserTaggedAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <maya/MStatus.h>
#include <maya/MString.h>

#include <boost/python.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>

#include <string>
Expand Down
3 changes: 2 additions & 1 deletion lib/mayaUsd/python/wrapWriteUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

#include <maya/MObject.h>

#include <boost/python.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>

using namespace boost::python;

Expand Down
2 changes: 1 addition & 1 deletion lib/mayaUsd/ufe/wrapGlobal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//
#include <mayaUsd/ufe/Global.h>

#include <boost/python.hpp>
#include <boost/python/def.hpp>

using namespace MayaUsd;
using namespace boost::python;
Expand Down
2 changes: 1 addition & 1 deletion lib/mayaUsd/ufe/wrapNotice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <pxr/base/tf/pyNoticeWrapper.h>

#include <boost/python.hpp>
#include <boost/python/class.hpp>

using namespace MayaUsd;
using namespace boost::python;
Expand Down
Loading

0 comments on commit 7475c4e

Please sign in to comment.