<commit_before>#include "AssetSubCommandLoadAsset.h"

#include <maya/MFileObject.h>
#include <maya/MGlobal.h>
#include <maya/MPlug.h>
#include <maya/MPxCommand.h>

#include "AssetNode.h"
#include "AssetSubCommandSync.h"
#include "util.h"

AssetSubCommandLoadAsset::AssetSubCommandLoadAsset(
        const MString &otlFilePath,
        const MString &assetName
        ) :
    myOTLFilePath(otlFilePath),
    myAssetName(assetName),
    myAssetSubCommandSync(NULL)
{
}

AssetSubCommandLoadAsset::~AssetSubCommandLoadAsset()
{
}

MStatus
AssetSubCommandLoadAsset::doIt()
{
    MStatus status;

    // create houdiniAsset node
    MObject assetNode = myDagModifier.createNode(AssetNode::typeId, MObject::kNullObj, &status);
    CHECK_MSTATUS_AND_RETURN_IT(status);

    // rename houdiniAsset node
    MString nodeName = Util::sanitizeStringForNodeName(myAssetName);
    status = myDagModifier.renameNode(assetNode, nodeName);
    CHECK_MSTATUS_AND_RETURN_IT(status);

    // set otl file attribute
    {
        MPlug plug(assetNode, AssetNode::otlFilePath);
        status = myDagModifier.newPlugValueString(plug, myOTLFilePath);
        CHECK_MSTATUS_AND_RETURN_IT(status);
    }

    // set asset name attribute
    {
        MPlug plug(assetNode, AssetNode::assetName);
        status = myDagModifier.newPlugValueString(plug, myAssetName);<commit_msg>Remove the op type name when naming asset nodes<commit_after>#include "AssetSubCommandLoadAsset.h"

#include <maya/MFileObject.h>
#include <maya/MGlobal.h>
#include <maya/MPlug.h>
#include <maya/MPxCommand.h>

#include "AssetNode.h"
#include "AssetSubCommandSync.h"
#include "util.h"

AssetSubCommandLoadAsset::AssetSubCommandLoadAsset(
        const MString &otlFilePath,
        const MString &assetName
        ) :
    myOTLFilePath(otlFilePath),
    myAssetName(assetName),
    myAssetSubCommandSync(NULL)
{
}

AssetSubCommandLoadAsset::~AssetSubCommandLoadAsset()
{
}

MStatus
AssetSubCommandLoadAsset::doIt()
{
    MStatus status;

    // create houdiniAsset node
    MObject assetNode = myDagModifier.createNode(AssetNode::typeId, MObject::kNullObj, &status);
    CHECK_MSTATUS_AND_RETURN_IT(status);

    // rename houdiniAsset node
    assert(myAssetName.index('/') >= 0);
    MString nodeName = myAssetName.substring(
            myAssetName.index('/') + 1,
            myAssetName.length() - 1
            )  + "1";
    status = myDagModifier.renameNode(assetNode, nodeName);
    CHECK_MSTATUS_AND_RETURN_IT(status);

    // set otl file attribute
    {
        MPlug plug(assetNode, AssetNode::otlFilePath);
        status = myDagModifier.newPlugValueString(plug, myOTLFilePath);
        CHECK_MSTATUS_AND_RETURN_IT(status);
    }

    // set asset name attribute
    {
        MPlug plug(assetNode, AssetNode::assetName);
        status = myDagModifier.newPlugValueString(plug, myAssetName);
{'fraction_non_alphanumeric': 0.10535526776338817, 'fraction_numerical': 0.001400070003500175, 'mean_word_length': 4.022847100175747, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2942313', 'n_tokens_mistral': 948, 'n_tokens_neox': 932, 'n_words': 156}