Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAYA-129538 move commands out of context op implementation #3179

Merged
merged 6 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/mayaUsd/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ target_sources(${PYTHON_TARGET_NAME}
wrapAdaptor.cpp
wrapBlockSceneModificationContext.cpp
wrapColorSpace.cpp
wrapCommands.cpp
wrapConverter.cpp
wrapDiagnosticDelegate.cpp
wrapMeshWriteUtils.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 @@ -29,6 +29,7 @@ TF_WRAP_MODULE
TF_WRAP(Adaptor);
TF_WRAP(BlockSceneModificationContext);
TF_WRAP(ColorSpace);
TF_WRAP(Commands);
TF_WRAP(Converter);
TF_WRAP(ConverterArgs);
TF_WRAP(DiagnosticDelegate);
Expand Down
56 changes: 56 additions & 0 deletions lib/mayaUsd/python/wrapCommands.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// Copyright 2023 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/UsdUndoPayloadCommand.h>

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

using namespace boost::python;

namespace {

MayaUsd::ufe::UsdUndoLoadPayloadCommand*
LoadPayloadCommandInit(const PXR_NS::UsdPrim& prim, PXR_NS::UsdLoadPolicy policy)
{
return new MayaUsd::ufe::UsdUndoLoadPayloadCommand(prim, policy);
}

MayaUsd::ufe::UsdUndoUnloadPayloadCommand* UnloadPayloadCommandInit(const PXR_NS::UsdPrim& prim)
{
return new MayaUsd::ufe::UsdUndoUnloadPayloadCommand(prim);
}

} // namespace

void wrapCommands()
{
{
using This = MayaUsd::ufe::UsdUndoLoadPayloadCommand;
class_<This, boost::noncopyable>("LoadPayloadCommand", no_init)
.def("__init__", make_constructor(LoadPayloadCommandInit))
.def("execute", &MayaUsd::ufe::UsdUndoLoadPayloadCommand::execute)
.def("undo", &MayaUsd::ufe::UsdUndoLoadPayloadCommand::undo)
.def("redo", &MayaUsd::ufe::UsdUndoLoadPayloadCommand::redo);
}
{
using This = MayaUsd::ufe::UsdUndoUnloadPayloadCommand;
class_<This, boost::noncopyable>("UnloadPayloadCommand", no_init)
.def("__init__", make_constructor(UnloadPayloadCommandInit))
.def("execute", &MayaUsd::ufe::UsdUndoUnloadPayloadCommand::execute)
.def("undo", &MayaUsd::ufe::UsdUndoUnloadPayloadCommand::undo)
.def("redo", &MayaUsd::ufe::UsdUndoUnloadPayloadCommand::redo);
}
}
2 changes: 2 additions & 0 deletions lib/mayaUsd/ufe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ target_sources(${PROJECT_NAME}
UsdTranslateUndoableCommand.cpp
UsdUndoDeleteCommand.cpp
UsdUndoDuplicateCommand.cpp
UsdUndoPayloadCommand.cpp
UsdUndoRenameCommand.cpp
Utils.cpp
moduleDeps.cpp
Expand Down Expand Up @@ -197,6 +198,7 @@ set(HEADERS
UsdTranslateUndoableCommand.h
UsdUndoDeleteCommand.h
UsdUndoDuplicateCommand.h
UsdUndoPayloadCommand.h
UsdUndoRenameCommand.h
Utils.h
)
Expand Down
Loading