-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #942 from Autodesk/sabrih/MAYA-106089/usd_undo_ser…
…vice_support MAYA-106089: Undo/Redo support for USD data model.
- Loading branch information
Showing
31 changed files
with
1,735 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,8 @@ set(MSVC_FLAGS | |
/wd4506 | ||
/wd4996 | ||
/wd4180 | ||
# exporting STL classes | ||
/wd4251 | ||
) | ||
|
||
set(MSVC_DEFINITIONS | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// | ||
// 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/undo/UsdUndoBlock.h> | ||
#include <mayaUsd/undo/UsdUndoManager.h> | ||
#include <mayaUsd/undo/UsdUndoableItem.h> | ||
|
||
#include <pxr/base/tf/pyContainerConversions.h> | ||
#include <pxr/base/tf/pyNoticeWrapper.h> | ||
#include <pxr/pxr.h> | ||
#include <pxr/usd/sdf/layer.h> | ||
|
||
#include <boost/python.hpp> | ||
|
||
#include <memory> | ||
|
||
using namespace boost::python; | ||
|
||
PXR_NAMESPACE_USING_DIRECTIVE | ||
|
||
namespace { | ||
class PythonUndoBlock | ||
{ | ||
public: | ||
PythonUndoBlock() | ||
: _block(nullptr) | ||
{ | ||
} | ||
|
||
~PythonUndoBlock() { } | ||
|
||
void enter() | ||
{ | ||
if (!TF_VERIFY(_block == nullptr)) { | ||
return; | ||
} | ||
_block = std::make_unique<MayaUsd::UsdUndoBlock>(); | ||
} | ||
|
||
void exit(object, object, object) | ||
{ | ||
if (!TF_VERIFY(_block != nullptr)) { | ||
return; | ||
} | ||
_block.reset(); | ||
} | ||
|
||
private: | ||
std::unique_ptr<MayaUsd::UsdUndoBlock> _block; | ||
}; | ||
|
||
void _trackLayerStates(const SdfLayerHandle& layer) | ||
{ | ||
MayaUsd::UsdUndoManager::instance().trackLayerStates(layer); | ||
} | ||
|
||
} // namespace | ||
|
||
void wrapUsdUndoManager() | ||
{ | ||
// UsdUndoManager | ||
{ | ||
typedef MayaUsd::UsdUndoManager This; | ||
class_<This, boost::noncopyable>("UsdUndoManager", no_init) | ||
.def("trackLayerStates", &_trackLayerStates) | ||
.staticmethod("trackLayerStates"); | ||
} | ||
|
||
// UsdUndoBlock | ||
{ | ||
typedef PythonUndoBlock This; | ||
class_<This, boost::noncopyable>("UsdUndoBlock", init<>()) | ||
.def("__enter__", &This::enter) | ||
.def("__exit__", &This::exit); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.