summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/base/classes.xml18
-rwxr-xr-xmethods.py53
-rw-r--r--platform/windows/detect.py91
-rw-r--r--scene/animation/animation_player.cpp5
4 files changed, 136 insertions, 31 deletions
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 774cea50fb..dd0b729286 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -2735,12 +2735,14 @@
<argument index="1" name="custom_blend" type="float" default="-1">
</argument>
<description>
+ Play a given animation by the animation name in reverse.
</description>
</method>
<method name="stop">
<argument index="0" name="reset" type="bool" default="true">
</argument>
<description>
+ Stop the currently playing animation.
</description>
</method>
<method name="stop_all">
@@ -2900,6 +2902,7 @@
<argument index="0" name="delta" type="float">
</argument>
<description>
+ Used to skip ahead or skip back in an animation. Delta is the time in seconds to skip.
</description>
</method>
</methods>
@@ -2908,6 +2911,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
+ Notifies when an animation starts playing.
</description>
</signal>
<signal name="animation_changed">
@@ -38535,6 +38539,7 @@ This method controls whether the position between two cached points is interpola
</class>
<class name="Timer" inherits="Node" category="Core">
<brief_description>
+ A simple Timer node.
</brief_description>
<description>
Timer node. This is a simple node that will emit a timeout callback when the timer runs out. It can optionally be set to loop.
@@ -38596,12 +38601,14 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="active" type="bool">
</argument>
<description>
+ Set whether the timer is active or not. An inactive timer will be paused until it is activated again.
</description>
</method>
<method name="is_active" qualifiers="const">
<return type="bool">
</return>
<description>
+ Return if the timer is active or not.
</description>
</method>
<method name="get_time_left" qualifiers="const">
@@ -43922,6 +43929,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="from" type="int">
</argument>
<description>
+ Cast an [int] value to a boolean value, this method will return true if called with an integer value different to 0 and false in other case.
</description>
</method>
<method name="bool">
@@ -43930,6 +43938,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="from" type="float">
</argument>
<description>
+ Cast a [float] value to a boolean value, this method will return true if called with a floating point value different to 0 and false in other case.
</description>
</method>
<method name="bool">
@@ -43938,6 +43947,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="from" type="String">
</argument>
<description>
+ Cast a [String] value to a boolean value, this method will return true if called with a non empty string and false in other case. Examples: [code]bool('False')[/code] returns true, [code]bool('')[/code]. returns false
</description>
</method>
</methods>
@@ -43946,8 +43956,10 @@ This method controls whether the position between two cached points is interpola
</class>
<class name="float" category="Built-In Types">
<brief_description>
+ Float built-in type
</brief_description>
<description>
+ Float built-in type.
</description>
<methods>
<method name="float">
@@ -43956,6 +43968,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="from" type="bool">
</argument>
<description>
+ Cast a [bool] value to a floating point value, [code]float(true)[/code] will be equals to 1.0 and [code]float(false)[/code] will be equals to 0.0.
</description>
</method>
<method name="float">
@@ -43964,6 +43977,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="from" type="int">
</argument>
<description>
+ Cast an [int] value to a floating point value, [code]float(1)[/code] will be equals to 1.0.
</description>
</method>
<method name="float">
@@ -43972,6 +43986,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="from" type="String">
</argument>
<description>
+ Cast a [String] value to a floating point value. This method accepts float value strings like [code] '1.23' [/code] and exponential notation strings for its parameter so calling [code] float('1e3') [/code] will return 1000.0 and calling [code] float('1e-3') [/code] will return -0.001.
</description>
</method>
</methods>
@@ -43992,6 +44007,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="from" type="bool">
</argument>
<description>
+ Cast a [bool] value to an integer value, [code]int(true)[/code] will be equals to 1 and [code]int(false)[/code] will be equals to 0.
</description>
</method>
<method name="int">
@@ -44000,6 +44016,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="from" type="float">
</argument>
<description>
+ Cast a float value to an integer value, this method simply removes the number fractions, so for example [code]int(2.7)[/code] will be equals to 2, [code]int(.1)[/code] will be equals to 0 and [code]int(-2.7)[/code] will be equals to -2.
</description>
</method>
<method name="int">
@@ -44008,6 +44025,7 @@ This method controls whether the position between two cached points is interpola
<argument index="0" name="from" type="String">
</argument>
<description>
+ Cast a [String] value to an integer value, this method is an integer parser from a string, so calling this method with an invalid integer string will return 0, a valid string will be something like [code]'1.7'[/code]. This method will ignore all non-number characters, so calling [code]int('1e3')[/code] will return 13.
</description>
</method>
</methods>
diff --git a/methods.py b/methods.py
index d3895fd7a3..730558a064 100755
--- a/methods.py
+++ b/methods.py
@@ -665,43 +665,42 @@ def build_hlsl_dx9_headers( target, source, env ):
class LegacyGLHeaderStruct:
- vertex_lines=[]
- fragment_lines=[]
- uniforms=[]
- attributes=[]
- fbos=[]
- conditionals=[]
- enums={}
- texunits=[]
- texunit_names=[]
- ubos=[]
- ubo_names=[]
-
- vertex_included_files=[]
- fragment_included_files=[]
-
- line_offset=0
- vertex_offset=0
- fragment_offset=0
+ def __init__(self):
+ self.vertex_lines=[]
+ self.fragment_lines=[]
+ self.uniforms=[]
+ self.attributes=[]
+ self.fbos=[]
+ self.conditionals=[]
+ self.enums={}
+ self.texunits=[]
+ self.texunit_names=[]
+ self.ubos=[]
+ self.ubo_names=[]
+
+ self.vertex_included_files=[]
+ self.fragment_included_files=[]
+
+ self.reading=""
+ self.line_offset=0
+ self.vertex_offset=0
+ self.fragment_offset=0
def include_file_in_legacygl_header( filename, header_data, depth ):
fs = open(filename,"r")
-
line=fs.readline()
- reading=""
-
while(line):
if (line.find("[vertex]")!=-1):
- reading="vertex"
+ header_data.reading="vertex"
line=fs.readline()
header_data.line_offset+=1
header_data.vertex_offset=header_data.line_offset
continue
if (line.find("[fragment]")!=-1):
- reading="fragment"
+ header_data.reading="fragment"
line=fs.readline()
header_data.line_offset+=1
header_data.fragment_offset=header_data.line_offset
@@ -713,11 +712,11 @@ def include_file_in_legacygl_header( filename, header_data, depth ):
import os.path
included_file = os.path.relpath(os.path.dirname(filename) + "/" + includeline)
- if (not included_file in header_data.vertex_included_files and reading=="vertex"):
+ if (not included_file in header_data.vertex_included_files and header_data.reading=="vertex"):
header_data.vertex_included_files+=[included_file]
if(include_file_in_legacygl_header( included_file, header_data, depth + 1 ) == None):
print "Error in file '" + filename + "': #include " + includeline + "could not be found!"
- elif (not included_file in header_data.fragment_included_files and reading=="fragment"):
+ elif (not included_file in header_data.fragment_included_files and header_data.reading=="fragment"):
header_data.fragment_included_files+=[included_file]
if(include_file_in_legacygl_header( included_file, header_data, depth + 1 ) == None):
print "Error in file '" + filename + "': #include " + includeline + "could not be found!"
@@ -808,9 +807,9 @@ def include_file_in_legacygl_header( filename, header_data, depth ):
#line=line.replace("\"","\\\"")
#line=line+"\\n\\"
- if (reading=="vertex"):
+ if (header_data.reading=="vertex"):
header_data.vertex_lines+=[line]
- if (reading=="fragment"):
+ if (header_data.reading=="fragment"):
header_data.fragment_lines+=[line]
line=fs.readline()
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 689cad8343..d01a5a114d 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -262,7 +262,33 @@ def configure(env):
env.Append(CCFLAGS=["/I"+DIRECTX_PATH+"/Include"])
env.Append(LIBPATH=[DIRECTX_PATH+"/Lib/x86"])
env['ENV'] = os.environ;
+
+ # This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
+ compiler_version_str = detect_visual_c_compiler_version(env['ENV'])
+
+ # Note: this detection/override code from here onward should be here instead of in SConstruct because it's platform and compiler specific (MSVC/Windows)
+ if(env["bits"] != "default"):
+ print "Error: bits argument is disabled for MSVC"
+ print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
+ +" that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler"
+ +" will be executed and inform you.")
+ sys.exit()
+
+ # Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the propper command prompt
+ # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
+ env["bits"]="32"
env["x86_opt_vc"]=True
+
+ print "Detected MSVC compiler: "+compiler_version_str
+ # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
+ if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
+ env["bits"]="64"
+ env["x86_opt_vc"]=False
+ print "Compiled program architecture will be a 64 bit executable (forcing bits=64)."
+ elif (compiler_version_str=="x86" or compiler_version_str == "amd64_x86"):
+ print "Compiled program architecture will be a 32 bit executable. (forcing bits=32)."
+ else:
+ print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
else:
# Workaround for MinGW. See:
@@ -366,4 +392,67 @@ def configure(env):
env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-
+def detect_visual_c_compiler_version(tools_env):
+ # tools_env is the variable scons uses to call tools that execute tasks, SCons's env['ENV'] that executes tasks...
+ # (see the SCons documentation for more information on what it does)...
+ # in order for this function to be well encapsulated i choose to force it to recieve SCons's TOOLS env (env['ENV']
+ # and not scons setup environment (env)... so make sure you call the right environment on it or it will fail to detect
+ # the propper vc version that will be called
+
+ # These is no flag to give to visual c compilers to set the architecture, ie scons bits argument (32,64,ARM etc)
+ # There are many different cl.exe files that are run, and each one compiles & links to a different architecture
+ # As far as I know, the only way to figure out what compiler will be run when Scons calls cl.exe via Program()
+ # is to check the PATH varaible and figure out which one will be called first. Code bellow does that and returns:
+ # the following string values:
+
+ # "" Compiler not detected
+ # "amd64" Native 64 bit compiler
+ # "amd64_x86" 64 bit Cross Compiler for 32 bit
+ # "x86" Native 32 bit compiler
+ # "x86_amd64" 32 bit Cross Compiler for 64 bit
+
+ # There are other architectures, but Godot does not support them currently, so this function does not detect arm/amd64_arm
+ # and similar architectures/compilers
+
+ # Set chosen compiler to "not detected"
+ vc_chosen_compiler_index = -1
+ vc_chosen_compiler_str = ""
+
+ # find() works with -1 so big ifs bellow are needed... the simplest solution, in fact
+ # First test if amd64 and amd64_x86 compilers are present in the path
+ vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN\\amd64;")
+ if(vc_amd64_compiler_detection_index > -1):
+ vc_chosen_compiler_index = vc_amd64_compiler_detection_index
+ vc_chosen_compiler_str = "amd64"
+
+ vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN\\amd64_x86;")
+ if(vc_amd64_x86_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
+ vc_chosen_compiler_str = "amd64_x86"
+
+
+ # Now check the 32 bit compilers
+ vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN;")
+ if(vc_x86_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_x86_compiler_detection_index
+ vc_chosen_compiler_str = "x86"
+
+ vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR']+"BIN\\x86_amd64;")
+ if(vc_x86_amd64_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
+ vc_chosen_compiler_str = "x86_amd64"
+
+ # debug help
+ #print vc_amd64_compiler_detection_index
+ #print vc_amd64_x86_compiler_detection_index
+ #print vc_x86_compiler_detection_index
+ #print vc_x86_amd64_compiler_detection_index
+ #print "chosen "+str(vc_chosen_compiler_index)+ " | "+str(vc_chosen_compiler_str)
+
+ return vc_chosen_compiler_str
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 9d5d52b816..25f49a8a8b 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -728,11 +728,10 @@ void AnimationPlayer::_animation_process(float p_delta) {
emit_signal(SceneStringNames::get_singleton()->animation_changed, old, new_name);
} else {
//stop();
- String name = playback.assigned;
playing = false;
_set_process(false);
end_notify=false;
- emit_signal(SceneStringNames::get_singleton()->finished, name);
+ emit_signal(SceneStringNames::get_singleton()->finished);
}
}
@@ -1348,7 +1347,7 @@ void AnimationPlayer::_bind_methods() {
ADD_PROPERTY( PropertyInfo( Variant::REAL, "playback/default_blend_time", PROPERTY_HINT_RANGE, "0,4096,0.01"), _SCS("set_default_blend_time"), _SCS("get_default_blend_time"));
ADD_PROPERTY( PropertyInfo( Variant::NODE_PATH, "root/root"), _SCS("set_root"), _SCS("get_root"));
- ADD_SIGNAL( MethodInfo("finished", PropertyInfo(Variant::STRING,"name")) );
+ ADD_SIGNAL( MethodInfo("finished") );
ADD_SIGNAL( MethodInfo("animation_changed", PropertyInfo(Variant::STRING,"old_name"), PropertyInfo(Variant::STRING,"new_name")) );
ADD_SIGNAL( MethodInfo("animation_started", PropertyInfo(Variant::STRING,"name")) );