Add editor setting: Manipulator Gizmo Opacity

This commit is contained in:
marynate 2014-07-15 13:05:55 +08:00
parent 9ff6d55822
commit 95383469d3
1 changed files with 5 additions and 2 deletions

View File

@ -2800,11 +2800,13 @@ void SpatialEditor::_init_indicators() {
//move gizmo //move gizmo
float gizmo_alph = EditorSettings::get_singleton()->get("3d_editor/manipulator_gizmo_opacity");
gizmo_hl = Ref<FixedMaterial>( memnew( FixedMaterial ) ); gizmo_hl = Ref<FixedMaterial>( memnew( FixedMaterial ) );
gizmo_hl->set_flag(Material::FLAG_UNSHADED, true); gizmo_hl->set_flag(Material::FLAG_UNSHADED, true);
gizmo_hl->set_flag(Material::FLAG_ONTOP, true); gizmo_hl->set_flag(Material::FLAG_ONTOP, true);
gizmo_hl->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); gizmo_hl->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true);
gizmo_hl->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,0.4)); gizmo_hl->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,gizmo_alph+0.2f));
for(int i=0;i<3;i++) { for(int i=0;i<3;i++) {
@ -2818,7 +2820,7 @@ void SpatialEditor::_init_indicators() {
mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true);
Color col; Color col;
col[i]=1.0; col[i]=1.0;
col.a=0.2; col.a= gizmo_alph;
mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,col); mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,col);
gizmo_color[i]=mat; gizmo_color[i]=mat;
@ -3507,6 +3509,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
EDITOR_DEF("3d_editor/manipulator_gizmo_size",80); EDITOR_DEF("3d_editor/manipulator_gizmo_size",80);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT,"3d_editor/manipulator_gizmo_size",PROPERTY_HINT_RANGE,"16,1024,1")); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT,"3d_editor/manipulator_gizmo_size",PROPERTY_HINT_RANGE,"16,1024,1"));
EDITOR_DEF("3d_editor/manipulator_gizmo_opacity",0.2);
over_gizmo_handle=-1; over_gizmo_handle=-1;
} }