Check for empty asset name when creating the asset
So that undoing a deletion wouldn't trigger error if asset name is
empty.
Also delete the asset if the asset name is empty, so that it's the same
behavior as an invalid asset name.
@@ -1844,16 +1844,7 @@ AssetNode::setInternalValueInContext(
// Create the Asset object as early as possible. We may need it before
// the first compute. For example, Maya may call internalArrayCount.
-
- // When the AssetNode is first created, setInternalValueInContext()
- // will be called with default values. But we don't want to try to
- // create the Asset at that time, since it'll result in errors that's
- // not caused by the user. So make sure the asset name is at least set
- // to avoid getting false errors.
- if(myAssetName.length())
- {
rebuildAsset();
- }
return true;
}
@@ -1932,6 +1923,11 @@ AssetNode::createAsset()
return;
}
+ // Make sure the asset name is set before trying to create the asset.
+ if(!myAssetName.length())
+ {
+ return;
+ }
myAsset = new Asset(myOTLFilePath, myAssetName, thisMObject());
