Remove `BaseObject` as a base class from `NodeGroup`

Nothing uses the use count that the `BaseObject` base class provides, so
there's no reason to keep it.

Signed-off-by: Chris Burel <burelc@amazon.com>
monroegm-disable-blank-issue-2
Chris Burel 5 years ago
parent 8730d5657f
commit 9e6832c6a9

@ -24,7 +24,6 @@ namespace CommandSystem
// constructor
CommandAdjustNodeGroup::CommandAdjustNodeGroup(MCore::Command* orgCommand)
: MCore::Command("AdjustNodeGroup", orgCommand)
, mOldNodeGroup(nullptr)
{
}
@ -32,10 +31,7 @@ namespace CommandSystem
// destructor
CommandAdjustNodeGroup::~CommandAdjustNodeGroup()
{
if (mOldNodeGroup)
{
mOldNodeGroup->Destroy();
}
delete mOldNodeGroup;
}
@ -65,10 +61,7 @@ namespace CommandSystem
}
// copy the old node group for undo
if (mOldNodeGroup)
{
mOldNodeGroup->Destroy();
}
delete mOldNodeGroup;
mOldNodeGroup = aznew EMotionFX::NodeGroup(*nodeGroup);
@ -235,11 +228,8 @@ namespace CommandSystem
}
}
// delete the old node group
if (mOldNodeGroup)
{
mOldNodeGroup->Destroy();
}
delete mOldNodeGroup;
mOldNodeGroup = nullptr;
// set the dirty flag back to the old value
@ -304,7 +294,7 @@ namespace CommandSystem
}
// add new node group to the actor
EMotionFX::NodeGroup* nodeGroup = EMotionFX::NodeGroup::Create(name.c_str());
EMotionFX::NodeGroup* nodeGroup = aznew EMotionFX::NodeGroup(name);
actor->AddNodeGroup(nodeGroup);
// save the current dirty flag and tell the actor that something got changed
@ -374,10 +364,7 @@ namespace CommandSystem
// destructor
CommandRemoveNodeGroup::~CommandRemoveNodeGroup()
{
if (mOldNodeGroup)
{
mOldNodeGroup->Destroy();
}
delete mOldNodeGroup;
}
@ -407,11 +394,7 @@ namespace CommandSystem
}
// copy the old node group for undo
if (mOldNodeGroup)
{
mOldNodeGroup->Destroy();
}
delete mOldNodeGroup;
mOldNodeGroup = aznew EMotionFX::NodeGroup(*nodeGroup);
// remove the node group

@ -22,7 +22,7 @@ namespace CommandSystem
// adjust a node group
MCORE_DEFINECOMMAND_START(CommandAdjustNodeGroup, "Adjust node group", true)
bool mOldDirtyFlag;
EMotionFX::NodeGroup* mOldNodeGroup;
EMotionFX::NodeGroup* mOldNodeGroup = nullptr;
MCORE_DEFINECOMMAND_END

@ -1015,7 +1015,7 @@ namespace EMotionFX
const uint32 numGroups = mNodeGroups.GetLength();
for (uint32 i = 0; i < numGroups; ++i)
{
mNodeGroups[i]->Destroy();
delete mNodeGroups[i];
}
mNodeGroups.Clear();
}
@ -2085,7 +2085,7 @@ namespace EMotionFX
{
if (delFromMem)
{
mNodeGroups[index]->Destroy();
delete mNodeGroups[index];
}
mNodeGroups.Remove(index);
@ -2097,7 +2097,7 @@ namespace EMotionFX
mNodeGroups.RemoveByValue(group);
if (delFromMem)
{
group->Destroy();
delete group;
}
}

@ -1469,7 +1469,7 @@ namespace EMotionFX
}
// create the new group inside the actor
NodeGroup* newGroup = NodeGroup::Create(groupName, fileGroup.mNumNodes, fileGroup.mDisabledOnDefault ? false : true);
NodeGroup* newGroup = aznew NodeGroup(groupName, fileGroup.mNumNodes, fileGroup.mDisabledOnDefault ? false : true);
// read the node numbers
uint16 nodeIndex;

@ -17,63 +17,16 @@ namespace EMotionFX
AZ_CLASS_ALLOCATOR_IMPL(NodeGroup, NodeAllocator, 0)
// default constructor
NodeGroup::NodeGroup()
: BaseObject()
NodeGroup::NodeGroup(const AZStd::string& groupName, uint16 numNodes, bool enabledOnDefault)
: mName(groupName)
, mNodes(numNodes)
, mEnabledOnDefault(enabledOnDefault)
{
SetIsEnabledOnDefault(true);
}
// extended constructor
NodeGroup::NodeGroup(const char* groupName, bool enabledOnDefault)
: BaseObject()
{
SetName(groupName);
SetIsEnabledOnDefault(enabledOnDefault);
}
// another extended constructor
NodeGroup::NodeGroup(const char* groupName, uint16 numNodes, bool enabledOnDefault)
: BaseObject()
{
SetName(groupName);
SetNumNodes(numNodes);
SetIsEnabledOnDefault(enabledOnDefault);
}
// destructor
NodeGroup::~NodeGroup()
{
mNodes.Clear();
}
// create
NodeGroup* NodeGroup::Create()
{
return aznew NodeGroup();
}
// create
NodeGroup* NodeGroup::Create(const char* groupName, bool enabledOnDefault)
{
return aznew NodeGroup(groupName, enabledOnDefault);
}
// create
NodeGroup* NodeGroup::Create(const char* groupName, uint16 numNodes, bool enabledOnDefault)
{
return aznew NodeGroup(groupName, numNodes, enabledOnDefault);
}
// set the name of the group
void NodeGroup::SetName(const char* groupName)
void NodeGroup::SetName(const AZStd::string& groupName)
{
mName = groupName;
}

@ -30,38 +30,19 @@ namespace EMotionFX
* might contain incorrect or even uninitialized data.
*/
class EMFX_API NodeGroup
: public BaseObject
{
public:
AZ_CLASS_ALLOCATOR_DECL
/**
* The default creation method.
* This does not assign a name and there will be nodes inside this group on default.
* Also the default enabled state is set to true.
*/
static NodeGroup* Create();
/**
* Extended creation.
* @param groupName The name of the group. Please keep in mind that it is not allowed to have two groups with the same name inside an Actor.
* @param enabledOnDefault Set to true (default) when the nodes inside this group should be enabled on default.
*/
static NodeGroup* Create(const char* groupName, bool enabledOnDefault = true);
/**
* Another extended constructor.
* @param groupName The name of the group. Please keep in mind that it is not allowed to have two groups with the same name inside an Actor.
* @param numNodes The number of nodes to create inside the group. This will have all uninitialized values for the node indices in the group, so be sure that you
* set them all to some valid node index using the NodeGroup::SetNode(...) method. This method automatically calls the SetNumNodes(...) method.
* @param enabledOnDefault Set to true (default) when the nodes inside this group should be enabled on default.
*/
static NodeGroup* Create(const char* groupName, uint16 numNodes, bool enabledOnDefault = true);
NodeGroup(const AZStd::string& groupName = {}, uint16 numNodes = 0, bool enabledOnDefault = true);
NodeGroup(const NodeGroup& aOther);
NodeGroup& operator=(const NodeGroup& aOther);
/**
* Set the name of the group. Please keep in mind that group names must be unique inside the Actor objects. So you should not have two or more groups with the same name.
* @param groupName The name of the group.
*/
void SetName(const char* groupName);
void SetName(const AZStd::string& groupName);
/**
* Get the name of the group as null terminated character buffer.
@ -172,37 +153,6 @@ namespace EMotionFX
*/
void SetIsEnabledOnDefault(bool enabledOnDefault);
/**
* The default constructor.
* This does not assign a name and there will be nodes inside this group on default.
* Also the default enabled state is set to true.
*/
NodeGroup();
/**
* Extended constructor.
* @param groupName The name of the group. Please keep in mind that it is not allowed to have two groups with the same name inside an Actor.
* @param enabledOnDefault Set to true (default) when the nodes inside this group should be enabled on default.
*/
NodeGroup(const char* groupName, bool enabledOnDefault = true);
/**
* Another extended constructor.
* @param groupName The name of the group. Please keep in mind that it is not allowed to have two groups with the same name inside an Actor.
* @param numNodes The number of nodes to create inside the group. This will have all uninitialized values for the node indices in the group, so be sure that you
* set them all to some valid node index using the NodeGroup::SetNode(...) method. This method automatically calls the SetNumNodes(...) method.
* @param enabledOnDefault Set to true (default) when the nodes inside this group should be enabled on default.
*/
NodeGroup(const char* groupName, uint16 numNodes, bool enabledOnDefault = true);
/**
* The destructor.
*/
~NodeGroup();
NodeGroup(const NodeGroup& aOther);
NodeGroup& operator=(const NodeGroup& aOther);
private:
AZStd::string mName; /**< The name of the group. */
MCore::SmallArray<uint16> mNodes; /**< The node index numbers that are inside this group. */

Loading…
Cancel
Save