Skip to content

Commit

Permalink
#123 Implement icon axis (Entity) on Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
ducphamhong committed May 14, 2022
1 parent af7c2d2 commit c8b283b
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 5 deletions.
Binary file added Assets/Editor/Icon/Editor/16/axis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Editor/Icon/Editor/16/origin_xyz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Editor/Icon/Editor/32/axis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Editor/Icon/Editor/32/origin_xyz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ namespace Skylicht
}
else if (object->getType() == CSelectObject::Entity)
{
// Name and icon
spaceProperty->setIcon(GUI::ESystemIcon::Poly);

// Label on Propety
std::wstring label = L"Entity: ";

Expand All @@ -146,6 +143,12 @@ namespace Skylicht
CWorldTransformData* worldTransform = entity->getData<CWorldTransformData>();
label += CStringImp::convertUTF8ToUnicode(worldTransform->Name.c_str());

CRenderMeshData* renderData = entity->getData<CRenderMeshData>();
if (renderData != NULL)
spaceProperty->setIcon(GUI::ESystemIcon::Poly);
else
spaceProperty->setIcon(GUI::ESystemIcon::Axis);

// Activator
CEditorActivator* activator = CEditorActivator::getInstance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,18 @@ namespace Skylicht
for (CEntity* entity : entities)
{
CWorldTransformData* worldData = entity->getData<CWorldTransformData>();
CRenderMeshData* renderData = entity->getData<CRenderMeshData>();

CHierachyNode* parentNode = treeNodes[worldData->ParentIndex];

CHierachyNode* node = parentNode->addChild();
node->setName(CStringImp::convertUTF8ToUnicode(worldData->Name.c_str()).c_str());
node->setIcon(GUI::ESystemIcon::Poly);

if (renderData != NULL)
node->setIcon(GUI::ESystemIcon::Poly);
else
node->setIcon(GUI::ESystemIcon::Axis);

node->setTagData(entity, CHierachyNode::Entity);

treeNodes[entity->getIndex()] = node;
Expand Down
2 changes: 2 additions & 0 deletions Projects/Editor/Source/GUI/Theme/CSkylichtTheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ namespace Skylicht
addEditorIcon(ESystemIcon::Scale, "tool_scale.png");
addEditorIcon(ESystemIcon::ViewSelect, "view_select.png");
addEditorIcon(ESystemIcon::ViewHand, "view_hand.png");
addEditorIcon(ESystemIcon::Axis, "axis.png");
addEditorIcon(ESystemIcon::OriginXYZ, "origin_xyz.png");
}

void CSkylichtTheme::addSystemIcon(ESystemIcon type, const char* name)
Expand Down
2 changes: 2 additions & 0 deletions Projects/Editor/Source/GUI/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ namespace Skylicht
ObjectRect,
ObjectSphere,
ObjectTorus,
Axis,
OriginXYZ,
Move,
Rotate,
Scale,
Expand Down
2 changes: 1 addition & 1 deletion Projects/Skylicht/Engine/Source/Entity/CEntityHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ namespace Skylicht
for (int i = 0; i < count; i++)
{
CEntity* entity = entities[i];
CWorldTransformData* transformData = entity->addData<CWorldTransformData>();
CWorldTransformData* transformData = entity->getData<CWorldTransformData>();

// assign name
if (transformData != NULL && transformData->Name.empty())
Expand Down

0 comments on commit c8b283b

Please sign in to comment.