Skip to content

Commit

Permalink
Merge pull request #3 from hungrymonkey/master
Browse files Browse the repository at this point in the history
track master
  • Loading branch information
jcalifornia authored Oct 8, 2017
2 parents a0d2586 + c95ba4d commit beccd21
Show file tree
Hide file tree
Showing 84 changed files with 2,718 additions and 1,041 deletions.
29 changes: 29 additions & 0 deletions compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ def encode_utf8(x):
return x
def iteritems(d):
return d.iteritems()
def escape_string(s):
if isinstance(s, unicode):
s = s.encode('ascii')
result = ''
for c in s:
if not (32 <= ord(c) < 127) or c in ('\\', '"'):
result += '\\%03o' % ord(c)
else:
result += c
return result

else:
def isbasestring(s):
return isinstance(s, (str, bytes))
Expand All @@ -29,3 +40,21 @@ def encode_utf8(x):
return codecs.utf_8_encode(x)[0]
def iteritems(d):
return iter(d.items())
def charcode_to_c_escapes(c):
rev_result = []
while c >= 256:
c, low = (c // 256, c % 256)
rev_result.append('\\%03o' % low)
rev_result.append('\\%03o' % c)
return ''.join(reversed(rev_result))
def escape_string(s):
result = ''
if isinstance(s, str):
s = s.encode('utf-8')
for c in s:
if not(32 <= c < 127) or c in (ord('\\'), ord('"')):
result += charcode_to_c_escapes(c)
else:
result += chr(c)
return result

5 changes: 4 additions & 1 deletion core/io/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,14 @@ void RotatedFileLogger::logv(const char *p_format, va_list p_list, bool p_err) {
const int static_buf_size = 512;
char static_buf[static_buf_size];
char *buf = static_buf;
va_list list_copy;
va_copy(list_copy, p_list);
int len = vsnprintf(buf, static_buf_size, p_format, p_list);
if (len >= static_buf_size) {
buf = (char *)Memory::alloc_static(len + 1);
vsnprintf(buf, len + 1, p_format, p_list);
vsnprintf(buf, len + 1, p_format, list_copy);
}
va_end(list_copy);
file->store_buffer((uint8_t *)buf, len);
if (len >= static_buf_size) {
Memory::free_static(buf);
Expand Down
2 changes: 1 addition & 1 deletion core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ void ResourceLoader::reload_translation_remaps() {

void ResourceLoader::load_translation_remaps() {

if (!ProjectSettings::get_singleton()->has("locale/translation_remaps"))
if (!ProjectSettings::get_singleton()->has_setting("locale/translation_remaps"))
return;

Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps");
Expand Down
2 changes: 1 addition & 1 deletion core/os/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ OS::OS() {

_render_thread_mode = RENDER_THREAD_SAFE;

_allow_hidpi = true;
_allow_hidpi = false;
_stack_bottom = (void *)(&stack_bottom);

_logger = NULL;
Expand Down
16 changes: 13 additions & 3 deletions core/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) {
return OK;
}

bool ProjectSettings::has(String p_var) const {
bool ProjectSettings::has_setting(String p_var) const {

_THREAD_SAFE_METHOD_

Expand Down Expand Up @@ -800,7 +800,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) {

Variant ret;
if (ProjectSettings::get_singleton()->has(p_var)) {
if (ProjectSettings::get_singleton()->has_setting(p_var)) {
ret = ProjectSettings::get_singleton()->get(p_var);
} else {
ProjectSettings::get_singleton()->set(p_var, p_default);
Expand Down Expand Up @@ -907,9 +907,19 @@ Variant ProjectSettings::property_get_revert(const String &p_name) {
return props[p_name].initial;
}

void ProjectSettings::set_setting(const String &p_setting, const Variant &p_value) {
set(p_setting, p_value);
}

Variant ProjectSettings::get_setting(const String &p_setting) const {
return get(p_setting);
}

void ProjectSettings::_bind_methods() {

ClassDB::bind_method(D_METHOD("has", "name"), &ProjectSettings::has);
ClassDB::bind_method(D_METHOD("has_setting", "name"), &ProjectSettings::has_setting);
ClassDB::bind_method(D_METHOD("set_setting", "name", "value"), &ProjectSettings::set_setting);
ClassDB::bind_method(D_METHOD("get_setting", "name"), &ProjectSettings::get_setting);
ClassDB::bind_method(D_METHOD("set_order", "name", "position"), &ProjectSettings::set_order);
ClassDB::bind_method(D_METHOD("get_order", "name"), &ProjectSettings::get_order);
ClassDB::bind_method(D_METHOD("set_initial_value", "name", "value"), &ProjectSettings::set_initial_value);
Expand Down
5 changes: 4 additions & 1 deletion core/project_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ class ProjectSettings : public Object {
static void _bind_methods();

public:
bool has(String p_var) const;
void set_setting(const String &p_setting, const Variant &p_value);
Variant get_setting(const String &p_setting) const;

bool has_setting(String p_var) const;
String localize_path(const String &p_path) const;
String globalize_path(const String &p_path) const;

Expand Down
3 changes: 3 additions & 0 deletions core/string_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ class StringName {
else
return 0;
}
_FORCE_INLINE_ const void *data_unique_pointer() const {
return (void *)_data;
}
bool operator!=(const StringName &p_name) const;

_FORCE_INLINE_ operator String() const {
Expand Down
2 changes: 1 addition & 1 deletion core/translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ TranslationServer *TranslationServer::singleton = NULL;

bool TranslationServer::_load_translations(const String &p_from) {

if (ProjectSettings::get_singleton()->has(p_from)) {
if (ProjectSettings::get_singleton()->has_setting(p_from)) {
PoolVector<String> translations = ProjectSettings::get_singleton()->get(p_from);

int tcount = translations.size();
Expand Down
7 changes: 7 additions & 0 deletions doc/classes/ARVRAnchor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
Returns true if the anchor is being tracked and false if no anchor with this id is currently known.
</description>
</method>
<method name="get_plane" qualifiers="const">
<return type="Plane">
</return>
<description>
Returns a plane aligned with our anchor, handy for intersection testing
</description>
</method>
<method name="get_size" qualifiers="const">
<return type="Vector3">
</return>
Expand Down
88 changes: 75 additions & 13 deletions doc/classes/ARVRInterface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@
<demos>
</demos>
<methods>
<method name="get_anchor_detection_is_enabled" qualifiers="const">
<return type="bool">
</return>
<description>
Returns true if achor detection is enabled (AR only).
</description>
</method>
<method name="get_capabilities" qualifiers="const">
<return type="int">
</return>
<description>
Returns a combination of flags providing information about the capabilities of this interface.
</description>
</method>
<method name="get_name" qualifiers="const">
<return type="String">
</return>
Expand All @@ -26,11 +40,11 @@
Returns the resolution at which we should render our intermediate results before things like lens distortion are applied by the VR platform.
</description>
</method>
<method name="hmd_is_present">
<return type="bool">
<method name="get_tracking_status" qualifiers="const">
<return type="int" enum="ARVRInterface.Tracking_status">
</return>
<description>
Returns true if an HMD is available for this interface.
If supported, returns the status of our tracking. This will allow you to provide feedback to the user whether there are issues with positional tracking.
</description>
</method>
<method name="initialize">
Expand All @@ -51,34 +65,45 @@
Returns true if this interface is active.
</description>
</method>
<method name="is_installed">
<method name="is_primary">
<return type="bool">
</return>
<description>
Returns true if this interface has been installed. Say your game is designed to work with OpenVR so you are using the OpenVR interface but the user hasn't installed SteamVR, this would return false.
Returns true if this interface is currently the primary interface (the interface responsible for showing the output).
</description>
</method>
<method name="is_primary">
<method name="is_stereo">
<return type="bool">
</return>
<description>
Returns true if this interface is currently the primary interface (the interface responsible for showing the output).
Returns true if the current output of this interface is in stereo.
</description>
</method>
<method name="set_is_primary">
<method name="set_anchor_detection_is_enabled">
<return type="void">
</return>
<argument index="0" name="enable" type="bool">
</argument>
<description>
Set this interface to the primary interface (unset the old one).
Enables anchor detection, this is used on AR interfaces and enables the extra logic that will detect planes, features, objects, etc. and adds/modifies anchor points.
</description>
</method>
<method name="supports_hmd">
<return type="bool">
<method name="set_is_initialized">
<return type="void">
</return>
<argument index="0" name="initialized" type="bool">
</argument>
<description>
Initialise/uninitilise this interface (same effect as calling intialize/uninitialize).
</description>
</method>
<method name="set_is_primary">
<return type="void">
</return>
<argument index="0" name="enable" type="bool">
</argument>
<description>
Returns true if this interface supports HMDs and by extension uses stereo scopic rendering.
Set this interface to the primary interface (unset the old one).
</description>
</method>
<method name="uninitialize">
Expand All @@ -90,10 +115,32 @@
</method>
</methods>
<members>
<member name="primary" type="bool" setter="set_is_primary" getter="is_primary">
<member name="ar_is_anchor_detection_enabled" type="bool" setter="set_anchor_detection_is_enabled" getter="get_anchor_detection_is_enabled">
On an AR interface, is our anchor detection enabled?
</member>
<member name="interface_is_initialized" type="bool" setter="set_is_initialized" getter="is_initialized">
Has this interface been initialized?
</member>
<member name="interface_is_primary" type="bool" setter="set_is_primary" getter="is_primary">
Is this our primary interface?
</member>
</members>
<constants>
<constant name="ARVR_NONE" value="0">
No ARVR capabilities.
</constant>
<constant name="ARVR_MONO" value="1">
This interface can work with normal rendering output (non-HMD based AR).
</constant>
<constant name="ARVR_STEREO" value="2">
This interface supports stereoscopic rendering.
</constant>
<constant name="ARVR_AR" value="4">
This interface support AR (video background and real world tracking).
</constant>
<constant name="ARVR_EXTERNAL" value="8">
This interface outputs to an external device, if the main viewport is used the on screen output is an unmodified buffer of either the left or right eye (stretched if the viewport size is not changed to the same aspect ratio of get_recommended_render_targetsize. Using a seperate viewport node frees up the main viewport for other purposes.
</constant>
<constant name="EYE_MONO" value="0">
Mono output, this is mostly used internally when retrieving positioning information for our camera node or when stereo scopic rendering is not supported.
</constant>
Expand All @@ -103,5 +150,20 @@
<constant name="EYE_RIGHT" value="2">
Right eye output, this is mostly used internally when rendering the image for the right eye and obtaining positioning and projection information.
</constant>
<constant name="ARVR_NORMAL_TRACKING" value="0">
Tracking is behaving as expected.
</constant>
<constant name="ARVR_EXCESSIVE_MOTION" value="1">
Tracking is hindered by excessive motion, player is moving faster then tracking can keep up.
</constant>
<constant name="ARVR_INSUFFICIENT_FEATURES" value="2">
Tracking is hindered by insufficient features, it's too dark (for camera based tracking), player is blocked, etc.
</constant>
<constant name="ARVR_UNKNOWN_TRACKING" value="3">
We don't know the status of the tracking or this interface does not provide feedback.
</constant>
<constant name="ARVR_NOT_TRACKING" value="4">
Tracking is not functional (camera not plugged in or obscured, lighthouses turned off, etc.)
</constant>
</constants>
</class>
43 changes: 26 additions & 17 deletions doc/classes/ARVRScriptInterface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,34 @@
Outputs a finished render buffer to the AR/VR device for the given eye.
</description>
</method>
<method name="get_anchor_detection_is_enabled" qualifiers="virtual">
<return type="bool">
</return>
<description>
Returns true if achor detection is enabled (AR only).
</description>
</method>
<method name="get_capabilities" qualifiers="virtual">
<return type="int">
</return>
<description>
Returns a combination of flags providing information about the capabilities of this interface.
</description>
</method>
<method name="get_recommended_render_targetsize" qualifiers="virtual">
<return type="Vector2">
</return>
<description>
Returns the size at which we should render our scene to get optimal quality on the output device.
</description>
</method>
<method name="get_tracking_status" qualifiers="virtual">
<return type="int">
</return>
<description>
If supported, returns the status of our tracking. This will allow you to provide feedback to the user whether there are issues with positional tracking.
</description>
</method>
<method name="get_transform_for_eye" qualifiers="virtual">
<return type="Transform">
</return>
Expand All @@ -47,13 +68,6 @@
Get the location and orientation transform used when rendering a specific eye.
</description>
</method>
<method name="hmd_is_present" qualifiers="virtual">
<return type="bool">
</return>
<description>
Return true is an HMD is available.
</description>
</method>
<method name="initialize" qualifiers="virtual">
<return type="bool">
</return>
Expand All @@ -68,13 +82,6 @@
Returns true if this interface has been initialized and is active.
</description>
</method>
<method name="is_installed" qualifiers="virtual">
<return type="bool">
</return>
<description>
Returns true if the required middleware is installed.
</description>
</method>
<method name="is_stereo" qualifiers="virtual">
<return type="bool">
</return>
Expand All @@ -89,11 +96,13 @@
Gets called before rendering each frame so tracking data gets updated in time.
</description>
</method>
<method name="supports_hmd" qualifiers="virtual">
<return type="bool">
<method name="set_anchor_detection_is_enabled" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="enabled" type="bool">
</argument>
<description>
Returns true if this interface supports HMDs.
Enables anchor detection, this is used on AR interfaces and enables the extra logic that will detect planes, features, objects, etc. and adds/modifies anchor points.
</description>
</method>
<method name="uninitialize" qualifiers="virtual">
Expand Down
Loading

0 comments on commit beccd21

Please sign in to comment.