-
Notifications
You must be signed in to change notification settings - Fork 202
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
New Import UI feature - WIP #206
Changes from all commits
584c2a2
6af359c
991b68e
503dbcf
1115a2e
fac4479
b5e84bb
189497c
3446485
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ function(mayaUsd_find_python_module module) | |
"Location of Python module ${module}") | ||
endif(NOT _${module}_status) | ||
endif(NOT ${module_found}) | ||
endfunction(mayaUsd_find_python_module) | ||
endfunction() | ||
|
||
# Initialize a variable to accumulate an rpath. The origin is the | ||
# RUNTIME DESTINATION of the target. If not absolute it's appended | ||
|
@@ -158,10 +158,36 @@ function(mayaUsd_promoteMayaUsdHeader) | |
configure_file(${srcFile} ${dstFile}) | ||
endfunction() | ||
|
||
# | ||
# mayaUsd_promoteHeaderList( | ||
# [SUBDIR <optional sub-directory>]) | ||
# [FILES <list of files>] | ||
# | ||
# SUBDIR - optional sub-directory in which to promote files. | ||
# FILES - list of files to promote. | ||
# | ||
function(mayaUsd_promoteHeaderList) | ||
foreach(header ${ARGV}) | ||
cmake_parse_arguments(PREFIX | ||
"" # options | ||
"SUBDIR" # one_value keywords | ||
"HEADERS" # multi_value keywords | ||
${ARGN} | ||
) | ||
|
||
set(DEST_DIR ${CMAKE_BINARY_DIR}/include/mayaUsd) | ||
if(PREFIX_SUBDIR) | ||
set(DEST_DIR ${DEST_DIR}/${PREFIX_SUBDIR}) | ||
endif() | ||
|
||
if(PREFIX_HEADERS) | ||
set(headerFiles ${PREFIX_HEADERS}) | ||
else() | ||
message(FATAL_ERROR "HEADERS keyword is not specified.") | ||
endif() | ||
|
||
foreach(header ${headerFiles}) | ||
set(srcFile ${CMAKE_CURRENT_SOURCE_DIR}/${header}) | ||
set(dstFile ${CMAKE_BINARY_DIR}/include/mayaUsd/${header}) | ||
set(dstFile ${DEST_DIR}/${header}) | ||
Comment on lines
+161
to
+190
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes to these CMake functions and their existing usages would also be nice to see as a dedicated pull request. The new feature only adds one new usage of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mattyjams great point. I am going to have a separate PR addressing all that after this PR is merged into dev. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Matt, you are right. But in this case this is one of our backlog branch issues which was waiting for PR154 to go in. |
||
|
||
set(content "#pragma once\n#include \"${srcFile}\"\n") | ||
|
||
|
@@ -193,9 +219,9 @@ endfunction() | |
# | ||
function(mayaUsd_copyFiles target) | ||
cmake_parse_arguments(PREFIX | ||
"TARGET" | ||
"DESTINATION" | ||
"FILES" | ||
"" # options | ||
"DESTINATION" # one_value keywords | ||
"FILES" # multi_value keywords | ||
${ARGN} | ||
) | ||
|
||
|
@@ -236,9 +262,9 @@ endfunction() | |
# | ||
function(mayaUsd_copyDirectory target) | ||
cmake_parse_arguments(PREFIX | ||
"TARGET" | ||
"DESTINATION" | ||
"DIRECTORY" | ||
"" # options | ||
"DESTINATION" # one_value keywords | ||
"DIRECTORY" # multi_value keywords | ||
${ARGN} | ||
) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
// | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New file containing all the import data, such as root prim path, stage pop mask, variants, etc. |
||
// Copyright 2019 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 "importData.h" | ||
|
||
#include <type_traits> | ||
|
||
MAYAUSD_NS_DEF { | ||
|
||
//------------------------------------------------------------------------------ | ||
// ImportData: | ||
//------------------------------------------------------------------------------ | ||
|
||
constexpr const char* kRootPrimPath = "/"; | ||
|
||
ImportData::ImportData() | ||
: fLoadSet(UsdStage::InitialLoadSet::LoadAll) | ||
, fRootPrimPath(kRootPrimPath) | ||
{ | ||
} | ||
|
||
ImportData::ImportData(const std::string& f) | ||
: fLoadSet(UsdStage::InitialLoadSet::LoadAll) | ||
, fRootPrimPath(kRootPrimPath) | ||
, fFilename(f) | ||
{ | ||
} | ||
|
||
/*static*/ | ||
ImportData& ImportData::instance() | ||
{ | ||
static ImportData sImportData; | ||
return sImportData; | ||
} | ||
Comment on lines
+41
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a little unclear why this is made available as a static global singleton. Can't it just be constructed from the import arguments on demand and be owned by the import UI? It feels like careless use of this in future code could open up the possibility of confusing behavior if you go back and forth between importing via the UI and importing via commands (or using some other tool that does that) since they may share state. This would also block any chance of imports working in parallel, if that is or even could be possible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I explained in another comment why this is a singleton. But you do bring up a good point about going back and forth between import via the UI and importing via commands. Note: I've partially fixed this by moving the filename into the import data and first checking if the filenames match. So this problem will only happen if you import via UI and import from command the same file and you don't import a different file inbetween. And this problem only exists when using the import from the MayaUSD plugin since it's the only one with the import UI. I need to think about a good way to solve this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI, another reason that its a global is because we want to be able to support a user opening the import dialog, making some changes, closing the dialog and then before importing reopen the dialog to continue making changes. It is not done yet, but I will be repopulating the dialog with the data stored in import data. So a user can continue editing. |
||
|
||
/*static*/ | ||
const ImportData& ImportData::cinstance() | ||
{ | ||
return instance(); | ||
} | ||
|
||
void ImportData::clearData() | ||
{ | ||
fLoadSet = UsdStage::InitialLoadSet::LoadAll; | ||
UsdStagePopulationMask tmpPopMask; | ||
fPopMask.swap(tmpPopMask); | ||
fRootVariants.clear(); | ||
fPrimVariants.clear(); | ||
fFilename.clear(); | ||
fRootPrimPath = kRootPrimPath; | ||
} | ||
|
||
bool ImportData::empty() const | ||
{ | ||
// If we don't have a filename set then we are empty. | ||
return fFilename.empty(); | ||
} | ||
Comment on lines
+65
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a little dubious of the concept of an I could see this class being useful if you already have a handle to an open stage and just want to use an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that I've moved the filename into the import data, does it being empty without a filename solve your concern? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could still imagine cases where you might want to import from an open stage as opposed to a file, but I don't think we have any existing usage like that currently. Seems like we have what we need for now. |
||
|
||
const std::string& ImportData::filename() const | ||
{ | ||
return fFilename; | ||
} | ||
|
||
void ImportData::setFilename(const std::string& f) | ||
{ | ||
// If the input filename doesn't match what we have stored (empty or not) we | ||
// clear the data because it doesn't belong to the new file. | ||
if (fFilename != f) | ||
clearData(); | ||
fFilename = f; | ||
} | ||
|
||
const std::string& ImportData::rootPrimPath() const | ||
{ | ||
return fRootPrimPath; | ||
} | ||
|
||
void ImportData::setRootPrimPath(const std::string& primPath) | ||
{ | ||
fRootPrimPath = primPath; | ||
} | ||
|
||
bool ImportData::hasPopulationMask() const | ||
{ | ||
return !fPopMask.IsEmpty(); | ||
} | ||
|
||
const UsdStagePopulationMask& ImportData::stagePopulationMask() const | ||
{ | ||
return fPopMask; | ||
} | ||
|
||
void ImportData::setStagePopulationMask(const UsdStagePopulationMask& mask) | ||
{ | ||
fPopMask = mask; | ||
} | ||
|
||
void ImportData::setStagePopulationMask(UsdStagePopulationMask&& mask) | ||
{ | ||
fPopMask = std::move(mask); | ||
} | ||
|
||
UsdStage::InitialLoadSet ImportData::stageInitialLoadSet() const | ||
{ | ||
return fLoadSet; | ||
} | ||
|
||
void ImportData::setStageInitialLoadSet(UsdStage::InitialLoadSet loadSet) | ||
{ | ||
fLoadSet = loadSet; | ||
} | ||
|
||
bool ImportData::hasVariantSelections() const | ||
{ | ||
return !(fRootVariants.empty() || fPrimVariants.empty()); | ||
} | ||
|
||
const SdfVariantSelectionMap& ImportData::rootVariantSelections() const | ||
{ | ||
return fRootVariants; | ||
} | ||
|
||
const ImportData::PrimVariantSelections& ImportData::primVariantSelections() const | ||
{ | ||
return fPrimVariants; | ||
} | ||
|
||
void ImportData::setRootVariantSelections(const SdfVariantSelectionMap& vars) | ||
{ | ||
fRootVariants = vars; | ||
} | ||
|
||
void ImportData::setRootVariantSelections(SdfVariantSelectionMap&& vars) | ||
{ | ||
fRootVariants = std::move(vars); | ||
} | ||
|
||
void ImportData::setPrimVariantSelections(const PrimVariantSelections& vars) | ||
{ | ||
fPrimVariants = vars; | ||
} | ||
|
||
void ImportData::setPrimVariantSelections(PrimVariantSelections&& vars) | ||
{ | ||
fPrimVariants = std::move(vars); | ||
} | ||
|
||
} // namespace MayaUsd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To build the new UI (which uses) Qt you need to specify where to find Qt (should be the same one that Maya is using).