modify not show path componet
This commit is contained in:
parent
5e6b554f90
commit
9c6dd93ef7
@ -109,6 +109,25 @@ Entity* EntitiesManager::CreateMesh(const QString& mesh) {
|
|||||||
SceneComponent* conponent = ComponentFactory::Create("MeshComponent", nullptr);
|
SceneComponent* conponent = ComponentFactory::Create("MeshComponent", nullptr);
|
||||||
conponent->SetAttribute("mesh", mesh.toStdString().c_str());
|
conponent->SetAttribute("mesh", mesh.toStdString().c_str());
|
||||||
conponent->AttachEntity(entity);
|
conponent->AttachEntity(entity);
|
||||||
|
// Also add PathComponent so the entity has a path attribute by default
|
||||||
|
SceneComponent* rootComponent = entity->GetRootComponent();
|
||||||
|
if (rootComponent) {
|
||||||
|
SceneComponent* pathComponent = ComponentFactory::Create("PathComponent", rootComponent);
|
||||||
|
if (pathComponent) {
|
||||||
|
pathComponent->AttachTo(rootComponent);
|
||||||
|
LOG_INFO("EntitiesManager::CreateMesh - Added PathComponent");
|
||||||
|
} else {
|
||||||
|
LOG_WARN("EntitiesManager::CreateMesh - Failed to create PathComponent");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SceneComponent* pathComponent = ComponentFactory::Create("PathComponent", nullptr);
|
||||||
|
if (pathComponent) {
|
||||||
|
pathComponent->AttachEntity(entity);
|
||||||
|
LOG_INFO("EntitiesManager::CreateMesh - Added PathComponent with no root");
|
||||||
|
} else {
|
||||||
|
LOG_WARN("EntitiesManager::CreateMesh - Failed to create PathComponent with no root");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,6 +66,28 @@ Entity* EntityFactory::CreateEntityWithComponents(const QString& type, const QSt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always add PathComponent so entity has path attribute editable in PropertyBrowser
|
||||||
|
{
|
||||||
|
SceneComponent* rootComponent = entity->GetRootComponent();
|
||||||
|
if (nullptr == rootComponent) {
|
||||||
|
SceneComponent* pathComponent = ComponentFactory::Create("PathComponent", nullptr);
|
||||||
|
if (pathComponent) {
|
||||||
|
pathComponent->AttachEntity(entity);
|
||||||
|
LOG_INFO("EntityFactory::CreateEntityWithComponents - Added PathComponent");
|
||||||
|
} else {
|
||||||
|
LOG_WARN("EntityFactory::CreateEntityWithComponents - Failed to create PathComponent");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SceneComponent* pathComponent = ComponentFactory::Create("PathComponent", rootComponent);
|
||||||
|
if (pathComponent) {
|
||||||
|
pathComponent->AttachTo(rootComponent);
|
||||||
|
LOG_INFO("EntityFactory::CreateEntityWithComponents - Added PathComponent");
|
||||||
|
} else {
|
||||||
|
LOG_WARN("EntityFactory::CreateEntityWithComponents - Failed to create PathComponent");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add required components
|
// Add required components
|
||||||
QStringList requiredComponents = it->second->GetRequiredComponents();
|
QStringList requiredComponents = it->second->GetRequiredComponents();
|
||||||
SceneComponent* rootComponent = entity->GetRootComponent();
|
SceneComponent* rootComponent = entity->GetRootComponent();
|
||||||
|
|||||||
@ -9308,7 +9308,7 @@ void QtMeshComponetManager::SetPropertyValue(QtProperty* property, SceneComponen
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString QtMeshComponetManager::GetPropertyId() const {
|
QString QtMeshComponetManager::GetPropertyId() const {
|
||||||
return tr("MeshComponent");
|
return QStringLiteral("MeshComponent");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -9467,9 +9467,8 @@ void QtPathComponentManager::SetPropertyValue(QtProperty* property, SceneCompone
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString QtPathComponentManager::GetPropertyId() const {
|
QString QtPathComponentManager::GetPropertyId() const {
|
||||||
return tr("PathComponent");
|
return QStringLiteral("PathComponent");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the given \a property's value.
|
Returns the given \a property's value.
|
||||||
|
|
||||||
@ -9732,7 +9731,7 @@ void QtConeWaveComponentManager::SetPropertyValue(QtProperty* property, SceneCom
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString QtConeWaveComponentManager::GetPropertyId() const {
|
QString QtConeWaveComponentManager::GetPropertyId() const {
|
||||||
return tr("ConeWaveComponent");
|
return QStringLiteral("ConeWaveComponent");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -10073,7 +10072,7 @@ void QtDashedLineComponentManager::SetPropertyValue(QtProperty* property, SceneC
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString QtDashedLineComponentManager::GetPropertyId() const {
|
QString QtDashedLineComponentManager::GetPropertyId() const {
|
||||||
return tr("DashedLineComponent");
|
return QStringLiteral("DashedLineComponent");
|
||||||
}
|
}
|
||||||
|
|
||||||
QDashedLineComponentAttribute QtDashedLineComponentManager::value(const QtProperty* property) const {
|
QDashedLineComponentAttribute QtDashedLineComponentManager::value(const QtProperty* property) const {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user