mirror of
https://github.com/godotengine/godot-git-plugin.git
synced 2026-01-06 02:09:44 +03:00
Add singleton recognition in engine
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -21,3 +21,4 @@ bin/
|
|||||||
*.dylib
|
*.dylib
|
||||||
*.exe
|
*.exe
|
||||||
*.out
|
*.out
|
||||||
|
.import/
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
source_md5="acc86098bce4ae4c28cadb6a53ffcdb6"
|
||||||
|
dest_md5="2f1e2ef0a20f671eac9200fabb450d48"
|
||||||
|
|
||||||
BIN
demo/.import/gdlibrary.obj-ff1e0f18f4d5d0574974da75c2f21313.mesh
Normal file
BIN
demo/.import/gdlibrary.obj-ff1e0f18f4d5d0574974da75c2f21313.mesh
Normal file
Binary file not shown.
@@ -0,0 +1,3 @@
|
|||||||
|
source_md5="4d5c95052707b1c45aa645159a17d4d3"
|
||||||
|
dest_md5="2f1e2ef0a20f671eac9200fabb450d48"
|
||||||
|
|
||||||
BIN
demo/.import/git_api.obj-354b740fe44ec55047e8eac5458d0ec2.mesh
Normal file
BIN
demo/.import/git_api.obj-354b740fe44ec55047e8eac5458d0ec2.mesh
Normal file
Binary file not shown.
@@ -1,11 +1,3 @@
|
|||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene format=2]
|
||||||
|
|
||||||
[ext_resource path="res://bin/gitapi.gdns" type="Script" id=1]
|
|
||||||
[ext_resource path="res://icon.png" type="Texture" id=2]
|
|
||||||
|
|
||||||
[node name="Node2D" type="Node2D"]
|
[node name="Node2D" type="Node2D"]
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
|
||||||
texture = ExtResource( 2 )
|
|
||||||
centered = false
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
|
|||||||
@@ -16,9 +16,12 @@ _global_script_class_icons={
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="demo"
|
config/name="demo"
|
||||||
run/main_scene="res://demo.tscn"
|
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
|
[gdnative]
|
||||||
|
|
||||||
|
singletons=[ "res://bin/git_api.gdnlib" ]
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
environment/default_environment="res://default_env.tres"
|
environment/default_environment="res://default_env.tres"
|
||||||
|
|||||||
127
godot-git-plugin/.clang-format
Normal file
127
godot-git-plugin/.clang-format
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
# Commented out parameters are those with the same value as base LLVM style
|
||||||
|
# We can uncomment them if we want to change their value, or enforce the
|
||||||
|
# chosen value in case the base style changes (last sync: Clang 6.0.1).
|
||||||
|
---
|
||||||
|
### General config, applies to all languages ###
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignAfterOpenBracket: DontAlign
|
||||||
|
# AlignConsecutiveAssignments: false
|
||||||
|
# AlignConsecutiveDeclarations: false
|
||||||
|
# AlignEscapedNewlines: Right
|
||||||
|
# AlignOperands: true
|
||||||
|
AlignTrailingComments: false
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
# AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
|
AllowShortFunctionsOnASingleLine: Inline
|
||||||
|
AllowShortIfStatementsOnASingleLine: true
|
||||||
|
# AllowShortLoopsOnASingleLine: false
|
||||||
|
# AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
# AlwaysBreakAfterReturnType: None
|
||||||
|
# AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
# AlwaysBreakTemplateDeclarations: false
|
||||||
|
# BinPackArguments: true
|
||||||
|
# BinPackParameters: true
|
||||||
|
# BraceWrapping:
|
||||||
|
# AfterClass: false
|
||||||
|
# AfterControlStatement: false
|
||||||
|
# AfterEnum: false
|
||||||
|
# AfterFunction: false
|
||||||
|
# AfterNamespace: false
|
||||||
|
# AfterObjCDeclaration: false
|
||||||
|
# AfterStruct: false
|
||||||
|
# AfterUnion: false
|
||||||
|
# AfterExternBlock: false
|
||||||
|
# BeforeCatch: false
|
||||||
|
# BeforeElse: false
|
||||||
|
# IndentBraces: false
|
||||||
|
# SplitEmptyFunction: true
|
||||||
|
# SplitEmptyRecord: true
|
||||||
|
# SplitEmptyNamespace: true
|
||||||
|
# BreakBeforeBinaryOperators: None
|
||||||
|
# BreakBeforeBraces: Attach
|
||||||
|
# BreakBeforeInheritanceComma: false
|
||||||
|
BreakBeforeTernaryOperators: false
|
||||||
|
# BreakConstructorInitializersBeforeComma: false
|
||||||
|
BreakConstructorInitializers: AfterColon
|
||||||
|
# BreakStringLiterals: true
|
||||||
|
ColumnLimit: 0
|
||||||
|
# CommentPragmas: '^ IWYU pragma:'
|
||||||
|
# CompactNamespaces: false
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
|
ConstructorInitializerIndentWidth: 8
|
||||||
|
ContinuationIndentWidth: 8
|
||||||
|
Cpp11BracedListStyle: false
|
||||||
|
# DerivePointerAlignment: false
|
||||||
|
# DisableFormat: false
|
||||||
|
# ExperimentalAutoDetectBinPacking: false
|
||||||
|
# FixNamespaceComments: true
|
||||||
|
# ForEachMacros:
|
||||||
|
# - foreach
|
||||||
|
# - Q_FOREACH
|
||||||
|
# - BOOST_FOREACH
|
||||||
|
# IncludeBlocks: Preserve
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '".*"'
|
||||||
|
Priority: 1
|
||||||
|
- Regex: '^<.*\.h>'
|
||||||
|
Priority: 2
|
||||||
|
- Regex: '^<.*'
|
||||||
|
Priority: 3
|
||||||
|
# IncludeIsMainRegex: '(Test)?$'
|
||||||
|
IndentCaseLabels: true
|
||||||
|
# IndentPPDirectives: None
|
||||||
|
IndentWidth: 4
|
||||||
|
# IndentWrappedFunctionNames: false
|
||||||
|
# JavaScriptQuotes: Leave
|
||||||
|
# JavaScriptWrapImports: true
|
||||||
|
# KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
# MacroBlockBegin: ''
|
||||||
|
# MacroBlockEnd: ''
|
||||||
|
# MaxEmptyLinesToKeep: 1
|
||||||
|
# NamespaceIndentation: None
|
||||||
|
# PenaltyBreakAssignment: 2
|
||||||
|
# PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
# PenaltyBreakComment: 300
|
||||||
|
# PenaltyBreakFirstLessLess: 120
|
||||||
|
# PenaltyBreakString: 1000
|
||||||
|
# PenaltyExcessCharacter: 1000000
|
||||||
|
# PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
# PointerAlignment: Right
|
||||||
|
# RawStringFormats:
|
||||||
|
# - Delimiter: pb
|
||||||
|
# Language: TextProto
|
||||||
|
# BasedOnStyle: google
|
||||||
|
# ReflowComments: true
|
||||||
|
# SortIncludes: true
|
||||||
|
# SortUsingDeclarations: true
|
||||||
|
# SpaceAfterCStyleCast: false
|
||||||
|
# SpaceAfterTemplateKeyword: true
|
||||||
|
# SpaceBeforeAssignmentOperators: true
|
||||||
|
# SpaceBeforeParens: ControlStatements
|
||||||
|
# SpaceInEmptyParentheses: false
|
||||||
|
# SpacesBeforeTrailingComments: 1
|
||||||
|
# SpacesInAngles: false
|
||||||
|
# SpacesInContainerLiterals: true
|
||||||
|
# SpacesInCStyleCastParentheses: false
|
||||||
|
# SpacesInParentheses: false
|
||||||
|
# SpacesInSquareBrackets: false
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Always
|
||||||
|
---
|
||||||
|
### C++ specific config ###
|
||||||
|
Language: Cpp
|
||||||
|
Standard: Cpp03
|
||||||
|
---
|
||||||
|
### ObjC specific config ###
|
||||||
|
Language: ObjC
|
||||||
|
Standard: Cpp03
|
||||||
|
ObjCBlockIndentWidth: 4
|
||||||
|
# ObjCSpaceAfterProperty: false
|
||||||
|
# ObjCSpaceBeforeProtocolList: true
|
||||||
|
---
|
||||||
|
### Java specific config ###
|
||||||
|
Language: Java
|
||||||
|
# BreakAfterJavaFieldAnnotations: false
|
||||||
|
...
|
||||||
18
godot-git-plugin/.editorconfig
Normal file
18
godot-git-plugin/.editorconfig
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_style = tab
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.{cpp,hpp,c,h,mm}]
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[{*.{py,cs},SConstruct,SCsub}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[.travis.yml]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
@@ -73,6 +73,9 @@
|
|||||||
<IncludePath>.\src\;..\godot-cpp\godot_headers\;..\godot-cpp\include\gen;..\godot-cpp\include\core\;..\godot-cpp\include\;$(IncludePath)</IncludePath>
|
<IncludePath>.\src\;..\godot-cpp\godot_headers\;..\godot-cpp\include\gen;..\godot-cpp\include\core\;..\godot-cpp\include\;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>..\godot-cpp\bin;$(LibraryPath)</LibraryPath>
|
<LibraryPath>..\godot-cpp\bin;$(LibraryPath)</LibraryPath>
|
||||||
<SourcePath>.\src\;$(VC_SourcePath);</SourcePath>
|
<SourcePath>.\src\;$(VC_SourcePath);</SourcePath>
|
||||||
|
<OutDir>$(SolutionDir)..\demo\bin\win64\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)..\demo\bin\win64\intermediate\</IntDir>
|
||||||
|
<TargetName>libgitapi</TargetName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@@ -131,6 +134,8 @@
|
|||||||
<ClInclude Include="src\git_api.h" />
|
<ClInclude Include="src\git_api.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include=".clang-format" />
|
||||||
|
<None Include=".editorconfig" />
|
||||||
<None Include="cpp.hint" />
|
<None Include="cpp.hint" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
|||||||
@@ -29,5 +29,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="cpp.hint" />
|
<None Include="cpp.hint" />
|
||||||
|
<None Include=".clang-format" />
|
||||||
|
<None Include=".editorconfig" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ShowAllFiles>false</ShowAllFiles>
|
<ShowAllFiles>true</ShowAllFiles>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,15 +1,26 @@
|
|||||||
|
#include <Godot.hpp>
|
||||||
#include "git_api.h"
|
#include "git_api.h"
|
||||||
|
|
||||||
extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *o) {
|
extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *o) {
|
||||||
godot::Godot::gdnative_init(o);
|
|
||||||
|
godot::Godot::gdnative_init(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
//extern "C" void GDN_EXPORT godot_singelton_init(godot_gdnative_init_options *o) {
|
||||||
|
// godot::Godot::print("godot_singelton_init");
|
||||||
|
//}
|
||||||
|
|
||||||
|
extern "C" void GDN_EXPORT godot_gdnative_singleton(godot_gdnative_init_options *o) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *o) {
|
extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *o) {
|
||||||
|
|
||||||
godot::Godot::gdnative_terminate(o);
|
godot::Godot::gdnative_terminate(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void GDN_EXPORT godot_nativescript_init(void *handle) {
|
extern "C" void GDN_EXPORT godot_nativescript_init(void *handle) {
|
||||||
godot::Godot::nativescript_init(handle);
|
|
||||||
|
|
||||||
|
godot::Godot::nativescript_init(handle);
|
||||||
godot::register_class<godot::GitAPI>();
|
godot::register_class<godot::GitAPI>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ void GitAPI::_register_methods() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GitAPI::GitAPI() {
|
GitAPI::GitAPI() {
|
||||||
|
|
||||||
|
register_singleton((Node *)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
GitAPI::~GitAPI() {
|
GitAPI::~GitAPI() {
|
||||||
@@ -15,7 +17,7 @@ GitAPI::~GitAPI() {
|
|||||||
|
|
||||||
void GitAPI::_init() {
|
void GitAPI::_init() {
|
||||||
|
|
||||||
EditorVCS::replace_singleton((Node *) this);
|
WARN_PRINT("Gitinit!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitAPI::_process(float delta) {
|
void GitAPI::_process(float delta) {
|
||||||
|
|||||||
@@ -2,26 +2,27 @@
|
|||||||
#define GIT_API_H
|
#define GIT_API_H
|
||||||
|
|
||||||
#include <Godot.hpp>
|
#include <Godot.hpp>
|
||||||
#include <EditorVCS.hpp>
|
#include <EditorVCSInterface.hpp>
|
||||||
|
|
||||||
namespace godot {
|
namespace godot {
|
||||||
|
|
||||||
class GitAPI : public EditorVCS {
|
class GitAPI : public EditorVCSInterface {
|
||||||
|
|
||||||
GODOT_CLASS(GitAPI, EditorVCS) // This base class is temporary
|
GODOT_CLASS(GitAPI, EditorVCSInterface)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void _register_methods();
|
static void _register_methods();
|
||||||
|
|
||||||
GitAPI();
|
GitAPI();
|
||||||
~GitAPI();
|
~GitAPI();
|
||||||
|
|
||||||
void _init();
|
void _init();
|
||||||
|
|
||||||
|
void _process(float delta);
|
||||||
|
};
|
||||||
|
|
||||||
void _process(float delta);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !GIT_API_H
|
#endif // !GIT_API_H
|
||||||
|
|||||||
Reference in New Issue
Block a user