mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-13 22:31:11 +01:00
Separated shader editor into a new module.
This commit is contained in:
parent
8d7090241a
commit
7c946c9ba9
@ -195,7 +195,6 @@
|
||||
#ifdef MODULE_CODE_EDITOR_ENABLED
|
||||
#include "modules/code_editor/script_editor_plugin.h"
|
||||
#include "modules/code_editor/script_text_editor.h"
|
||||
#include "modules/code_editor/shader_editor_plugin.h"
|
||||
#include "modules/code_editor/text_editor.h"
|
||||
#endif
|
||||
|
||||
|
12
editor_modules/shader_editor/SCsub
Normal file
12
editor_modules/shader_editor/SCsub
Normal file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import("env")
|
||||
|
||||
env_mlp = env.Clone()
|
||||
|
||||
sources = [
|
||||
"register_types.cpp",
|
||||
"shader_editor_plugin.cpp",
|
||||
]
|
||||
|
||||
env_mlp.add_source_files(env.modules_sources, sources)
|
20
editor_modules/shader_editor/config.py
Normal file
20
editor_modules/shader_editor/config.py
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
def can_build(env, platform):
|
||||
if not env["tools"]:
|
||||
return False
|
||||
|
||||
env.module_add_dependencies("shader_editor", ["code_editor"], False)
|
||||
|
||||
return True
|
||||
|
||||
def configure(env):
|
||||
pass
|
||||
|
||||
|
||||
def get_doc_classes():
|
||||
return [
|
||||
]
|
||||
|
||||
def get_doc_path():
|
||||
return "doc_classes"
|
19
editor_modules/shader_editor/register_types.cpp
Normal file
19
editor_modules/shader_editor/register_types.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
#include "register_types.h"
|
||||
|
||||
#include "shader_editor_plugin.h"
|
||||
|
||||
void register_shader_editor_types(ModuleRegistrationLevel p_level) {
|
||||
if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) {
|
||||
//ClassDB::register_class<>();
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) {
|
||||
EditorPlugins::add_by_type<ShaderEditorPlugin>();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void unregister_shader_editor_types(ModuleRegistrationLevel p_level) {
|
||||
}
|
9
editor_modules/shader_editor/register_types.h
Normal file
9
editor_modules/shader_editor/register_types.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef SHADER_EDITOR_REGISTER_TYPES_H
|
||||
#define SHADER_EDITOR_REGISTER_TYPES_H
|
||||
|
||||
#include "modules/register_module_types.h"
|
||||
|
||||
void register_shader_editor_types(ModuleRegistrationLevel p_level);
|
||||
void unregister_shader_editor_types(ModuleRegistrationLevel p_level);
|
||||
|
||||
#endif
|
@ -30,7 +30,7 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "code_editor.h"
|
||||
#include "modules/code_editor/code_editor.h"
|
||||
#include "editor/editor_plugin.h"
|
||||
#include "scene/gui/margin_container.h"
|
||||
|
@ -9,7 +9,6 @@ sources = [
|
||||
"code_editor.cpp",
|
||||
"script_editor_plugin.cpp",
|
||||
"script_text_editor.cpp",
|
||||
"shader_editor_plugin.cpp",
|
||||
"text_editor.cpp",
|
||||
]
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "register_types.h"
|
||||
|
||||
#include "script_editor_plugin.h"
|
||||
#include "shader_editor_plugin.h"
|
||||
|
||||
#include "script_text_editor.h"
|
||||
#include "text_editor.h"
|
||||
@ -16,7 +15,6 @@ void register_code_editor_types(ModuleRegistrationLevel p_level) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) {
|
||||
EditorPlugins::add_by_type<ScriptEditorPlugin>();
|
||||
EditorPlugins::add_by_type<ShaderEditorPlugin>();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -90,9 +90,14 @@
|
||||
#include "scene/resources/texture.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "script_text_editor.h"
|
||||
#include "shader_editor_plugin.h"
|
||||
#include "text_editor.h"
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef MODULE_SHADER_EDITOR_ENABLED
|
||||
#include "shader_editor/shader_editor_plugin.h"
|
||||
#endif
|
||||
|
||||
/*** SCRIPT EDITOR ****/
|
||||
|
||||
void ScriptEditorBase::_bind_methods() {
|
||||
@ -3140,6 +3145,7 @@ void ScriptEditor::_on_find_in_files_result_selected(String fpath, int line_numb
|
||||
if (ResourceLoader::exists(fpath)) {
|
||||
RES res = ResourceLoader::load(fpath);
|
||||
|
||||
#ifdef MODULE_SHADER_EDITOR_ENABLED
|
||||
if (fpath.get_extension() == "gdshader" || fpath.get_extension() == "shader") {
|
||||
ShaderEditorPlugin *shader_editor = Object::cast_to<ShaderEditorPlugin>(EditorNode::get_singleton()->get_editor_data().get_editor("Shader"));
|
||||
shader_editor->edit(res.ptr());
|
||||
@ -3147,6 +3153,9 @@ void ScriptEditor::_on_find_in_files_result_selected(String fpath, int line_numb
|
||||
shader_editor->get_shader_editor()->goto_line_selection(line_number - 1, begin, end);
|
||||
return;
|
||||
} else if (fpath.get_extension() == "tscn") {
|
||||
#else
|
||||
if (fpath.get_extension() == "tscn") {
|
||||
#endif
|
||||
editor->load_scene(fpath);
|
||||
return;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user