New option to send canvas to render buffer

allows to use 3D environment effects for post processing such as Glow,
Bloom, HDR, etc. in 2D.
This commit is contained in:
Juan Linietsky 2015-03-16 00:47:37 -03:00
parent 5b54361daf
commit 53e1694e1e
22 changed files with 238 additions and 50 deletions

View File

@ -0,0 +1,26 @@
extends Node2D
# member variables here, example:
# var a=2
# var b="textvar"
const CAVE_LIMIT=1000
func _input(ev):
if (ev.type==InputEvent.MOUSE_MOTION and ev.button_mask&1):
var rel_x = ev.relative_x
var cavepos = get_node("cave").get_pos()
cavepos.x+=rel_x
if (cavepos.x<-CAVE_LIMIT):
cavepos.x=-CAVE_LIMIT
elif (cavepos.x>0):
cavepos.x=0
get_node("cave").set_pos(cavepos)
func _ready():
set_process_input(true)
# Initialization here
pass

BIN
demos/2d/hdr/beach_cave.scn Normal file

Binary file not shown.

13
demos/2d/hdr/engine.cfg Normal file
View File

@ -0,0 +1,13 @@
[application]
name="HDR for 2D"
main_scene="res://beach_cave.scn"
[display]
width=1080
height=720
[rasterizer]
blur_buffer_size=128

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 KiB

View File

@ -0,0 +1 @@
tolinear=true

BIN
demos/2d/hdr/ocean_cave.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 KiB

View File

@ -0,0 +1 @@
tolinear=true

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -4288,7 +4288,7 @@ void RasterizerGLES2::capture_viewport(Image* r_capture) {
void RasterizerGLES2::clear_viewport(const Color& p_color) {
if (current_rt) {
if (current_rt || using_canvas_bg) {
glScissor( 0, 0, viewport.width, viewport.height );
} else {
@ -6944,7 +6944,7 @@ void RasterizerGLES2::_draw_tex_bg() {
RID texture;
if (current_env->bg_mode==VS::ENV_BG_TEXTURE || current_env->bg_mode==VS::ENV_BG_TEXTURE_RGBE) {
if (current_env->bg_mode==VS::ENV_BG_TEXTURE) {
texture=current_env->bg_param[VS::ENV_BG_PARAM_TEXTURE];
} else {
texture=current_env->bg_param[VS::ENV_BG_PARAM_CUBEMAP];
@ -6961,25 +6961,20 @@ void RasterizerGLES2::_draw_tex_bg() {
copy_shader.set_conditional(CopyShaderGLES2::USE_ENERGY,true);
if (current_env->bg_mode==VS::ENV_BG_TEXTURE || current_env->bg_mode==VS::ENV_BG_TEXTURE_RGBE) {
if (current_env->bg_mode==VS::ENV_BG_TEXTURE) {
copy_shader.set_conditional(CopyShaderGLES2::USE_CUBEMAP,false);
} else {
copy_shader.set_conditional(CopyShaderGLES2::USE_CUBEMAP,true);
}
if (current_env->bg_mode==VS::ENV_BG_CUBEMAP_RGBE || current_env->bg_mode==VS::ENV_BG_TEXTURE_RGBE) {
copy_shader.set_conditional(CopyShaderGLES2::USE_RGBE,true);
} else {
copy_shader.set_conditional(CopyShaderGLES2::USE_RGBE,false);
}
copy_shader.set_conditional(CopyShaderGLES2::USE_CUSTOM_ALPHA,true);
copy_shader.bind();
if (current_env->bg_mode==VS::ENV_BG_TEXTURE || current_env->bg_mode==VS::ENV_BG_TEXTURE_RGBE) {
if (current_env->bg_mode==VS::ENV_BG_TEXTURE) {
glUniform1i( copy_shader.get_uniform_location(CopyShaderGLES2::SOURCE),0);
} else {
glUniform1i( copy_shader.get_uniform_location(CopyShaderGLES2::SOURCE_CUBE),0);
@ -7006,7 +7001,7 @@ void RasterizerGLES2::_draw_tex_bg() {
Vector3( 0, 0, 0)
};
if (current_env->bg_mode==VS::ENV_BG_TEXTURE || current_env->bg_mode==VS::ENV_BG_TEXTURE_RGBE) {
if (current_env->bg_mode==VS::ENV_BG_TEXTURE) {
//regular texture
//adjust aspect
@ -7076,7 +7071,7 @@ void RasterizerGLES2::end_scene() {
if (framebuffer.active) {
//detect when to use the framebuffer object
if (texscreen_used || framebuffer.scale!=1) {
if (using_canvas_bg || texscreen_used || framebuffer.scale!=1) {
use_fb=true;
} else if (current_env) {
use_fb=false;
@ -7128,6 +7123,7 @@ void RasterizerGLES2::end_scene() {
switch(current_env->bg_mode) {
case VS::ENV_BG_CANVAS:
case VS::ENV_BG_KEEP: {
//copy from framebuffer if framebuffer
glClear(GL_DEPTH_BUFFER_BIT);
@ -7140,7 +7136,7 @@ void RasterizerGLES2::end_scene() {
bgcolor = current_env->bg_param[VS::ENV_BG_PARAM_COLOR];
else
bgcolor = Globals::get_singleton()->get("render/default_clear_color");
bgcolor = _convert_color(bgcolor);
bgcolor = _convert_color(bgcolor);
float a = use_fb ? float(current_env->bg_param[VS::ENV_BG_PARAM_GLOW]) : 1.0;
glClearColor(bgcolor.r,bgcolor.g,bgcolor.b,a);
_glClearDepth(1.0);
@ -7148,9 +7144,7 @@ void RasterizerGLES2::end_scene() {
} break;
case VS::ENV_BG_TEXTURE:
case VS::ENV_BG_CUBEMAP:
case VS::ENV_BG_TEXTURE_RGBE:
case VS::ENV_BG_CUBEMAP_RGBE: {
case VS::ENV_BG_CUBEMAP: {
glClear(GL_DEPTH_BUFFER_BIT);
@ -7369,8 +7363,12 @@ void RasterizerGLES2::end_scene() {
_debug_shadows();
}
// _debug_luminances();
_debug_samplers();
// _debug_samplers();
if (using_canvas_bg) {
using_canvas_bg=false;
glColorMask(1,1,1,1); //don't touch alpha
}
}
void RasterizerGLES2::end_shadow_map() {
@ -7839,8 +7837,26 @@ void RasterizerGLES2::flush_frame() {
/* CANVAS API */
void RasterizerGLES2::begin_canvas_bg() {
if (framebuffer.active) {
using_canvas_bg=true;
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.fbo);
glViewport( 0,0,viewport.width , viewport.height );
} else {
using_canvas_bg=false;
}
}
void RasterizerGLES2::canvas_begin() {
if (using_canvas_bg) {
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.fbo);
glColorMask(1,1,1,0); //don't touch alpha
}
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
@ -10567,7 +10583,7 @@ void RasterizerGLES2::init() {
glBindBuffer(GL_ARRAY_BUFFER,0); //unbind
using_canvas_bg=false;
_update_framebuffer();
DEBUG_TEST_ERROR("Initializing");
}

View File

@ -677,6 +677,7 @@ class RasterizerGLES2 : public Rasterizer {
bg_param[VS::ENV_BG_PARAM_ENERGY]=1.0;
bg_param[VS::ENV_BG_PARAM_SCALE]=1.0;
bg_param[VS::ENV_BG_PARAM_GLOW]=0.0;
bg_param[VS::ENV_BG_PARAM_CANVAS_MAX_LAYER]=0;
for(int i=0;i<VS::ENV_FX_MAX;i++)
fx_enabled[i]=false;
@ -1258,6 +1259,7 @@ class RasterizerGLES2 : public Rasterizer {
void _process_hdr();
void _draw_tex_bg();
bool using_canvas_bg;
Size2 window_size;
VS::ViewportRect viewport;
double last_time;
@ -1600,6 +1602,8 @@ public:
/* CANVAS API */
virtual void begin_canvas_bg();
virtual void canvas_begin();
virtual void canvas_disable_blending();

View File

@ -1862,6 +1862,7 @@ String OS_Windows::get_stdin_string(bool p_block) {
void OS_Windows::move_window_to_foreground() {
SetForegroundWindow(hWnd);
BringWindowToTop(hWnd);
}

View File

@ -1345,7 +1345,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
return;
}
if (k.scancode==KEY_HOME) {
if (k.scancode==KEY_HOME && completion_index>0) {
completion_index=0;
completion_current=completion_options[completion_index];
@ -1354,7 +1354,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
return;
}
if (k.scancode==KEY_END) {
if (k.scancode==KEY_END && completion_index<completion_options.size()-1) {
completion_index=completion_options.size()-1;
completion_current=completion_options[completion_index];

View File

@ -108,13 +108,14 @@ void Environment::_bind_methods() {
ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"fxaa/enabled"),_SCS("set_enable_fx"),_SCS("is_fx_enabled"), FX_FXAA);
ADD_PROPERTY( PropertyInfo(Variant::INT,"background/mode",PROPERTY_HINT_ENUM,"Keep,Default Color,Color,Texture,Cubemap,Texture RGBE,Cubemap RGBE"),_SCS("set_background"),_SCS("get_background"));
ADD_PROPERTY( PropertyInfo(Variant::INT,"background/mode",PROPERTY_HINT_ENUM,"Keep,Default Color,Color,Texture,Cubemap,Canvas"),_SCS("set_background"),_SCS("get_background"));
ADD_PROPERTYI( PropertyInfo(Variant::COLOR,"background/color"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_COLOR);
ADD_PROPERTYI( PropertyInfo(Variant::OBJECT,"background/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_TEXTURE);
ADD_PROPERTYI( PropertyInfo(Variant::OBJECT,"background/cubemap",PROPERTY_HINT_RESOURCE_TYPE,"CubeMap"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_CUBEMAP);
ADD_PROPERTYI( PropertyInfo(Variant::REAL,"background/energy",PROPERTY_HINT_RANGE,"0,128,0.01"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_ENERGY);
ADD_PROPERTYI( PropertyInfo(Variant::REAL,"background/scale",PROPERTY_HINT_RANGE,"0.001,16,0.001"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_SCALE);
ADD_PROPERTYI( PropertyInfo(Variant::REAL,"background/glow",PROPERTY_HINT_RANGE,"0.00,8,0.01"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_GLOW);
ADD_PROPERTYI( PropertyInfo(Variant::INT,"background/canvas_max_layer"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_CANVAS_MAX_LAYER);
ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"glow/enabled"),_SCS("set_enable_fx"),_SCS("is_fx_enabled"), FX_GLOW);
ADD_PROPERTYI( PropertyInfo(Variant::INT,"glow/blur_passes",PROPERTY_HINT_RANGE,"1,4,1"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_GLOW_BLUR_PASSES);
@ -182,10 +183,10 @@ void Environment::_bind_methods() {
BIND_CONSTANT( BG_COLOR );
BIND_CONSTANT( BG_TEXTURE );
BIND_CONSTANT( BG_CUBEMAP );
BIND_CONSTANT( BG_TEXTURE_RGBE );
BIND_CONSTANT( BG_CUBEMAP_RGBE );
BIND_CONSTANT( BG_CANVAS );
BIND_CONSTANT( BG_MAX );
BIND_CONSTANT( BG_PARAM_CANVAS_MAX_LAYER );
BIND_CONSTANT( BG_PARAM_COLOR );
BIND_CONSTANT( BG_PARAM_TEXTURE );
BIND_CONSTANT( BG_PARAM_CUBEMAP );

View File

@ -44,14 +44,14 @@ public:
BG_COLOR=VS::ENV_BG_COLOR,
BG_TEXTURE=VS::ENV_BG_TEXTURE,
BG_CUBEMAP=VS::ENV_BG_CUBEMAP,
BG_TEXTURE_RGBE=VS::ENV_BG_TEXTURE_RGBE,
BG_CUBEMAP_RGBE=VS::ENV_BG_CUBEMAP_RGBE,
BG_CANVAS=VS::ENV_BG_CANVAS,
BG_MAX=VS::ENV_BG_MAX
};
enum BGParam {
BG_PARAM_COLOR=VS::ENV_BG_PARAM_COLOR,
BG_PARAM_CANVAS_MAX_LAYER=VS::ENV_BG_PARAM_CANVAS_MAX_LAYER,
BG_PARAM_COLOR=VS::ENV_BG_PARAM_COLOR,
BG_PARAM_TEXTURE=VS::ENV_BG_PARAM_TEXTURE,
BG_PARAM_CUBEMAP=VS::ENV_BG_PARAM_CUBEMAP,
BG_PARAM_ENERGY=VS::ENV_BG_PARAM_ENERGY,

View File

@ -918,6 +918,7 @@ public:
CanvasItemDrawViewportFunc draw_viewport_func;
virtual void begin_canvas_bg()=0;
virtual void canvas_begin()=0;
virtual void canvas_disable_blending()=0;
virtual void canvas_set_opacity(float p_opacity)=0;

View File

@ -1693,6 +1693,17 @@ void VisualServerRaster::viewport_set_hide_canvas(RID p_viewport,bool p_hide) {
}
void VisualServerRaster::viewport_set_disable_environment(RID p_viewport,bool p_disable) {
VS_CHANGED;
Viewport *viewport=NULL;
viewport = viewport_owner.get( p_viewport );
ERR_FAIL_COND(!viewport);
viewport->disable_environment=p_disable;
}
void VisualServerRaster::viewport_attach_camera(RID p_viewport,RID p_camera) {
VS_CHANGED;
@ -6267,6 +6278,20 @@ void VisualServerRaster::_process_sampled_light(const Transform& p_camera,Instan
}
void VisualServerRaster::_render_no_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario) {
RID environment;
if (p_scenario->environment.is_valid())
environment=p_scenario->environment;
else
environment=p_scenario->fallback_environment;
rasterizer->set_camera(Transform(),CameraMatrix());
rasterizer->begin_scene(p_viewport->viewport_data,environment,p_scenario->debug);
rasterizer->set_viewport(viewport_rect);
rasterizer->end_scene();
}
void VisualServerRaster::_render_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario) {
@ -6889,6 +6914,23 @@ void VisualServerRaster::_render_canvas(Canvas *p_canvas,const Matrix32 &p_trans
}
void VisualServerRaster::_draw_viewport_camera(Viewport *p_viewport,bool p_ignore_camera) {
Camera *camera=NULL;
if (camera_owner.owns( p_viewport->camera ))
camera=camera_owner.get( p_viewport->camera );
Scenario *scenario = scenario_owner.get( p_viewport->scenario );
_update_instances(); // check dirty instances before rendering
if (p_ignore_camera)
_render_no_camera(p_viewport, camera,scenario );
else
_render_camera(p_viewport, camera,scenario );
}
void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_ofs_y,int p_parent_w,int p_parent_h) {
ViewportRect desired_rect=p_viewport->rect;
@ -6923,14 +6965,31 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
/* Camera should always be BEFORE any other 3D */
if (!p_viewport->hide_scenario && camera_owner.owns(p_viewport->camera) && scenario_owner.owns(p_viewport->scenario)) {
bool scenario_draw_canvas_bg=false;
int scenario_canvas_max_layer=0;
Camera *camera = camera_owner.get( p_viewport->camera );
Scenario *scenario = scenario_owner.get( p_viewport->scenario );
if (!p_viewport->hide_canvas && !p_viewport->disable_environment && scenario_owner.owns(p_viewport->scenario)) {
_update_instances(); // check dirty instances before rendering
Scenario *scenario=scenario_owner.get(p_viewport->scenario);
if (scenario->environment.is_valid()) {
if (rasterizer->is_environment(scenario->environment)) {
scenario_draw_canvas_bg=rasterizer->environment_get_background(scenario->environment)==VS::ENV_BG_CANVAS;
scenario_canvas_max_layer=rasterizer->environment_get_background_param(scenario->environment,VS::ENV_BG_PARAM_CANVAS_MAX_LAYER);
}
}
}
_render_camera(p_viewport, camera,scenario );
bool can_draw_3d=!p_viewport->hide_scenario && camera_owner.owns(p_viewport->camera) && scenario_owner.owns(p_viewport->scenario);
if (scenario_draw_canvas_bg) {
rasterizer->begin_canvas_bg();
}
if (!scenario_draw_canvas_bg && can_draw_3d) {
_draw_viewport_camera(p_viewport,false);
} else if (true /*|| !p_viewport->canvas_list.empty()*/){
@ -6940,7 +6999,10 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
rasterizer->clear_viewport(Color(0,0,0,0));
}
else {
rasterizer->clear_viewport(clear_color);
Color cc=clear_color;
if (scenario_draw_canvas_bg)
cc.a=0;
rasterizer->clear_viewport(cc);
}
p_viewport->render_target_clear=false;
}
@ -7040,6 +7102,16 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
rasterizer->set_viewport(viewport_rect); //must reset viewport afterwards
}
if (scenario_draw_canvas_bg && canvas_map.front() && canvas_map.front()->key().layer>scenario_canvas_max_layer) {
_draw_viewport_camera(p_viewport,!can_draw_3d);
scenario_draw_canvas_bg=false;
}
for (Map<Viewport::CanvasKey,Viewport::CanvasData*>::Element *E=canvas_map.front();E;E=E->next()) {
@ -7061,8 +7133,20 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
_render_canvas( E->get()->canvas,xform,canvas_lights );
i++;
if (scenario_draw_canvas_bg && E->key().layer>=scenario_canvas_max_layer) {
_draw_viewport_camera(p_viewport,!can_draw_3d);
scenario_draw_canvas_bg=false;
}
}
if (scenario_draw_canvas_bg) {
_draw_viewport_camera(p_viewport,!can_draw_3d);
scenario_draw_canvas_bg=false;
}
//rasterizer->canvas_debug_viewport_shadows(lights_with_shadow);
}

View File

@ -489,6 +489,8 @@ class VisualServerRaster : public VisualServer {
bool render_target_vflip;
bool render_target_clear_on_new_frame;
bool render_target_clear;
bool disable_environment;
Image capture;
bool rendered_in_prev_frame;
@ -515,7 +517,7 @@ class VisualServerRaster : public VisualServer {
SelfList<Viewport> update_list;
Viewport() : update_list(this) { transparent_bg=false; render_target_update_mode=RENDER_TARGET_UPDATE_WHEN_VISIBLE; queue_capture=false; rendered_in_prev_frame=false; render_target_vflip=false; render_target_clear_on_new_frame=true; render_target_clear=true;}
Viewport() : update_list(this) { transparent_bg=false; render_target_update_mode=RENDER_TARGET_UPDATE_WHEN_VISIBLE; queue_capture=false; rendered_in_prev_frame=false; render_target_vflip=false; render_target_clear_on_new_frame=true; render_target_clear=true; disable_environment=false; }
};
SelfList<Viewport>::List viewport_update_list;
@ -626,6 +628,7 @@ class VisualServerRaster : public VisualServer {
void _cull_room(Camera *p_camera, Instance *p_room,Instance *p_from_portal=NULL);
void _process_sampled_light(const Transform &p_camera, Instance *p_sampled_light, bool p_linear_colorspace);
void _render_no_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario);
void _render_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario);
static void _render_canvas_item_viewport(VisualServer* p_self,void *p_vp,const Rect2& p_rect);
void _render_canvas_item_tree(CanvasItem *p_canvas_item, const Matrix32& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, Rasterizer::CanvasLight *p_lights);
@ -643,6 +646,7 @@ class VisualServerRaster : public VisualServer {
int changes;
bool draw_extra_frame;
void _draw_viewport_camera(Viewport *p_viewport, bool p_ignore_camera);
void _draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_ofs_y,int p_parent_w,int p_parent_h);
void _draw_viewports();
void _draw_cursors_and_margins();
@ -983,6 +987,7 @@ public:
virtual void viewport_render_target_clear(RID p_viewport);
virtual void viewport_set_render_target_to_screen_rect(RID p_viewport,const Rect2& p_rect);
virtual void viewport_queue_screen_capture(RID p_viewport);
virtual Image viewport_get_screen_capture(RID p_viewport) const;
@ -991,6 +996,7 @@ public:
virtual void viewport_set_hide_scenario(RID p_viewport,bool p_hide);
virtual void viewport_set_hide_canvas(RID p_viewport,bool p_hide);
virtual void viewport_set_disable_environment(RID p_viewport,bool p_disable);
virtual void viewport_attach_camera(RID p_viewport,RID p_camera);
virtual void viewport_set_scenario(RID p_viewport,RID p_scenario);

View File

@ -982,6 +982,7 @@ public:
FUNC2(viewport_set_hide_canvas,RID,bool );
FUNC2(viewport_attach_camera,RID,RID );
FUNC2(viewport_set_scenario,RID,RID );
FUNC2(viewport_set_disable_environment,RID,bool );
FUNC1RC(RID,viewport_get_attached_camera,RID);
FUNC1RC(RID,viewport_get_scenario,RID );

View File

@ -704,6 +704,7 @@ public:
virtual void viewport_set_hide_scenario(RID p_viewport,bool p_hide)=0;
virtual void viewport_set_hide_canvas(RID p_viewport,bool p_hide)=0;
virtual void viewport_set_disable_environment(RID p_viewport,bool p_disable)=0;
virtual void viewport_attach_camera(RID p_viewport,RID p_camera)=0;
virtual void viewport_set_scenario(RID p_viewport,RID p_scenario)=0;
@ -734,8 +735,7 @@ public:
ENV_BG_COLOR,
ENV_BG_TEXTURE,
ENV_BG_CUBEMAP,
ENV_BG_TEXTURE_RGBE,
ENV_BG_CUBEMAP_RGBE,
ENV_BG_CANVAS,
ENV_BG_MAX
};
@ -744,6 +744,7 @@ public:
enum EnvironmentBGParam {
ENV_BG_PARAM_CANVAS_MAX_LAYER,
ENV_BG_PARAM_COLOR,
ENV_BG_PARAM_TEXTURE,
ENV_BG_PARAM_CUBEMAP,

View File

@ -218,6 +218,7 @@ void EditorNode::_notification(int p_what) {
}
if (p_what==NOTIFICATION_ENTER_TREE) {
//MessageQueue::get_singleton()->push_call(this,"_get_scene_metadata");
get_tree()->set_editor_hint(true);
get_tree()->get_root()->set_as_audio_listener(false);
@ -231,6 +232,8 @@ void EditorNode::_notification(int p_what) {
VisualServer::get_singleton()->viewport_set_hide_scenario(get_scene_root()->get_viewport(),true);
VisualServer::get_singleton()->viewport_set_hide_canvas(get_scene_root()->get_viewport(),true);
VisualServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(),true);
_editor_select(1);
if (defer_load_scene!="") {
@ -3412,6 +3415,8 @@ EditorNode::EditorNode() {
scene_root = memnew( Viewport );
//scene_root_base->add_child(scene_root);
scene_root->set_meta("_editor_disable_input",true);
VisualServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport(),true);

View File

@ -651,6 +651,8 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
if (!RES(v).is_null()) {
menu->add_icon_item(get_icon("EditResource","EditorIcons"),"Edit",OBJ_MENU_EDIT);
menu->add_icon_item(get_icon("Del","EditorIcons"),"Clear",OBJ_MENU_CLEAR);
menu->add_icon_item(get_icon("Duplicate","EditorIcons"),"Make Unique",OBJ_MENU_MAKE_UNIQUE);
@ -659,6 +661,13 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
menu->add_separator();
menu->add_icon_item(get_icon("Reload","EditorIcons"),"Re-Import",OBJ_MENU_REIMPORT);
}
/*if (r.is_valid() && r->get_path().is_resource_file()) {
menu->set_item_tooltip(1,r->get_path());
} else if (r.is_valid()) {
menu->set_item_tooltip(1,r->get_name()+" ("+r->get_type()+")");
}*/
} else {
}
@ -1858,6 +1867,14 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
p_item->set_text(1,"<"+res->get_type()+">");
};
if (res.is_valid() && res->get_path().is_resource_file()) {
p_item->set_tooltip(1,res->get_path());
} else if (res.is_valid()) {
p_item->set_tooltip(1,res->get_name()+" ("+res->get_type()+")");
}
if (has_icon(res->get_type(),"EditorIcons")) {
p_item->set_icon(0,get_icon(res->get_type(),"EditorIcons"));
@ -2584,6 +2601,13 @@ void PropertyEditor::update_tree() {
if (has_icon(res->get_type(),"EditorIcons")) {
type=res->get_type();
}
if (res.is_valid() && res->get_path().is_resource_file()) {
item->set_tooltip(1,res->get_path());
} else if (res.is_valid()) {
item->set_tooltip(1,res->get_name()+" ("+res->get_type()+")");
}
}