Hand-merge API hash fixes #18514

This hasn't made it into master yet but is important for mono support.
If this turns out to be the wrong call we'll revert and merge whatever
next version of this becomes available.
This commit is contained in:
Hein-Pieter van Braam 2018-04-29 20:44:48 +02:00
parent 00c55bb2eb
commit 3ee4d6af2e
12 changed files with 22 additions and 37 deletions

View File

@ -364,7 +364,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
ClassInfo *t = classes.getptr(E->get()); ClassInfo *t = classes.getptr(E->get());
ERR_FAIL_COND_V(!t, 0); ERR_FAIL_COND_V(!t, 0);
if (t->api != p_api) if (t->api != p_api || !t->exposed)
continue; continue;
hash = hash_djb2_one_64(t->name.hash(), hash); hash = hash_djb2_one_64(t->name.hash(), hash);
hash = hash_djb2_one_64(t->inherits.hash(), hash); hash = hash_djb2_one_64(t->inherits.hash(), hash);

View File

@ -112,7 +112,9 @@ void register_visual_script_types() {
register_visual_script_expression_node(); register_visual_script_expression_node();
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
ClassDB::set_current_api(ClassDB::API_EDITOR);
ClassDB::register_class<_VisualScriptEditor>(); ClassDB::register_class<_VisualScriptEditor>();
ClassDB::set_current_api(ClassDB::API_CORE);
vs_editor_singleton = memnew(_VisualScriptEditor); vs_editor_singleton = memnew(_VisualScriptEditor);
Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptEditor", _VisualScriptEditor::get_singleton())); Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptEditor", _VisualScriptEditor::get_singleton()));

View File

@ -107,12 +107,12 @@ OccluderPolygon2D::~OccluderPolygon2D() {
VS::get_singleton()->free(occ_polygon); VS::get_singleton()->free(occ_polygon);
} }
#ifdef DEBUG_ENABLED
void LightOccluder2D::_poly_changed() { void LightOccluder2D::_poly_changed() {
#ifdef DEBUG_ENABLED
update(); update();
}
#endif #endif
}
void LightOccluder2D::_notification(int p_what) { void LightOccluder2D::_notification(int p_what) {
@ -221,9 +221,7 @@ void LightOccluder2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_occluder_light_mask", "mask"), &LightOccluder2D::set_occluder_light_mask); ClassDB::bind_method(D_METHOD("set_occluder_light_mask", "mask"), &LightOccluder2D::set_occluder_light_mask);
ClassDB::bind_method(D_METHOD("get_occluder_light_mask"), &LightOccluder2D::get_occluder_light_mask); ClassDB::bind_method(D_METHOD("get_occluder_light_mask"), &LightOccluder2D::get_occluder_light_mask);
#ifdef DEBUG_ENABLED
ClassDB::bind_method("_poly_changed", &LightOccluder2D::_poly_changed); ClassDB::bind_method("_poly_changed", &LightOccluder2D::_poly_changed);
#endif
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "occluder", PROPERTY_HINT_RESOURCE_TYPE, "OccluderPolygon2D"), "set_occluder_polygon", "get_occluder_polygon"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "occluder", PROPERTY_HINT_RESOURCE_TYPE, "OccluderPolygon2D"), "set_occluder_polygon", "get_occluder_polygon");
ADD_PROPERTY(PropertyInfo(Variant::INT, "light_mask", PROPERTY_HINT_LAYERS_2D_RENDER), "set_occluder_light_mask", "get_occluder_light_mask"); ADD_PROPERTY(PropertyInfo(Variant::INT, "light_mask", PROPERTY_HINT_LAYERS_2D_RENDER), "set_occluder_light_mask", "get_occluder_light_mask");

View File

@ -78,9 +78,7 @@ class LightOccluder2D : public Node2D {
int mask; int mask;
Ref<OccluderPolygon2D> occluder_polygon; Ref<OccluderPolygon2D> occluder_polygon;
#ifdef DEBUG_ENABLED
void _poly_changed(); void _poly_changed();
#endif
protected: protected:
void _notification(int p_what); void _notification(int p_what);

View File

@ -432,10 +432,9 @@ Ref<SpatialGizmo> Spatial::get_gizmo() const {
#endif #endif
} }
#ifdef TOOLS_ENABLED
void Spatial::_update_gizmo() { void Spatial::_update_gizmo() {
#ifdef TOOLS_ENABLED
if (!is_inside_world()) if (!is_inside_world())
return; return;
data.gizmo_dirty = false; data.gizmo_dirty = false;
@ -447,8 +446,10 @@ void Spatial::_update_gizmo() {
data.gizmo->clear(); data.gizmo->clear();
} }
} }
#endif
} }
#ifdef TOOLS_ENABLED
void Spatial::set_disable_gizmo(bool p_enabled) { void Spatial::set_disable_gizmo(bool p_enabled) {
data.gizmo_disabled = p_enabled; data.gizmo_disabled = p_enabled;
@ -728,9 +729,7 @@ void Spatial::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_set_as_toplevel"), &Spatial::is_set_as_toplevel); ClassDB::bind_method(D_METHOD("is_set_as_toplevel"), &Spatial::is_set_as_toplevel);
ClassDB::bind_method(D_METHOD("get_world"), &Spatial::get_world); ClassDB::bind_method(D_METHOD("get_world"), &Spatial::get_world);
#ifdef TOOLS_ENABLED
ClassDB::bind_method(D_METHOD("_update_gizmo"), &Spatial::_update_gizmo); ClassDB::bind_method(D_METHOD("_update_gizmo"), &Spatial::_update_gizmo);
#endif
ClassDB::bind_method(D_METHOD("update_gizmo"), &Spatial::update_gizmo); ClassDB::bind_method(D_METHOD("update_gizmo"), &Spatial::update_gizmo);
ClassDB::bind_method(D_METHOD("set_gizmo", "gizmo"), &Spatial::set_gizmo); ClassDB::bind_method(D_METHOD("set_gizmo", "gizmo"), &Spatial::set_gizmo);
@ -792,9 +791,7 @@ void Spatial::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "scale", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_scale", "get_scale"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "scale", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_scale", "get_scale");
ADD_GROUP("Visibility", ""); ADD_GROUP("Visibility", "");
ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "visible"), "set_visible", "is_visible"); ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "visible"), "set_visible", "is_visible");
#ifdef TOOLS_ENABLED
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "gizmo", PROPERTY_HINT_RESOURCE_TYPE, "SpatialGizmo", 0), "set_gizmo", "get_gizmo"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "gizmo", PROPERTY_HINT_RESOURCE_TYPE, "SpatialGizmo", 0), "set_gizmo", "get_gizmo");
#endif
ADD_SIGNAL(MethodInfo("visibility_changed")); ADD_SIGNAL(MethodInfo("visibility_changed"));
} }

View File

@ -100,10 +100,8 @@ class Spatial : public Node {
#endif #endif
} data; } data;
#ifdef TOOLS_ENABLED
void _update_gizmo(); void _update_gizmo();
#endif
void _notify_dirty(); void _notify_dirty();
void _propagate_transform_changed(Spatial *p_origin); void _propagate_transform_changed(Spatial *p_origin);

View File

@ -1325,12 +1325,12 @@ PopupMenu *LineEdit::get_menu() const {
return menu; return menu;
} }
#ifdef TOOLS_ENABLED
void LineEdit::_editor_settings_changed() { void LineEdit::_editor_settings_changed() {
#ifdef TOOLS_ENABLED
cursor_set_blink_enabled(EDITOR_DEF("text_editor/cursor/caret_blink", false)); cursor_set_blink_enabled(EDITOR_DEF("text_editor/cursor/caret_blink", false));
cursor_set_blink_speed(EDITOR_DEF("text_editor/cursor/caret_blink_speed", 0.65)); cursor_set_blink_speed(EDITOR_DEF("text_editor/cursor/caret_blink_speed", 0.65));
}
#endif #endif
}
void LineEdit::set_expand_to_text_length(bool p_enabled) { void LineEdit::set_expand_to_text_length(bool p_enabled) {
@ -1399,9 +1399,7 @@ void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("_text_changed"), &LineEdit::_text_changed); ClassDB::bind_method(D_METHOD("_text_changed"), &LineEdit::_text_changed);
ClassDB::bind_method(D_METHOD("_toggle_draw_caret"), &LineEdit::_toggle_draw_caret); ClassDB::bind_method(D_METHOD("_toggle_draw_caret"), &LineEdit::_toggle_draw_caret);
#ifdef TOOLS_ENABLED
ClassDB::bind_method("_editor_settings_changed", &LineEdit::_editor_settings_changed); ClassDB::bind_method("_editor_settings_changed", &LineEdit::_editor_settings_changed);
#endif
ClassDB::bind_method(D_METHOD("set_align", "align"), &LineEdit::set_align); ClassDB::bind_method(D_METHOD("set_align", "align"), &LineEdit::set_align);
ClassDB::bind_method(D_METHOD("get_align"), &LineEdit::get_align); ClassDB::bind_method(D_METHOD("get_align"), &LineEdit::get_align);

View File

@ -134,9 +134,7 @@ private:
void clear_internal(); void clear_internal();
void changed_internal(); void changed_internal();
#ifdef TOOLS_ENABLED
void _editor_settings_changed(); void _editor_settings_changed();
#endif
void _gui_input(Ref<InputEvent> p_event); void _gui_input(Ref<InputEvent> p_event);
void _notification(int p_what); void _notification(int p_what);

View File

@ -2736,18 +2736,21 @@ Array Node::_get_children() const {
return arr; return arr;
} }
#ifdef TOOLS_ENABLED
void Node::set_import_path(const NodePath &p_import_path) { void Node::set_import_path(const NodePath &p_import_path) {
#ifdef TOOLS_ENABLED
data.import_path = p_import_path; data.import_path = p_import_path;
#endif
} }
NodePath Node::get_import_path() const { NodePath Node::get_import_path() const {
#ifdef TOOLS_ENABLED
return data.import_path; return data.import_path;
} #else
return NodePath();
#endif #endif
}
static void _add_nodes_to_options(const Node *p_base, const Node *p_node, List<String> *r_options) { static void _add_nodes_to_options(const Node *p_base, const Node *p_node, List<String> *r_options) {
@ -2903,13 +2906,10 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("rpc_config", "method", "mode"), &Node::rpc_config); ClassDB::bind_method(D_METHOD("rpc_config", "method", "mode"), &Node::rpc_config);
ClassDB::bind_method(D_METHOD("rset_config", "property", "mode"), &Node::rset_config); ClassDB::bind_method(D_METHOD("rset_config", "property", "mode"), &Node::rset_config);
#ifdef TOOLS_ENABLED
ClassDB::bind_method(D_METHOD("_set_import_path", "import_path"), &Node::set_import_path); ClassDB::bind_method(D_METHOD("_set_import_path", "import_path"), &Node::set_import_path);
ClassDB::bind_method(D_METHOD("_get_import_path"), &Node::get_import_path); ClassDB::bind_method(D_METHOD("_get_import_path"), &Node::get_import_path);
ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "_import_path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_import_path", "_get_import_path"); ADD_PROPERTYNZ(PropertyInfo(Variant::NODE_PATH, "_import_path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_import_path", "_get_import_path");
#endif
{ {
MethodInfo mi; MethodInfo mi;

View File

@ -372,10 +372,8 @@ public:
void force_parent_owned() { data.parent_owned = true; } //hack to avoid duplicate nodes void force_parent_owned() { data.parent_owned = true; } //hack to avoid duplicate nodes
#ifdef TOOLS_ENABLED
void set_import_path(const NodePath &p_import_path); //path used when imported, used by scene editors to keep tracking void set_import_path(const NodePath &p_import_path); //path used when imported, used by scene editors to keep tracking
NodePath get_import_path() const; NodePath get_import_path() const;
#endif
bool is_owned_by_parent() const; bool is_owned_by_parent() const;

View File

@ -1197,16 +1197,20 @@ void SceneTree::set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, c
_update_root_rect(); _update_root_rect();
} }
#ifdef TOOLS_ENABLED
void SceneTree::set_edited_scene_root(Node *p_node) { void SceneTree::set_edited_scene_root(Node *p_node) {
#ifdef TOOLS_ENABLED
edited_scene_root = p_node; edited_scene_root = p_node;
#endif
} }
Node *SceneTree::get_edited_scene_root() const { Node *SceneTree::get_edited_scene_root() const {
#ifdef TOOLS_ENABLED
return edited_scene_root; return edited_scene_root;
} #else
return NULL;
#endif #endif
}
void SceneTree::set_current_scene(Node *p_scene) { void SceneTree::set_current_scene(Node *p_scene) {
@ -2143,10 +2147,8 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_debug_navigation_hint", "enable"), &SceneTree::set_debug_navigation_hint); ClassDB::bind_method(D_METHOD("set_debug_navigation_hint", "enable"), &SceneTree::set_debug_navigation_hint);
ClassDB::bind_method(D_METHOD("is_debugging_navigation_hint"), &SceneTree::is_debugging_navigation_hint); ClassDB::bind_method(D_METHOD("is_debugging_navigation_hint"), &SceneTree::is_debugging_navigation_hint);
#ifdef TOOLS_ENABLED
ClassDB::bind_method(D_METHOD("set_edited_scene_root", "scene"), &SceneTree::set_edited_scene_root); ClassDB::bind_method(D_METHOD("set_edited_scene_root", "scene"), &SceneTree::set_edited_scene_root);
ClassDB::bind_method(D_METHOD("get_edited_scene_root"), &SceneTree::get_edited_scene_root); ClassDB::bind_method(D_METHOD("get_edited_scene_root"), &SceneTree::get_edited_scene_root);
#endif
ClassDB::bind_method(D_METHOD("set_pause", "enable"), &SceneTree::set_pause); ClassDB::bind_method(D_METHOD("set_pause", "enable"), &SceneTree::set_pause);
ClassDB::bind_method(D_METHOD("is_paused"), &SceneTree::is_paused); ClassDB::bind_method(D_METHOD("is_paused"), &SceneTree::is_paused);
@ -2219,9 +2221,7 @@ void SceneTree::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "paused"), "set_pause", "is_paused"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "paused"), "set_pause", "is_paused");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "refuse_new_network_connections"), "set_refuse_new_network_connections", "is_refusing_new_network_connections"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "refuse_new_network_connections"), "set_refuse_new_network_connections", "is_refusing_new_network_connections");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_font_oversampling"), "set_use_font_oversampling", "is_using_font_oversampling"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_font_oversampling"), "set_use_font_oversampling", "is_using_font_oversampling");
#ifdef TOOLS_ENABLED
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "edited_scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_edited_scene_root", "get_edited_scene_root"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "edited_scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_edited_scene_root", "get_edited_scene_root");
#endif
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "current_scene", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_current_scene", "get_current_scene"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "current_scene", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_current_scene", "get_current_scene");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "network_peer", PROPERTY_HINT_RESOURCE_TYPE, "NetworkedMultiplayerPeer", 0), "set_network_peer", "get_network_peer"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "network_peer", PROPERTY_HINT_RESOURCE_TYPE, "NetworkedMultiplayerPeer", 0), "set_network_peer", "get_network_peer");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "root", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "", "get_root"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "root", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "", "get_root");

View File

@ -428,10 +428,8 @@ public:
//void change_scene(const String& p_path); //void change_scene(const String& p_path);
//Node *get_loaded_scene(); //Node *get_loaded_scene();
#ifdef TOOLS_ENABLED
void set_edited_scene_root(Node *p_node); void set_edited_scene_root(Node *p_node);
Node *get_edited_scene_root() const; Node *get_edited_scene_root() const;
#endif
void set_current_scene(Node *p_scene); void set_current_scene(Node *p_scene);
Node *get_current_scene() const; Node *get_current_scene() const;