diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 14:29:06 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (patch) | |
tree | 43cdc7cfe8239c23065616a931de3769d2db1e86 /editor/plugins/material_editor_plugin.cpp | |
parent | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (diff) | |
download | redot-engine-07bc4e2f96f8f47991339654ff4ab16acc19d44f.tar.gz |
Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
-o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
-o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```
This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.
This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.
Part of #33027.
Diffstat (limited to 'editor/plugins/material_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/material_editor_plugin.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 2e61ff59fd..992f080cec 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -239,10 +239,12 @@ MaterialEditorPlugin::MaterialEditorPlugin(EditorNode *p_node) { String StandardMaterial3DConversionPlugin::converts_to() const { return "ShaderMaterial"; } + bool StandardMaterial3DConversionPlugin::handles(const Ref<Resource> &p_resource) const { Ref<StandardMaterial3D> mat = p_resource; return mat.is_valid(); } + Ref<Resource> StandardMaterial3DConversionPlugin::convert(const Ref<Resource> &p_resource) const { Ref<StandardMaterial3D> mat = p_resource; ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>()); @@ -281,10 +283,12 @@ Ref<Resource> StandardMaterial3DConversionPlugin::convert(const Ref<Resource> &p String ParticlesMaterialConversionPlugin::converts_to() const { return "ShaderMaterial"; } + bool ParticlesMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const { Ref<ParticlesMaterial> mat = p_resource; return mat.is_valid(); } + Ref<Resource> ParticlesMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const { Ref<ParticlesMaterial> mat = p_resource; ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>()); @@ -316,10 +320,12 @@ Ref<Resource> ParticlesMaterialConversionPlugin::convert(const Ref<Resource> &p_ String CanvasItemMaterialConversionPlugin::converts_to() const { return "ShaderMaterial"; } + bool CanvasItemMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const { Ref<CanvasItemMaterial> mat = p_resource; return mat.is_valid(); } + Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const { Ref<CanvasItemMaterial> mat = p_resource; ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>()); @@ -351,10 +357,12 @@ Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p String ProceduralSkyMaterialConversionPlugin::converts_to() const { return "ShaderMaterial"; } + bool ProceduralSkyMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const { Ref<ProceduralSkyMaterial> mat = p_resource; return mat.is_valid(); } + Ref<Resource> ProceduralSkyMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const { Ref<ProceduralSkyMaterial> mat = p_resource; ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>()); @@ -386,10 +394,12 @@ Ref<Resource> ProceduralSkyMaterialConversionPlugin::convert(const Ref<Resource> String PanoramaSkyMaterialConversionPlugin::converts_to() const { return "ShaderMaterial"; } + bool PanoramaSkyMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const { Ref<PanoramaSkyMaterial> mat = p_resource; return mat.is_valid(); } + Ref<Resource> PanoramaSkyMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const { Ref<PanoramaSkyMaterial> mat = p_resource; ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>()); @@ -421,10 +431,12 @@ Ref<Resource> PanoramaSkyMaterialConversionPlugin::convert(const Ref<Resource> & String PhysicalSkyMaterialConversionPlugin::converts_to() const { return "ShaderMaterial"; } + bool PhysicalSkyMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const { Ref<PhysicalSkyMaterial> mat = p_resource; return mat.is_valid(); } + Ref<Resource> PhysicalSkyMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) const { Ref<PhysicalSkyMaterial> mat = p_resource; ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>()); |