Small Fixes
----------- -Added Ability for centering on top left for centercontainer -Added ability to bind more than 5 parameters (must include an extra file)
This commit is contained in:
parent
64b01d6ce0
commit
fa004d5c0f
10 changed files with 161 additions and 23 deletions
|
@ -53,7 +53,7 @@ env.add_source_files(env.core_sources,"*.cpp")
|
|||
Export('env')
|
||||
|
||||
import make_binders
|
||||
env.Command('method_bind.inc', 'make_binders.py', make_binders.run)
|
||||
env.Command(['method_bind.inc','method_bind_ext.inc'], 'make_binders.py', make_binders.run)
|
||||
|
||||
SConscript('os/SCsub');
|
||||
SConscript('math/SCsub');
|
||||
|
|
|
@ -214,25 +214,36 @@ def make_version(template,nargs,argmax,const,ret):
|
|||
|
||||
def run(target, source, env):
|
||||
|
||||
versions=5
|
||||
versions=10
|
||||
versions_ext=6
|
||||
text=""
|
||||
text_ext=""
|
||||
|
||||
for i in range(0,versions+1):
|
||||
|
||||
text+=make_version(template,i,5,False,False)
|
||||
text+=make_version(template_typed,i,5,False,False)
|
||||
text+=make_version(template,i,5,False,True)
|
||||
text+=make_version(template_typed,i,5,False,True)
|
||||
text+=make_version(template,i,5,True,False)
|
||||
text+=make_version(template_typed,i,5,True,False)
|
||||
text+=make_version(template,i,5,True,True)
|
||||
text+=make_version(template_typed,i,5,True,True)
|
||||
t=""
|
||||
t+=make_version(template,i,versions,False,False)
|
||||
t+=make_version(template_typed,i,versions,False,False)
|
||||
t+=make_version(template,i,versions,False,True)
|
||||
t+=make_version(template_typed,i,versions,False,True)
|
||||
t+=make_version(template,i,versions,True,False)
|
||||
t+=make_version(template_typed,i,versions,True,False)
|
||||
t+=make_version(template,i,versions,True,True)
|
||||
t+=make_version(template_typed,i,versions,True,True)
|
||||
if (i>=versions_ext):
|
||||
text_ext+=t
|
||||
else:
|
||||
text+=t
|
||||
|
||||
|
||||
f=open(target[0].path,"w")
|
||||
f.write(text)
|
||||
f.close()
|
||||
|
||||
f=open(target[1].path,"w")
|
||||
f.write(text_ext)
|
||||
f.close()
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -105,6 +105,88 @@ MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,co
|
|||
return md;
|
||||
}
|
||||
|
||||
|
||||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3,const char *p_arg4,const char *p_arg5,const char *p_arg6) {
|
||||
|
||||
MethodDefinition md;
|
||||
md.name=StaticCString::create(p_name);
|
||||
md.args.resize(6);
|
||||
md.args[0]=StaticCString::create(p_arg1);
|
||||
md.args[1]=StaticCString::create(p_arg2);
|
||||
md.args[2]=StaticCString::create(p_arg3);
|
||||
md.args[3]=StaticCString::create(p_arg4);
|
||||
md.args[4]=StaticCString::create(p_arg5);
|
||||
md.args[5]=StaticCString::create(p_arg6);
|
||||
return md;
|
||||
}
|
||||
|
||||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3,const char *p_arg4,const char *p_arg5,const char *p_arg6,const char *p_arg7) {
|
||||
|
||||
MethodDefinition md;
|
||||
md.name=StaticCString::create(p_name);
|
||||
md.args.resize(6);
|
||||
md.args[0]=StaticCString::create(p_arg1);
|
||||
md.args[1]=StaticCString::create(p_arg2);
|
||||
md.args[2]=StaticCString::create(p_arg3);
|
||||
md.args[3]=StaticCString::create(p_arg4);
|
||||
md.args[4]=StaticCString::create(p_arg5);
|
||||
md.args[5]=StaticCString::create(p_arg6);
|
||||
md.args[6]=StaticCString::create(p_arg7);
|
||||
return md;
|
||||
}
|
||||
|
||||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3,const char *p_arg4,const char *p_arg5,const char *p_arg6,const char *p_arg7,const char *p_arg8) {
|
||||
|
||||
MethodDefinition md;
|
||||
md.name=StaticCString::create(p_name);
|
||||
md.args.resize(6);
|
||||
md.args[0]=StaticCString::create(p_arg1);
|
||||
md.args[1]=StaticCString::create(p_arg2);
|
||||
md.args[2]=StaticCString::create(p_arg3);
|
||||
md.args[3]=StaticCString::create(p_arg4);
|
||||
md.args[4]=StaticCString::create(p_arg5);
|
||||
md.args[5]=StaticCString::create(p_arg6);
|
||||
md.args[6]=StaticCString::create(p_arg7);
|
||||
md.args[7]=StaticCString::create(p_arg8);
|
||||
return md;
|
||||
}
|
||||
|
||||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3,const char *p_arg4,const char *p_arg5,const char *p_arg6,const char *p_arg7,const char *p_arg8,const char *p_arg9) {
|
||||
|
||||
MethodDefinition md;
|
||||
md.name=StaticCString::create(p_name);
|
||||
md.args.resize(6);
|
||||
md.args[0]=StaticCString::create(p_arg1);
|
||||
md.args[1]=StaticCString::create(p_arg2);
|
||||
md.args[2]=StaticCString::create(p_arg3);
|
||||
md.args[3]=StaticCString::create(p_arg4);
|
||||
md.args[4]=StaticCString::create(p_arg5);
|
||||
md.args[5]=StaticCString::create(p_arg6);
|
||||
md.args[6]=StaticCString::create(p_arg7);
|
||||
md.args[7]=StaticCString::create(p_arg8);
|
||||
md.args[8]=StaticCString::create(p_arg9);
|
||||
return md;
|
||||
}
|
||||
|
||||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3,const char *p_arg4,const char *p_arg5,const char *p_arg6,const char *p_arg7,const char *p_arg8,const char *p_arg9,const char *p_arg10) {
|
||||
|
||||
MethodDefinition md;
|
||||
md.name=StaticCString::create(p_name);
|
||||
md.args.resize(6);
|
||||
md.args[0]=StaticCString::create(p_arg1);
|
||||
md.args[1]=StaticCString::create(p_arg2);
|
||||
md.args[2]=StaticCString::create(p_arg3);
|
||||
md.args[3]=StaticCString::create(p_arg4);
|
||||
md.args[4]=StaticCString::create(p_arg5);
|
||||
md.args[5]=StaticCString::create(p_arg6);
|
||||
md.args[6]=StaticCString::create(p_arg7);
|
||||
md.args[7]=StaticCString::create(p_arg8);
|
||||
md.args[8]=StaticCString::create(p_arg9);
|
||||
md.args[9]=StaticCString::create(p_arg10);
|
||||
return md;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
HashMap<StringName,ObjectTypeDB::TypeInfo,StringNameHasher> ObjectTypeDB::types;
|
||||
|
|
|
@ -86,6 +86,11 @@ MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2);
|
|||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3);
|
||||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3,const char *p_arg4);
|
||||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3,const char *p_arg4,const char *p_arg5);
|
||||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3,const char *p_arg4,const char *p_arg5,const char *p_arg6);
|
||||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3,const char *p_arg4,const char *p_arg5,const char *p_arg6,const char *p_arg7);
|
||||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3,const char *p_arg4,const char *p_arg5,const char *p_arg6,const char *p_arg7,const char *p_arg8);
|
||||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3,const char *p_arg4,const char *p_arg5,const char *p_arg6,const char *p_arg7,const char *p_arg8,const char *p_arg9);
|
||||
MethodDefinition _MD(const char* p_name,const char *p_arg1,const char *p_arg2,const char *p_arg3,const char *p_arg4,const char *p_arg5,const char *p_arg6,const char *p_arg7,const char *p_arg8,const char *p_arg9,const char *p_arg10);
|
||||
|
||||
#else
|
||||
|
||||
|
@ -369,7 +374,7 @@ public:
|
|||
return bind_methodfi(METHOD_FLAGS_DEFAULT,bind,p_method_name,ptr,4);
|
||||
}
|
||||
|
||||
template<class N, class M>
|
||||
template<class N, class M>
|
||||
static MethodBind* bind_method(N p_method_name, M p_method,const Variant& p_def1,const Variant& p_def2,const Variant& p_def3,const Variant& p_def4,const Variant& p_def5) {
|
||||
|
||||
MethodBind *bind = create_method_bind(p_method);
|
||||
|
@ -377,6 +382,16 @@ public:
|
|||
|
||||
return bind_methodfi(METHOD_FLAGS_DEFAULT,bind,p_method_name,ptr,5);
|
||||
}
|
||||
|
||||
template<class N, class M>
|
||||
static MethodBind* bind_method(N p_method_name, M p_method,const Variant& p_def1,const Variant& p_def2,const Variant& p_def3,const Variant& p_def4,const Variant& p_def5,const Variant& p_def6) {
|
||||
|
||||
MethodBind *bind = create_method_bind(p_method);
|
||||
const Variant* ptr[6]={&p_def1,&p_def2,&p_def3,&p_def4,&p_def5,&p_def6};
|
||||
|
||||
return bind_methodfi(METHOD_FLAGS_DEFAULT,bind,p_method_name,ptr,6);
|
||||
}
|
||||
|
||||
#if 0
|
||||
template<class N, class M>
|
||||
static MethodBind* bind_methodf(uint32_t p_flags, N p_method_name, M p_method,
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "tween.h"
|
||||
#include "method_bind_ext.inc"
|
||||
|
||||
bool Tween::_set(const StringName& p_name, const Variant& p_value) {
|
||||
|
||||
|
|
|
@ -54,17 +54,15 @@ public:
|
|||
TRANS_CIRC,
|
||||
TRANS_BOUNCE,
|
||||
TRANS_BACK,
|
||||
|
||||
TRANS_COUNT,
|
||||
TRANS_COUNT,
|
||||
};
|
||||
|
||||
enum EaseType {
|
||||
EASE_IN,
|
||||
EASE_OUT,
|
||||
EASE_IN_OUT,
|
||||
EASE_OUT_IN,
|
||||
|
||||
EASE_COUNT,
|
||||
EASE_OUT_IN,
|
||||
EASE_COUNT,
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
Size2 CenterContainer::get_minimum_size() const {
|
||||
|
||||
|
||||
if (use_top_left)
|
||||
return Size2();
|
||||
Size2 ms;
|
||||
for(int i=0;i<get_child_count();i++) {
|
||||
|
||||
|
@ -53,6 +55,20 @@ Size2 CenterContainer::get_minimum_size() const {
|
|||
|
||||
}
|
||||
|
||||
|
||||
void CenterContainer::set_use_top_left(bool p_enable) {
|
||||
|
||||
use_top_left=p_enable;
|
||||
queue_sort();
|
||||
|
||||
}
|
||||
|
||||
bool CenterContainer::is_using_top_left() const {
|
||||
|
||||
return use_top_left;
|
||||
}
|
||||
|
||||
|
||||
void CenterContainer::_notification(int p_what) {
|
||||
|
||||
if (p_what==NOTIFICATION_SORT_CHILDREN) {
|
||||
|
@ -65,14 +81,24 @@ void CenterContainer::_notification(int p_what) {
|
|||
continue;
|
||||
if (c->is_set_as_toplevel())
|
||||
continue;
|
||||
|
||||
Size2 minsize = c->get_combined_minimum_size();
|
||||
Point2 ofs = ((size - minsize)/2.0).floor();
|
||||
Point2 ofs = use_top_left ? (-minsize*0.5).floor() : ((size - minsize)/2.0).floor();
|
||||
fit_child_in_rect(c,Rect2(ofs,minsize));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CenterContainer::CenterContainer()
|
||||
{
|
||||
void CenterContainer::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_use_top_left","enable"),&CenterContainer::set_use_top_left);
|
||||
ObjectTypeDB::bind_method(_MD("is_using_top_left"),&CenterContainer::is_using_top_left);
|
||||
|
||||
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"use_top_left"),_SCS("set_use_top_left"),_SCS("is_using_top_left"));
|
||||
}
|
||||
|
||||
CenterContainer::CenterContainer() {
|
||||
|
||||
use_top_left=false;
|
||||
}
|
||||
|
|
|
@ -36,11 +36,16 @@ class CenterContainer : public Container {
|
|||
|
||||
OBJ_TYPE( CenterContainer, Container );
|
||||
|
||||
bool use_top_left;
|
||||
protected:
|
||||
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
public:
|
||||
|
||||
void set_use_top_left(bool p_enable);
|
||||
bool is_using_top_left() const;
|
||||
|
||||
virtual Size2 get_minimum_size() const;
|
||||
|
||||
CenterContainer();
|
||||
|
|
|
@ -1738,9 +1738,9 @@ float Control::_a2s(float p_val, AnchorType p_anchor,float p_range) const {
|
|||
case ANCHOR_RATIO: {
|
||||
return Math::floor(p_range*p_val);
|
||||
} break;
|
||||
case ANCHOR_CENTER: {
|
||||
return Math::floor((p_range/2)-p_val);
|
||||
} break;
|
||||
case ANCHOR_CENTER: {
|
||||
return Math::floor((p_range/2)-p_val);
|
||||
} break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
ANCHOR_BEGIN,
|
||||
ANCHOR_END,
|
||||
ANCHOR_RATIO,
|
||||
ANCHOR_CENTER,
|
||||
ANCHOR_CENTER,
|
||||
};
|
||||
|
||||
enum FocusMode {
|
||||
|
|
Loading…
Reference in a new issue