summaryrefslogtreecommitdiff
path: root/tools/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/plugins')
-rw-r--r--tools/editor/plugins/baked_light_baker.cpp21
-rw-r--r--tools/editor/plugins/baked_light_baker.h3
-rw-r--r--tools/editor/plugins/baked_light_editor_plugin.cpp5
-rw-r--r--tools/editor/plugins/baked_light_editor_plugin.h4
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp5
-rw-r--r--tools/editor/plugins/collision_polygon_editor_plugin.cpp23
-rw-r--r--tools/editor/plugins/collision_polygon_editor_plugin.h8
-rw-r--r--tools/editor/plugins/cube_grid_theme_editor_plugin.cpp3
-rw-r--r--tools/editor/plugins/cube_grid_theme_editor_plugin.h3
-rw-r--r--tools/editor/plugins/editor_preview_plugins.cpp17
-rw-r--r--tools/editor/plugins/editor_preview_plugins.h3
-rw-r--r--tools/editor/plugins/gi_probe_editor_plugin.cpp57
-rw-r--r--tools/editor/plugins/gi_probe_editor_plugin.h37
-rw-r--r--tools/editor/plugins/material_editor_plugin.cpp3
-rw-r--r--tools/editor/plugins/material_editor_plugin.h3
-rw-r--r--tools/editor/plugins/mesh_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/mesh_editor_plugin.h3
-rw-r--r--tools/editor/plugins/multimesh_editor_plugin.cpp8
-rw-r--r--tools/editor/plugins/particles_2d_editor_plugin.cpp4
-rw-r--r--tools/editor/plugins/particles_editor_plugin.cpp3
-rw-r--r--tools/editor/plugins/particles_editor_plugin.h3
-rw-r--r--tools/editor/plugins/path_editor_plugin.cpp14
-rw-r--r--tools/editor/plugins/path_editor_plugin.h7
-rw-r--r--tools/editor/plugins/polygon_2d_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/sample_editor_plugin.cpp4
-rw-r--r--tools/editor/plugins/sample_library_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/shader_editor_plugin.cpp204
-rw-r--r--tools/editor/plugins/shader_editor_plugin.h25
-rw-r--r--tools/editor/plugins/shader_graph_editor_plugin.cpp4
-rw-r--r--tools/editor/plugins/shader_graph_editor_plugin.h4
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp145
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.h10
33 files changed, 380 insertions, 261 deletions
diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp
index abb355113a..2b660c4f94 100644
--- a/tools/editor/plugins/baked_light_baker.cpp
+++ b/tools/editor/plugins/baked_light_baker.cpp
@@ -33,7 +33,7 @@
#include "tools/editor/editor_node.h"
#include "tools/editor/editor_settings.h"
-
+#if 0
void baked_light_baker_add_64f(double *dst,double value);
void baked_light_baker_add_64i(int64_t *dst,int64_t value);
@@ -91,15 +91,15 @@ BakedLightBaker::MeshTexture* BakedLightBaker::_get_mat_tex(const Ref<Texture>&
if (image.empty())
return NULL;
- if (image.get_format()!=Image::FORMAT_RGBA) {
+ if (image.get_format()!=Image::FORMAT_RGBA8) {
if (image.get_format()>Image::FORMAT_INDEXED_ALPHA) {
Error err = image.decompress();
if (err)
return NULL;
}
- if (image.get_format()!=Image::FORMAT_RGBA)
- image.convert(Image::FORMAT_RGBA);
+ if (image.get_format()!=Image::FORMAT_RGBA8)
+ image.convert(Image::FORMAT_RGBA8);
}
if (imgtex->get_flags()&Texture::FLAG_CONVERT_TO_LINEAR) {
@@ -143,18 +143,18 @@ void BakedLightBaker::_add_mesh(const Ref<Mesh>& p_mesh,const Ref<Material>& p_m
MeshMaterial mm;
- Ref<FixedMaterial> fm = mat;
+ Ref<FixedSpatialMaterial> fm = mat;
if (fm.is_valid()) {
//fixed route
- mm.diffuse.color=fm->get_parameter(FixedMaterial::PARAM_DIFFUSE);
+ mm.diffuse.color=fm->get_parameter(FixedSpatialMaterial::PARAM_DIFFUSE);
if (linear_color)
mm.diffuse.color=mm.diffuse.color.to_linear();
- mm.diffuse.tex=_get_mat_tex(fm->get_texture(FixedMaterial::PARAM_DIFFUSE));
- mm.specular.color=fm->get_parameter(FixedMaterial::PARAM_SPECULAR);
+ mm.diffuse.tex=_get_mat_tex(fm->get_texture(FixedSpatialMaterial::PARAM_DIFFUSE));
+ mm.specular.color=fm->get_parameter(FixedSpatialMaterial::PARAM_SPECULAR);
if (linear_color)
mm.specular.color=mm.specular.color.to_linear();
- mm.specular.tex=_get_mat_tex(fm->get_texture(FixedMaterial::PARAM_SPECULAR));
+ mm.specular.tex=_get_mat_tex(fm->get_texture(FixedSpatialMaterial::PARAM_SPECULAR));
} else {
mm.diffuse.color=Color(1,1,1,1);
@@ -2619,7 +2619,7 @@ Error BakedLightBaker::transfer_to_lightmaps() {
copymem(w.ptr(),baked_textures[i].data.ptr(),baked_textures[i].data.size());
}
- Image img(baked_textures[i].width,baked_textures[i].height,0,Image::FORMAT_RGBA,dv);
+ Image img(baked_textures[i].width,baked_textures[i].height,0,Image::FORMAT_RGBA8,dv);
Ref<ImageTexture> tex = memnew( ImageTexture );
tex->create_from_image(img);
baked_light->set_lightmap_texture(i,tex);
@@ -2720,3 +2720,4 @@ BakedLightBaker::~BakedLightBaker() {
clear();
}
+#endif
diff --git a/tools/editor/plugins/baked_light_baker.h b/tools/editor/plugins/baked_light_baker.h
index cfce1b81e4..5616183cb1 100644
--- a/tools/editor/plugins/baked_light_baker.h
+++ b/tools/editor/plugins/baked_light_baker.h
@@ -34,6 +34,8 @@
#include "scene/3d/mesh_instance.h"
#include "os/thread.h"
+#if 0
+
class BakedLightBaker {
public:
@@ -375,3 +377,4 @@ public:
};
#endif // BAKED_LIGHT_BAKER_H
+#endif
diff --git a/tools/editor/plugins/baked_light_editor_plugin.cpp b/tools/editor/plugins/baked_light_editor_plugin.cpp
index c8e55ca54e..0b576a2d2c 100644
--- a/tools/editor/plugins/baked_light_editor_plugin.cpp
+++ b/tools/editor/plugins/baked_light_editor_plugin.cpp
@@ -33,7 +33,7 @@
#include "io/resource_saver.h"
-
+#if 0
void BakedLightEditor::_end_baking() {
@@ -145,7 +145,7 @@ void BakedLightEditor::_notification(int p_option) {
#if 1
//debug
- Image img(baker->baked_octree_texture_w,baker->baked_octree_texture_h,0,Image::FORMAT_RGBA,octree_texture);
+ Image img(baker->baked_octree_texture_w,baker->baked_octree_texture_h,0,Image::FORMAT_RGBA8,octree_texture);
Ref<ImageTexture> it = memnew( ImageTexture );
it->create_from_image(img);
ResourceSaver::save("baked_octree.png",it);
@@ -373,3 +373,4 @@ BakedLightEditorPlugin::~BakedLightEditorPlugin()
}
+#endif
diff --git a/tools/editor/plugins/baked_light_editor_plugin.h b/tools/editor/plugins/baked_light_editor_plugin.h
index 044cd05e87..64f3295b48 100644
--- a/tools/editor/plugins/baked_light_editor_plugin.h
+++ b/tools/editor/plugins/baked_light_editor_plugin.h
@@ -40,7 +40,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-
+#if 0
class MeshInstance;
@@ -116,5 +116,5 @@ public:
};
#endif // MULTIMESH_EDITOR_PLUGIN_H
-
+#endif
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 9b910200a7..a5e388ea90 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -3334,7 +3334,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
vp_base->set_v_size_flags(SIZE_EXPAND_FILL);
palette_split->add_child(vp_base);
- Control *vp = memnew (Control);
+ ViewportContainer *vp = memnew (ViewportContainer);
+ vp->set_stretch(true);
vp_base->add_child(vp);
vp->set_area_as_parent_rect();
vp->add_child(p_editor->get_scene_root());
@@ -3688,7 +3689,7 @@ void CanvasItemEditorViewport::_create_preview(const Vector<String>& files) cons
Ref<ImageTexture> texture=Ref<ImageTexture> ( ResourceCache::get(path)->cast_to<ImageTexture>() );
Sprite* sprite=memnew(Sprite);
sprite->set_texture(texture);
- sprite->set_opacity(0.7f);
+ sprite->set_modulate(Color(1,1,1,0.7f));
preview->add_child(sprite);
label->show();
label_desc->show();
diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp
index 4ba75da4a1..bdd1e325b5 100644
--- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp
+++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp
@@ -33,6 +33,8 @@
#include "scene/3d/camera.h"
#include "canvas_item_editor_plugin.h"
+#if 0
+
void CollisionPolygonEditor::_notification(int p_what) {
switch(p_what) {
@@ -568,25 +570,25 @@ CollisionPolygonEditor::CollisionPolygonEditor(EditorNode *p_editor) {
imgeom->set_transform(Transform(Matrix3(),Vector3(0,0,0.00001)));
- line_material = Ref<FixedMaterial>( memnew( FixedMaterial ));
+ line_material = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial ));
line_material->set_flag(Material::FLAG_UNSHADED, true);
line_material->set_line_width(3.0);
- line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true);
- line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true);
- line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1));
+ line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true);
+ line_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, true);
+ line_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1));
- handle_material = Ref<FixedMaterial>( memnew( FixedMaterial ));
+ handle_material = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial ));
handle_material->set_flag(Material::FLAG_UNSHADED, true);
- handle_material->set_fixed_flag(FixedMaterial::FLAG_USE_POINT_SIZE, true);
- handle_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1));
- handle_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true);
- handle_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, false);
+ handle_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_POINT_SIZE, true);
+ handle_material->set_parameter(FixedSpatialMaterial::PARAM_DIFFUSE,Color(1,1,1));
+ handle_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true);
+ handle_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY, false);
Ref<Texture> handle=editor->get_gui_base()->get_icon("Editor3DHandle","EditorIcons");
handle_material->set_point_size(handle->get_width());
- handle_material->set_texture(FixedMaterial::PARAM_DIFFUSE,handle);
+ handle_material->set_texture(FixedSpatialMaterial::PARAM_DIFFUSE,handle);
pointsm = memnew( MeshInstance );
imgeom->add_child(pointsm);
@@ -642,3 +644,4 @@ CollisionPolygonEditorPlugin::~CollisionPolygonEditorPlugin()
{
}
+#endif
diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.h b/tools/editor/plugins/collision_polygon_editor_plugin.h
index 66cf2a3f0a..43a9f0b5fc 100644
--- a/tools/editor/plugins/collision_polygon_editor_plugin.h
+++ b/tools/editor/plugins/collision_polygon_editor_plugin.h
@@ -40,6 +40,8 @@
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
+#if 0
class CanvasItemEditor;
class CollisionPolygonEditor : public HBoxContainer {
@@ -60,8 +62,8 @@ class CollisionPolygonEditor : public HBoxContainer {
ToolButton *button_edit;
- Ref<FixedMaterial> line_material;
- Ref<FixedMaterial> handle_material;
+ Ref<FixedSpatialMaterial> line_material;
+ Ref<FixedSpatialMaterial> handle_material;
EditorNode *editor;
Panel *panel;
@@ -117,5 +119,5 @@ public:
~CollisionPolygonEditorPlugin();
};
-
+#endif
#endif // COLLISION_POLYGON_EDITOR_PLUGIN_H
diff --git a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp
index dcbe6f225b..c18f611a49 100644
--- a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp
+++ b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp
@@ -28,6 +28,7 @@
/*************************************************************************/
#include "cube_grid_theme_editor_plugin.h"
+#if 0
#include "scene/3d/mesh_instance.h"
#include "scene/3d/physics_body.h"
#include "scene/main/viewport.h"
@@ -353,4 +354,4 @@ MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) {
theme_editor->hide();
}
-
+#endif
diff --git a/tools/editor/plugins/cube_grid_theme_editor_plugin.h b/tools/editor/plugins/cube_grid_theme_editor_plugin.h
index 6601983aeb..d50e3156c3 100644
--- a/tools/editor/plugins/cube_grid_theme_editor_plugin.h
+++ b/tools/editor/plugins/cube_grid_theme_editor_plugin.h
@@ -32,7 +32,7 @@
#include "scene/resources/mesh_library.h"
#include "tools/editor/editor_node.h"
-
+#if 0
class MeshLibraryEditor : public Control {
OBJ_TYPE( MeshLibraryEditor, Control );
@@ -93,3 +93,4 @@ public:
#endif // CUBE_GRID_THEME_EDITOR_PLUGIN_H
+#endif
diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp
index 0804b94e95..0886edb073 100644
--- a/tools/editor/plugins/editor_preview_plugins.cpp
+++ b/tools/editor/plugins/editor_preview_plugins.cpp
@@ -37,6 +37,7 @@
#include "scene/resources/bit_mask.h"
#include "tools/editor/editor_scale.h"
+#if 0
bool EditorTexturePreviewPlugin::handles(const String& p_type) const {
return (ObjectTypeDB::is_type(p_type,"ImageTexture") || ObjectTypeDB::is_type(p_type, "AtlasTexture"));
@@ -69,8 +70,8 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES& p_from) {
if (img.is_compressed()) {
if (img.decompress()!=OK)
return Ref<Texture>();
- } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGBA) {
- img.convert(Image::FORMAT_RGBA);
+ } else if (img.get_format()!=Image::FORMAT_RGB8 && img.get_format()!=Image::FORMAT_RGBA8) {
+ img.convert(Image::FORMAT_RGBA8);
}
int width,height;
@@ -138,15 +139,15 @@ Ref<Texture> EditorBitmapPreviewPlugin::generate(const RES& p_from) {
}
- Image img(bm->get_size().width,bm->get_size().height,0,Image::FORMAT_GRAYSCALE,data);
+ Image img(bm->get_size().width,bm->get_size().height,0,Image::FORMAT_L8,data);
int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size");
thumbnail_size*=EDSCALE;
if (img.is_compressed()) {
if (img.decompress()!=OK)
return Ref<Texture>();
- } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGBA) {
- img.convert(Image::FORMAT_RGBA);
+ } else if (img.get_format()!=Image::FORMAT_RGB8 && img.get_format()!=Image::FORMAT_RGBA8) {
+ img.convert(Image::FORMAT_RGBA8);
}
int width,height;
@@ -434,7 +435,7 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES& p_from) {
int col=0;
int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size");
thumbnail_size*=EDSCALE;
- Image img(thumbnail_size,thumbnail_size,0,Image::FORMAT_RGBA);
+ Image img(thumbnail_size,thumbnail_size,0,Image::FORMAT_RGBA8);
@@ -778,7 +779,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
imgdata = DVector<uint8_t>::Write();
Ref<ImageTexture> ptex = Ref<ImageTexture>( memnew( ImageTexture));
- ptex->create_from_image(Image(w,h,0,Image::FORMAT_RGB,img),0);
+ ptex->create_from_image(Image(w,h,0,Image::FORMAT_RGB8,img),0);
return ptex;
}
@@ -888,6 +889,7 @@ EditorMeshPreviewPlugin::EditorMeshPreviewPlugin() {
}
+
EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() {
//VS::get_singleton()->free(sphere);
@@ -901,3 +903,4 @@ EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() {
VS::get_singleton()->free(scenario);
}
+#endif
diff --git a/tools/editor/plugins/editor_preview_plugins.h b/tools/editor/plugins/editor_preview_plugins.h
index ef484244ee..3c1689e61e 100644
--- a/tools/editor/plugins/editor_preview_plugins.h
+++ b/tools/editor/plugins/editor_preview_plugins.h
@@ -31,6 +31,7 @@
#include "tools/editor/editor_resource_preview.h"
+#if 0
class EditorTexturePreviewPlugin : public EditorResourcePreviewGenerator {
public:
@@ -123,5 +124,5 @@ public:
~EditorMeshPreviewPlugin();
};
-
+#endif
#endif // EDITORPREVIEWPLUGINS_H
diff --git a/tools/editor/plugins/gi_probe_editor_plugin.cpp b/tools/editor/plugins/gi_probe_editor_plugin.cpp
new file mode 100644
index 0000000000..4ec95eb8c6
--- /dev/null
+++ b/tools/editor/plugins/gi_probe_editor_plugin.cpp
@@ -0,0 +1,57 @@
+#include "gi_probe_editor_plugin.h"
+
+
+void GIProbeEditorPlugin::_bake() {
+
+ if (gi_probe) {
+ gi_probe->bake();
+ }
+}
+
+
+void GIProbeEditorPlugin::edit(Object *p_object) {
+
+ GIProbe * s = p_object->cast_to<GIProbe>();
+ if (!s)
+ return;
+
+ gi_probe=s;
+}
+
+bool GIProbeEditorPlugin::handles(Object *p_object) const {
+
+ return p_object->is_type("GIProbe");
+}
+
+void GIProbeEditorPlugin::make_visible(bool p_visible) {
+
+ if (p_visible) {
+ bake->show();
+ } else {
+
+ bake->hide();
+ }
+
+}
+
+void GIProbeEditorPlugin::_bind_methods() {
+
+ ObjectTypeDB::bind_method("_bake",&GIProbeEditorPlugin::_bake);
+}
+
+GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) {
+
+ editor=p_node;
+ bake = memnew( Button );
+ bake->set_icon(editor->get_gui_base()->get_icon("BakedLight","EditorIcons"));
+ bake->hide();;
+ bake->connect("pressed",this,"_bake");
+ add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU,bake);
+ gi_probe=NULL;
+}
+
+
+GIProbeEditorPlugin::~GIProbeEditorPlugin() {
+
+ memdelete(bake);
+}
diff --git a/tools/editor/plugins/gi_probe_editor_plugin.h b/tools/editor/plugins/gi_probe_editor_plugin.h
new file mode 100644
index 0000000000..7db91bebaf
--- /dev/null
+++ b/tools/editor/plugins/gi_probe_editor_plugin.h
@@ -0,0 +1,37 @@
+#ifndef GIPROBEEDITORPLUGIN_H
+#define GIPROBEEDITORPLUGIN_H
+
+#include "tools/editor/editor_plugin.h"
+#include "tools/editor/editor_node.h"
+#include "scene/resources/material.h"
+#include "scene/3d/gi_probe.h"
+
+
+
+class GIProbeEditorPlugin : public EditorPlugin {
+
+ OBJ_TYPE( GIProbeEditorPlugin, EditorPlugin );
+
+ GIProbe *gi_probe;
+
+ Button *bake;
+ EditorNode *editor;
+
+ void _bake();
+protected:
+
+ static void _bind_methods();
+public:
+
+ virtual String get_name() const { return "GIProbe"; }
+ bool has_main_screen() const { return false; }
+ virtual void edit(Object *p_node);
+ virtual bool handles(Object *p_node) const;
+ virtual void make_visible(bool p_visible);
+
+ GIProbeEditorPlugin(EditorNode *p_node);
+ ~GIProbeEditorPlugin();
+
+};
+
+#endif // GIPROBEEDITORPLUGIN_H
diff --git a/tools/editor/plugins/material_editor_plugin.cpp b/tools/editor/plugins/material_editor_plugin.cpp
index 876fab0d6e..1036016194 100644
--- a/tools/editor/plugins/material_editor_plugin.cpp
+++ b/tools/editor/plugins/material_editor_plugin.cpp
@@ -1,6 +1,8 @@
#include "material_editor_plugin.h"
#include "scene/main/viewport.h"
+#if 0
+
void MaterialEditor::_input_event(InputEvent p_event) {
@@ -379,3 +381,4 @@ MaterialEditorPlugin::~MaterialEditorPlugin()
}
+#endif
diff --git a/tools/editor/plugins/material_editor_plugin.h b/tools/editor/plugins/material_editor_plugin.h
index 49e92493b3..68b3b3b1a7 100644
--- a/tools/editor/plugins/material_editor_plugin.h
+++ b/tools/editor/plugins/material_editor_plugin.h
@@ -8,7 +8,7 @@
#include "scene/3d/mesh_instance.h"
#include "scene/3d/camera.h"
-
+#if 0
class MaterialEditor : public Control {
OBJ_TYPE(MaterialEditor, Control);
@@ -69,3 +69,4 @@ public:
};
#endif // MATERIAL_EDITOR_PLUGIN_H
+#endif
diff --git a/tools/editor/plugins/mesh_editor_plugin.cpp b/tools/editor/plugins/mesh_editor_plugin.cpp
index bfe99004b5..6574bb8e1a 100644
--- a/tools/editor/plugins/mesh_editor_plugin.cpp
+++ b/tools/editor/plugins/mesh_editor_plugin.cpp
@@ -28,6 +28,7 @@
/*************************************************************************/
#include "mesh_editor_plugin.h"
+#if 0
void MeshEditor::_input_event(InputEvent p_event) {
@@ -241,3 +242,4 @@ MeshEditorPlugin::MeshEditorPlugin(EditorNode *p_node) {
MeshEditorPlugin::~MeshEditorPlugin()
{
}
+#endif
diff --git a/tools/editor/plugins/mesh_editor_plugin.h b/tools/editor/plugins/mesh_editor_plugin.h
index 5d8875e5d3..cd52c5c05c 100644
--- a/tools/editor/plugins/mesh_editor_plugin.h
+++ b/tools/editor/plugins/mesh_editor_plugin.h
@@ -29,6 +29,8 @@
#ifndef MESH_EDITOR_PLUGIN_H
#define MESH_EDITOR_PLUGIN_H
+#if 0
+
#include "tools/editor/editor_plugin.h"
#include "tools/editor/editor_node.h"
#include "scene/resources/material.h"
@@ -93,3 +95,4 @@ public:
};
#endif // MESH_EDITOR_PLUGIN_H
+#endif
diff --git a/tools/editor/plugins/multimesh_editor_plugin.cpp b/tools/editor/plugins/multimesh_editor_plugin.cpp
index 31012f8690..c0f5f6491d 100644
--- a/tools/editor/plugins/multimesh_editor_plugin.cpp
+++ b/tools/editor/plugins/multimesh_editor_plugin.cpp
@@ -195,6 +195,8 @@ void MultiMeshEditor::_populate() {
int instance_count=populate_amount->get_val();
+ multimesh->set_transform_format(MultiMesh::TRANSFORM_3D);
+ multimesh->set_color_format(MultiMesh::COLOR_NONE);
multimesh->set_instance_count(instance_count);
float _tilt_random = populate_tilt_random->get_val();
@@ -247,10 +249,10 @@ void MultiMeshEditor::_populate() {
multimesh->set_instance_transform(i,xform);
- multimesh->set_instance_color(i,Color(1,1,1,1));
+
}
- multimesh->generate_aabb();
+
node->set_multimesh(multimesh);
@@ -386,6 +388,7 @@ MultiMeshEditor::MultiMeshEditor() {
populate_scale_random->set_min(0);
populate_scale_random->set_max(1);
populate_scale_random->set_val(0);
+ populate_scale_random->set_step(0.01);
vbc->add_margin_child(TTR("Random Scale:"),populate_scale_random);
@@ -393,6 +396,7 @@ MultiMeshEditor::MultiMeshEditor() {
populate_scale->set_min(0.001);
populate_scale->set_max(4096);
populate_scale->set_val(1);
+ populate_scale->set_step(0.01);
vbc->add_margin_child(TTR("Scale:"),populate_scale);
diff --git a/tools/editor/plugins/particles_2d_editor_plugin.cpp b/tools/editor/plugins/particles_2d_editor_plugin.cpp
index 0f46c7fd5c..5ba46dc802 100644
--- a/tools/editor/plugins/particles_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/particles_2d_editor_plugin.cpp
@@ -69,8 +69,8 @@ void Particles2DEditorPlugin::_file_selected(const String& p_file) {
ERR_EXPLAIN(TTR("Error loading image:")+" "+p_file);
ERR_FAIL_COND(err!=OK);
- img.convert(Image::FORMAT_GRAYSCALE_ALPHA);
- ERR_FAIL_COND(img.get_format()!=Image::FORMAT_GRAYSCALE_ALPHA);
+ img.convert(Image::FORMAT_LA8);
+ ERR_FAIL_COND(img.get_format()!=Image::FORMAT_LA8);
Size2i s = Size2(img.get_width(),img.get_height());
ERR_FAIL_COND(s.width==0 || s.height==0);
diff --git a/tools/editor/plugins/particles_editor_plugin.cpp b/tools/editor/plugins/particles_editor_plugin.cpp
index 0fe03e49b7..b17867ffd9 100644
--- a/tools/editor/plugins/particles_editor_plugin.cpp
+++ b/tools/editor/plugins/particles_editor_plugin.cpp
@@ -26,6 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
+#if 0
#include "particles_editor_plugin.h"
#include "io/resource_loader.h"
#include "servers/visual/particle_system_sw.h"
@@ -456,3 +458,4 @@ ParticlesEditorPlugin::~ParticlesEditorPlugin()
}
+#endif
diff --git a/tools/editor/plugins/particles_editor_plugin.h b/tools/editor/plugins/particles_editor_plugin.h
index 9558ab5ad9..0dd759bc75 100644
--- a/tools/editor/plugins/particles_editor_plugin.h
+++ b/tools/editor/plugins/particles_editor_plugin.h
@@ -37,7 +37,7 @@
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-
+#if 0
class ParticlesEditor : public Control {
OBJ_TYPE(ParticlesEditor, Control );
@@ -113,3 +113,4 @@ public:
};
#endif // PARTICLES_EDITOR_PLUGIN_H
+#endif
diff --git a/tools/editor/plugins/path_editor_plugin.cpp b/tools/editor/plugins/path_editor_plugin.cpp
index 5317e53218..c4e88d3aa8 100644
--- a/tools/editor/plugins/path_editor_plugin.cpp
+++ b/tools/editor/plugins/path_editor_plugin.cpp
@@ -31,6 +31,7 @@
#include "scene/resources/curve.h"
#include "os/keyboard.h"
+#if 0
String PathSpatialGizmo::get_handle_name(int p_idx) const {
Ref<Curve3D> c = path->get_curve();
@@ -528,16 +529,16 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) {
editor=p_node;
singleton=this;
- path_material = Ref<FixedMaterial>( memnew( FixedMaterial ));
- path_material->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.8) );
- path_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true);
+ path_material = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial ));
+ path_material->set_parameter( FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.8) );
+ path_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true);
path_material->set_line_width(3);
path_material->set_flag(Material::FLAG_DOUBLE_SIDED,true);
path_material->set_flag(Material::FLAG_UNSHADED,true);
- path_thin_material = Ref<FixedMaterial>( memnew( FixedMaterial ));
- path_thin_material->set_parameter( FixedMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.4) );
- path_thin_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true);
+ path_thin_material = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial ));
+ path_thin_material->set_parameter( FixedSpatialMaterial::PARAM_DIFFUSE,Color(0.5,0.5,1.0,0.4) );
+ path_thin_material->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA, true);
path_thin_material->set_line_width(1);
path_thin_material->set_flag(Material::FLAG_DOUBLE_SIDED,true);
path_thin_material->set_flag(Material::FLAG_UNSHADED,true);
@@ -599,3 +600,4 @@ PathEditorPlugin::~PathEditorPlugin()
{
}
+#endif
diff --git a/tools/editor/plugins/path_editor_plugin.h b/tools/editor/plugins/path_editor_plugin.h
index cfe8159108..55920516a2 100644
--- a/tools/editor/plugins/path_editor_plugin.h
+++ b/tools/editor/plugins/path_editor_plugin.h
@@ -32,6 +32,7 @@
#include "tools/editor/spatial_editor_gizmos.h"
#include "scene/3d/path.h"
+# if 0
class PathSpatialGizmo : public EditorSpatialGizmo {
OBJ_TYPE(PathSpatialGizmo,EditorSpatialGizmo);
@@ -78,8 +79,8 @@ public:
Path *get_edited_path() { return path; }
static PathEditorPlugin* singleton;
- Ref<FixedMaterial> path_material;
- Ref<FixedMaterial> path_thin_material;
+ Ref<FixedSpatialMaterial> path_material;
+ Ref<FixedSpatialMaterial> path_thin_material;
virtual bool forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event);
// virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
@@ -95,5 +96,5 @@ public:
};
-
+#endif
#endif // PATH_EDITOR_PLUGIN_H
diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp
index 20ed762501..6949f0256e 100644
--- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -850,7 +850,7 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) {
uv_edit = memnew( AcceptDialog );
add_child(uv_edit);
uv_edit->set_title(TTR("Polygon 2D UV Editor"));
- uv_edit->set_self_opacity(0.9);
+ uv_edit->set_self_modulate(Color(1,1,1,0.9));
VBoxContainer *uv_main_vb = memnew( VBoxContainer );
uv_edit->add_child(uv_main_vb);
diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp
index 35f0888c76..423e6f6f1f 100644
--- a/tools/editor/plugins/sample_editor_plugin.cpp
+++ b/tools/editor/plugins/sample_editor_plugin.cpp
@@ -311,7 +311,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
imgdata = DVector<uint8_t>::Write();
- p_texture->set_data(Image(w,h,0,Image::FORMAT_RGB,img));
+ p_texture->set_data(Image(w,h,0,Image::FORMAT_RGB8,img));
}
@@ -392,7 +392,7 @@ SampleEditor::SampleEditor() {
add_child(stop);
peakdisplay=Ref<ImageTexture>( memnew( ImageTexture) );
- peakdisplay->create( EDITOR_DEF("audio/sample_editor_preview_width",512),EDITOR_DEF("audio/sample_editor_preview_height",128),Image::FORMAT_RGB);
+ peakdisplay->create( EDITOR_DEF("audio/sample_editor_preview_width",512),EDITOR_DEF("audio/sample_editor_preview_height",128),Image::FORMAT_RGB8);
sample_texframe->set_expand(true);
sample_texframe->set_texture(peakdisplay);
diff --git a/tools/editor/plugins/sample_library_editor_plugin.cpp b/tools/editor/plugins/sample_library_editor_plugin.cpp
index 3f07fdb8e4..82321962eb 100644
--- a/tools/editor/plugins/sample_library_editor_plugin.cpp
+++ b/tools/editor/plugins/sample_library_editor_plugin.cpp
@@ -236,7 +236,7 @@ void SampleLibraryEditor::_update_library() {
// Preview/edit
Ref<ImageTexture> preview( memnew( ImageTexture ));
- preview->create(128,16,Image::FORMAT_RGB);
+ preview->create(128,16,Image::FORMAT_RGB8);
SampleEditor::generate_preview_texture(smp,preview);
ti->set_cell_mode(1,TreeItem::CELL_MODE_ICON);
ti->set_selectable(1,false);
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 789149fc00..6988d8c6f2 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -1841,6 +1841,8 @@ void ScriptEditor::get_window_layout(Ref<ConfigFile> p_layout) {
void ScriptEditor::_help_class_open(const String& p_class) {
+ if (p_class=="")
+ return;
for(int i=0;i<tab_container->get_child_count();i++) {
diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp
index 839a49272b..789fdcd6b0 100644
--- a/tools/editor/plugins/shader_editor_plugin.cpp
+++ b/tools/editor/plugins/shader_editor_plugin.cpp
@@ -37,7 +37,7 @@
#include "tools/editor/editor_node.h"
#include "tools/editor/property_editor.h"
#include "os/os.h"
-
+#include "servers/visual/shader_types.h"
/*** SETTINGS EDITOR ****/
@@ -51,19 +51,14 @@ Ref<Shader> ShaderTextEditor::get_edited_shader() const {
return shader;
}
-void ShaderTextEditor::set_edited_shader(const Ref<Shader>& p_shader,ShaderLanguage::ShaderType p_type) {
+void ShaderTextEditor::set_edited_shader(const Ref<Shader>& p_shader) {
shader=p_shader;
- type=p_type;
+
_load_theme_settings();
- if (p_type==ShaderLanguage::SHADER_MATERIAL_LIGHT || p_type==ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT)
- get_text_edit()->set_text(shader->get_light_code());
- else if (p_type==ShaderLanguage::SHADER_MATERIAL_VERTEX || p_type==ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX)
- get_text_edit()->set_text(shader->get_vertex_code());
- else
- get_text_edit()->set_text(shader->get_fragment_code());
+ get_text_edit()->set_text(p_shader->get_code());
_line_col_changed();
@@ -105,7 +100,25 @@ void ShaderTextEditor::_load_theme_settings() {
List<String> keywords;
- ShaderLanguage::get_keyword_list(type,&keywords);
+ ShaderLanguage::get_keyword_list(&keywords);
+
+ if (shader.is_valid()) {
+
+
+ for(const Map< StringName, Map<StringName,ShaderLanguage::DataType> >::Element *E=ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())).front();E;E=E->next()) {
+
+ for (const Map<StringName,ShaderLanguage::DataType>::Element *F=E->get().front();F;F=F->next()) {
+ keywords.push_back(F->key());
+ }
+
+ }
+
+ for(const Set<String>::Element *E =ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())).front();E;E=E->next()) {
+
+ keywords.push_back(E->get());
+
+ }
+ }
for(List<String>::Element *E=keywords.front();E;E=E->next()) {
@@ -138,22 +151,34 @@ void ShaderTextEditor::_load_theme_settings() {
}*/
}
+void ShaderTextEditor::_code_complete_script(const String& p_code, List<String>* r_options) {
-void ShaderTextEditor::_validate_script() {
+ print_line("code complete");
+
+ ShaderLanguage sl;
+ String calltip;
+
+ Error err = sl.complete(p_code,ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())),ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())),r_options,calltip);
+
+ if (calltip!="") {
+ get_text_edit()->set_code_hint(calltip);
+ }
+}
- String errortxt;
- int line,col;
+void ShaderTextEditor::_validate_script() {
String code=get_text_edit()->get_text();
//List<StringName> params;
//shader->get_param_list(&params);
- Error err = ShaderLanguage::compile(code,type,NULL,NULL,&errortxt,&line,&col);
+ ShaderLanguage sl;
+
+ Error err = sl.compile(code,ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader->get_mode())),ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader->get_mode())));
if (err!=OK) {
- String error_text="error("+itos(line+1)+","+itos(col+1)+"): "+errortxt;
+ String error_text="error("+itos(sl.get_error_line())+"): "+sl.get_error_text();
set_error(error_text);
- get_text_edit()->set_line_as_marked(line,true);
+ get_text_edit()->set_line_as_marked(sl.get_error_line(),true);
} else {
for(int i=0;i<get_text_edit()->get_line_count();i++)
@@ -183,9 +208,7 @@ ShaderTextEditor::ShaderTextEditor() {
void ShaderEditor::_menu_option(int p_option) {
- ShaderTextEditor *current = tab_container->get_current_tab_control()->cast_to<ShaderTextEditor>();
- if (!current)
- return;
+ ShaderTextEditor *current = shader_editor;
switch(p_option) {
case EDIT_UNDO: {
@@ -241,24 +264,11 @@ void ShaderEditor::_menu_option(int p_option) {
}
}
-void ShaderEditor::_tab_changed(int p_which) {
-
- ShaderTextEditor *shader_editor = tab_container->get_tab_control(p_which)->cast_to<ShaderTextEditor>();
-
- if (shader_editor && is_inside_tree())
- shader_editor->get_text_edit()->grab_focus();
-
- ensure_select_current();
-}
void ShaderEditor::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
- close->set_normal_texture( get_icon("Close","EditorIcons"));
- close->set_hover_texture( get_icon("CloseHover","EditorIcons"));
- close->set_pressed_texture( get_icon("Close","EditorIcons"));
- close->connect("pressed",this,"_close_callback");
}
if (p_what==NOTIFICATION_DRAW) {
@@ -361,25 +371,30 @@ void ShaderEditor::clear() {
void ShaderEditor::_params_changed() {
- fragment_editor->_validate_script();
- vertex_editor->_validate_script();
- light_editor->_validate_script();
+ shader_editor->_validate_script();
}
void ShaderEditor::_editor_settings_changed() {
- vertex_editor->update_editor_settings();
- fragment_editor->update_editor_settings();
- light_editor->update_editor_settings();
+ shader_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete"));
+ shader_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file"));
+ shader_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size"));
+ shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs"));
+ shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers"));
+ shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting"));
+ shader_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences"));
+ shader_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink"));
+ shader_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed"));
+ shader_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing"));
+ shader_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret"));
}
void ShaderEditor::_bind_methods() {
ObjectTypeDB::bind_method("_editor_settings_changed",&ShaderEditor::_editor_settings_changed);
- ObjectTypeDB::bind_method("_tab_changed",&ShaderEditor::_tab_changed);
+
ObjectTypeDB::bind_method("_menu_option",&ShaderEditor::_menu_option);
ObjectTypeDB::bind_method("_params_changed",&ShaderEditor::_params_changed);
- ObjectTypeDB::bind_method("_close_callback",&ShaderEditor::_close_callback);
ObjectTypeDB::bind_method("apply_shaders",&ShaderEditor::apply_shaders);
// ObjectTypeDB::bind_method("_close_current_tab",&ShaderEditor::_close_current_tab);
}
@@ -405,16 +420,7 @@ void ShaderEditor::edit(const Ref<Shader>& p_shader) {
shader=p_shader;
- if (shader->get_mode()==Shader::MODE_MATERIAL) {
- vertex_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_MATERIAL_VERTEX);
- fragment_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_MATERIAL_FRAGMENT);
- light_editor->set_edited_shader(shader,ShaderLanguage::SHADER_MATERIAL_LIGHT);
- } else if (shader->get_mode()==Shader::MODE_CANVAS_ITEM) {
-
- vertex_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX);
- fragment_editor->set_edited_shader(p_shader,ShaderLanguage::SHADER_CANVAS_ITEM_FRAGMENT);
- light_editor->set_edited_shader(shader,ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT);
- }
+ shader_editor->set_edited_shader(p_shader);
//vertex_editor->set_edited_shader(shader,ShaderLanguage::SHADER_MATERIAL_VERTEX);
// see if already has it
@@ -438,35 +444,21 @@ void ShaderEditor::apply_shaders() {
if (shader.is_valid()) {
- shader->set_code(vertex_editor->get_text_edit()->get_text(),fragment_editor->get_text_edit()->get_text(),light_editor->get_text_edit()->get_text(),0,0);
+ shader->set_code(shader_editor->get_text_edit()->get_text());
shader->set_edited(true);
}
}
-void ShaderEditor::_close_callback() {
-
- hide();
-}
-
ShaderEditor::ShaderEditor() {
- tab_container = memnew( TabContainer );
- add_child(tab_container);
- tab_container->set_area_as_parent_rect();
- tab_container->set_begin(Point2(0,0));
- //tab_container->set_begin(Point2(0,0));
-
- close = memnew( TextureButton );
- close->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_END,20);
- close->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,4);
- close->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN,2);
- add_child(close);
+ HBoxContainer *hbc = memnew( HBoxContainer);
+ add_child(hbc);
edit_menu = memnew( MenuButton );
- add_child(edit_menu);
+ hbc->add_child(edit_menu);
edit_menu->set_pos(Point2(5,-1));
edit_menu->set_text(TTR("Edit"));
edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/undo", TTR("Undo"), KEY_MASK_CMD|KEY_Z), EDIT_UNDO);
@@ -481,7 +473,7 @@ ShaderEditor::ShaderEditor() {
search_menu = memnew( MenuButton );
- add_child(search_menu);
+ hbc->add_child(search_menu);
search_menu->set_pos(Point2(38,-1));
search_menu->set_text(TTR("Search"));
search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find.."), KEY_MASK_CMD|KEY_F), SEARCH_FIND);
@@ -494,34 +486,15 @@ ShaderEditor::ShaderEditor() {
search_menu->get_popup()->connect("item_pressed", this,"_menu_option");
- tab_container->connect("tab_changed", this,"_tab_changed");
-
- erase_tab_confirm = memnew( ConfirmationDialog );
- add_child(erase_tab_confirm);
- erase_tab_confirm->connect("confirmed", this,"_close_current_tab");
-
-
goto_line_dialog = memnew(GotoLineDialog);
add_child(goto_line_dialog);
- vertex_editor = memnew( ShaderTextEditor );
- tab_container->add_child(vertex_editor);
- vertex_editor->set_name(TTR("Vertex"));
+ shader_editor = memnew( ShaderTextEditor );
+ add_child(shader_editor);
+ shader_editor->set_v_size_flags(SIZE_EXPAND_FILL);
- fragment_editor = memnew( ShaderTextEditor );
- tab_container->add_child(fragment_editor);
- fragment_editor->set_name(TTR("Fragment"));
- light_editor = memnew( ShaderTextEditor );
- tab_container->add_child(light_editor);
- light_editor->set_name(TTR("Lighting"));
-
- tab_container->set_current_tab(1);
-
-
- vertex_editor->connect("script_changed", this,"apply_shaders");
- fragment_editor->connect("script_changed", this,"apply_shaders");
- light_editor->connect("script_changed", this,"apply_shaders");
+ shader_editor->connect("script_changed", this,"apply_shaders");
EditorSettings::get_singleton()->connect("settings_changed",this,"_editor_settings_changed");
_editor_settings_changed();
@@ -531,15 +504,7 @@ ShaderEditor::ShaderEditor() {
void ShaderEditorPlugin::edit(Object *p_object) {
Shader* s = p_object->cast_to<Shader>();
- if (!s || s->cast_to<ShaderGraph>()) {
- shader_editor->hide(); //Dont edit ShaderGraph
- return;
- }
-
- if (_2d && s->get_mode()==Shader::MODE_CANVAS_ITEM)
- shader_editor->edit(s);
- else if (!_2d && s->get_mode()==Shader::MODE_MATERIAL)
- shader_editor->edit(s);
+ shader_editor->edit(s);
}
@@ -547,24 +512,25 @@ bool ShaderEditorPlugin::handles(Object *p_object) const {
bool handles = true;
Shader *shader=p_object->cast_to<Shader>();
- if (!shader || shader->cast_to<ShaderGraph>()) // Dont handle ShaderGraph's
- handles = false;
- if (handles && _2d)
- handles = shader->get_mode()==Shader::MODE_CANVAS_ITEM;
- else if (handles && !_2d)
- return shader->get_mode()==Shader::MODE_MATERIAL;
-
- if (!handles)
- shader_editor->hide();
- return handles;
+ //if (!shader || shader->cast_to<ShaderGraph>()) // Dont handle ShaderGraph's
+ // handles = false;
+
+ return shader!=NULL;
}
void ShaderEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
- shader_editor->show();
+ button->show();
+ editor->make_bottom_panel_item_visible(shader_editor);
+
} else {
+
+ button->hide();
+ if (shader_editor->is_visible())
+ editor->hide_bottom_panel();
shader_editor->apply_shaders();
+
}
}
@@ -598,19 +564,14 @@ void ShaderEditorPlugin::apply_changes() {
shader_editor->apply_shaders();
}
-ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node, bool p_2d) {
+ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node) {
+
editor=p_node;
shader_editor = memnew( ShaderEditor );
- _2d=p_2d;
- if (p_2d)
- add_control_to_container(CONTAINER_CANVAS_EDITOR_BOTTOM,shader_editor);
- else
- add_control_to_container(CONTAINER_SPATIAL_EDITOR_BOTTOM,shader_editor);
-// editor->get_viewport()->add_child(shader_editor);
-// shader_editor->set_area_as_parent_rect();
- shader_editor->hide();
+ shader_editor->set_custom_minimum_size(Size2(0,300));
+ button=editor->add_bottom_panel_item("Shader",shader_editor);
}
@@ -618,3 +579,4 @@ ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node, bool p_2d) {
ShaderEditorPlugin::~ShaderEditorPlugin() {
}
+
diff --git a/tools/editor/plugins/shader_editor_plugin.h b/tools/editor/plugins/shader_editor_plugin.h
index 9f9576b871..c13d4256a1 100644
--- a/tools/editor/plugins/shader_editor_plugin.h
+++ b/tools/editor/plugins/shader_editor_plugin.h
@@ -38,33 +38,34 @@
#include "scene/resources/shader.h"
#include "servers/visual/shader_language.h"
-
class ShaderTextEditor : public CodeTextEditor {
OBJ_TYPE( ShaderTextEditor, CodeTextEditor );
Ref<Shader> shader;
- ShaderLanguage::ShaderType type;
protected:
static void _bind_methods();
virtual void _load_theme_settings();
+
+ virtual void _code_complete_script(const String& p_code, List<String>* r_options);
+
public:
virtual void _validate_script();
Ref<Shader> get_edited_shader() const;
- void set_edited_shader(const Ref<Shader>& p_shader,ShaderLanguage::ShaderType p_type);
+ void set_edited_shader(const Ref<Shader>& p_shader);
ShaderTextEditor();
};
-class ShaderEditor : public Control {
+class ShaderEditor : public VBoxContainer {
- OBJ_TYPE(ShaderEditor, Control );
+ OBJ_TYPE(ShaderEditor, VBoxContainer );
enum {
@@ -88,22 +89,17 @@ class ShaderEditor : public Control {
MenuButton *settings_menu;
uint64_t idle;
- TabContainer *tab_container;
GotoLineDialog *goto_line_dialog;
ConfirmationDialog *erase_tab_confirm;
- TextureButton *close;
- ShaderTextEditor *vertex_editor;
- ShaderTextEditor *fragment_editor;
- ShaderTextEditor *light_editor;
+ ShaderTextEditor *shader_editor;
+
- void _tab_changed(int p_which);
void _menu_option(int p_optin);
void _params_changed();
mutable Ref<Shader> shader;
- void _close_callback();
void _editor_settings_changed();
@@ -134,6 +130,8 @@ class ShaderEditorPlugin : public EditorPlugin {
bool _2d;
ShaderEditor *shader_editor;
EditorNode *editor;
+ Button *button;
+
public:
virtual String get_name() const { return "Shader"; }
@@ -150,8 +148,9 @@ public:
virtual void save_external_data();
virtual void apply_changes();
- ShaderEditorPlugin(EditorNode *p_node,bool p_2d);
+ ShaderEditorPlugin(EditorNode *p_node);
~ShaderEditorPlugin();
};
+
#endif
diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp
index c82811534a..0a00e47f37 100644
--- a/tools/editor/plugins/shader_graph_editor_plugin.cpp
+++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp
@@ -28,6 +28,7 @@
/*************************************************************************/
#include "shader_graph_editor_plugin.h"
+#if 0
#include "scene/gui/check_box.h"
#include "scene/gui/menu_button.h"
@@ -1377,7 +1378,7 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int
edit->set_icon(ped_popup->get_icon("Matrix", "EditorIcons"));
break;
case Variant::COLOR: {
- Image icon_color = Image(15,15,false,Image::FORMAT_RGB);
+ Image icon_color = Image(15,15,false,Image::FORMAT_RGB8);
Color c = graph->default_get_value(type,p_id,param);
for (int x=1;x<14;x++)
for (int y=1;y<14;y++)
@@ -2945,3 +2946,4 @@ ShaderGraphEditorPlugin::~ShaderGraphEditorPlugin()
+#endif
diff --git a/tools/editor/plugins/shader_graph_editor_plugin.h b/tools/editor/plugins/shader_graph_editor_plugin.h
index c5ea5a3e3d..7b33e586b5 100644
--- a/tools/editor/plugins/shader_graph_editor_plugin.h
+++ b/tools/editor/plugins/shader_graph_editor_plugin.h
@@ -43,7 +43,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-
+#if 0
class GraphColorRampEdit : public Control {
OBJ_TYPE(GraphColorRampEdit,Control);
@@ -239,4 +239,4 @@ public:
};
#endif
-
+#endif
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index eb0289bd26..83e3cb77f3 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -274,7 +274,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b
Vector3 ray=_get_ray(p_pos);
Vector3 pos=_get_ray_pos(p_pos);
- Vector<RID> instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() );
+ Vector<ObjectID> instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() );
Set<Ref<SpatialEditorGizmo> > found_gizmos;
//uint32_t closest=0;
@@ -286,8 +286,7 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b
for (int i=0;i<instances.size();i++) {
- uint32_t id=VisualServer::get_singleton()->instance_get_object_instance_ID(instances[i]);
- Object *obj=ObjectDB::get_instance(id);
+ Object *obj=ObjectDB::get_instance(instances[i]);
if (!obj)
continue;
@@ -405,15 +404,15 @@ void SpatialEditorViewport::_find_items_at_pos(const Point2& p_pos,bool &r_inclu
Vector3 ray=_get_ray(p_pos);
Vector3 pos=_get_ray_pos(p_pos);
- Vector<RID> instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() );
+ Vector<ObjectID> instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() );
Set<Ref<SpatialEditorGizmo> > found_gizmos;
r_includes_current=false;
for (int i=0;i<instances.size();i++) {
- uint32_t id=VisualServer::get_singleton()->instance_get_object_instance_ID(instances[i]);
- Object *obj=ObjectDB::get_instance(id);
+ Object *obj=ObjectDB::get_instance(instances[i]);
+
if (!obj)
continue;
@@ -534,14 +533,12 @@ void SpatialEditorViewport::_select_region() {
frustum.push_back( far );
- Vector<RID> instances=VisualServer::get_singleton()->instances_cull_convex(frustum,get_tree()->get_root()->get_world()->get_scenario());
+ Vector<ObjectID> instances=VisualServer::get_singleton()->instances_cull_convex(frustum,get_tree()->get_root()->get_world()->get_scenario());
for (int i=0;i<instances.size();i++) {
- uint32_t id=VisualServer::get_singleton()->instance_get_object_instance_ID(instances[i]);
-
- Object *obj=ObjectDB::get_instance(id);
+ Object *obj=ObjectDB::get_instance(instances[i]);
if (!obj)
continue;
Spatial *sp = obj->cast_to<Spatial>();
@@ -877,7 +874,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
if (b.mod.control) {
- Vector<RID> instances=VisualServer::get_singleton()->instances_cull_ray(ray_origin,ray_dir,get_tree()->get_root()->get_world()->get_scenario() );
+ Vector<ObjectID> instances=VisualServer::get_singleton()->instances_cull_ray(ray_origin,ray_dir,get_tree()->get_root()->get_world()->get_scenario() );
Plane p(ray_origin,_get_camera_normal());
@@ -886,8 +883,9 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
for (int i=0;i<instances.size();i++) {
- uint32_t id=VisualServer::get_singleton()->instance_get_object_instance_ID(instances[i]);
- Object *obj=ObjectDB::get_instance(id);
+
+ Object *obj=ObjectDB::get_instance(instances[i]);
+
if (!obj)
continue;
@@ -1825,6 +1823,30 @@ void SpatialEditorViewport::_notification(int p_what) {
surface->update();
}
+ //update shadow atlas if changed
+
+ int shadowmap_size = Globals::get_singleton()->get("rendering/shadow_atlas/size");
+ int atlas_q0 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_0_subdiv");
+ int atlas_q1 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_1_subdiv");
+ int atlas_q2 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_2_subdiv");
+ int atlas_q3 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_3_subdiv");
+
+
+ viewport->set_shadow_atlas_size(shadowmap_size);
+ viewport->set_shadow_atlas_quadrant_subdiv(0,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q0));
+ viewport->set_shadow_atlas_quadrant_subdiv(1,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q1));
+ viewport->set_shadow_atlas_quadrant_subdiv(2,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q2));
+ viewport->set_shadow_atlas_quadrant_subdiv(3,Viewport::ShadowAtlasQuadrantSubdiv(atlas_q3));
+
+ //update msaa if changed
+
+ int msaa_mode = Globals::get_singleton()->get("rendering/antialias/msaa");
+ viewport->set_msaa(Viewport::MSAA(msaa_mode));
+
+ bool hdr = Globals::get_singleton()->get("rendering/dynamic_range/hdr");
+ viewport->set_hdr(hdr);
+
+
}
if (p_what==NOTIFICATION_ENTER_TREE) {
@@ -2066,9 +2088,9 @@ void SpatialEditorViewport::_menu_option(int p_option) {
bool current = view_menu->get_popup()->is_item_checked( idx );
current=!current;
if (current)
- camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<<GIZMO_EDIT_LAYER)|(1<<GIZMO_GRID_LAYER) );
+ camera->set_cull_mask( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<<GIZMO_EDIT_LAYER)|(1<<GIZMO_GRID_LAYER) );
else
- camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<<GIZMO_GRID_LAYER) );
+ camera->set_cull_mask( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<<GIZMO_GRID_LAYER) );
view_menu->get_popup()->set_item_checked( idx, current );
} break;
@@ -2355,18 +2377,20 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
message_time=0;
spatial_editor=p_spatial_editor;
- Control *c=memnew(Control);
+ ViewportContainer *c=memnew(ViewportContainer);
+ c->set_stretch(true);
add_child(c);
c->set_area_as_parent_rect();
viewport = memnew( Viewport );
viewport->set_disable_input(true);
+
c->add_child(viewport);
surface = memnew( Control );
add_child(surface);
surface->set_area_as_parent_rect();
camera = memnew(Camera);
camera->set_disable_gizmo(true);
- camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+p_index))|(1<<GIZMO_EDIT_LAYER)|(1<<GIZMO_GRID_LAYER) );
+ camera->set_cull_mask( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+p_index))|(1<<GIZMO_EDIT_LAYER)|(1<<GIZMO_GRID_LAYER) );
//camera->set_environment(SpatialEditor::get_singleton()->get_viewport_environment());
viewport->add_child(camera);
camera->make_current();
@@ -2375,7 +2399,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
view_menu = memnew( MenuButton );
surface->add_child(view_menu);
view_menu->set_pos( Point2(4,4));
- view_menu->set_self_opacity(0.5);
+ view_menu->set_self_modulate(Color(1,1,1,0.5));
view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/top_view"), VIEW_TOP);
view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/bottom_view"), VIEW_BOTTOM);
view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/left_view"), VIEW_LEFT);
@@ -2555,11 +2579,12 @@ void SpatialEditor::_generate_selection_box() {
}
- Ref<FixedMaterial> mat = memnew( FixedMaterial );
- mat->set_flag(Material::FLAG_UNSHADED,true);
- mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1));
- mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true);
- mat->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY,true);
+ Ref<FixedSpatialMaterial> mat = memnew( FixedSpatialMaterial );
+ mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true);
+ mat->set_albedo(Color(1,1,1));
+ mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true);
+ mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true);
+ mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true);
st->set_material(mat);
selection_box = st->commit();
}
@@ -2691,14 +2716,14 @@ void SpatialEditor::set_state(const Dictionary& p_state) {
}
if (d.has("ambient_light_color")) {
settings_ambient_color->set_color(d["ambient_light_color"]);
- viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,d["ambient_light_color"]);
+ //viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,d["ambient_light_color"]);
}
if (d.has("default_srgb")) {
bool use = d["default_srgb"];
- viewport_environment->set_enable_fx(Environment::FX_SRGB,use);
- view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_DEFAULT_SRGB), use );
+ //viewport_environment->set_enable_fx(Environment::FX_SRGB,use);
+ //view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_USE_DEFAULT_SRGB), use );
}
if (d.has("show_grid")) {
bool use = d["show_grid"];
@@ -2898,9 +2923,9 @@ void SpatialEditor::_menu_item_pressed(int p_option) {
bool is_checked = view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(p_option) );
if (is_checked) {
- viewport_environment->set_enable_fx(Environment::FX_SRGB,false);
+ //viewport_environment->set_enable_fx(Environment::FX_SRGB,false);
} else {
- viewport_environment->set_enable_fx(Environment::FX_SRGB,true);
+ //viewport_environment->set_enable_fx(Environment::FX_SRGB,true);
}
is_checked = ! is_checked;
@@ -3146,11 +3171,13 @@ void SpatialEditor::_init_indicators() {
{
- indicator_mat = VisualServer::get_singleton()->fixed_material_create();
- VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_UNSHADED, true );
- VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_ONTOP, false );
- VisualServer::get_singleton()->fixed_material_set_flag(indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA,true);
- VisualServer::get_singleton()->fixed_material_set_flag(indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true);
+ indicator_mat.instance();;
+ indicator_mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true);
+ indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP,true);
+ indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true);
+ indicator_mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true);
+
+ indicator_mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true);
DVector<Color> grid_colors[3];
DVector<Vector3> grid_points[3];
@@ -3192,8 +3219,8 @@ void SpatialEditor::_init_indicators() {
d.resize(VS::ARRAY_MAX);
d[VisualServer::ARRAY_VERTEX]=grid_points[i];
d[VisualServer::ARRAY_COLOR]=grid_colors[i];
- VisualServer::get_singleton()->mesh_add_surface(grid[i],VisualServer::PRIMITIVE_LINES,d);
- VisualServer::get_singleton()->mesh_surface_set_material(grid[i],0,indicator_mat);
+ VisualServer::get_singleton()->mesh_add_surface_from_arrays(grid[i],VisualServer::PRIMITIVE_LINES,d);
+ VisualServer::get_singleton()->mesh_surface_set_material(grid[i],0,indicator_mat->get_rid());
grid_instance[i] = VisualServer::get_singleton()->instance_create2(grid[i],get_tree()->get_root()->get_world()->get_scenario());
grid_visible[i]=false;
@@ -3211,8 +3238,8 @@ void SpatialEditor::_init_indicators() {
d[VisualServer::ARRAY_VERTEX]=origin_points;
d[VisualServer::ARRAY_COLOR]=origin_colors;
- VisualServer::get_singleton()->mesh_add_surface(origin,VisualServer::PRIMITIVE_LINES,d);
- VisualServer::get_singleton()->mesh_surface_set_material(origin,0,indicator_mat);
+ VisualServer::get_singleton()->mesh_add_surface_from_arrays(origin,VisualServer::PRIMITIVE_LINES,d);
+ VisualServer::get_singleton()->mesh_surface_set_material(origin,0,indicator_mat->get_rid());
// origin = VisualServer::get_singleton()->poly_create();
@@ -3243,17 +3270,15 @@ void SpatialEditor::_init_indicators() {
cursor_points.push_back(Vector3(0,-cs,0));
cursor_points.push_back(Vector3(0,0,+cs));
cursor_points.push_back(Vector3(0,0,-cs));
- cursor_material=VisualServer::get_singleton()->fixed_material_create();
- VisualServer::get_singleton()->fixed_material_set_param(cursor_material,VS::FIXED_MATERIAL_PARAM_DIFFUSE,Color(0,1,1));
- VisualServer::get_singleton()->material_set_flag( cursor_material, VisualServer::MATERIAL_FLAG_UNSHADED, true );
- VisualServer::get_singleton()->fixed_material_set_flag(cursor_material, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA,true);
- VisualServer::get_singleton()->fixed_material_set_flag(cursor_material, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true);
+ cursor_material.instance();
+ cursor_material->set_albedo(Color(0,1,1));
+ cursor_material->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true);
Array d;
d.resize(VS::ARRAY_MAX);
d[VS::ARRAY_VERTEX]=cursor_points;
- VisualServer::get_singleton()->mesh_add_surface(cursor_mesh,VS::PRIMITIVE_LINES,d);
- VisualServer::get_singleton()->mesh_surface_set_material(cursor_mesh,0,cursor_material);
+ VisualServer::get_singleton()->mesh_add_surface_from_arrays(cursor_mesh,VS::PRIMITIVE_LINES,d);
+ VisualServer::get_singleton()->mesh_surface_set_material(cursor_mesh,0,cursor_material->get_rid());
cursor_instance = VisualServer::get_singleton()->instance_create2(cursor_mesh,get_tree()->get_root()->get_world()->get_scenario());
VS::get_singleton()->instance_set_layer_mask(cursor_instance,1<<SpatialEditorViewport::GIZMO_GRID_LAYER);
@@ -3271,11 +3296,11 @@ void SpatialEditor::_init_indicators() {
float gizmo_alph = EditorSettings::get_singleton()->get("3d_editor/manipulator_gizmo_opacity");
- gizmo_hl = Ref<FixedMaterial>( memnew( FixedMaterial ) );
- gizmo_hl->set_flag(Material::FLAG_UNSHADED, true);
- gizmo_hl->set_flag(Material::FLAG_ONTOP, true);
- gizmo_hl->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true);
- gizmo_hl->set_parameter(FixedMaterial::PARAM_DIFFUSE,Color(1,1,1,gizmo_alph+0.2f));
+ gizmo_hl = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial ) );
+ gizmo_hl->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true);
+ gizmo_hl->set_flag(FixedSpatialMaterial::FLAG_ONTOP, true);
+ gizmo_hl->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true);
+ gizmo_hl->set_albedo(Color(1,1,1,gizmo_alph+0.2f));
for(int i=0;i<3;i++) {
@@ -3283,14 +3308,14 @@ void SpatialEditor::_init_indicators() {
rotate_gizmo[i]=Ref<Mesh>( memnew( Mesh ) );
- Ref<FixedMaterial> mat = memnew( FixedMaterial );
- mat->set_flag(Material::FLAG_UNSHADED, true);
- mat->set_flag(Material::FLAG_ONTOP, true);
- mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true);
+ Ref<FixedSpatialMaterial> mat = memnew( FixedSpatialMaterial );
+ mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true);
+ mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP, true);
+ mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT, true);
Color col;
col[i]=1.0;
col.a= gizmo_alph;
- mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,col);
+ mat->set_albedo(col);
gizmo_color[i]=mat;
@@ -3436,8 +3461,6 @@ void SpatialEditor::_finish_indicators() {
VisualServer::get_singleton()->free(cursor_instance);
VisualServer::get_singleton()->free(cursor_mesh);
- VisualServer::get_singleton()->free(indicator_mat);
- VisualServer::get_singleton()->free(cursor_material);
}
void SpatialEditor::_instance_scene() {
@@ -3730,7 +3753,7 @@ void SpatialEditor::clear() {
settings_default_light_rot_x=Math_PI*0.3;
settings_default_light_rot_y=Math_PI*0.2;
- viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15));
+ //viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15));
settings_ambient_color->set_color(Color(0.15,0.15,0.15));
if (!light_instance.is_valid())
_menu_item_pressed(MENU_VIEW_USE_DEFAULT_LIGHT);
@@ -3743,7 +3766,7 @@ void SpatialEditor::clear() {
void SpatialEditor::_update_ambient_light_color(const Color& p_color) {
- viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,settings_ambient_color->get_color());
+// viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,settings_ambient_color->get_color());
}
@@ -3982,7 +4005,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
- settings_light_base = memnew( Control );
+ settings_light_base = memnew( ViewportContainer );
settings_light_base->set_custom_minimum_size(Size2(128,128));
settings_light_base->connect("input_event",this,"_default_light_angle_input");
settings_vbc->add_margin_child(TTR("Default Light Normal:"),settings_light_base);
@@ -4013,8 +4036,8 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
settings_vbc->add_margin_child(TTR("Ambient Light Color:"),settings_ambient_color);
settings_ambient_color->connect("color_changed",this,"_update_ambient_light_color");
- viewport_environment->set_enable_fx(Environment::FX_AMBIENT_LIGHT,true);
- viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15));
+// viewport_environment->set_enable_fx(Environment::FX_AMBIENT_LIGHT,true);
+// viewport_environment->fx_set_param(Environment::FX_PARAM_AMBIENT_LIGHT_COLOR,Color(0.15,0.15,0.15));
settings_ambient_color->set_color(Color(0.15,0.15,0.15));
diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h
index 0ee9fcd4bd..deed5072d4 100644
--- a/tools/editor/plugins/spatial_editor_plugin.h
+++ b/tools/editor/plugins/spatial_editor_plugin.h
@@ -332,8 +332,8 @@ private:
bool grid_enabled;
Ref<Mesh> move_gizmo[3], rotate_gizmo[3];
- Ref<FixedMaterial> gizmo_color[3];
- Ref<FixedMaterial> gizmo_hl;
+ Ref<FixedSpatialMaterial> gizmo_color[3];
+ Ref<FixedSpatialMaterial> gizmo_hl;
int over_gizmo_handle;
@@ -345,8 +345,8 @@ private:
RID indicators_instance;
RID cursor_mesh;
RID cursor_instance;
- RID indicator_mat;
- RID cursor_material;
+ Ref<FixedSpatialMaterial> indicator_mat;
+ Ref<FixedSpatialMaterial> cursor_material;
/*
struct Selected {
@@ -431,7 +431,7 @@ private:
float settings_default_light_rot_x;
float settings_default_light_rot_y;
- Control *settings_light_base;
+ ViewportContainer *settings_light_base;
Viewport *settings_light_vp;
ColorPickerButton *settings_ambient_color;
Image settings_light_dir_image;