misc cleanup

This commit is contained in:
Juan Linietsky 2015-10-17 10:29:54 -03:00
parent b3cda43a0f
commit ab22203791
13 changed files with 35 additions and 7 deletions

View File

@ -81,7 +81,7 @@ float BakedLightSampler::get_param(Param p_param) const{
void BakedLightSampler::set_resolution(int p_resolution){ void BakedLightSampler::set_resolution(int p_resolution){
ERR_FAIL_COND(p_resolution<4 && p_resolution>32); ERR_FAIL_COND(p_resolution<4 || p_resolution>32);
resolution=p_resolution; resolution=p_resolution;
VS::get_singleton()->baked_light_sampler_set_resolution(base,resolution); VS::get_singleton()->baked_light_sampler_set_resolution(base,resolution);
} }

View File

@ -126,7 +126,7 @@ void CollisionPolygon::_notification(int p_what) {
} break; } break;
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: {
if (!can_update_body && shape_from>=0 && shape_from>=0) { if (!can_update_body && shape_from>=0 && shape_to>=0) {
CollisionObject *co = get_parent()->cast_to<CollisionObject>(); CollisionObject *co = get_parent()->cast_to<CollisionObject>();
if (co) { if (co) {

View File

@ -2713,6 +2713,21 @@ void Control::warp_mouse(const Point2& p_to_pos) {
get_viewport()->warp_mouse(get_global_transform().xform(p_to_pos)); get_viewport()->warp_mouse(get_global_transform().xform(p_to_pos));
} }
bool Control::is_text_field() const {
/*
if (get_script_instance()) {
Variant v=p_point;
const Variant *p[2]={&v,&p_data};
Variant::CallError ce;
Variant ret = get_script_instance()->call("is_text_field",p,2,ce);
if (ce.error==Variant::CallError::CALL_OK)
return ret;
}
*/
return false;
}
void Control::_bind_methods() { void Control::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_window_input_event"),&Control::_window_input_event); ObjectTypeDB::bind_method(_MD("_window_input_event"),&Control::_window_input_event);

View File

@ -382,6 +382,8 @@ public:
void warp_mouse(const Point2& p_to_pos); void warp_mouse(const Point2& p_to_pos);
virtual bool is_text_field() const;
Control(); Control();
~Control(); ~Control();

View File

@ -782,6 +782,10 @@ void LineEdit::select(int p_from, int p_to) {
update(); update();
} }
bool LineEdit::is_text_field() const {
return true;
}
void LineEdit::_bind_methods() { void LineEdit::_bind_methods() {

View File

@ -112,6 +112,8 @@ public:
void select(int p_from=0, int p_to=-1); void select(int p_from=0, int p_to=-1);
virtual Size2 get_minimum_size() const; virtual Size2 get_minimum_size() const;
virtual bool is_text_field() const;
LineEdit(); LineEdit();
~LineEdit(); ~LineEdit();

View File

@ -3568,7 +3568,10 @@ void TextEdit::set_show_line_numbers(bool p_show) {
update(); update();
} }
bool TextEdit::is_text_field() const {
return true;
}
void TextEdit::_bind_methods() { void TextEdit::_bind_methods() {

View File

@ -393,6 +393,7 @@ public:
String get_text_for_completion(); String get_text_for_completion();
virtual bool is_text_field() const;
TextEdit(); TextEdit();
~TextEdit(); ~TextEdit();
}; };

View File

@ -1375,7 +1375,7 @@ void VisualServerRaster::_update_baked_light_sampler_dp_cache(BakedLightSampler
void VisualServerRaster::baked_light_sampler_set_resolution(RID p_baked_light_sampler,int p_resolution){ void VisualServerRaster::baked_light_sampler_set_resolution(RID p_baked_light_sampler,int p_resolution){
ERR_FAIL_COND(p_resolution<4 && p_resolution>64); ERR_FAIL_COND(p_resolution<4 || p_resolution>64);
VS_CHANGED; VS_CHANGED;
BakedLightSampler * blsamp = baked_light_sampler_owner.get(p_baked_light_sampler); BakedLightSampler * blsamp = baked_light_sampler_owner.get(p_baked_light_sampler);
ERR_FAIL_COND(!blsamp); ERR_FAIL_COND(!blsamp);

View File

@ -2369,7 +2369,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
te->update(); te->update();
track_editor->set_tooltip(""); track_editor->set_tooltip("");
if (!track_editor->has_focus() && (!get_focus_owner() || !get_focus_owner()->cast_to<LineEdit>())) if (!track_editor->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field()))
track_editor->call_deferred("grab_focus"); track_editor->call_deferred("grab_focus");

View File

@ -1281,7 +1281,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
if (p_event.type==InputEvent::MOUSE_MOTION) { if (p_event.type==InputEvent::MOUSE_MOTION) {
if (!viewport->has_focus()) if (!viewport->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field()))
viewport->call_deferred("grab_focus"); viewport->call_deferred("grab_focus");
const InputEventMouseMotion &m=p_event.mouse_motion; const InputEventMouseMotion &m=p_event.mouse_motion;

View File

@ -25,7 +25,7 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES& p_from) {
if (img.is_compressed()) { if (img.is_compressed()) {
if (img.decompress()!=OK) if (img.decompress()!=OK)
return Ref<Texture>(); return Ref<Texture>();
} else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGB) { } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGBA) {
img.convert(Image::FORMAT_RGBA); img.convert(Image::FORMAT_RGBA);
} }

View File

@ -677,7 +677,8 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2& p_screenpos,bool p_hili
void SpatialEditorViewport::_smouseenter() { void SpatialEditorViewport::_smouseenter() {
surface->grab_focus(); if (!surface->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field()))
surface->grab_focus();
} }
void SpatialEditorViewport::_sinput(const InputEvent &p_event) { void SpatialEditorViewport::_sinput(const InputEvent &p_event) {