git-svn-id: svn://db.shs.com.ru/libs@690 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -280,8 +280,8 @@ const Box3D & Scene::boundingBox() const {
|
||||
}
|
||||
|
||||
|
||||
Material * Scene::newMaterial() {
|
||||
materials << new Material();
|
||||
Material * Scene::newMaterial(const QString & name) {
|
||||
materials << new Material(name);
|
||||
makeMaterialsUniqueNames();
|
||||
mat_changed = true;
|
||||
return materials.back();
|
||||
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
const Box3D & boundingBox() const;
|
||||
|
||||
QVector<Material*> getMaterials() const {return materials;}
|
||||
Material * newMaterial();
|
||||
Material * newMaterial(const QString & name = QString());
|
||||
void removeMaterial(Material * m);
|
||||
void makeMaterialsUniqueNames();
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ bool MaterialsEditor::event(QEvent * e) {
|
||||
ui->comboMaterial->setIconSize(sz * 3);
|
||||
ui->buttonRename->setIconSize(sz);
|
||||
ui->buttonAdd ->setIconSize(sz);
|
||||
ui->buttonClone ->setIconSize(sz);
|
||||
ui->buttonDelete->setIconSize(sz);
|
||||
ui->buttonAssign->setIconSize(sz);
|
||||
ui->buttonUnset ->setIconSize(sz);
|
||||
@@ -162,6 +163,20 @@ void MaterialsEditor::on_buttonAdd_clicked() {
|
||||
}
|
||||
|
||||
|
||||
void MaterialsEditor::on_buttonClone_clicked() {
|
||||
if (!view) return;
|
||||
Material * curm = currentMaterial();
|
||||
if (!curm) return;
|
||||
Material * m = view->scene()->newMaterial(curm->name);
|
||||
QString nm = m->name;
|
||||
*m = *curm;
|
||||
m->name = nm;
|
||||
m->_changed = true;
|
||||
materialsChanged();
|
||||
selectMaterial(m);
|
||||
}
|
||||
|
||||
|
||||
void MaterialsEditor::on_buttonDelete_clicked() {
|
||||
if (!view) return;
|
||||
Material * m = currentMaterial();
|
||||
|
||||
@@ -53,6 +53,7 @@ private slots:
|
||||
void on_comboMaterial_currentIndexChanged(int index);
|
||||
void on_buttonRename_clicked();
|
||||
void on_buttonAdd_clicked();
|
||||
void on_buttonClone_clicked();
|
||||
void on_buttonDelete_clicked();
|
||||
void on_buttonAssign_clicked();
|
||||
void on_buttonUnset_clicked();
|
||||
|
||||
@@ -68,17 +68,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QToolButton" name="buttonRename">
|
||||
<property name="toolTip">
|
||||
<string>Rename ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qglview.qrc">
|
||||
<normaloff>:/icons/edit-rename.png</normaloff>:/icons/edit-rename.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" rowspan="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
@@ -106,7 +95,18 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="1" column="3">
|
||||
<widget class="QToolButton" name="buttonAssign">
|
||||
<property name="toolTip">
|
||||
<string>Assign</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="widgets.qrc">
|
||||
<normaloff>:/icons/go-jump.png</normaloff>:/icons/go-jump.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QToolButton" name="buttonAdd">
|
||||
<property name="toolTip">
|
||||
<string>Add</string>
|
||||
@@ -117,7 +117,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="buttonDelete">
|
||||
<property name="toolTip">
|
||||
<string>Delete</string>
|
||||
@@ -128,14 +128,25 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QToolButton" name="buttonAssign">
|
||||
<item row="1" column="1">
|
||||
<widget class="QToolButton" name="buttonRename">
|
||||
<property name="toolTip">
|
||||
<string>Assign</string>
|
||||
<string>Rename ...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="widgets.qrc">
|
||||
<normaloff>:/icons/go-jump.png</normaloff>:/icons/go-jump.png</iconset>
|
||||
<iconset resource="../qglview.qrc">
|
||||
<normaloff>:/icons/edit-rename.png</normaloff>:/icons/edit-rename.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QToolButton" name="buttonClone">
|
||||
<property name="toolTip">
|
||||
<string>Clone</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/utils/qad_utils.qrc">
|
||||
<normaloff>:/icons/edit-copy.png</normaloff>:/icons/edit-copy.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user