Changed: #1302 Added preview properties (except ConstStringArray values).
This commit is contained in:
parent
83db0f0adf
commit
3c09ce3ee8
7 changed files with 287 additions and 88 deletions
|
@ -173,6 +173,26 @@ WorldEditNode::~WorldEditNode()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldEditNode::setContext(const QString &name)
|
||||||
|
{
|
||||||
|
m_context = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString WorldEditNode::context() const
|
||||||
|
{
|
||||||
|
return m_context;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldEditNode::setDataPath(const QString &path)
|
||||||
|
{
|
||||||
|
m_dataPath = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString WorldEditNode::dataPath() const
|
||||||
|
{
|
||||||
|
return m_dataPath;
|
||||||
|
}
|
||||||
|
|
||||||
Node::NodeType WorldEditNode::type() const
|
Node::NodeType WorldEditNode::type() const
|
||||||
{
|
{
|
||||||
return WorldEditNodeType;
|
return WorldEditNodeType;
|
||||||
|
|
|
@ -112,9 +112,16 @@ public:
|
||||||
WorldEditNode(const QString &name);
|
WorldEditNode(const QString &name);
|
||||||
virtual ~WorldEditNode();
|
virtual ~WorldEditNode();
|
||||||
|
|
||||||
|
void setContext(const QString &name);
|
||||||
|
QString context() const;
|
||||||
|
void setDataPath(const QString &path);
|
||||||
|
QString dataPath() const;
|
||||||
|
|
||||||
virtual NodeType type() const;
|
virtual NodeType type() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString m_context;
|
||||||
|
QString m_dataPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "property_editor_widget.h"
|
#include "property_editor_widget.h"
|
||||||
|
#include "world_editor_misc.h"
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
|
@ -38,15 +39,20 @@ PropertyEditorWidget::PropertyEditorWidget(QWidget *parent)
|
||||||
|
|
||||||
m_variantManager = new QtVariantPropertyManager(this);
|
m_variantManager = new QtVariantPropertyManager(this);
|
||||||
m_enumManager = new QtEnumPropertyManager(this);
|
m_enumManager = new QtEnumPropertyManager(this);
|
||||||
|
m_stringArrayManager = new QtTextPropertyManager(this);
|
||||||
|
|
||||||
connect(m_variantManager, SIGNAL(valueChanged(QtProperty *, const QVariant &)),
|
connect(m_variantManager, SIGNAL(valueChanged(QtProperty *, const QVariant &)),
|
||||||
this, SLOT(valueChanged(QtProperty *, const QVariant &)));
|
this, SLOT(valueChanged(QtProperty *, const QVariant &)));
|
||||||
|
|
||||||
QtVariantEditorFactory *variantFactory = new QtVariantEditorFactory(this);
|
QtVariantEditorFactory *variantFactory = new QtVariantEditorFactory(this);
|
||||||
QtEnumEditorFactory *enumFactory = new QtEnumEditorFactory(this);
|
QtEnumEditorFactory *enumFactory = new QtEnumEditorFactory(this);
|
||||||
|
QtTextEditorFactory *textFactory = new QtTextEditorFactory(this);
|
||||||
|
|
||||||
m_ui.treePropertyBrowser->setFactoryForManager(m_variantManager, variantFactory);
|
m_ui.treePropertyBrowser->setFactoryForManager(m_variantManager, variantFactory);
|
||||||
m_ui.treePropertyBrowser->setFactoryForManager(m_enumManager, enumFactory);
|
m_ui.treePropertyBrowser->setFactoryForManager(m_enumManager, enumFactory);
|
||||||
|
m_ui.treePropertyBrowser->setFactoryForManager(m_stringArrayManager, textFactory);
|
||||||
|
|
||||||
m_groupManager = new QtGroupPropertyManager(this);
|
m_groupManager = new QtGroupPropertyManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyEditorWidget::~PropertyEditorWidget()
|
PropertyEditorWidget::~PropertyEditorWidget()
|
||||||
|
@ -58,110 +64,238 @@ void PropertyEditorWidget::clearProperties()
|
||||||
m_ui.treePropertyBrowser->clear();
|
m_ui.treePropertyBrowser->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyEditorWidget::updateSelection(const NodeList &selected, const NodeList &deselected)
|
void PropertyEditorWidget::updateSelection(Node *node)
|
||||||
{
|
{
|
||||||
clearProperties();
|
clearProperties();
|
||||||
|
|
||||||
|
if ((node == 0) || (node->type() != Node::PrimitiveNodeType))
|
||||||
|
return;
|
||||||
|
|
||||||
// The parameter list
|
// The parameter list
|
||||||
std::set<NLLIGO::CPrimitiveClass::CParameter> parameterList;
|
std::list<NLLIGO::CPrimitiveClass::CParameter> parameterList;
|
||||||
|
|
||||||
for (int i = 0; i < selected.size(); ++i)
|
PrimitiveNode *primNode = static_cast<PrimitiveNode *>(node);
|
||||||
|
const NLLIGO::IPrimitive *primitive = primNode->primitive();
|
||||||
|
const NLLIGO::CPrimitiveClass *primClass = primNode->primitiveClass();
|
||||||
|
|
||||||
|
// Use the class or not ?
|
||||||
|
if (primClass)
|
||||||
{
|
{
|
||||||
if (selected.at(i)->type() == Node::RootPrimitiveNodeType)
|
// For each properties of the class
|
||||||
|
for (uint p = 0; p < primClass->Parameters.size(); p++)
|
||||||
{
|
{
|
||||||
/*
|
// Is the parameter visible ?
|
||||||
const_cast<IPrimitive*>(_PropDlgLocators[i].Primitive)->removePropertyByName("name");
|
if (primClass->Parameters[p].Visible)
|
||||||
const_cast<IPrimitive*>(_PropDlgLocators[i].Primitive)->removePropertyByName("path");
|
{
|
||||||
//TODO faire une fonction dans CWorldDoc pour recup m_strPathName
|
if (primClass->Parameters[p].Name == "name")
|
||||||
string name;
|
parameterList.push_front(primClass->Parameters[p]);
|
||||||
getDocument()->getPrimitiveDisplayName(name,_PropDlgLocators[i].getDatabaseIndex());
|
else
|
||||||
string path;
|
parameterList.push_back(primClass->Parameters[p]);
|
||||||
getDocument()->getFilePath(_PropDlgLocators[i].getDatabaseIndex(),path);
|
}
|
||||||
|
|
||||||
const_cast<IPrimitive*>(_PropDlgLocators[i].Primitive)->addPropertyByName("name",new CPropertyString (name));
|
|
||||||
const_cast<IPrimitive*>(_PropDlgLocators[i].Primitive)->addPropertyByName("path",new CPropertyString (path));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (selected.at(i)->type() == Node::PrimitiveNodeType)
|
else
|
||||||
|
{
|
||||||
|
// For each primitive property
|
||||||
|
uint numProp = primitive->getNumProperty();
|
||||||
|
for (uint p = 0; p < numProp; p++)
|
||||||
{
|
{
|
||||||
PrimitiveNode *node = static_cast<PrimitiveNode *>(selected.at(i));
|
// Get the property
|
||||||
const NLLIGO::IPrimitive *primitive = node->primitive();
|
std::string propertyName;
|
||||||
const NLLIGO::CPrimitiveClass *primClass = node->primitiveClass();
|
const NLLIGO::IProperty *prop;
|
||||||
|
nlverify(primitive->getProperty(p, propertyName, prop));
|
||||||
// Use the class or not ?
|
|
||||||
if (primClass)
|
|
||||||
{
|
|
||||||
QtProperty *groupNode;
|
|
||||||
groupNode = m_groupManager->addProperty(node->data(Qt::DisplayRole).toString());
|
|
||||||
m_ui.treePropertyBrowser->addProperty(groupNode);
|
|
||||||
|
|
||||||
// For each properties of the class
|
|
||||||
for (uint p = 0; p < primClass->Parameters.size(); p++)
|
|
||||||
{
|
|
||||||
// Is the parameter visible ?
|
|
||||||
if (primClass->Parameters[p].Visible)
|
|
||||||
{
|
|
||||||
QtProperty *param;
|
|
||||||
|
|
||||||
if (primClass->Parameters[p].Type == NLLIGO::CPrimitiveClass::CParameter::Boolean)
|
// Add a default property
|
||||||
param = m_variantManager->addProperty(QVariant::Bool, primClass->Parameters[p].Name.c_str());
|
NLLIGO::CPrimitiveClass::CParameter defProp(*prop, propertyName.c_str());
|
||||||
else if (primClass->Parameters[p].Type == NLLIGO::CPrimitiveClass::CParameter::ConstString)
|
|
||||||
{
|
|
||||||
param = m_enumManager->addProperty(primClass->Parameters[p].Name.c_str());
|
|
||||||
}
|
|
||||||
else if (primClass->Parameters[p].Type == NLLIGO::CPrimitiveClass::CParameter::String)
|
|
||||||
param = m_variantManager->addProperty(QVariant::String, primClass->Parameters[p].Name.c_str());
|
|
||||||
else
|
|
||||||
param = m_variantManager->addProperty(QVariant::String, primClass->Parameters[p].Name.c_str());
|
|
||||||
|
|
||||||
groupNode->addSubProperty(param);
|
if (defProp.Name == "name")
|
||||||
|
parameterList.push_front(defProp);
|
||||||
parameterList.insert(primClass->Parameters[p]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
parameterList.push_back(defProp);
|
||||||
// For each primitive property
|
|
||||||
uint numProp = primitive->getNumProperty();
|
|
||||||
for (uint p = 0; p < numProp; p++)
|
|
||||||
{
|
|
||||||
// Get the property
|
|
||||||
std::string propertyName;
|
|
||||||
const NLLIGO::IProperty *prop;
|
|
||||||
nlverify(primitive->getProperty (p, propertyName, prop));
|
|
||||||
|
|
||||||
// Add a default property
|
|
||||||
NLLIGO::CPrimitiveClass::CParameter defProp(*prop, propertyName.c_str());
|
|
||||||
parameterList.insert(defProp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove property class
|
// Remove property class
|
||||||
std::set<NLLIGO::CPrimitiveClass::CParameter>::iterator ite = parameterList.begin ();
|
std::list<NLLIGO::CPrimitiveClass::CParameter>::iterator ite = parameterList.begin ();
|
||||||
while (ite != parameterList.end ())
|
while (ite != parameterList.end ())
|
||||||
{
|
{
|
||||||
// Next iterator
|
std::list<NLLIGO::CPrimitiveClass::CParameter>::iterator next = ite;
|
||||||
std::set<NLLIGO::CPrimitiveClass::CParameter>::iterator next = ite;
|
|
||||||
next++;
|
next++;
|
||||||
|
|
||||||
// Property name ?
|
|
||||||
if (ite->Name == "class")
|
if (ite->Name == "class")
|
||||||
{
|
{
|
||||||
// Remove it
|
parameterList.erase(ite);
|
||||||
parameterList.erase (ite);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ite = next;
|
ite = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the default parameter
|
QtProperty *groupNode;
|
||||||
NLLIGO::CPrimitiveClass::CParameter defaultParameter;
|
groupNode = m_groupManager->addProperty(QString("%1(%2)").arg(node->data(Qt::DisplayRole).toString()).arg(primClass->Name.c_str()));
|
||||||
defaultParameter.Visible = true;
|
m_ui.treePropertyBrowser->addProperty(groupNode);
|
||||||
defaultParameter.Filename = false;
|
|
||||||
|
ite = parameterList.begin ();
|
||||||
|
while (ite != parameterList.end ())
|
||||||
|
{
|
||||||
|
NLLIGO::CPrimitiveClass::CParameter ¶meter = (*ite);
|
||||||
|
QtProperty *prop;
|
||||||
|
NLLIGO::IProperty *ligoProperty;
|
||||||
|
primitive->getPropertyByName(parameter.Name.c_str(), ligoProperty);
|
||||||
|
|
||||||
|
if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::ConstString)
|
||||||
|
prop = addConstStringProperty(ligoProperty, parameter, primitive);
|
||||||
|
else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::String)
|
||||||
|
prop = addStringProperty(ligoProperty, parameter, primitive);
|
||||||
|
else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::StringArray)
|
||||||
|
prop = addStringArrayProperty(ligoProperty, parameter, primitive);
|
||||||
|
else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::ConstStringArray)
|
||||||
|
prop = addConstStringArrayProperty(ligoProperty, parameter, primitive);
|
||||||
|
else
|
||||||
|
// hmn?
|
||||||
|
prop = addBoolProperty(parameter, primitive);
|
||||||
|
|
||||||
|
// Default value ?
|
||||||
|
if ((ligoProperty == NULL) || (ligoProperty->Default))
|
||||||
|
prop->setModified(false);
|
||||||
|
else
|
||||||
|
prop->setModified(true);
|
||||||
|
|
||||||
|
bool staticChildSelected = Utils::ligoConfig()->isStaticChild(*primitive);
|
||||||
|
if (parameter.ReadOnly || (staticChildSelected && (parameter.Name == "name")))
|
||||||
|
prop->setEnabled(false);
|
||||||
|
|
||||||
|
groupNode->addSubProperty(prop);
|
||||||
|
|
||||||
|
ite++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtProperty *PropertyEditorWidget::addBoolProperty(const NLLIGO::IProperty *property,
|
||||||
|
const NLLIGO::CPrimitiveClass::CParameter ¶meter,
|
||||||
|
const NLLIGO::IPrimitive *primitive)
|
||||||
|
{
|
||||||
|
std::string value;
|
||||||
|
std::string name = parameter.Name.c_str();
|
||||||
|
primitive->getPropertyByName(name.c_str(), value);
|
||||||
|
QtVariantProperty *prop = m_variantManager->addProperty(QVariant::Bool, name.c_str());
|
||||||
|
// if (Default)
|
||||||
|
{
|
||||||
|
//DialogProperties->setDefaultValue (this, value);
|
||||||
|
prop->setValue(bool((value=="true")?1:0));
|
||||||
|
}
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
QtProperty *PropertyEditorWidget::addConstStringProperty(const NLLIGO::IProperty *property,
|
||||||
|
const NLLIGO::CPrimitiveClass::CParameter ¶meter,
|
||||||
|
const NLLIGO::IPrimitive *primitive)
|
||||||
|
{
|
||||||
|
std::string context("default");
|
||||||
|
|
||||||
|
std::string value;
|
||||||
|
std::string name = parameter.Name.c_str();
|
||||||
|
primitive->getPropertyByName(name.c_str(), value);
|
||||||
|
QtProperty *prop = m_enumManager->addProperty(parameter.Name.c_str());
|
||||||
|
|
||||||
|
std::map<std::string, NLLIGO::CPrimitiveClass::CParameter::CConstStringValue>::const_iterator ite = parameter.ComboValues.find(context.c_str());
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
//if (ite != parameter.ComboValues.end())
|
||||||
|
{
|
||||||
|
std::vector<std::string> pathList;
|
||||||
|
{
|
||||||
|
ite->second.appendFilePath(pathList);
|
||||||
|
|
||||||
|
/*std::vector<const NLLIGO::IPrimitive*> relativePrimPaths;
|
||||||
|
{
|
||||||
|
std::vector<const NLLIGO::IPrimitive*> startPrimPath;
|
||||||
|
for (uint locIndex = 0; locIndex<_PropDlgLocators.size(); locIndex++)
|
||||||
|
startPrimPath.push_back(_PropDlgLocators[locIndex].Primitive);
|
||||||
|
|
||||||
|
ite->second.getPrimitivesForPrimPath(relativePrimPaths, startPrimPath);
|
||||||
|
}
|
||||||
|
ite->second.appendPrimPath(pathList, relativePrimPaths);*/
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameter.SortEntries)
|
||||||
|
std::sort(pathList.begin(), pathList.end());
|
||||||
|
|
||||||
|
int currentValue = 0;
|
||||||
|
QStringList listEnums;
|
||||||
|
for (size_t i = 0; i < pathList.size(); ++i)
|
||||||
|
{
|
||||||
|
listEnums.append(pathList[i].c_str());
|
||||||
|
if (value == pathList[i])
|
||||||
|
currentValue = i;
|
||||||
|
}
|
||||||
|
if (!pathList.empty())
|
||||||
|
{
|
||||||
|
m_enumManager->setEnumNames(prop, listEnums);
|
||||||
|
m_enumManager->setValue(prop, currentValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
QtProperty *PropertyEditorWidget::addStringProperty(const NLLIGO::IProperty *property,
|
||||||
|
const NLLIGO::CPrimitiveClass::CParameter ¶meter,
|
||||||
|
const NLLIGO::IPrimitive *primitive)
|
||||||
|
{
|
||||||
|
std::string value;
|
||||||
|
std::string name = parameter.Name.c_str();
|
||||||
|
primitive->getPropertyByName(name.c_str(), value);
|
||||||
|
QtVariantProperty *prop = m_variantManager->addProperty(QVariant::String, parameter.Name.c_str());
|
||||||
|
prop->setValue(QString(value.c_str()));
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
QtProperty *PropertyEditorWidget::addStringArrayProperty(const NLLIGO::IProperty *property,
|
||||||
|
const NLLIGO::CPrimitiveClass::CParameter ¶meter,
|
||||||
|
const NLLIGO::IPrimitive *primitive)
|
||||||
|
{
|
||||||
|
std::string name = parameter.Name.c_str();
|
||||||
|
QtProperty *prop = m_stringArrayManager->addProperty(parameter.Name.c_str());
|
||||||
|
|
||||||
|
const NLLIGO::IProperty *ligoProperty;
|
||||||
|
std::vector<std::string> vectString;
|
||||||
|
|
||||||
|
if (primitive->getPropertyByName (parameter.Name.c_str (), ligoProperty))
|
||||||
|
{
|
||||||
|
const NLLIGO::CPropertyStringArray *const propStringArray = dynamic_cast<const NLLIGO::CPropertyStringArray *> (ligoProperty);
|
||||||
|
if (propStringArray)
|
||||||
|
{
|
||||||
|
const std::vector<std::string> &vectString = propStringArray->StringArray;
|
||||||
|
if (vectString.empty())
|
||||||
|
{
|
||||||
|
//m_stringArrayManager->setValue(prop, "StringArray");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string temp;
|
||||||
|
for (size_t i = 0; i < vectString.size(); i++)
|
||||||
|
{
|
||||||
|
temp += vectString[i];
|
||||||
|
if (i != (vectString.size() - 1))
|
||||||
|
temp += '\n';
|
||||||
|
}
|
||||||
|
m_stringArrayManager->setValue(prop, temp.c_str());
|
||||||
|
prop->setToolTip(temp.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_stringArrayManager->setValue(prop, "StringArray :(");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
QtProperty *PropertyEditorWidget::addConstStringArrayProperty(const NLLIGO::IProperty *property,
|
||||||
|
const NLLIGO::CPrimitiveClass::CParameter ¶meter,
|
||||||
|
const NLLIGO::IPrimitive *primitive)
|
||||||
|
{
|
||||||
|
std::string name = parameter.Name.c_str();
|
||||||
|
QtVariantProperty *prop = m_variantManager->addProperty(QVariant::String, parameter.Name.c_str());
|
||||||
|
prop->setValue("ConstStringArray");
|
||||||
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace WorldEditor */
|
} /* namespace WorldEditor */
|
||||||
|
|
|
@ -51,14 +51,30 @@ public:
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void clearProperties();
|
void clearProperties();
|
||||||
|
|
||||||
/// Update of selections
|
/// Update of selections
|
||||||
void updateSelection(const NodeList &selected, const NodeList &deselected);
|
void updateSelection(Node *node);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QtProperty *addBoolProperty(const NLLIGO::IProperty *property,
|
||||||
|
const NLLIGO::CPrimitiveClass::CParameter ¶meter,
|
||||||
|
const NLLIGO::IPrimitive *primitive);
|
||||||
|
QtProperty *addConstStringProperty(const NLLIGO::IProperty *property,
|
||||||
|
const NLLIGO::CPrimitiveClass::CParameter ¶meter,
|
||||||
|
const NLLIGO::IPrimitive *primitive);
|
||||||
|
QtProperty *addStringProperty(const NLLIGO::IProperty *property,
|
||||||
|
const NLLIGO::CPrimitiveClass::CParameter ¶meter,
|
||||||
|
const NLLIGO::IPrimitive *primitive);
|
||||||
|
QtProperty *addStringArrayProperty(const NLLIGO::IProperty *property,
|
||||||
|
const NLLIGO::CPrimitiveClass::CParameter ¶meter,
|
||||||
|
const NLLIGO::IPrimitive *primitive);
|
||||||
|
QtProperty *addConstStringArrayProperty(const NLLIGO::IProperty *property,
|
||||||
|
const NLLIGO::CPrimitiveClass::CParameter ¶meter,
|
||||||
|
const NLLIGO::IPrimitive *primitive);
|
||||||
|
|
||||||
QtVariantPropertyManager *m_variantManager;
|
QtVariantPropertyManager *m_variantManager;
|
||||||
QtEnumPropertyManager *m_enumManager;
|
QtEnumPropertyManager *m_enumManager;
|
||||||
QtGroupPropertyManager *m_groupManager;
|
QtGroupPropertyManager *m_groupManager;
|
||||||
|
QtTextPropertyManager *m_stringArrayManager;
|
||||||
|
|
||||||
Ui::PropertyEditorWidget m_ui;
|
Ui::PropertyEditorWidget m_ui;
|
||||||
}; /* PropertyEditorWidget */
|
}; /* PropertyEditorWidget */
|
||||||
|
|
|
@ -31,9 +31,14 @@ const int GRAPHICS_DATA_NEL3D = USER_TYPE + 4;
|
||||||
const int PRIMITIVE_IS_MODIFIED = USER_TYPE + 5;
|
const int PRIMITIVE_IS_MODIFIED = USER_TYPE + 5;
|
||||||
const int PRIMITIVE_FILE_IS_CREATED = USER_TYPE + 6;
|
const int PRIMITIVE_FILE_IS_CREATED = USER_TYPE + 6;
|
||||||
const int PRIMITIVE_IS_VISIBLE = USER_TYPE + 7;
|
const int PRIMITIVE_IS_VISIBLE = USER_TYPE + 7;
|
||||||
|
const int PRIMITIVE_IS_ENABLD = USER_TYPE + 8;
|
||||||
|
const int PRIMITIVE_FILE_NAME = USER_TYPE + 9;
|
||||||
|
const int PRIMITIVE_NON_REMOVABLE = USER_TYPE + 10;
|
||||||
|
const int ROOT_PRIMITIVE_CONTEXT = USER_TYPE + 20;
|
||||||
|
const int ROOT_PRIMITIVE_DATA_DIRECTORY = USER_TYPE + 21;
|
||||||
|
|
||||||
//properties editor
|
//properties editor
|
||||||
const char *const DIFFERENT_VALUE_STRING = "<different values>";
|
const char *const DIFFERENT_VALUE_STRING = "<different values>";
|
||||||
const char *const DIFFERENT_VALUE_MULTI_STRING = "<diff>";
|
const char *const DIFFERENT_VALUE_MULTI_STRING = "<diff>";
|
||||||
|
|
||||||
//settings
|
//settings
|
||||||
|
|
|
@ -274,7 +274,7 @@ void WorldEditorScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
||||||
else
|
else
|
||||||
m_editedSelectedItems = false;
|
m_editedSelectedItems = false;
|
||||||
}
|
}
|
||||||
// Update render
|
// Update render (drawing selection area when enabled multiple selection mode)
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,8 +275,16 @@ void WorldEditorWindow::updateSelection(const QItemSelection &selected, const QI
|
||||||
nodesDeselected.push_back(node);
|
nodesDeselected.push_back(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: update property editor
|
// update property editor
|
||||||
m_ui.propertyEditWidget->updateSelection(nodesSelected, nodesDeselected);
|
if (nodesSelected.size() > 0)
|
||||||
|
{
|
||||||
|
// only single selection
|
||||||
|
m_ui.propertyEditWidget->updateSelection(nodesSelected.at(0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ui.propertyEditWidget->clearProperties();
|
||||||
|
}
|
||||||
|
|
||||||
QList<QGraphicsItem *> itemSelected;
|
QList<QGraphicsItem *> itemSelected;
|
||||||
Q_FOREACH(Node *node, nodesSelected)
|
Q_FOREACH(Node *node, nodesSelected)
|
||||||
|
@ -320,8 +328,17 @@ void WorldEditorWindow::selectedItemsInScene(const QList<QGraphicsItem *> &selec
|
||||||
|
|
||||||
selectionModel->select(itemSelection, QItemSelectionModel::Select);
|
selectionModel->select(itemSelection, QItemSelectionModel::Select);
|
||||||
|
|
||||||
// TODO: update property editor
|
// update property editor
|
||||||
// ...
|
if (!selected.isEmpty())
|
||||||
|
{
|
||||||
|
// only single selection
|
||||||
|
Node *node = qvariant_cast<Node *>(selected.at(0)->data(Constants::WORLD_EDITOR_NODE));
|
||||||
|
m_ui.propertyEditWidget->updateSelection(node);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ui.propertyEditWidget->clearProperties();
|
||||||
|
}
|
||||||
|
|
||||||
connect(m_ui.treePrimitivesView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
|
connect(m_ui.treePrimitivesView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
|
||||||
this, SLOT(updateSelection(QItemSelection, QItemSelection)));
|
this, SLOT(updateSelection(QItemSelection, QItemSelection)));
|
||||||
|
|
Loading…
Reference in a new issue