mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-06 00:44:18 +05:00
"0021179: EDF 1654 SMESH GEOM: better look'n'feel" issue.
Material Properties.
This commit is contained in:
parent
48ea388121
commit
b28749ce34
@ -28,6 +28,7 @@
|
|||||||
#include "GEOMBase.h"
|
#include "GEOMBase.h"
|
||||||
|
|
||||||
#include <QtxColorButton.h>
|
#include <QtxColorButton.h>
|
||||||
|
#include <QtxDoubleSpinBox.h>
|
||||||
#include <SUIT_Desktop.h>
|
#include <SUIT_Desktop.h>
|
||||||
#include <SUIT_MessageBox.h>
|
#include <SUIT_MessageBox.h>
|
||||||
#include <SUIT_OverrideCursor.h>
|
#include <SUIT_OverrideCursor.h>
|
||||||
@ -52,17 +53,11 @@
|
|||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSlider>
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#define MARGIN 9 // layout spacing
|
#define MARGIN 9 // layout spacing
|
||||||
#define SPACING 6 // layout margin
|
#define SPACING 6 // layout margin
|
||||||
|
|
||||||
// convert floating point value to the integer equivalent
|
|
||||||
#define COEF2INT(val) (int)(val*100.)
|
|
||||||
// convert integer value to the floating point equivalent
|
|
||||||
#define INT2COEF(val) (val/100.)
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class GEOMToolsGUI_MaterialList
|
\class GEOMToolsGUI_MaterialList
|
||||||
\brief Internal class, used to handle context menu event from materials list
|
\brief Internal class, used to handle context menu event from materials list
|
||||||
@ -145,10 +140,11 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
refl.color = new QtxColorButton( propWidget );
|
refl.color = new QtxColorButton( propWidget );
|
||||||
//refl.color->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
//refl.color->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
||||||
|
|
||||||
refl.coef = new QSlider( Qt::Horizontal, propWidget );
|
refl.coef = new QtxDoubleSpinBox( propWidget );
|
||||||
refl.coef->setRange( 0, 100 );
|
refl.coef->setPrecision( 4 );
|
||||||
refl.coef->setSingleStep( 1 );
|
refl.coef->setDecimals( 4 );
|
||||||
refl.coef->setPageStep( 10 );
|
refl.coef->setRange( 0., 1. );
|
||||||
|
refl.coef->setSingleStep( 0.05 );
|
||||||
|
|
||||||
refl.enabled = new QCheckBox( tr( "ENABLED" ), propWidget );
|
refl.enabled = new QCheckBox( tr( "ENABLED" ), propWidget );
|
||||||
|
|
||||||
@ -157,10 +153,11 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
|
|
||||||
// shininess widgets
|
// shininess widgets
|
||||||
QLabel* shininessLab = new QLabel( tr( "SHININESS" ), propWidget );
|
QLabel* shininessLab = new QLabel( tr( "SHININESS" ), propWidget );
|
||||||
myShininess = new QSlider( Qt::Horizontal, propWidget );
|
myShininess = new QtxDoubleSpinBox( propWidget );
|
||||||
myShininess->setRange( 0, 100 );
|
myShininess->setPrecision( 4 );
|
||||||
myShininess->setSingleStep( 1 );
|
myShininess->setDecimals( 4 );
|
||||||
myShininess->setPageStep( 10 );
|
myShininess->setRange( 0., 1. );
|
||||||
|
myShininess->setSingleStep( 0.05 );
|
||||||
|
|
||||||
// separator widgets
|
// separator widgets
|
||||||
QFrame* line1 = new QFrame( propWidget );
|
QFrame* line1 = new QFrame( propWidget );
|
||||||
@ -236,10 +233,10 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
connect( myPhysical, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
|
connect( myPhysical, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
|
||||||
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) {
|
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) {
|
||||||
connect( myReflection[i].color, SIGNAL( changed( QColor ) ), this, SIGNAL( changed() ) );
|
connect( myReflection[i].color, SIGNAL( changed( QColor ) ), this, SIGNAL( changed() ) );
|
||||||
connect( myReflection[i].coef, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
|
connect( myReflection[i].coef, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
|
||||||
connect( myReflection[i].enabled, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
|
connect( myReflection[i].enabled, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
|
||||||
}
|
}
|
||||||
connect( myShininess, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
|
connect( myShininess, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
|
||||||
connect( myMaterials, SIGNAL( itemSelectionChanged() ),
|
connect( myMaterials, SIGNAL( itemSelectionChanged() ),
|
||||||
this, SLOT( onMaterialChanged() ) );
|
this, SLOT( onMaterialChanged() ) );
|
||||||
connect( myMaterials, SIGNAL( itemChanged( QListWidgetItem* ) ),
|
connect( myMaterials, SIGNAL( itemChanged( QListWidgetItem* ) ),
|
||||||
@ -326,12 +323,12 @@ void GEOMToolsGUI_MaterialPropertiesDlg::fromModel( const Material_Model& model
|
|||||||
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
|
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
|
||||||
{
|
{
|
||||||
myReflection[i].color->setColor( model.color( (Material_Model::ReflectionType)i ) );
|
myReflection[i].color->setColor( model.color( (Material_Model::ReflectionType)i ) );
|
||||||
myReflection[i].coef->setValue( COEF2INT( model.reflection( (Material_Model::ReflectionType)i ) ) );
|
myReflection[i].coef->setValue( model.reflection( (Material_Model::ReflectionType)i ) );
|
||||||
myReflection[i].enabled->setChecked( model.hasReflection( (Material_Model::ReflectionType)i ) );
|
myReflection[i].enabled->setChecked( model.hasReflection( (Material_Model::ReflectionType)i ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// shininess
|
// shininess
|
||||||
myShininess->setValue( COEF2INT( model.shininess() ) );
|
myShininess->setValue( model.shininess() );
|
||||||
|
|
||||||
// type (physical or no)
|
// type (physical or no)
|
||||||
myPhysical->setChecked( model.isPhysical() );
|
myPhysical->setChecked( model.isPhysical() );
|
||||||
@ -347,13 +344,13 @@ void GEOMToolsGUI_MaterialPropertiesDlg::toModel( Material_Model& model ) const
|
|||||||
model.setPhysical( myPhysical->isChecked() );
|
model.setPhysical( myPhysical->isChecked() );
|
||||||
|
|
||||||
// shininess
|
// shininess
|
||||||
model.setShininess( INT2COEF( myShininess->value() ) );
|
model.setShininess( myShininess->value() );
|
||||||
|
|
||||||
// reflection components
|
// reflection components
|
||||||
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
|
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
|
||||||
{
|
{
|
||||||
model.setColor ( (Material_Model::ReflectionType)i, myReflection[i].color->color() );
|
model.setColor ( (Material_Model::ReflectionType)i, myReflection[i].color->color() );
|
||||||
model.setReflection( (Material_Model::ReflectionType)i, INT2COEF( myReflection[i].coef->value() ) );
|
model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].coef->value() );
|
||||||
model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].enabled->isChecked() );
|
model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].enabled->isChecked() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QSlider;
|
class QtxDoubleSpinBox;
|
||||||
class QtxColorButton;
|
class QtxColorButton;
|
||||||
class GEOMToolsGUI_MaterialList;
|
class GEOMToolsGUI_MaterialList;
|
||||||
|
|
||||||
@ -78,14 +78,14 @@ private:
|
|||||||
{
|
{
|
||||||
QLabel* label;
|
QLabel* label;
|
||||||
QtxColorButton* color;
|
QtxColorButton* color;
|
||||||
QSlider* coef;
|
QtxDoubleSpinBox* coef;
|
||||||
QCheckBox* enabled;
|
QCheckBox* enabled;
|
||||||
} Reflection;
|
} Reflection;
|
||||||
|
|
||||||
GEOMToolsGUI_MaterialList* myMaterials;
|
GEOMToolsGUI_MaterialList* myMaterials;
|
||||||
QCheckBox* myPhysical;
|
QCheckBox* myPhysical;
|
||||||
QList<Reflection> myReflection;
|
QList<Reflection> myReflection;
|
||||||
QSlider* myShininess;
|
QtxDoubleSpinBox* myShininess;
|
||||||
QLabel* myColorLab;
|
QLabel* myColorLab;
|
||||||
QtxColorButton* myColor;
|
QtxColorButton* myColor;
|
||||||
QPushButton* myAddButton;
|
QPushButton* myAddButton;
|
||||||
|
@ -398,8 +398,12 @@ void GEOM_AISShape::shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPre
|
|||||||
//a4bis->SetInteriorColor(myShadingColor);
|
//a4bis->SetInteriorColor(myShadingColor);
|
||||||
if( isTopLevel() )
|
if( isTopLevel() )
|
||||||
myDrawer->ShadingAspect()->SetColor( topLevelColor() );
|
myDrawer->ShadingAspect()->SetColor( topLevelColor() );
|
||||||
else if(myDrawer->ShadingAspect()->Aspect()->FrontMaterial().MaterialType( Graphic3d_MATERIAL_ASPECT ))
|
else {
|
||||||
|
if(myDrawer->ShadingAspect()->Aspect()->FrontMaterial().MaterialType( Graphic3d_MATERIAL_ASPECT ))
|
||||||
myDrawer->ShadingAspect()->SetColor(myShadingColor);
|
myDrawer->ShadingAspect()->SetColor(myShadingColor);
|
||||||
|
else
|
||||||
|
myDrawer->ShadingAspect()->SetColor(myDrawer->ShadingAspect()->Aspect()->FrontMaterial().AmbientColor());
|
||||||
|
}
|
||||||
|
|
||||||
// PAL12113: AIS_Shape::Compute() works correctly with shapes containing no faces
|
// PAL12113: AIS_Shape::Compute() works correctly with shapes containing no faces
|
||||||
//StdPrs_ShadedShape::Add(aPrs,myshape,myDrawer);
|
//StdPrs_ShadedShape::Add(aPrs,myshape,myDrawer);
|
||||||
|
Loading…
Reference in New Issue
Block a user