add entity visible
This commit is contained in:
parent
a88557220b
commit
13345128f5
@ -182,3 +182,25 @@ void Entity::SetParent(Entity* parent) {
|
||||
SetWorkspace(workSpace);
|
||||
parent_->childer_.push_back(this);
|
||||
}
|
||||
|
||||
void Entity::SetVisible(bool v) {
|
||||
LOG_INFO("set visible: {}", v);
|
||||
if (nullptr == rootComponet_) {
|
||||
LOG_WARN("rootComponet_ is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
rootComponet_->SetVisible(v);
|
||||
for (auto item : childer_) {
|
||||
item->SetVisible(v);
|
||||
}
|
||||
}
|
||||
|
||||
bool Entity::IsVisible() const {
|
||||
if (nullptr == rootComponet_) {
|
||||
LOG_WARN("rootComponet_ is nullptr");
|
||||
return false;
|
||||
}
|
||||
|
||||
return rootComponet_->IsVisible();
|
||||
}
|
||||
|
@ -68,6 +68,9 @@ public:
|
||||
return childer_;
|
||||
}
|
||||
|
||||
void SetVisible(bool v);
|
||||
bool IsVisible() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void NameChanged(const QString& name);
|
||||
|
||||
|
@ -261,3 +261,19 @@ void SceneComponent::AddToRender() {
|
||||
AttachParent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
void SceneComponent::SetVisible(bool v) {
|
||||
visible_ = v;
|
||||
if (nullptr == mt_) {
|
||||
return;
|
||||
}
|
||||
mt_->setNodeMask(v ? ~0 : 0);
|
||||
|
||||
// for (auto child : children_) {
|
||||
// child->SetVisible(v);
|
||||
// }
|
||||
}
|
||||
|
||||
bool SceneComponent::IsVisible() const {
|
||||
return visible_;
|
||||
}
|
||||
|
@ -60,6 +60,9 @@ public:
|
||||
void AttachParent(SceneComponent* parent);
|
||||
void UpdateLocationAndRotation();
|
||||
|
||||
void SetVisible(bool v);
|
||||
bool IsVisible() const;
|
||||
|
||||
protected:
|
||||
void RemoveRender();
|
||||
void RemoveParent();
|
||||
@ -75,4 +78,5 @@ protected:
|
||||
|
||||
protected:
|
||||
Transform transform_;
|
||||
bool visible_{ true };
|
||||
};
|
@ -809,12 +809,12 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser.cpp" line="212"/>
|
||||
<location filename="../ui/PropertyBrowser.cpp" line="216"/>
|
||||
<source>ModelBase</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser.cpp" line="217"/>
|
||||
<location filename="../ui/PropertyBrowser.cpp" line="221"/>
|
||||
<source>color base</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -944,48 +944,48 @@
|
||||
<context>
|
||||
<name>QtConeWaveComponentManager</name>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8878"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8887"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8926"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8935"/>
|
||||
<source>ConeWaveComponent</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8975"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9023"/>
|
||||
<source>Height</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8982"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9030"/>
|
||||
<source>Radius</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8989"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9037"/>
|
||||
<source>waveCount</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8999"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9047"/>
|
||||
<source>waveSpeed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9006"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9054"/>
|
||||
<source>baseColor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9013"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9061"/>
|
||||
<source>waveColor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9020"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9068"/>
|
||||
<source>ringBrightAlpha</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9027"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9075"/>
|
||||
<source>ringDarkAlpha</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -1091,28 +1091,28 @@
|
||||
<context>
|
||||
<name>QtDashedLineComponentManager</name>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9219"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9228"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9267"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9276"/>
|
||||
<source>DashedLineComponent</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9297"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9345"/>
|
||||
<source>Start</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9304"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9352"/>
|
||||
<source>End</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9311"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9359"/>
|
||||
<source>Radius</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9318"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9366"/>
|
||||
<source>Color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -1128,12 +1128,17 @@
|
||||
<context>
|
||||
<name>QtEntityPropertyManager</name>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8339"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8373"/>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8346"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8380"/>
|
||||
<source>Visible</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8387"/>
|
||||
<source>Transform</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -1215,13 +1220,13 @@
|
||||
<context>
|
||||
<name>QtMeshComponetManager</name>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8453"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8462"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8501"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8510"/>
|
||||
<source>MeshComponent</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8535"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8583"/>
|
||||
<source>Mesh</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -1229,25 +1234,30 @@
|
||||
<context>
|
||||
<name>QtModelBasePropertyManager</name>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7803"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7805"/>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7810"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7812"/>
|
||||
<source>Description</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7817"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7819"/>
|
||||
<source>Inflow</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7824"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7826"/>
|
||||
<source>InnerBottomElevation</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7833"/>
|
||||
<source>Visible</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QtOsgViewWidget</name>
|
||||
@ -1265,13 +1275,13 @@
|
||||
<context>
|
||||
<name>QtPathComponentManager</name>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8612"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8621"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8660"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8669"/>
|
||||
<source>PathComponent</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8694"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8742"/>
|
||||
<source>Path</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -1521,42 +1531,42 @@
|
||||
<context>
|
||||
<name>QtWorkspacePropertyManager</name>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8070"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8086"/>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8077"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8093"/>
|
||||
<source>Description</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8084"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8100"/>
|
||||
<source>Timestep</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8091"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8107"/>
|
||||
<source>SimMatlab</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8098"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8114"/>
|
||||
<source>MatlabParam</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8105"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8121"/>
|
||||
<source>Wave</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8112"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8128"/>
|
||||
<source>RD</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8119"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8135"/>
|
||||
<source>Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -120,6 +120,8 @@ void PropertyBrowser::InitUI() {
|
||||
}
|
||||
|
||||
void PropertyBrowser::InitPropertyManager() {
|
||||
intManager_ = new QtIntPropertyManager(this);
|
||||
boolManager_ = new QtBoolPropertyManager(this);
|
||||
doubleManager_ = new QtDoublePropertyManager(this);
|
||||
stringManager_ = new QtStringPropertyManager(this);
|
||||
colorManager_ = new QtColorPropertyManager(this);
|
||||
@ -138,6 +140,8 @@ void PropertyBrowser::InitPropertyManager() {
|
||||
QtFilePathFactory* filePathFactory = new QtFilePathFactory(this);
|
||||
//QtTransfromEditorFactory* transformFactory = new QtTransfromEditorFactory(this);
|
||||
|
||||
browser_->setFactoryForManager(intManager_, spinBoxFactory);
|
||||
browser_->setFactoryForManager(boolManager_, checkBoxFactory);
|
||||
browser_->setFactoryForManager(doubleManager_, doubleSpinBoxFactory);
|
||||
browser_->setFactoryForManager(stringManager_, lineEditFactory);
|
||||
browser_->setFactoryForManager(colorManager_->subIntPropertyManager(), spinBoxFactory);
|
||||
@ -210,7 +214,7 @@ void PropertyBrowser::Test() {
|
||||
QtProperty* property;
|
||||
|
||||
property = modelBaseManager_->addProperty(tr("ModelBase"));
|
||||
QModelAttbute modelAttr(QString("test"), QString("test222"), true, 1.0 );
|
||||
QModelAttbute modelAttr(QString("test"), QString("test222"), true, 1.0 , true);
|
||||
modelBaseManager_->setValue(property, modelAttr);
|
||||
addProperty(property, QLatin1String("brush"));
|
||||
|
||||
|
@ -32,6 +32,8 @@ private:
|
||||
private:
|
||||
class QtTreePropertyBrowser* browser_{ nullptr };
|
||||
|
||||
class QtIntPropertyManager* intManager_{ nullptr };
|
||||
class QtBoolPropertyManager* boolManager_{ nullptr };
|
||||
class QtDoublePropertyManager* doubleManager_{ nullptr };
|
||||
class QtStringPropertyManager* stringManager_{ nullptr };
|
||||
class QtColorPropertyManager* colorManager_{ nullptr };
|
||||
|
@ -1,16 +1,18 @@
|
||||
#include "qtmodelattribute.h"
|
||||
|
||||
QModelAttbute::QModelAttbute(QString name, QString discription,
|
||||
bool inflow, float innerBottomElevation)
|
||||
bool inflow, float innerBottomElevation, bool visible)
|
||||
: name_(name)
|
||||
, description_(discription)
|
||||
, inflow_(inflow)
|
||||
, innerBottomElevation_(innerBottomElevation) {
|
||||
, innerBottomElevation_(innerBottomElevation)
|
||||
, visible_(visible) {
|
||||
}
|
||||
|
||||
bool QModelAttbute::operator==(const QModelAttbute& other) {
|
||||
return name_ == other.name_ && description_ == other.description_ &&
|
||||
inflow_ == other.inflow_ && innerBottomElevation_ == other.innerBottomElevation_;
|
||||
inflow_ == other.inflow_ && innerBottomElevation_ == other.innerBottomElevation_ &&
|
||||
visible_ == other.visible_;
|
||||
}
|
||||
|
||||
void QModelAttbute::SetName(const QString& name) {
|
||||
@ -29,3 +31,6 @@ void QModelAttbute::SetInnerBottomElevation(float v) {
|
||||
innerBottomElevation_ = v;
|
||||
}
|
||||
|
||||
void QModelAttbute::SetVisible(bool v) {
|
||||
visible_ = v;
|
||||
}
|
@ -45,7 +45,7 @@
|
||||
class QModelAttbute {
|
||||
public:
|
||||
QModelAttbute() = default;
|
||||
QModelAttbute(QString name, QString discription, bool inflow, float innerBottomElevation);
|
||||
QModelAttbute(QString name, QString discription, bool inflow, float innerBottomElevation, bool visible);
|
||||
~QModelAttbute() = default;
|
||||
|
||||
bool operator== (const QModelAttbute& other);
|
||||
@ -70,11 +70,17 @@ public:
|
||||
return innerBottomElevation_;
|
||||
}
|
||||
|
||||
void SetVisible(bool v);
|
||||
bool IsVisible() const {
|
||||
return visible_;
|
||||
}
|
||||
|
||||
private:
|
||||
QString name_;
|
||||
QString description_;
|
||||
bool inflow_{ false };
|
||||
float innerBottomElevation_{ 0.0f };
|
||||
bool visible_{ true };
|
||||
};
|
||||
|
||||
//Q_DECLARE_SHARED(QModelAttbute)
|
||||
|
@ -7645,7 +7645,7 @@ class QtModelBasePropertyManagerPrivate {
|
||||
public:
|
||||
|
||||
void slotStringChanged(QtProperty* property, QString value);
|
||||
void slotStringChanged(QtProperty* property, bool value);
|
||||
void slotBoolChanged(QtProperty* property, bool value);
|
||||
void slotStringChanged(QtProperty* property, double value);
|
||||
|
||||
void slotPropertyDestroyed(QtProperty* property);
|
||||
@ -7662,12 +7662,13 @@ public:
|
||||
QMap<const QtProperty*, QtProperty*> m_properyToDescription;
|
||||
QMap<const QtProperty*, QtProperty*> m_properyToInflow;
|
||||
QMap<const QtProperty*, QtProperty*> m_properyToInnerBottomElevation;
|
||||
QMap<const QtProperty*, QtProperty*> m_properyToVisible;
|
||||
|
||||
QMap<const QtProperty*, QtProperty*> m_nameToPropery;
|
||||
QMap<const QtProperty*, QtProperty*> m_descriptionToPropery;
|
||||
QMap<const QtProperty*, QtProperty*> m_inflowToPropery;
|
||||
QMap<const QtProperty*, QtProperty*> m_InnerBottomElevationToPropery;
|
||||
|
||||
QMap<const QtProperty*, QtProperty*> m_visibleToPropery;
|
||||
};
|
||||
|
||||
void QtModelBasePropertyManagerPrivate::slotStringChanged(QtProperty* property, QString value) {
|
||||
@ -7678,7 +7679,7 @@ void QtModelBasePropertyManagerPrivate::slotStringChanged(QtProperty* property,
|
||||
}
|
||||
}
|
||||
|
||||
void QtModelBasePropertyManagerPrivate::slotStringChanged(QtProperty* property, bool value) {
|
||||
void QtModelBasePropertyManagerPrivate::slotBoolChanged(QtProperty* property, bool value) {
|
||||
if (QtProperty* prop = m_properyToInflow.value(property, 0)) {
|
||||
QModelAttbute c = m_values[prop];
|
||||
c.EnableInflow(value);
|
||||
@ -7705,7 +7706,7 @@ QtModelBasePropertyManager::QtModelBasePropertyManager(QObject* parent)
|
||||
|
||||
d_ptr->m_boolPropertyManager = new QtBoolPropertyManager(this);
|
||||
connect(d_ptr->m_boolPropertyManager, SIGNAL(valueChanged(QtProperty*, bool)),
|
||||
this, SLOT(slotStringChanged(QtProperty*, bool)));
|
||||
this, SLOT(slotBoolChanged(QtProperty*, bool)));
|
||||
|
||||
d_ptr->m_deoubleProperyManager = new QtDoublePropertyManager(this);
|
||||
connect(d_ptr->m_deoubleProperyManager, SIGNAL(valueChanged(QtProperty*, double)),
|
||||
@ -7787,7 +7788,8 @@ void QtModelBasePropertyManager::setValue(QtProperty* property, const QModelAttb
|
||||
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToDescription[property], value.GetDescription());
|
||||
d_ptr->m_boolPropertyManager->setValue(d_ptr->m_properyToInflow[property], value.IsEnableInfow());
|
||||
d_ptr->m_deoubleProperyManager->setValue(d_ptr->m_properyToInnerBottomElevation[property], value.GetInnerBottomElevation());
|
||||
|
||||
d_ptr->m_boolPropertyManager->setValue(d_ptr->m_properyToVisible[property], value.IsVisible());
|
||||
|
||||
emit propertyChanged(property);
|
||||
emit valueChanged(property, value);
|
||||
}
|
||||
@ -7822,10 +7824,17 @@ void QtModelBasePropertyManager::initializeProperty(QtProperty* property) {
|
||||
|
||||
prop = d_ptr->m_deoubleProperyManager->addProperty();
|
||||
prop->setPropertyName(tr("InnerBottomElevation"));
|
||||
d_ptr->m_boolPropertyManager->setValueOnly(prop, val.GetInnerBottomElevation());
|
||||
d_ptr->m_deoubleProperyManager->setValueOnly(prop, val.GetInnerBottomElevation());
|
||||
d_ptr->m_properyToInnerBottomElevation[property] = prop;
|
||||
d_ptr->m_InnerBottomElevationToPropery[prop] = property;
|
||||
property->addSubProperty(prop);
|
||||
|
||||
prop = d_ptr->m_boolPropertyManager->addProperty();
|
||||
prop->setPropertyName(tr("Visible"));
|
||||
d_ptr->m_boolPropertyManager->setValueOnly(prop, val.IsVisible());
|
||||
d_ptr->m_properyToVisible[property] = prop;
|
||||
d_ptr->m_visibleToPropery[prop] = property;
|
||||
property->addSubProperty(prop);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -7859,6 +7868,13 @@ void QtModelBasePropertyManager::uninitializeProperty(QtProperty* property) {
|
||||
delete prop;
|
||||
}
|
||||
d_ptr->m_properyToInnerBottomElevation.remove(property);
|
||||
|
||||
prop = d_ptr->m_visibleToPropery[property];
|
||||
if (prop) {
|
||||
d_ptr->m_visibleToPropery.remove(prop);
|
||||
delete prop;
|
||||
}
|
||||
d_ptr->m_properyToVisible.remove(property);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
@ -8196,7 +8212,7 @@ public:
|
||||
|
||||
void slotStringChanged(QtProperty* property, QString value);
|
||||
void slotTransfromChanged(QtProperty* property, QTransformAttribute value);
|
||||
|
||||
void slotBoolChanged(QtProperty* property, bool value);
|
||||
void slotPropertyDestroyed(QtProperty* property);
|
||||
|
||||
typedef QMap<const QtProperty*, QEntityAttribute> PropertyValueMap;
|
||||
@ -8204,14 +8220,16 @@ public:
|
||||
|
||||
|
||||
QtStringPropertyManager* m_stringProperyManager;
|
||||
QtBoolPropertyManager* m_boolProperyManager;
|
||||
QtTransfromPropertyManager* m_transfromPropertyManager;
|
||||
|
||||
QMap<const QtProperty*, QtProperty*> m_properyToName;
|
||||
QMap<const QtProperty*, QtProperty*> m_properyTotrans;
|
||||
QMap<const QtProperty*, QtProperty*> m_properyToVisible;
|
||||
|
||||
QMap<const QtProperty*, QtProperty*> m_nameToPropery;
|
||||
QMap<const QtProperty*, QtProperty*> m_transToPropery;
|
||||
|
||||
QMap<const QtProperty*, QtProperty*> m_visibleToPropery;
|
||||
};
|
||||
|
||||
void QtEntityPropertyManagerPrivate::slotStringChanged(QtProperty* property, QString value) {
|
||||
@ -8222,6 +8240,15 @@ void QtEntityPropertyManagerPrivate::slotStringChanged(QtProperty* property, QSt
|
||||
}
|
||||
}
|
||||
|
||||
void QtEntityPropertyManagerPrivate::slotBoolChanged(QtProperty* property, bool value) {
|
||||
|
||||
if (QtProperty* prop = m_properyToVisible.value(property, 0)) {
|
||||
QEntityAttribute c = m_values[prop];
|
||||
c.SetVisible(value);
|
||||
q_ptr->setValue(prop, c);
|
||||
}
|
||||
}
|
||||
|
||||
void QtEntityPropertyManagerPrivate::slotTransfromChanged(QtProperty* property, QTransformAttribute value) {
|
||||
if (QtProperty* prop = m_properyTotrans.value(property, 0)) {
|
||||
QEntityAttribute c = m_values[prop];
|
||||
@ -8237,6 +8264,9 @@ void QtEntityPropertyManagerPrivate::slotPropertyDestroyed(QtProperty* property)
|
||||
} else if (QtProperty* subProp = m_transToPropery.value(property, nullptr)) {
|
||||
m_transToPropery[subProp] = 0;
|
||||
m_transToPropery.remove(property);
|
||||
} else if (QtProperty* subProp = m_visibleToPropery.value(property, nullptr)) {
|
||||
m_visibleToPropery[subProp] = 0;
|
||||
m_visibleToPropery.remove(property);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8247,7 +8277,11 @@ QtEntityPropertyManager::QtEntityPropertyManager(QObject* parent)
|
||||
d_ptr->m_stringProperyManager = new QtStringPropertyManager(this);
|
||||
connect(d_ptr->m_stringProperyManager, SIGNAL(valueChanged(QtProperty*, QString)),
|
||||
this, SLOT(slotStringChanged(QtProperty*, QString)));
|
||||
|
||||
|
||||
d_ptr->m_boolProperyManager = new QtBoolPropertyManager(this);
|
||||
connect(d_ptr->m_boolProperyManager, SIGNAL(valueChanged(QtProperty*, bool)),
|
||||
this, SLOT(slotBoolChanged(QtProperty*, bool)));
|
||||
|
||||
d_ptr->m_transfromPropertyManager = new QtTransfromPropertyManager(this);
|
||||
connect(d_ptr->m_transfromPropertyManager, SIGNAL(valueChanged(QtProperty*, QTransformAttribute)),
|
||||
this, SLOT(slotTransfromChanged(QtProperty*, QTransformAttribute)));
|
||||
@ -8323,7 +8357,7 @@ void QtEntityPropertyManager::setValue(QtProperty* property, const QEntityAttrib
|
||||
|
||||
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToName[property], value.GetName());
|
||||
d_ptr->m_transfromPropertyManager->setValue(d_ptr->m_properyTotrans[property], value.GetTransform());
|
||||
|
||||
d_ptr->m_boolProperyManager->setValue(d_ptr->m_properyToVisible[property], value.IsVisible());
|
||||
emit propertyChanged(property);
|
||||
emit valueChanged(property, value);
|
||||
}
|
||||
@ -8342,6 +8376,13 @@ void QtEntityPropertyManager::initializeProperty(QtProperty* property) {
|
||||
d_ptr->m_nameToPropery[prop] = property;
|
||||
property->addSubProperty(prop);
|
||||
|
||||
prop = d_ptr->m_boolProperyManager->addProperty();
|
||||
prop->setPropertyName(tr("Visible"));
|
||||
d_ptr->m_boolProperyManager->setValueOnly(prop, val.IsVisible());
|
||||
d_ptr->m_properyToVisible[property] = prop;
|
||||
d_ptr->m_visibleToPropery[prop] = property;
|
||||
property->addSubProperty(prop);
|
||||
|
||||
prop = d_ptr->m_transfromPropertyManager->addProperty();
|
||||
prop->setPropertyName(tr("Transform"));
|
||||
d_ptr->m_transfromPropertyManager->setValueOnly(prop, val.GetTransform());
|
||||
@ -8361,6 +8402,13 @@ void QtEntityPropertyManager::uninitializeProperty(QtProperty* property) {
|
||||
}
|
||||
d_ptr->m_properyToName.remove(property);
|
||||
|
||||
prop = d_ptr->m_visibleToPropery[property];
|
||||
if (prop) {
|
||||
d_ptr->m_visibleToPropery.remove(prop);
|
||||
delete prop;
|
||||
}
|
||||
d_ptr->m_properyToVisible.remove(property);
|
||||
|
||||
prop = d_ptr->m_transToPropery[property];
|
||||
if (prop) {
|
||||
d_ptr->m_properyTotrans.remove(prop);
|
||||
|
@ -228,10 +228,11 @@ QTransformAttribute& QTransformAttribute::operator=(const QTransformAttribute& o
|
||||
|
||||
QEntityAttribute::QEntityAttribute(class Entity* entity)
|
||||
: entity_(entity) {
|
||||
if (nullptr == entity) {
|
||||
if (nullptr == entity) {
|
||||
return;
|
||||
}
|
||||
transform_ = (new QTransformAttribute(entity->GetTransform()));
|
||||
visible_ = entity->IsVisible();
|
||||
}
|
||||
|
||||
bool QEntityAttribute::operator==(const QEntityAttribute& other) {
|
||||
@ -266,6 +267,19 @@ QTransformAttribute QEntityAttribute::GetTransform() const {
|
||||
return *transform_;
|
||||
}
|
||||
|
||||
void QEntityAttribute::SetVisible(bool v) {
|
||||
visible_ = v;
|
||||
if (nullptr == entity_) {
|
||||
return;
|
||||
}
|
||||
|
||||
entity_->SetVisible(v);
|
||||
}
|
||||
|
||||
bool QEntityAttribute::IsVisible() const {
|
||||
return visible_;
|
||||
}
|
||||
|
||||
QMeshComponentAttribute::QMeshComponentAttribute(class MeshComponent* object)
|
||||
: object_(object) {
|
||||
}
|
||||
|
@ -118,10 +118,13 @@ public:
|
||||
|
||||
QTransformAttribute GetTransform() const;
|
||||
|
||||
void SetVisible(bool v);
|
||||
bool IsVisible() const;
|
||||
|
||||
private:
|
||||
class Entity* entity_{ nullptr };
|
||||
QTransformAttribute* transform_{ nullptr };
|
||||
bool visible_{ true };
|
||||
};
|
||||
|
||||
class QMeshComponentAttribute {
|
||||
|
Loading…
Reference in New Issue
Block a user