Remove trailing spaces

This commit is contained in:
Rémi Verschelde 2016-04-02 20:26:12 +02:00
parent 48f057ea81
commit 0a5472e697
42 changed files with 815 additions and 817 deletions

View file

@ -329,7 +329,7 @@ if selected_platform in platform_list:
if (env['theora']=='yes'): if (env['theora']=='yes'):
env['theoralib']='yes' env['theoralib']='yes'
env.Append(CPPFLAGS=['-DTHEORA_ENABLED']); env.Append(CPPFLAGS=['-DTHEORA_ENABLED']);
if (env['theoralib']=='yes'): if (env['theoralib']=='yes'):
env.Append(CPPFLAGS=['-DTHEORALIB_ENABLED']); env.Append(CPPFLAGS=['-DTHEORALIB_ENABLED']);

View file

@ -6,7 +6,7 @@ template_typed="""
template<class T $ifret ,class R$ $ifargs ,$ $arg, class P@$> template<class T $ifret ,class R$ $ifargs ,$ $arg, class P@$>
class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind { class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
public: public:
$ifret R$ $ifnoret void$ (T::*method)($arg, P@$) $ifconst const$; $ifret R$ $ifnoret void$ (T::*method)($arg, P@$) $ifconst const$;
#ifdef DEBUG_METHODS_ENABLED #ifdef DEBUG_METHODS_ENABLED
virtual Variant::Type _gen_argument_type(int p_arg) const { return _get_argument_type(p_arg); } virtual Variant::Type _gen_argument_type(int p_arg) const { return _get_argument_type(p_arg); }
@ -16,13 +16,13 @@ public:
$ $
return Variant::NIL; return Variant::NIL;
} }
#endif #endif
virtual String get_instance_type() const { virtual String get_instance_type() const {
return T::get_type_static(); return T::get_type_static();
} }
virtual Variant call(Object* p_object,const Variant** p_args,int p_arg_count, Variant::CallError& r_error) { virtual Variant call(Object* p_object,const Variant** p_args,int p_arg_count, Variant::CallError& r_error) {
T *instance=p_object->cast_to<T>(); T *instance=p_object->cast_to<T>();
r_error.error=Variant::CallError::CALL_OK; r_error.error=Variant::CallError::CALL_OK;
#ifdef DEBUG_METHODS_ENABLED #ifdef DEBUG_METHODS_ENABLED
@ -47,7 +47,7 @@ public:
$ifret return Variant(ret);$ $ifret return Variant(ret);$
$ifnoret return Variant();$ $ifnoret return Variant();$
} }
MethodBind$argc$$ifret R$$ifconst C$ () { MethodBind$argc$$ifret R$$ifconst C$ () {
#ifdef DEBUG_METHODS_ENABLED #ifdef DEBUG_METHODS_ENABLED
@ -55,14 +55,14 @@ public:
_generate_argument_types($argc$); _generate_argument_types($argc$);
#else #else
set_argument_count($argc$); set_argument_count($argc$);
#endif #endif
}; };
}; };
template<class T $ifret ,class R$ $ifargs ,$ $arg, class P@$> template<class T $ifret ,class R$ $ifargs ,$ $arg, class P@$>
MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$) $ifconst const$ ) { MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$) $ifconst const$ ) {
MethodBind$argc$$ifret R$$ifconst C$<T $ifret ,R$ $ifargs ,$ $arg, P@$> * a = memnew( (MethodBind$argc$$ifret R$$ifconst C$<T $ifret ,R$ $ifargs ,$ $arg, P@$>) ); MethodBind$argc$$ifret R$$ifconst C$<T $ifret ,R$ $ifargs ,$ $arg, P@$> * a = memnew( (MethodBind$argc$$ifret R$$ifconst C$<T $ifret ,R$ $ifargs ,$ $arg, P@$>) );
a->method=p_method; a->method=p_method;
return a; return a;
} }
@ -88,7 +88,7 @@ public:
$ $
return Variant::NIL; return Variant::NIL;
} }
#endif #endif
virtual String get_instance_type() const { virtual String get_instance_type() const {
return type_name; return type_name;
} }
@ -105,15 +105,15 @@ public:
r_error.error=Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; r_error.error=Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
r_error.argument=get_argument_count(); r_error.argument=get_argument_count();
return Variant(); return Variant();
} }
if (p_arg_count<(get_argument_count()-get_default_argument_count())) { if (p_arg_count<(get_argument_count()-get_default_argument_count())) {
r_error.error=Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.error=Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
r_error.argument=get_argument_count()-get_default_argument_count(); r_error.argument=get_argument_count()-get_default_argument_count();
return Variant(); return Variant();
} }
$arg CHECK_ARG(@); $arg CHECK_ARG(@);
$ $
#endif #endif
@ -128,7 +128,7 @@ public:
_generate_argument_types($argc$); _generate_argument_types($argc$);
#else #else
set_argument_count($argc$); set_argument_count($argc$);
#endif #endif
}; };
}; };
@ -151,12 +151,12 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$
def make_version(template,nargs,argmax,const,ret): def make_version(template,nargs,argmax,const,ret):
intext=template intext=template
from_pos=0 from_pos=0
outtext="" outtext=""
while(True): while(True):
to_pos=intext.find("$",from_pos) to_pos=intext.find("$",from_pos)
if (to_pos==-1): if (to_pos==-1):
outtext+=intext[from_pos:] outtext+=intext[from_pos:]
@ -169,13 +169,13 @@ def make_version(template,nargs,argmax,const,ret):
macro=intext[to_pos+1:end] macro=intext[to_pos+1:end]
cmd="" cmd=""
data="" data=""
if (macro.find(" ")!=-1): if (macro.find(" ")!=-1):
cmd=macro[0:macro.find(" ")] cmd=macro[0:macro.find(" ")]
data=macro[macro.find(" ")+1:] data=macro[macro.find(" ")+1:]
else: else:
cmd=macro cmd=macro
if (cmd=="argc"): if (cmd=="argc"):
outtext+=str(nargs) outtext+=str(nargs)
if (cmd=="ifret" and ret): if (cmd=="ifret" and ret):
@ -206,11 +206,11 @@ def make_version(template,nargs,argmax,const,ret):
elif (cmd=="noarg"): elif (cmd=="noarg"):
for i in range(nargs+1,argmax+1): for i in range(nargs+1,argmax+1):
outtext+=data.replace("@",str(i)) outtext+=data.replace("@",str(i))
from_pos=end+1 from_pos=end+1
return outtext return outtext
def run(target, source, env): def run(target, source, env):
@ -244,9 +244,9 @@ def run(target, source, env):
f.write(text_ext) f.write(text_ext)
f.close() f.close()

View file

@ -30,7 +30,7 @@ def escape(ret):
ret=ret.replace("'","&apos;"); ret=ret.replace("'","&apos;");
ret=ret.replace("\"","&quot;"); ret=ret.replace("\"","&quot;");
return ret return ret
def inc_tab(): def inc_tab():
global tab global tab
@ -50,34 +50,34 @@ def get_tag(node,name):
return tag return tag
def find_method_descr(old_class,name): def find_method_descr(old_class,name):
methods = old_class.find("methods") methods = old_class.find("methods")
if(methods!=None and len(list(methods))>0): if(methods!=None and len(list(methods))>0):
for m in list(methods): for m in list(methods):
if (m.attrib["name"]==name): if (m.attrib["name"]==name):
description=m.find("description") description=m.find("description")
if (description!=None and description.text.strip()!=""): if (description!=None and description.text.strip()!=""):
return description.text return description.text
return None return None
def find_signal_descr(old_class,name): def find_signal_descr(old_class,name):
signals = old_class.find("signals") signals = old_class.find("signals")
if(signals!=None and len(list(signals))>0): if(signals!=None and len(list(signals))>0):
for m in list(signals): for m in list(signals):
if (m.attrib["name"]==name): if (m.attrib["name"]==name):
description=m.find("description") description=m.find("description")
if (description!=None and description.text.strip()!=""): if (description!=None and description.text.strip()!=""):
return description.text return description.text
return None return None
def find_constant_descr(old_class,name): def find_constant_descr(old_class,name):
if (old_class==None): if (old_class==None):
return None return None
constants = old_class.find("constants") constants = old_class.find("constants")
if(constants!=None and len(list(constants))>0): if(constants!=None and len(list(constants))>0):
for m in list(constants): for m in list(constants):
if (m.attrib["name"]==name): if (m.attrib["name"]==name):
@ -98,31 +98,31 @@ def write_class(c):
inherits=get_tag(c,"inherits") inherits=get_tag(c,"inherits")
write_string(f,'<class name="'+class_name+'" '+category+inherits+'>') write_string(f,'<class name="'+class_name+'" '+category+inherits+'>')
inc_tab() inc_tab()
write_string(f,"<brief_description>") write_string(f,"<brief_description>")
if (old_class!=None): if (old_class!=None):
old_brief_descr=old_class.find("brief_description") old_brief_descr=old_class.find("brief_description")
if (old_brief_descr!=None): if (old_brief_descr!=None):
write_string(f,escape(old_brief_descr.text.strip())) write_string(f,escape(old_brief_descr.text.strip()))
write_string(f,"</brief_description>") write_string(f,"</brief_description>")
write_string(f,"<description>") write_string(f,"<description>")
if (old_class!=None): if (old_class!=None):
old_descr=old_class.find("description") old_descr=old_class.find("description")
if (old_descr!=None): if (old_descr!=None):
write_string(f,escape(old_descr.text.strip())) write_string(f,escape(old_descr.text.strip()))
write_string(f,"</description>") write_string(f,"</description>")
methods = c.find("methods") methods = c.find("methods")
if(methods!=None and len(list(methods))>0): if(methods!=None and len(list(methods))>0):
write_string(f,"<methods>") write_string(f,"<methods>")
inc_tab() inc_tab()
for m in list(methods): for m in list(methods):
qualifiers=get_tag(m,"qualifiers") qualifiers=get_tag(m,"qualifiers")
@ -135,7 +135,7 @@ def write_class(c):
write_string(f,'<return'+typ+'>'); write_string(f,'<return'+typ+'>');
write_string(f,'</return>'); write_string(f,'</return>');
elif (a.tag=="argument"): elif (a.tag=="argument"):
default=get_tag(a,"default") default=get_tag(a,"default")
write_string(f,'<argument index="'+a.attrib["index"]+'" name="'+escape(a.attrib["name"])+'" type="'+a.attrib["type"]+'"' +default+'>'); write_string(f,'<argument index="'+a.attrib["index"]+'" name="'+escape(a.attrib["name"])+'" type="'+a.attrib["type"]+'"' +default+'>');
@ -146,20 +146,20 @@ def write_class(c):
old_method_descr=find_method_descr(old_class,m.attrib["name"]) old_method_descr=find_method_descr(old_class,m.attrib["name"])
if (old_method_descr): if (old_method_descr):
write_string(f,escape(escape(old_method_descr.strip()))) write_string(f,escape(escape(old_method_descr.strip())))
write_string(f,'</description>'); write_string(f,'</description>');
dec_tab() dec_tab()
write_string(f,"</method>") write_string(f,"</method>")
dec_tab() dec_tab()
write_string(f,"</methods>") write_string(f,"</methods>")
signals = c.find("signals") signals = c.find("signals")
if(signals!=None and len(list(signals))>0): if(signals!=None and len(list(signals))>0):
write_string(f,"<signals>") write_string(f,"<signals>")
inc_tab() inc_tab()
for m in list(signals): for m in list(signals):
write_string(f,'<signal name="'+escape(m.attrib["name"])+'">') write_string(f,'<signal name="'+escape(m.attrib["name"])+'">')
inc_tab() inc_tab()
@ -176,18 +176,18 @@ def write_class(c):
if (old_signal_descr): if (old_signal_descr):
write_string(f,escape(old_signal_descr.strip())) write_string(f,escape(old_signal_descr.strip()))
write_string(f,'</description>'); write_string(f,'</description>');
dec_tab() dec_tab()
write_string(f,"</signal>") write_string(f,"</signal>")
dec_tab() dec_tab()
write_string(f,"</signals>") write_string(f,"</signals>")
constants = c.find("constants") constants = c.find("constants")
if(constants!=None and len(list(constants))>0): if(constants!=None and len(list(constants))>0):
write_string(f,"<constants>") write_string(f,"<constants>")
inc_tab() inc_tab()
for m in list(constants): for m in list(constants):
write_string(f,'<constant name="'+escape(m.attrib["name"])+'" value="'+m.attrib["value"]+'">') write_string(f,'<constant name="'+escape(m.attrib["name"])+'" value="'+m.attrib["value"]+'">')
old_constant_descr=find_constant_descr(old_class,m.attrib["name"]) old_constant_descr=find_constant_descr(old_class,m.attrib["name"])

View file

@ -29,12 +29,12 @@ div.method_description {
list.inh_class_list { list.inh_class_list {
margin-left: 30px; margin-left: 30px;
} }
div.inh_class_list { div.inh_class_list {
margin-left: 30px; margin-left: 30px;
} }
div.method_doc div.method { div.method_doc div.method {

View file

@ -19,14 +19,14 @@ def validate_tag(elem,tag):
if (elem.tag != tag): if (elem.tag != tag):
print("Tag mismatch, expected '"+tag+"', got "+elem.tag); print("Tag mismatch, expected '"+tag+"', got "+elem.tag);
sys.exit(255) sys.exit(255)
class_names=[] class_names=[]
classes={} classes={}
def make_class_list(class_list,columns): def make_class_list(class_list,columns):
f=open("class_list.txt","wb") f=open("class_list.txt","wb")
prev=0 prev=0
col_max = len(class_list) / columns + 1 col_max = len(class_list) / columns + 1
@ -35,13 +35,13 @@ def make_class_list(class_list,columns):
row_count = 0 row_count = 0
last_initial = "" last_initial = ""
fit_columns=[] fit_columns=[]
for n in range(0,columns): for n in range(0,columns):
fit_columns+=[[]] fit_columns+=[[]]
indexers=[] indexers=[]
last_initial="" last_initial=""
idx=0 idx=0
for n in class_list: for n in class_list:
col = idx/col_max col = idx/col_max
@ -52,36 +52,36 @@ def make_class_list(class_list,columns):
if (n[:1]!=last_initial): if (n[:1]!=last_initial):
indexers+=[n] indexers+=[n]
last_initial=n[:1] last_initial=n[:1]
row_max=0 row_max=0
for n in range(0,columns): for n in range(0,columns):
if (len(fit_columns[n])>row_max): if (len(fit_columns[n])>row_max):
row_max=len(fit_columns[n]) row_max=len(fit_columns[n])
for r in range(0,row_max): for r in range(0,row_max):
s="|" s="|"
for c in range(0,columns): for c in range(0,columns):
if (r>=len(fit_columns[c])): if (r>=len(fit_columns[c])):
continue continue
classname = fit_columns[c][r] classname = fit_columns[c][r]
initial=classname[0] initial=classname[0]
if (classname in indexers): if (classname in indexers):
s+="**"+initial+"**|" s+="**"+initial+"**|"
else: else:
s+=" |" s+=" |"
s+="[["+classname.lower()+"|"+classname+"]]|" s+="[["+classname.lower()+"|"+classname+"]]|"
s+="\n" s+="\n"
f.write(s) f.write(s)
def dokuize_text(txt): def dokuize_text(txt):
return txt return txt
@ -95,13 +95,13 @@ def dokuize_text(text):
endq_pos=text.find("]",pos+1) endq_pos=text.find("]",pos+1)
if (endq_pos==-1): if (endq_pos==-1):
break break
pre_text=text[:pos] pre_text=text[:pos]
post_text=text[endq_pos+1:] post_text=text[endq_pos+1:]
tag_text=text[pos+1:endq_pos] tag_text=text[pos+1:endq_pos]
if (tag_text in class_names): if (tag_text in class_names):
tag_text="[["+tag_text.lower()+"|"+tag_text+"]]" tag_text="[["+tag_text.lower()+"|"+tag_text+"]]"
else: #command else: #command
cmd=tag_text cmd=tag_text
space_pos=tag_text.find(" ") space_pos=tag_text.find(" ")
@ -112,7 +112,7 @@ def dokuize_text(text):
elif(cmd.find("method")==0): elif(cmd.find("method")==0):
cmd=tag_text[:space_pos] cmd=tag_text[:space_pos]
param=tag_text[space_pos+1:] param=tag_text[space_pos+1:]
if (param.find(".")!=-1): if (param.find(".")!=-1):
class_param,method_param=param.split(".") class_param,method_param=param.split(".")
tag_text="[["+class_param.lower()+"#"+method_param+"|"+class_param+'.'+method_param+"]]" tag_text="[["+class_param.lower()+"#"+method_param+"|"+class_param+'.'+method_param+"]]"
@ -123,7 +123,7 @@ def dokuize_text(text):
elif (cmd.find("url=")==0): elif (cmd.find("url=")==0):
tag_text="[["+cmd[4:]+"|" tag_text="[["+cmd[4:]+"|"
elif (cmd=="/url"): elif (cmd=="/url"):
tag_text="]]>" tag_text="]]>"
elif (cmd=="center"): elif (cmd=="center"):
tag_text="" tag_text=""
elif (cmd=="/center"): elif (cmd=="/center"):
@ -138,25 +138,25 @@ def dokuize_text(text):
tag_text="__" tag_text="__"
else: else:
tag_text="["+tag_text+"]" tag_text="["+tag_text+"]"
text=pre_text+tag_text+post_text text=pre_text+tag_text+post_text
pos=len(pre_text)+len(tag_text) pos=len(pre_text)+len(tag_text)
#tnode = ET.SubElement(parent,"div") #tnode = ET.SubElement(parent,"div")
#tnode.text=text #tnode.text=text
return text return text
def make_type(t): def make_type(t):
global class_names global class_names
if (t in class_names): if (t in class_names):
return "[["+t.lower()+"|"+t+"]]" return "[["+t.lower()+"|"+t+"]]"
return t return t
def make_method(f,name,m,declare,event=False): def make_method(f,name,m,declare,event=False):
s=" * " s=" * "
ret_type="void" ret_type="void"
args=list(m) args=list(m)
@ -169,66 +169,66 @@ def make_method(f,name,m,declare,event=False):
idx=int(a.attrib["index"]) idx=int(a.attrib["index"])
else: else:
continue continue
mdata["argidx"].append(idx) mdata["argidx"].append(idx)
mdata[idx]=a mdata[idx]=a
if (not event):
if (not event):
if (-1 in mdata["argidx"]): if (-1 in mdata["argidx"]):
s+=make_type(mdata[-1].attrib["type"]) s+=make_type(mdata[-1].attrib["type"])
else: else:
s+="void" s+="void"
s+=" " s+=" "
if (declare): if (declare):
#span.attrib["class"]="funcdecl" #span.attrib["class"]="funcdecl"
#a=ET.SubElement(span,"a") #a=ET.SubElement(span,"a")
#a.attrib["name"]=name+"_"+m.attrib["name"] #a.attrib["name"]=name+"_"+m.attrib["name"]
#a.text=name+"::"+m.attrib["name"] #a.text=name+"::"+m.attrib["name"]
s+="**"+m.attrib["name"]+"**" s+="**"+m.attrib["name"]+"**"
else: else:
s+="[[#"+m.attrib["name"]+"|"+m.attrib["name"]+"]]" s+="[[#"+m.attrib["name"]+"|"+m.attrib["name"]+"]]"
s+="**(**" s+="**(**"
argfound=False argfound=False
for a in mdata["argidx"]: for a in mdata["argidx"]:
arg=mdata[a] arg=mdata[a]
if (a<0): if (a<0):
continue continue
if (a>0): if (a>0):
s+=", " s+=", "
else: else:
s+=" " s+=" "
s+=make_type(arg.attrib["type"]) s+=make_type(arg.attrib["type"])
if ("name" in arg.attrib): if ("name" in arg.attrib):
s+=" "+arg.attrib["name"] s+=" "+arg.attrib["name"]
else: else:
s+=" arg"+str(a) s+=" arg"+str(a)
if ("default" in arg.attrib): if ("default" in arg.attrib):
s+="="+arg.attrib["default"] s+="="+arg.attrib["default"]
argfound=True argfound=True
if (argfound): if (argfound):
s+=" " s+=" "
s+="**)**" s+="**)**"
if ("qualifiers" in m.attrib): if ("qualifiers" in m.attrib):
s+=" "+m.attrib["qualifiers"] s+=" "+m.attrib["qualifiers"]
f.write(s+"\n") f.write(s+"\n")
def make_doku_class(node): def make_doku_class(node):
name = node.attrib["name"] name = node.attrib["name"]
f=open(name.lower()+".txt","wb") f=open(name.lower()+".txt","wb")
f.write("====== "+name+" ======\n") f.write("====== "+name+" ======\n")
@ -238,26 +238,26 @@ def make_doku_class(node):
f.write("**Inherits:** [["+inh.lower()+"|"+inh+"]]\\\\\n") f.write("**Inherits:** [["+inh.lower()+"|"+inh+"]]\\\\\n")
if ("category" in node.attrib): if ("category" in node.attrib):
f.write("**Category:** "+node.attrib["category"].strip()+"\\\\\n") f.write("**Category:** "+node.attrib["category"].strip()+"\\\\\n")
briefd = node.find("brief_description") briefd = node.find("brief_description")
if (briefd!=None): if (briefd!=None):
f.write("===== Brief Description ======\n") f.write("===== Brief Description ======\n")
f.write( dokuize_text(briefd.text.strip())+"\n" ) f.write( dokuize_text(briefd.text.strip())+"\n" )
methods = node.find("methods") methods = node.find("methods")
if(methods!=None and len(list(methods))>0): if(methods!=None and len(list(methods))>0):
f.write("===== Member Functions ======\n") f.write("===== Member Functions ======\n")
for m in list(methods): for m in list(methods):
make_method(f,node.attrib["name"],m,False) make_method(f,node.attrib["name"],m,False)
events = node.find("signals") events = node.find("signals")
if(events!=None and len(list(events))>0): if(events!=None and len(list(events))>0):
f.write("===== Signals ======\n") f.write("===== Signals ======\n")
for m in list(events): for m in list(events):
make_method(f,node.attrib["name"],m,True,True) make_method(f,node.attrib["name"],m,True,True)
members = node.find("members") members = node.find("members")
if(members!=None and len(list(members))>0): if(members!=None and len(list(members))>0):
f.write("===== Member Variables ======\n") f.write("===== Member Variables ======\n")
@ -269,33 +269,33 @@ def make_doku_class(node):
if (c.text.strip()!=""): if (c.text.strip()!=""):
s+=" - "+c.text.strip() s+=" - "+c.text.strip()
f.write(s+"\n") f.write(s+"\n")
constants = node.find("constants") constants = node.find("constants")
if(constants!=None and len(list(constants))>0): if(constants!=None and len(list(constants))>0):
f.write("===== Numeric Constants ======\n") f.write("===== Numeric Constants ======\n")
for c in list(constants): for c in list(constants):
s = " * " s = " * "
s+="**"+c.attrib["name"]+"**" s+="**"+c.attrib["name"]+"**"
if ("value" in c.attrib): if ("value" in c.attrib):
s+=" = **"+c.attrib["value"]+"**" s+=" = **"+c.attrib["value"]+"**"
if (c.text.strip()!=""): if (c.text.strip()!=""):
s+=" - "+c.text.strip() s+=" - "+c.text.strip()
f.write(s+"\n") f.write(s+"\n")
descr=node.find("description") descr=node.find("description")
if (descr!=None and descr.text.strip()!=""): if (descr!=None and descr.text.strip()!=""):
f.write("===== Description ======\n") f.write("===== Description ======\n")
f.write(dokuize_text(descr.text.strip())+"\n") f.write(dokuize_text(descr.text.strip())+"\n")
methods = node.find("methods") methods = node.find("methods")
if(methods!=None and len(list(methods))>0): if(methods!=None and len(list(methods))>0):
f.write("===== Member Function Description ======\n") f.write("===== Member Function Description ======\n")
for m in list(methods): for m in list(methods):
d=m.find("description") d=m.find("description")
if (d==None or d.text.strip()==""): if (d==None or d.text.strip()==""):
continue continue
@ -304,18 +304,18 @@ def make_doku_class(node):
f.write("\\\\\n") f.write("\\\\\n")
f.write(dokuize_text(d.text.strip())) f.write(dokuize_text(d.text.strip()))
f.write("\n") f.write("\n")
""" """
div=ET.Element("div") div=ET.Element("div")
div.attrib["class"]="class"; div.attrib["class"]="class";
a=ET.SubElement(div,"a") a=ET.SubElement(div,"a")
a.attrib["name"]=node.attrib["name"] a.attrib["name"]=node.attrib["name"]
h3=ET.SubElement(a,"h3") h3=ET.SubElement(a,"h3")
h3.attrib["class"]="title class_title" h3.attrib["class"]="title class_title"
h3.text=node.attrib["name"] h3.text=node.attrib["name"]
@ -325,63 +325,63 @@ def make_doku_class(node):
div2=ET.SubElement(div,"div") div2=ET.SubElement(div,"div")
div2.attrib["class"]="description class_description" div2.attrib["class"]="description class_description"
div2.text=briefd.text div2.text=briefd.text
if ("inherits" in node.attrib): if ("inherits" in node.attrib):
ET.SubElement(div,"br") ET.SubElement(div,"br")
div2=ET.SubElement(div,"div") div2=ET.SubElement(div,"div")
div2.attrib["class"]="inheritance"; div2.attrib["class"]="inheritance";
span=ET.SubElement(div2,"span") span=ET.SubElement(div2,"span")
span.text="Inherits: " span.text="Inherits: "
make_type(node.attrib["inherits"],div2) make_type(node.attrib["inherits"],div2)
if ("category" in node.attrib): if ("category" in node.attrib):
ET.SubElement(div,"br") ET.SubElement(div,"br")
div3=ET.SubElement(div,"div") div3=ET.SubElement(div,"div")
div3.attrib["class"]="category"; div3.attrib["class"]="category";
span=ET.SubElement(div3,"span") span=ET.SubElement(div3,"span")
span.attrib["class"]="category" span.attrib["class"]="category"
span.text="Category: " span.text="Category: "
a = ET.SubElement(div3,"a") a = ET.SubElement(div3,"a")
a.attrib["class"]="category_ref" a.attrib["class"]="category_ref"
a.text=node.attrib["category"] a.text=node.attrib["category"]
catname=a.text catname=a.text
if (catname.rfind("/")!=-1): if (catname.rfind("/")!=-1):
catname=catname[catname.rfind("/"):] catname=catname[catname.rfind("/"):]
catname="CATEGORY_"+catname catname="CATEGORY_"+catname
if (single_page): if (single_page):
a.attrib["href"]="#"+catname a.attrib["href"]="#"+catname
else: else:
a.attrib["href"]="category.html#"+catname a.attrib["href"]="category.html#"+catname
methods = node.find("methods") methods = node.find("methods")
if(methods!=None and len(list(methods))>0): if(methods!=None and len(list(methods))>0):
h4=ET.SubElement(div,"h4") h4=ET.SubElement(div,"h4")
h4.text="Public Methods:" h4.text="Public Methods:"
method_table=ET.SubElement(div,"table") method_table=ET.SubElement(div,"table")
method_table.attrib["class"]="method_list"; method_table.attrib["class"]="method_list";
for m in list(methods): for m in list(methods):
# li = ET.SubElement(div2, "li") # li = ET.SubElement(div2, "li")
method_table.append( make_method_def(node.attrib["name"],m,False) ) method_table.append( make_method_def(node.attrib["name"],m,False) )
events = node.find("signals") events = node.find("signals")
if(events!=None and len(list(events))>0): if(events!=None and len(list(events))>0):
h4=ET.SubElement(div,"h4") h4=ET.SubElement(div,"h4")
h4.text="Events:" h4.text="Events:"
event_table=ET.SubElement(div,"table") event_table=ET.SubElement(div,"table")
event_table.attrib["class"]="method_list"; event_table.attrib["class"]="method_list";
for m in list(events): for m in list(events):
@ -389,20 +389,20 @@ def make_doku_class(node):
event_table.append( make_method_def(node.attrib["name"],m,False,True) ) event_table.append( make_method_def(node.attrib["name"],m,False,True) )
members = node.find("members") members = node.find("members")
if(members!=None and len(list(members))>0): if(members!=None and len(list(members))>0):
h4=ET.SubElement(div,"h4") h4=ET.SubElement(div,"h4")
h4.text="Public Variables:" h4.text="Public Variables:"
div2=ET.SubElement(div,"div") div2=ET.SubElement(div,"div")
div2.attrib["class"]="member_list"; div2.attrib["class"]="member_list";
for c in list(members): for c in list(members):
li = ET.SubElement(div2, "li") li = ET.SubElement(div2, "li")
div3=ET.SubElement(li,"div") div3=ET.SubElement(li,"div")
div3.attrib["class"]="member"; div3.attrib["class"]="member";
make_type(c.attrib["type"],div3) make_type(c.attrib["type"],div3)
span=ET.SubElement(div3,"span") span=ET.SubElement(div3,"span")
span.attrib["class"]="identifier member_name" span.attrib["class"]="identifier member_name"
span.text=" "+c.attrib["name"]+" " span.text=" "+c.attrib["name"]+" "
@ -411,19 +411,19 @@ def make_doku_class(node):
span.text=c.text span.text=c.text
constants = node.find("constants") constants = node.find("constants")
if(constants!=None and len(list(constants))>0): if(constants!=None and len(list(constants))>0):
h4=ET.SubElement(div,"h4") h4=ET.SubElement(div,"h4")
h4.text="Constants:" h4.text="Constants:"
div2=ET.SubElement(div,"div") div2=ET.SubElement(div,"div")
div2.attrib["class"]="constant_list"; div2.attrib["class"]="constant_list";
for c in list(constants): for c in list(constants):
li = ET.SubElement(div2, "li") li = ET.SubElement(div2, "li")
div3=ET.SubElement(li,"div") div3=ET.SubElement(li,"div")
div3.attrib["class"]="constant"; div3.attrib["class"]="constant";
span=ET.SubElement(div3,"span") span=ET.SubElement(div3,"span")
span.attrib["class"]="identifier constant_name" span.attrib["class"]="identifier constant_name"
span.text=c.attrib["name"]+" " span.text=c.attrib["name"]+" "
@ -437,23 +437,23 @@ def make_doku_class(node):
span=ET.SubElement(div3,"span") span=ET.SubElement(div3,"span")
span.attrib["class"]="constant_description" span.attrib["class"]="constant_description"
span.text=c.text span.text=c.text
# ET.SubElement(div,"br") # ET.SubElement(div,"br")
descr=node.find("description") descr=node.find("description")
if (descr!=None and descr.text.strip()!=""): if (descr!=None and descr.text.strip()!=""):
h4=ET.SubElement(div,"h4") h4=ET.SubElement(div,"h4")
h4.text="Description:" h4.text="Description:"
make_text_def(node.attrib["name"],div,descr.text) make_text_def(node.attrib["name"],div,descr.text)
# div2=ET.SubElement(div,"div") # div2=ET.SubElement(div,"div")
# div2.attrib["class"]="description"; # div2.attrib["class"]="description";
# div2.text=descr.text # div2.text=descr.text
if(methods!=None or events!=None): if(methods!=None or events!=None):
h4=ET.SubElement(div,"h4") h4=ET.SubElement(div,"h4")
@ -467,7 +467,7 @@ def make_doku_class(node):
for m in iter_list: for m in iter_list:
descr=m.find("description") descr=m.find("description")
if (descr==None or descr.text.strip()==""): if (descr==None or descr.text.strip()==""):
continue; continue;
@ -479,11 +479,11 @@ def make_doku_class(node):
#anchor = ET.SubElement(div2, "a") #anchor = ET.SubElement(div2, "a")
#anchor.attrib["name"] = #anchor.attrib["name"] =
make_text_def(node.attrib["name"],div2,descr.text) make_text_def(node.attrib["name"],div2,descr.text)
#div3=ET.SubElement(div2,"div") #div3=ET.SubElement(div2,"div")
#div3.attrib["class"]="description"; #div3.attrib["class"]="description";
#div3.text=descr.text #div3.text=descr.text
return div return div
""" """
for file in input_list: for file in input_list:
@ -501,14 +501,14 @@ for file in input_list:
continue continue
class_names.append(c.attrib["name"]) class_names.append(c.attrib["name"])
classes[c.attrib["name"]]=c classes[c.attrib["name"]]=c
class_names.sort() class_names.sort()
make_class_list(class_names,4) make_class_list(class_names,4)
for cn in class_names: for cn in class_names:
c=classes[cn] c=classes[cn]
make_doku_class(c) make_doku_class(c)

View file

@ -43,21 +43,21 @@ def validate_tag(elem,tag):
def make_html_bottom(body): def make_html_bottom(body):
#make_html_top(body,True) #make_html_top(body,True)
ET.SubElement(body,"hr") ET.SubElement(body,"hr")
copyright = ET.SubElement(body,"span") copyright = ET.SubElement(body,"span")
copyright.text = "Copyright 2008-2010 Codenix SRL" copyright.text = "Copyright 2008-2010 Codenix SRL"
def make_html_top(body,bottom=False): def make_html_top(body,bottom=False):
if (bottom): if (bottom):
ET.SubElement(body,"hr") ET.SubElement(body,"hr")
table = ET.SubElement(body,"table") table = ET.SubElement(body,"table")
table.attrib["class"]="top_table" table.attrib["class"]="top_table"
tr = ET.SubElement(table,"tr") tr = ET.SubElement(table,"tr")
td = ET.SubElement(tr,"td") td = ET.SubElement(tr,"td")
td.attrib["class"]="top_table" td.attrib["class"]="top_table"
img = ET.SubElement(td,"image") img = ET.SubElement(td,"image")
img.attrib["src"]="images/logo.png" img.attrib["src"]="images/logo.png"
td = ET.SubElement(tr,"td") td = ET.SubElement(tr,"td")
@ -81,18 +81,18 @@ def make_html_top(body,bottom=False):
a.text="Inheritance" a.text="Inheritance"
if (not bottom): if (not bottom):
ET.SubElement(body,"hr") ET.SubElement(body,"hr")
def make_html_class_list(class_list,columns): def make_html_class_list(class_list,columns):
div=ET.Element("div") div=ET.Element("div")
div.attrib["class"]="ClassList"; div.attrib["class"]="ClassList";
h1=ET.SubElement(div,"h2") h1=ET.SubElement(div,"h2")
h1.text="Alphabetical Class List" h1.text="Alphabetical Class List"
table=ET.SubElement(div,"table") table=ET.SubElement(div,"table")
table.attrib["class"]="class_table" table.attrib["class"]="class_table"
table.attrib["width"]="100%" table.attrib["width"]="100%"
@ -104,13 +104,13 @@ def make_html_class_list(class_list,columns):
row_count = 0 row_count = 0
last_initial = "" last_initial = ""
fit_columns=[] fit_columns=[]
for n in range(0,columns): for n in range(0,columns):
fit_columns+=[[]] fit_columns+=[[]]
indexers=[] indexers=[]
last_initial="" last_initial=""
idx=0 idx=0
for n in class_list: for n in class_list:
col = int(idx/col_max) col = int(idx/col_max)
@ -123,25 +123,25 @@ def make_html_class_list(class_list,columns):
last_initial=n[:1] last_initial=n[:1]
row_max=0 row_max=0
for n in range(0,columns): for n in range(0,columns):
if (len(fit_columns[n])>row_max): if (len(fit_columns[n])>row_max):
row_max=len(fit_columns[n]) row_max=len(fit_columns[n])
for r in range(0,row_max): for r in range(0,row_max):
tr = ET.SubElement(table,"tr") tr = ET.SubElement(table,"tr")
for c in range(0,columns): for c in range(0,columns):
tdi = ET.SubElement(tr,"td") tdi = ET.SubElement(tr,"td")
tdi.attrib["align"]="right" tdi.attrib["align"]="right"
td = ET.SubElement(tr,"td") td = ET.SubElement(tr,"td")
if (r>=len(fit_columns[c])): if (r>=len(fit_columns[c])):
continue continue
classname = fit_columns[c][r] classname = fit_columns[c][r]
print(classname) print(classname)
if (classname in indexers): if (classname in indexers):
span = ET.SubElement(tdi, "span") span = ET.SubElement(tdi, "span")
span.attrib["class"] = "class_index_letter" span.attrib["class"] = "class_index_letter"
span.text = classname[:1].upper() span.text = classname[:1].upper()
@ -161,23 +161,23 @@ def make_html_class_list(class_list,columns):
csscc = ET.SubElement(cat_class_list, "link") csscc = ET.SubElement(cat_class_list, "link")
csscc.attrib["href"] = "main.css" csscc.attrib["href"] = "main.css"
csscc.attrib["rel"] = "stylesheet" csscc.attrib["rel"] = "stylesheet"
csscc.attrib["type"] = "text/css" csscc.attrib["type"] = "text/css"
bodycc = ET.SubElement(cat_class_list, "body") bodycc = ET.SubElement(cat_class_list, "body")
make_html_top(bodycc) make_html_top(bodycc)
cat_class_parent=bodycc cat_class_parent=bodycc
else: else:
cat_class_parent=div cat_class_parent=div
h1=ET.SubElement(cat_class_parent,"h2") h1=ET.SubElement(cat_class_parent,"h2")
h1.text="Class List By Category" h1.text="Class List By Category"
class_cat_table={} class_cat_table={}
class_cat_list=[] class_cat_list=[]
for c in class_list: for c in class_list:
clss = classes[c] clss = classes[c]
if ("category" in clss.attrib): if ("category" in clss.attrib):
@ -190,9 +190,9 @@ def make_html_class_list(class_list,columns):
class_cat_list.append(class_cat) class_cat_list.append(class_cat)
class_cat_table[class_cat]=[] class_cat_table[class_cat]=[]
class_cat_table[class_cat].append(c) class_cat_table[class_cat].append(c)
class_cat_list.sort() class_cat_list.sort()
ct = ET.SubElement(cat_class_parent,"table") ct = ET.SubElement(cat_class_parent,"table")
for cl in class_cat_list: for cl in class_cat_list:
l = class_cat_table[cl] l = class_cat_table[cl]
@ -201,7 +201,7 @@ def make_html_class_list(class_list,columns):
tr.attrib["class"]="category_title" tr.attrib["class"]="category_title"
td = ET.SubElement(ct,"td") td = ET.SubElement(ct,"td")
td.attrib["class"]="category_title" td.attrib["class"]="category_title"
a = ET.SubElement(td,"a") a = ET.SubElement(td,"a")
a.attrib["class"]="category_title" a.attrib["class"]="category_title"
a.text=cl a.text=cl
@ -221,45 +221,45 @@ def make_html_class_list(class_list,columns):
bdtext=bd.text bdtext=bd.text
td = ET.SubElement(ct,"td") td = ET.SubElement(ct,"td")
td.text=bdtext td.text=bdtext
if (not single_page): if (not single_page):
make_html_bottom(bodycc) make_html_bottom(bodycc)
catet_out = ET.ElementTree(cat_class_list) catet_out = ET.ElementTree(cat_class_list)
catet_out.write("category.html") catet_out.write("category.html")
if (not single_page): if (not single_page):
inh_class_list=ET.Element("html") inh_class_list=ET.Element("html")
cssic = ET.SubElement(inh_class_list, "link") cssic = ET.SubElement(inh_class_list, "link")
cssic.attrib["href"] = "main.css" cssic.attrib["href"] = "main.css"
cssic.attrib["rel"] = "stylesheet" cssic.attrib["rel"] = "stylesheet"
cssic.attrib["type"] = "text/css" cssic.attrib["type"] = "text/css"
bodyic = ET.SubElement(inh_class_list, "body") bodyic = ET.SubElement(inh_class_list, "body")
make_html_top(bodyic) make_html_top(bodyic)
inh_class_parent=bodyic inh_class_parent=bodyic
else: else:
inh_class_parent=div inh_class_parent=div
h1=ET.SubElement(inh_class_parent,"h2") h1=ET.SubElement(inh_class_parent,"h2")
h1.text="Class List By Inheritance" h1.text="Class List By Inheritance"
itemlist = ET.SubElement(inh_class_parent,"list") itemlist = ET.SubElement(inh_class_parent,"list")
class_inh_table={} class_inh_table={}
def add_class(clss): def add_class(clss):
if (clss.attrib["name"] in class_inh_table): if (clss.attrib["name"] in class_inh_table):
return #already added return #already added
parent_list=None parent_list=None
if ("inherits" in clss.attrib): if ("inherits" in clss.attrib):
inhc = clss.attrib["inherits"] inhc = clss.attrib["inherits"]
if (not (inhc in class_inh_table)): if (not (inhc in class_inh_table)):
add_class(classes[inhc]) add_class(classes[inhc])
parent_list = class_inh_table[inhc].find("div") parent_list = class_inh_table[inhc].find("div")
if (parent_list == None): if (parent_list == None):
parent_div = ET.SubElement(class_inh_table[inhc],"div") parent_div = ET.SubElement(class_inh_table[inhc],"div")
@ -267,39 +267,39 @@ def make_html_class_list(class_list,columns):
parent_div.attrib["class"]="inh_class_list" parent_div.attrib["class"]="inh_class_list"
else: else:
parent_list = parent_list.find("list") parent_list = parent_list.find("list")
else: else:
parent_list=itemlist parent_list=itemlist
item = ET.SubElement(parent_list,"li") item = ET.SubElement(parent_list,"li")
# item.attrib["class"]="inh_class_list" # item.attrib["class"]="inh_class_list"
class_inh_table[clss.attrib["name"]]=item class_inh_table[clss.attrib["name"]]=item
make_type(clss.attrib["name"],item) make_type(clss.attrib["name"],item)
for c in class_list: for c in class_list:
add_class(classes[c]) add_class(classes[c])
if (not single_page): if (not single_page):
make_html_bottom(bodyic) make_html_bottom(bodyic)
catet_out = ET.ElementTree(inh_class_list) catet_out = ET.ElementTree(inh_class_list)
catet_out.write("inheritance.html") catet_out.write("inheritance.html")
#h1=ET.SubElement(div,"h2") #h1=ET.SubElement(div,"h2")
#h1.text="Class List By Inheritance" #h1.text="Class List By Inheritance"
return div return div
def make_type(p_type,p_parent): def make_type(p_type,p_parent):
if (p_type=="RefPtr"): if (p_type=="RefPtr"):
p_type="Resource" p_type="Resource"
if (p_type in class_names): if (p_type in class_names):
a=ET.SubElement(p_parent,"a") a=ET.SubElement(p_parent,"a")
a.attrib["class"]="datatype_existing" a.attrib["class"]="datatype_existing"
@ -326,7 +326,7 @@ def make_text_def(class_name,parent,text):
endq_pos=text.find("]",pos+1) endq_pos=text.find("]",pos+1)
if (endq_pos==-1): if (endq_pos==-1):
break break
pre_text=text[:pos] pre_text=text[:pos]
post_text=text[endq_pos+1:] post_text=text[endq_pos+1:]
tag_text=text[pos+1:endq_pos] tag_text=text[pos+1:endq_pos]
@ -346,7 +346,7 @@ def make_text_def(class_name,parent,text):
elif(cmd.find("method")==0): elif(cmd.find("method")==0):
cmd=tag_text[:space_pos] cmd=tag_text[:space_pos]
param=tag_text[space_pos+1:] param=tag_text[space_pos+1:]
if (not single_page and param.find(".")!=-1): if (not single_page and param.find(".")!=-1):
class_param,method_param=param.split(".") class_param,method_param=param.split(".")
tag_text=tag_text='<a href="'+class_param+'.html#'+class_param+"_"+method_param+'">'+class_param+'.'+method_param+'()</a>' tag_text=tag_text='<a href="'+class_param+'.html#'+class_param+"_"+method_param+'">'+class_param+'.'+method_param+'()</a>'
@ -358,22 +358,22 @@ def make_text_def(class_name,parent,text):
elif (cmd.find("url=")==0): elif (cmd.find("url=")==0):
tag_text="<a href="+cmd[4:]+">" tag_text="<a href="+cmd[4:]+">"
elif (cmd=="/url"): elif (cmd=="/url"):
tag_text="</a>" tag_text="</a>"
elif (cmd=="center"): elif (cmd=="center"):
tag_text="<div align=\"center\">" tag_text="<div align=\"center\">"
elif (cmd=="/center"): elif (cmd=="/center"):
tag_text="</div>" tag_text="</div>"
elif (cmd=="br"): elif (cmd=="br"):
tag_text="<br/>" tag_text="<br/>"
elif (cmd=="i" or cmd=="/i" or cmd=="b" or cmd=="/b" or cmd=="u" or cmd=="/u"): elif (cmd=="i" or cmd=="/i" or cmd=="b" or cmd=="/b" or cmd=="u" or cmd=="/u"):
tag_text="<"+tag_text+">" #html direct mapping tag_text="<"+tag_text+">" #html direct mapping
else: else:
tag_text="["+tag_text+"]" tag_text="["+tag_text+"]"
text=pre_text+tag_text+post_text text=pre_text+tag_text+post_text
pos=len(pre_text)+len(tag_text) pos=len(pre_text)+len(tag_text)
#tnode = ET.SubElement(parent,"div") #tnode = ET.SubElement(parent,"div")
#tnode.text=text #tnode.text=text
text="<div class=\"description\">"+text+"</div>" text="<div class=\"description\">"+text+"</div>"
@ -383,19 +383,19 @@ def make_text_def(class_name,parent,text):
except: except:
print("Error parsing description text: '"+text+"'") print("Error parsing description text: '"+text+"'")
sys.exit(255) sys.exit(255)
return tnode return tnode
def make_method_def(name,m,declare,event=False): def make_method_def(name,m,declare,event=False):
mdata={} mdata={}
if (not declare): if (not declare):
div=ET.Element("tr") div=ET.Element("tr")
div.attrib["class"]="method" div.attrib["class"]="method"
ret_parent=ET.SubElement(div,"td") ret_parent=ET.SubElement(div,"td")
@ -406,13 +406,13 @@ def make_method_def(name,m,declare,event=False):
div.attrib["class"]="method" div.attrib["class"]="method"
ret_parent=div ret_parent=div
func_parent=div func_parent=div
mdata["argidx"]=[] mdata["argidx"]=[]
mdata["name"]=m.attrib["name"] mdata["name"]=m.attrib["name"]
qualifiers="" qualifiers=""
if ("qualifiers" in m.attrib): if ("qualifiers" in m.attrib):
qualifiers=m.attrib["qualifiers"] qualifiers=m.attrib["qualifiers"]
args=list(m) args=list(m)
for a in args: for a in args:
if (a.tag=="return"): if (a.tag=="return"):
@ -421,11 +421,11 @@ def make_method_def(name,m,declare,event=False):
idx=int(a.attrib["index"]) idx=int(a.attrib["index"])
else: else:
continue continue
mdata["argidx"].append(idx) mdata["argidx"].append(idx)
mdata[idx]=a mdata[idx]=a
if (not event): if (not event):
if (-1 in mdata["argidx"]): if (-1 in mdata["argidx"]):
make_type(mdata[-1].attrib["type"],ret_parent) make_type(mdata[-1].attrib["type"],ret_parent)
mdata["argidx"].remove(-1) mdata["argidx"].remove(-1)
@ -443,29 +443,29 @@ def make_method_def(name,m,declare,event=False):
a=ET.SubElement(span,"a") a=ET.SubElement(span,"a")
a.attrib["href"]="#"+name+"_"+m.attrib["name"] a.attrib["href"]="#"+name+"_"+m.attrib["name"]
a.text=m.attrib["name"] a.text=m.attrib["name"]
span=ET.SubElement(func_parent,"span") span=ET.SubElement(func_parent,"span")
span.attrib["class"]="symbol" span.attrib["class"]="symbol"
span.text=" (" span.text=" ("
for a in mdata["argidx"]: for a in mdata["argidx"]:
arg=mdata[a] arg=mdata[a]
if (a>0): if (a>0):
span=ET.SubElement(func_parent,"span") span=ET.SubElement(func_parent,"span")
span.text=", " span.text=", "
else: else:
span=ET.SubElement(func_parent,"span") span=ET.SubElement(func_parent,"span")
span.text=" " span.text=" "
make_type(arg.attrib["type"],func_parent) make_type(arg.attrib["type"],func_parent)
span=ET.SubElement(func_parent,"span") span=ET.SubElement(func_parent,"span")
span.text=arg.attrib["name"] span.text=arg.attrib["name"]
if ("default" in arg.attrib): if ("default" in arg.attrib):
span.text=span.text+"="+arg.attrib["default"] span.text=span.text+"="+arg.attrib["default"]
span=ET.SubElement(func_parent,"span") span=ET.SubElement(func_parent,"span")
span.attrib["class"]="symbol" span.attrib["class"]="symbol"
if (len(mdata["argidx"])): if (len(mdata["argidx"])):
@ -477,9 +477,9 @@ def make_method_def(name,m,declare,event=False):
span=ET.SubElement(func_parent,"span") span=ET.SubElement(func_parent,"span")
span.attrib["class"]="qualifier" span.attrib["class"]="qualifier"
span.text=" "+qualifiers span.text=" "+qualifiers
return div return div
def make_html_class(node): def make_html_class(node):
@ -488,7 +488,7 @@ def make_html_class(node):
a=ET.SubElement(div,"a") a=ET.SubElement(div,"a")
a.attrib["name"]=node.attrib["name"] a.attrib["name"]=node.attrib["name"]
h3=ET.SubElement(a,"h3") h3=ET.SubElement(a,"h3")
h3.attrib["class"]="title class_title" h3.attrib["class"]="title class_title"
h3.text=node.attrib["name"] h3.text=node.attrib["name"]
@ -498,63 +498,63 @@ def make_html_class(node):
div2=ET.SubElement(div,"div") div2=ET.SubElement(div,"div")
div2.attrib["class"]="description class_description" div2.attrib["class"]="description class_description"
div2.text=briefd.text div2.text=briefd.text
if ("inherits" in node.attrib): if ("inherits" in node.attrib):
ET.SubElement(div,"br") ET.SubElement(div,"br")
div2=ET.SubElement(div,"div") div2=ET.SubElement(div,"div")
div2.attrib["class"]="inheritance"; div2.attrib["class"]="inheritance";
span=ET.SubElement(div2,"span") span=ET.SubElement(div2,"span")
span.text="Inherits: " span.text="Inherits: "
make_type(node.attrib["inherits"],div2) make_type(node.attrib["inherits"],div2)
if ("category" in node.attrib): if ("category" in node.attrib):
ET.SubElement(div,"br") ET.SubElement(div,"br")
div3=ET.SubElement(div,"div") div3=ET.SubElement(div,"div")
div3.attrib["class"]="category"; div3.attrib["class"]="category";
span=ET.SubElement(div3,"span") span=ET.SubElement(div3,"span")
span.attrib["class"]="category" span.attrib["class"]="category"
span.text="Category: " span.text="Category: "
a = ET.SubElement(div3,"a") a = ET.SubElement(div3,"a")
a.attrib["class"]="category_ref" a.attrib["class"]="category_ref"
a.text=node.attrib["category"] a.text=node.attrib["category"]
catname=a.text catname=a.text
if (catname.rfind("/")!=-1): if (catname.rfind("/")!=-1):
catname=catname[catname.rfind("/"):] catname=catname[catname.rfind("/"):]
catname="CATEGORY_"+catname catname="CATEGORY_"+catname
if (single_page): if (single_page):
a.attrib["href"]="#"+catname a.attrib["href"]="#"+catname
else: else:
a.attrib["href"]="category.html#"+catname a.attrib["href"]="category.html#"+catname
methods = node.find("methods") methods = node.find("methods")
if(methods!=None and len(list(methods))>0): if(methods!=None and len(list(methods))>0):
h4=ET.SubElement(div,"h4") h4=ET.SubElement(div,"h4")
h4.text="Public Methods:" h4.text="Public Methods:"
method_table=ET.SubElement(div,"table") method_table=ET.SubElement(div,"table")
method_table.attrib["class"]="method_list"; method_table.attrib["class"]="method_list";
for m in list(methods): for m in list(methods):
# li = ET.SubElement(div2, "li") # li = ET.SubElement(div2, "li")
method_table.append( make_method_def(node.attrib["name"],m,False) ) method_table.append( make_method_def(node.attrib["name"],m,False) )
events = node.find("signals") events = node.find("signals")
if(events!=None and len(list(events))>0): if(events!=None and len(list(events))>0):
h4=ET.SubElement(div,"h4") h4=ET.SubElement(div,"h4")
h4.text="Events:" h4.text="Events:"
event_table=ET.SubElement(div,"table") event_table=ET.SubElement(div,"table")
event_table.attrib["class"]="method_list"; event_table.attrib["class"]="method_list";
for m in list(events): for m in list(events):
@ -562,20 +562,20 @@ def make_html_class(node):
event_table.append( make_method_def(node.attrib["name"],m,False,True) ) event_table.append( make_method_def(node.attrib["name"],m,False,True) )
members = node.find("members") members = node.find("members")
if(members!=None and len(list(members))>0): if(members!=None and len(list(members))>0):
h4=ET.SubElement(div,"h4") h4=ET.SubElement(div,"h4")
h4.text="Public Variables:" h4.text="Public Variables:"
div2=ET.SubElement(div,"div") div2=ET.SubElement(div,"div")
div2.attrib["class"]="member_list"; div2.attrib["class"]="member_list";
for c in list(members): for c in list(members):
li = ET.SubElement(div2, "li") li = ET.SubElement(div2, "li")
div3=ET.SubElement(li,"div") div3=ET.SubElement(li,"div")
div3.attrib["class"]="member"; div3.attrib["class"]="member";
make_type(c.attrib["type"],div3) make_type(c.attrib["type"],div3)
span=ET.SubElement(div3,"span") span=ET.SubElement(div3,"span")
span.attrib["class"]="identifier member_name" span.attrib["class"]="identifier member_name"
span.text=" "+c.attrib["name"]+" " span.text=" "+c.attrib["name"]+" "
@ -584,19 +584,19 @@ def make_html_class(node):
span.text=c.text span.text=c.text
constants = node.find("constants") constants = node.find("constants")
if(constants!=None and len(list(constants))>0): if(constants!=None and len(list(constants))>0):
h4=ET.SubElement(div,"h4") h4=ET.SubElement(div,"h4")
h4.text="Constants:" h4.text="Constants:"
div2=ET.SubElement(div,"div") div2=ET.SubElement(div,"div")
div2.attrib["class"]="constant_list"; div2.attrib["class"]="constant_list";
for c in list(constants): for c in list(constants):
li = ET.SubElement(div2, "li") li = ET.SubElement(div2, "li")
div3=ET.SubElement(li,"div") div3=ET.SubElement(li,"div")
div3.attrib["class"]="constant"; div3.attrib["class"]="constant";
span=ET.SubElement(div3,"span") span=ET.SubElement(div3,"span")
span.attrib["class"]="identifier constant_name" span.attrib["class"]="identifier constant_name"
span.text=c.attrib["name"]+" " span.text=c.attrib["name"]+" "
@ -610,22 +610,22 @@ def make_html_class(node):
span=ET.SubElement(div3,"span") span=ET.SubElement(div3,"span")
span.attrib["class"]="constant_description" span.attrib["class"]="constant_description"
span.text=c.text span.text=c.text
# ET.SubElement(div,"br") # ET.SubElement(div,"br")
descr=node.find("description") descr=node.find("description")
if (descr!=None and descr.text.strip()!=""): if (descr!=None and descr.text.strip()!=""):
h4=ET.SubElement(div,"h4") h4=ET.SubElement(div,"h4")
h4.text="Description:" h4.text="Description:"
make_text_def(node.attrib["name"],div,descr.text) make_text_def(node.attrib["name"],div,descr.text)
# div2=ET.SubElement(div,"div") # div2=ET.SubElement(div,"div")
# div2.attrib["class"]="description"; # div2.attrib["class"]="description";
# div2.text=descr.text # div2.text=descr.text
if(methods!=None or events!=None): if(methods!=None or events!=None):
h4=ET.SubElement(div,"h4") h4=ET.SubElement(div,"h4")
@ -639,7 +639,7 @@ def make_html_class(node):
for m in iter_list: for m in iter_list:
descr=m.find("description") descr=m.find("description")
if (descr==None or descr.text.strip()==""): if (descr==None or descr.text.strip()==""):
continue; continue;
@ -651,11 +651,11 @@ def make_html_class(node):
#anchor = ET.SubElement(div2, "a") #anchor = ET.SubElement(div2, "a")
#anchor.attrib["name"] = #anchor.attrib["name"] =
make_text_def(node.attrib["name"],div2,descr.text) make_text_def(node.attrib["name"],div2,descr.text)
#div3=ET.SubElement(div2,"div") #div3=ET.SubElement(div2,"div")
#div3.attrib["class"]="description"; #div3.attrib["class"]="description";
#div3.text=descr.text #div3.text=descr.text
return div return div
class_names=[] class_names=[]
@ -676,7 +676,7 @@ for file in input_list:
continue continue
class_names.append(c.attrib["name"]) class_names.append(c.attrib["name"])
classes[c.attrib["name"]]=c classes[c.attrib["name"]]=c
html = ET.Element("html") html = ET.Element("html")
css = ET.SubElement(html, "link") css = ET.SubElement(html, "link")
css.attrib["href"] = "main.css" css.attrib["href"] = "main.css"
@ -690,7 +690,7 @@ if (not single_page):
class_names.sort() class_names.sort()
body.append( make_html_class_list(class_names,5) ) body.append( make_html_class_list(class_names,5) )
for cn in class_names: for cn in class_names:
@ -704,9 +704,9 @@ for cn in class_names:
css.attrib["rel"] = "stylesheet" css.attrib["rel"] = "stylesheet"
css.attrib["type"] = "text/css" css.attrib["type"] = "text/css"
body2 = ET.SubElement(html2, "body" ) body2 = ET.SubElement(html2, "body" )
make_html_top(body2) make_html_top(body2)
body2.append( make_html_class(c) ); body2.append( make_html_class(c) );
make_html_bottom(body2) make_html_bottom(body2)
et_out = ET.ElementTree(html2) et_out = ET.ElementTree(html2)
et_out.write(c.attrib["name"]+".html") et_out.write(c.attrib["name"]+".html")

View file

@ -54,7 +54,7 @@ def make_class_list(class_list, columns):
row_max = 0 row_max = 0
f.write("\n") f.write("\n")
for n in range(0, columns): for n in range(0, columns):
if len(fit_columns[n]) > row_max: if len(fit_columns[n]) > row_max:
row_max = len(fit_columns[n]) row_max = len(fit_columns[n])
@ -63,7 +63,7 @@ def make_class_list(class_list, columns):
for n in range(0, columns): for n in range(0, columns):
f.write(" | |") f.write(" | |")
f.write("\n") f.write("\n")
f.write("| ") f.write("| ")
for n in range(0, columns): for n in range(0, columns):
f.write(" --- | ------- |") f.write(" --- | ------- |")

View file

@ -60,7 +60,7 @@ def make_class_list(class_list, columns):
row_max = 0 row_max = 0
f.write("\n") f.write("\n")
for n in range(0, columns): for n in range(0, columns):
if len(fit_columns[n]) > row_max: if len(fit_columns[n]) > row_max:
row_max = len(fit_columns[n]) row_max = len(fit_columns[n])
@ -69,7 +69,7 @@ def make_class_list(class_list, columns):
for n in range(0, columns): for n in range(0, columns):
f.write(" | |") f.write(" | |")
f.write("\n") f.write("\n")
f.write("+") f.write("+")
for n in range(0, columns): for n in range(0, columns):
f.write("--+-------+") f.write("--+-------+")
@ -265,7 +265,7 @@ def make_method(
t = '- ' t = '- '
else: else:
t = "" t = ""
ret_type = 'void' ret_type = 'void'
args = list(m) args = list(m)
mdata = {} mdata = {}
@ -332,7 +332,7 @@ def make_method(
if (not declare): if (not declare):
if (pp!=None): if (pp!=None):
pp.append( (t,s) ) pp.append( (t,s) )
else: else:
f.write("- "+t+" "+s+"\n") f.write("- "+t+" "+s+"\n")
else: else:
f.write(t+s+"\n") f.write(t+s+"\n")
@ -366,24 +366,24 @@ def make_rst_class(node):
f.write(" **<** ") f.write(" **<** ")
else: else:
first=False first=False
f.write(make_type(inh)) f.write(make_type(inh))
inode = classes[inh] inode = classes[inh]
if ('inherits' in inode.attrib): if ('inherits' in inode.attrib):
inh=inode.attrib['inherits'].strip() inh=inode.attrib['inherits'].strip()
else: else:
inh=None inh=None
f.write("\n\n") f.write("\n\n")
inherited=[] inherited=[]
for cn in classes: for cn in classes:
c=classes[cn] c=classes[cn]
if 'inherits' in c.attrib: if 'inherits' in c.attrib:
if (c.attrib['inherits'].strip()==name): if (c.attrib['inherits'].strip()==name):
inherited.append(c.attrib['name']) inherited.append(c.attrib['name'])
if (len(inherited)): if (len(inherited)):
f.write('**Inherited By:** ') f.write('**Inherited By:** ')
for i in range(len(inherited)): for i in range(len(inherited)):
@ -415,7 +415,7 @@ def make_rst_class(node):
tl = len(s[1]) tl = len(s[1])
if (tl>longest_t): if (tl>longest_t):
longest_t=tl longest_t=tl
sep="+" sep="+"
for i in range(longest_s+2): for i in range(longest_s+2):
sep+="-" sep+="-"

View file

@ -15,19 +15,19 @@ def add_source_files(self, sources, filetype, lib_env = None, shared = False):
else: else:
for f in filetype: for f in filetype:
sources.append(self.Object(f)) sources.append(self.Object(f))
def build_shader_header( target, source, env ):
def build_shader_header( target, source, env ):
for x in source: for x in source:
print x print x
name = str(x) name = str(x)
name = name[ name.rfind("/")+1: ] name = name[ name.rfind("/")+1: ]
name = name[ name.rfind("\\")+1: ] name = name[ name.rfind("\\")+1: ]
name = name.replace(".","_") name = name.replace(".","_")
fs = open(str(x),"r") fs = open(str(x),"r")
fd = open(str(x)+".h","w") fd = open(str(x)+".h","w")
fd.write("/* this file has been generated by SCons, do not edit! */\n") fd.write("/* this file has been generated by SCons, do not edit! */\n")
@ -40,17 +40,17 @@ def build_shader_header( target, source, env ):
line=line.replace("\"","\\\"") line=line.replace("\"","\\\"")
fd.write("\""+line+"\\n\"\n") fd.write("\""+line+"\\n\"\n")
line=fs.readline() line=fs.readline()
fd.write(";\n") fd.write(";\n")
return 0 return 0
def build_glsl_header( filename ): def build_glsl_header( filename ):
fs = open(filename,"r") fs = open(filename,"r")
line=fs.readline() line=fs.readline()
vertex_lines=[] vertex_lines=[]
fragment_lines=[] fragment_lines=[]
uniforms=[] uniforms=[]
@ -68,21 +68,21 @@ def build_glsl_header( filename ):
fragment_offset=0 fragment_offset=0
while(line): while(line):
if (line.find("[vertex]")!=-1): if (line.find("[vertex]")!=-1):
reading="vertex" reading="vertex"
line=fs.readline() line=fs.readline()
line_offset+=1 line_offset+=1
vertex_offset=line_offset vertex_offset=line_offset
continue continue
if (line.find("[fragment]")!=-1): if (line.find("[fragment]")!=-1):
reading="fragment" reading="fragment"
line=fs.readline() line=fs.readline()
line_offset+=1 line_offset+=1
fragment_offset=line_offset fragment_offset=line_offset
continue continue
if (line.find("#ifdef ")!=-1): if (line.find("#ifdef ")!=-1):
ifdefline = line.replace("#ifdef ","").strip() ifdefline = line.replace("#ifdef ","").strip()
if (not ifdefline in conditionals): if (not ifdefline in conditionals):
@ -159,49 +159,49 @@ def build_glsl_header( filename ):
uline = uline.replace("attribute ",""); uline = uline.replace("attribute ","");
uline = uline.replace(";",""); uline = uline.replace(";","");
uline = uline[ uline.find(" "): ].strip() uline = uline[ uline.find(" "): ].strip()
if (uline.find("//")!=-1): if (uline.find("//")!=-1):
name,bind = uline.split("//") name,bind = uline.split("//")
if (bind.find("attrib:")!=-1): if (bind.find("attrib:")!=-1):
name=name.strip() name=name.strip()
bind=bind.replace("attrib:","").strip() bind=bind.replace("attrib:","").strip()
attributes+=[(name,bind)] attributes+=[(name,bind)]
if (line.strip().find("out ")==0): if (line.strip().find("out ")==0):
uline = line.replace("out","").strip(); uline = line.replace("out","").strip();
uline = uline.replace(";",""); uline = uline.replace(";","");
uline = uline[ uline.find(" "): ].strip() uline = uline[ uline.find(" "): ].strip()
if (uline.find("//")!=-1): if (uline.find("//")!=-1):
name,bind = uline.split("//") name,bind = uline.split("//")
if (bind.find("drawbuffer:")!=-1): if (bind.find("drawbuffer:")!=-1):
name=name.strip() name=name.strip()
bind=bind.replace("drawbuffer:","").strip() bind=bind.replace("drawbuffer:","").strip()
fbos+=[(name,bind)] fbos+=[(name,bind)]
line=line.replace("\r","") line=line.replace("\r","")
line=line.replace("\n","") line=line.replace("\n","")
line=line.replace("\\","\\\\") line=line.replace("\\","\\\\")
line=line.replace("\"","\\\"") line=line.replace("\"","\\\"")
#line=line+"\\n\\" no need to anymore #line=line+"\\n\\" no need to anymore
if (reading=="vertex"): if (reading=="vertex"):
vertex_lines+=[line] vertex_lines+=[line]
if (reading=="fragment"): if (reading=="fragment"):
fragment_lines+=[line] fragment_lines+=[line]
line=fs.readline() line=fs.readline()
line_offset+=1 line_offset+=1
fs.close(); fs.close();
out_file = filename+".h" out_file = filename+".h"
fd = open(out_file,"w") fd = open(out_file,"w")
fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n"); fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n");
out_file_base = out_file out_file_base = out_file
out_file_base = out_file_base[ out_file_base.rfind("/")+1: ] out_file_base = out_file_base[ out_file_base.rfind("/")+1: ]
out_file_base = out_file_base[ out_file_base.rfind("\\")+1: ] out_file_base = out_file_base[ out_file_base.rfind("\\")+1: ]
@ -209,14 +209,14 @@ def build_glsl_header( filename ):
out_file_ifdef = out_file_base.replace(".","_").upper() out_file_ifdef = out_file_base.replace(".","_").upper()
fd.write("#ifndef "+out_file_ifdef+"\n") fd.write("#ifndef "+out_file_ifdef+"\n")
fd.write("#define "+out_file_ifdef+"\n") fd.write("#define "+out_file_ifdef+"\n")
out_file_class = out_file_base.replace(".glsl.h","").title().replace("_","").replace(".","")+"ShaderGL"; out_file_class = out_file_base.replace(".glsl.h","").title().replace("_","").replace(".","")+"ShaderGL";
fd.write("\n\n"); fd.write("\n\n");
fd.write("#include \"drivers/opengl/shader_gl.h\"\n\n\n"); fd.write("#include \"drivers/opengl/shader_gl.h\"\n\n\n");
fd.write("class "+out_file_class+" : public ShaderGL {\n\n"); fd.write("class "+out_file_class+" : public ShaderGL {\n\n");
fd.write("\t virtual String get_shader_name() const { return \""+out_file_class+"\"; }\n"); fd.write("\t virtual String get_shader_name() const { return \""+out_file_class+"\"; }\n");
fd.write("public:\n\n"); fd.write("public:\n\n");
if (len(conditionals)): if (len(conditionals)):
fd.write("\tenum Conditionals {\n"); fd.write("\tenum Conditionals {\n");
for x in conditionals: for x in conditionals:
@ -227,11 +227,11 @@ def build_glsl_header( filename ):
for x in uniforms: for x in uniforms:
fd.write("\t\t"+x.upper()+",\n"); fd.write("\t\t"+x.upper()+",\n");
fd.write("\t};\n\n"); fd.write("\t};\n\n");
fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n"); fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n");
if (len(conditionals)): if (len(conditionals)):
fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n"); fd.write("\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n");
fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );\n\n "); fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; ERR_FAIL_COND( get_active()!=this );\n\n ");
fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n"); fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n");
fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n"); fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n");
@ -251,11 +251,11 @@ def build_glsl_header( filename ):
fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n"); fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n");
fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n"); fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n");
fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n"); fd.write("\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n");
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU
const Transform &tr = p_transform; const Transform &tr = p_transform;
GLfloat matrix[16]={ /* build a 16x16 matrix */ GLfloat matrix[16]={ /* build a 16x16 matrix */
tr.basis.elements[0][0], tr.basis.elements[0][0],
tr.basis.elements[1][0], tr.basis.elements[1][0],
@ -272,15 +272,15 @@ def build_glsl_header( filename ):
tr.origin.x, tr.origin.x,
tr.origin.y, tr.origin.y,
tr.origin.z, tr.origin.z,
1 1
}; };
glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
} }
"""); """);
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Matrix32& p_transform) { _FU fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Matrix32& p_transform) { _FU
@ -315,25 +315,25 @@ def build_glsl_header( filename ):
"""); """);
fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU fd.write("""\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
GLfloat matrix[16]; GLfloat matrix[16];
for (int i=0;i<4;i++) { for (int i=0;i<4;i++) {
for (int j=0;j<4;j++) { for (int j=0;j<4;j++) {
matrix[i*4+j]=p_matrix.matrix[i][j]; matrix[i*4+j]=p_matrix.matrix[i][j];
} }
} }
glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
}; """); }; """);
fd.write("\n\n#undef _FU\n\n\n"); fd.write("\n\n#undef _FU\n\n\n");
fd.write("\tvirtual void init() {\n\n"); fd.write("\tvirtual void init() {\n\n");
if (len(conditionals)): if (len(conditionals)):
fd.write("\t\tstatic const char* _conditional_strings[]={\n") fd.write("\t\tstatic const char* _conditional_strings[]={\n")
if (len(conditionals)): if (len(conditionals)):
for x in conditionals: for x in conditionals:
@ -341,9 +341,9 @@ def build_glsl_header( filename ):
fd.write("\t\t};\n\n"); fd.write("\t\t};\n\n");
else: else:
fd.write("\t\tstatic const char **_conditional_strings=NULL;\n") fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
if (len(uniforms)): if (len(uniforms)):
fd.write("\t\tstatic const char* _uniform_strings[]={\n") fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if (len(uniforms)): if (len(uniforms)):
for x in uniforms: for x in uniforms:
@ -351,18 +351,18 @@ def build_glsl_header( filename ):
fd.write("\t\t};\n\n"); fd.write("\t\t};\n\n");
else: else:
fd.write("\t\tstatic const char **_uniform_strings=NULL;\n") fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
if (len(attributes)): if (len(attributes)):
fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n") fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n")
for x in attributes: for x in attributes:
fd.write("\t\t\t{\""+x[0]+"\","+x[1]+"},\n"); fd.write("\t\t\t{\""+x[0]+"\","+x[1]+"},\n");
fd.write("\t\t};\n\n"); fd.write("\t\t};\n\n");
else: else:
fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n") fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n")
if (len(fbos)): if (len(fbos)):
fd.write("\t\tstatic FBOPair _fbo_pairs[]={\n") fd.write("\t\tstatic FBOPair _fbo_pairs[]={\n")
for x in fbos: for x in fbos:
@ -404,20 +404,20 @@ def build_glsl_header( filename ):
fd.write("\t\tsetup(_conditional_strings,"+str(len(conditionals))+",_uniform_strings,"+str(len(uniforms))+",_attribute_pairs,"+str(len(attributes))+",_fbo_pairs,"+str(len(fbos))+",_ubo_pairs,"+str(len(ubos))+",_texunit_pairs,"+str(len(texunits))+",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n") fd.write("\t\tsetup(_conditional_strings,"+str(len(conditionals))+",_uniform_strings,"+str(len(uniforms))+",_attribute_pairs,"+str(len(attributes))+",_fbo_pairs,"+str(len(fbos))+",_ubo_pairs,"+str(len(ubos))+",_texunit_pairs,"+str(len(texunits))+",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n")
fd.write("\t};\n\n") fd.write("\t};\n\n")
fd.write("};\n\n"); fd.write("};\n\n");
fd.write("#endif\n\n"); fd.write("#endif\n\n");
fd.close(); fd.close();
def build_glsl_headers( target, source, env ):
def build_glsl_headers( target, source, env ):
for x in source: for x in source:
build_glsl_header(str(x)); build_glsl_header(str(x));
return 0 return 0
@ -1084,12 +1084,12 @@ def build_gles2_headers( target, source, env ):
def update_version(): def update_version():
rev = "custom_build" rev = "custom_build"
if (os.getenv("BUILD_REVISION")!=None): if (os.getenv("BUILD_REVISION")!=None):
rev=os.getenv("BUILD_REVISION") rev=os.getenv("BUILD_REVISION")
print("Using custom revision: "+rev) print("Using custom revision: "+rev)
import version import version
f=open("core/version.h","wb") f=open("core/version.h","wb")
f.write("#define VERSION_SHORT_NAME "+str(version.short_name)+"\n") f.write("#define VERSION_SHORT_NAME "+str(version.short_name)+"\n")
@ -1134,7 +1134,7 @@ def parse_cg_file(fname, uniforms, sizes, conditionals):
line = fs.readline(); line = fs.readline();
def build_cg_shader(sname): def build_cg_shader(sname):
vp_uniforms = [] vp_uniforms = []
@ -1172,7 +1172,7 @@ def build_cg_shader(sname):
fd.write("\t};\n"); fd.write("\t};\n");
import glob import glob
def detect_modules(): def detect_modules():
@ -1371,7 +1371,7 @@ def save_active_platforms(apnames,ap):
str+="," str+=","
str+="};\n" str+="};\n"
wf = x+"/logo.h" wf = x+"/logo.h"
logow = open(wf,"wb") logow = open(wf,"wb")
logow.write(str) logow.write(str)

View file

@ -1,21 +1,21 @@
Import('env') Import('env')
env_modules = env.Clone() env_modules = env.Clone()
Export('env_modules') Export('env_modules')
env.modules_sources=[ env.modules_sources=[
"register_module_types.cpp", "register_module_types.cpp",
] ]
#env.add_source_files(env.modules_sources,"*.cpp") #env.add_source_files(env.modules_sources,"*.cpp")
Export('env') Export('env')
for x in env.module_list: for x in env.module_list:
if (x in env.disabled_modules): if (x in env.disabled_modules):
continue continue
env_modules.Append(CPPFLAGS=["-DMODULE_"+x.upper()+"_ENABLED"]) env_modules.Append(CPPFLAGS=["-DMODULE_"+x.upper()+"_ENABLED"])
SConscript(x+"/SCsub") SConscript(x+"/SCsub")
lib = env_modules.Library("modules",env.modules_sources) lib = env_modules.Library("modules",env.modules_sources)
env.Prepend(LIBS=[lib]) env.Prepend(LIBS=[lib])

View file

@ -2,10 +2,10 @@
def can_build(platform): def can_build(platform):
return True return True
def configure(env): def configure(env):
pass pass

View file

@ -2,10 +2,10 @@
def can_build(platform): def can_build(platform):
return True return True
def configure(env): def configure(env):
pass pass

View file

@ -5,7 +5,7 @@ import platform
def is_active(): def is_active():
return True return True
def get_name(): def get_name():
return "Android" return "Android"
@ -56,9 +56,9 @@ def configure(env):
# http://www.scons.org/wiki/LongCmdLinesOnWin32 # http://www.scons.org/wiki/LongCmdLinesOnWin32
import os import os
if (os.name=="nt"): if (os.name=="nt"):
import subprocess import subprocess
def mySubProcess(cmdline,env): def mySubProcess(cmdline,env):
#print "SPAWNED : " + cmdline #print "SPAWNED : " + cmdline
startupinfo = subprocess.STARTUPINFO() startupinfo = subprocess.STARTUPINFO()
@ -72,26 +72,26 @@ def configure(env):
print err print err
print "=====" print "====="
return rv return rv
def mySpawn(sh, escape, cmd, args, env): def mySpawn(sh, escape, cmd, args, env):
newargs = ' '.join(args[1:]) newargs = ' '.join(args[1:])
cmdline = cmd + " " + newargs cmdline = cmd + " " + newargs
rv=0 rv=0
if len(cmdline) > 32000 and cmd.endswith("ar") : if len(cmdline) > 32000 and cmd.endswith("ar") :
cmdline = cmd + " " + args[1] + " " + args[2] + " " cmdline = cmd + " " + args[1] + " " + args[2] + " "
for i in range(3,len(args)) : for i in range(3,len(args)) :
rv = mySubProcess( cmdline + args[i], env ) rv = mySubProcess( cmdline + args[i], env )
if rv : if rv :
break break
else: else:
rv = mySubProcess( cmdline, env ) rv = mySubProcess( cmdline, env )
return rv return rv
env['SPAWN'] = mySpawn env['SPAWN'] = mySpawn
ndk_platform=env['ndk_platform'] ndk_platform=env['ndk_platform']
if env['android_arch'] not in ['armv7','armv6','x86']: if env['android_arch'] not in ['armv7','armv6','x86']:
@ -114,7 +114,7 @@ def configure(env):
print("Godot Android!!!!! ("+env['android_arch']+")"+neon_text) print("Godot Android!!!!! ("+env['android_arch']+")"+neon_text)
env.Append(CPPPATH=['#platform/android']) env.Append(CPPPATH=['#platform/android'])
if env['android_arch']=='x86': if env['android_arch']=='x86':
env.extra_suffix=".x86"+env.extra_suffix env.extra_suffix=".x86"+env.extra_suffix
elif env['android_arch']=='armv6': elif env['android_arch']=='armv6':
@ -126,7 +126,7 @@ def configure(env):
env.extra_suffix=".armv7"+env.extra_suffix env.extra_suffix=".armv7"+env.extra_suffix
gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/"; gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/";
import os import os
if (sys.platform.find("linux")==0): if (sys.platform.find("linux")==0):
if (platform.architecture()[0]=='64bit' or os.path.isdir(gcc_path+"linux-x86_64/bin")): # check was not working if (platform.architecture()[0]=='64bit' or os.path.isdir(gcc_path+"linux-x86_64/bin")): # check was not working
@ -138,8 +138,8 @@ def configure(env):
env['SHLINKFLAGS'][1] = '-shared' env['SHLINKFLAGS'][1] = '-shared'
elif (os.name=="nt"): elif (os.name=="nt"):
gcc_path=gcc_path+"/windows-x86_64/bin" #this may be wrong gcc_path=gcc_path+"/windows-x86_64/bin" #this may be wrong
env['ENV']['PATH'] = gcc_path+":"+env['ENV']['PATH'] env['ENV']['PATH'] = gcc_path+":"+env['ENV']['PATH']
if env['android_arch']=='x86': if env['android_arch']=='x86':
@ -224,7 +224,7 @@ def configure(env):
elif env["android_arch"]=="armv7": elif env["android_arch"]=="armv7":
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include"]) env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include"])
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a"]) env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a"])
env.Append(LIBS=["gnustl_static","supc++"]) env.Append(LIBS=["gnustl_static","supc++"])
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"]) env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"])

View file

@ -6,7 +6,7 @@ import methods
def is_active(): def is_active():
return True return True
def get_name(): def get_name():
return "BlackBerry 10" return "BlackBerry 10"
@ -36,7 +36,7 @@ def get_flags():
('tools', 'no'), ('tools', 'no'),
('nedmalloc', 'no'), ('nedmalloc', 'no'),
('theora', 'no'), ('theora', 'no'),
] ]
def configure(env): def configure(env):

View file

@ -4,7 +4,7 @@ import string
def is_active(): def is_active():
return True return True
def get_name(): def get_name():
return "Flash" return "Flash"
@ -18,7 +18,7 @@ def can_build():
def get_opts(): def get_opts():
return [] return []
def get_flags(): def get_flags():
@ -52,7 +52,7 @@ def configure(env):
if (ccroot.find("/cygdrive")==0): if (ccroot.find("/cygdrive")==0):
unit = ccroot[ ccroot.find("/") + 1 ] unit = ccroot[ ccroot.find("/") + 1 ]
ccroot=ccroot.replace("/cygdrive/"+unit,unit+":") ccroot=ccroot.replace("/cygdrive/"+unit,unit+":")
env['FLASCC_ROOT'] = ccroot env['FLASCC_ROOT'] = ccroot
if env['PLATFORM'] == 'win32': if env['PLATFORM'] == 'win32':
import methods import methods
@ -71,11 +71,11 @@ def configure(env):
env['AR'] = ccroot+'/sdk/usr/bin/ar' env['AR'] = ccroot+'/sdk/usr/bin/ar'
env['LINK'] = ccroot+'/sdk/usr/bin/gcc' env['LINK'] = ccroot+'/sdk/usr/bin/gcc'
env['OBJSUFFIX'] = ".fl.o" env['OBJSUFFIX'] = ".fl.o"
env['LIBSUFFIX'] = ".fl.a" env['LIBSUFFIX'] = ".fl.a"
env['PROGSUFFIX'] = "_flash" env['PROGSUFFIX'] = "_flash"
#env["CXX"]='gcc-4' #env["CXX"]='gcc-4'
import string import string
#include path #include path

View file

@ -100,7 +100,7 @@ static int frame_count = 0;
int backingHeight; int backingHeight;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth); glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight); glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
OS::VideoMode vm; OS::VideoMode vm;
vm.fullscreen = true; vm.fullscreen = true;
@ -118,7 +118,7 @@ static int frame_count = 0;
NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *documentsDirectory = [paths objectAtIndex:0];
//NSString *documentsDirectory = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; //NSString *documentsDirectory = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
OSIPhone::get_singleton()->set_data_dir(String::utf8([documentsDirectory UTF8String])); OSIPhone::get_singleton()->set_data_dir(String::utf8([documentsDirectory UTF8String]));
NSString *locale_code = [[[NSLocale preferredLanguages] objectAtIndex:0] substringToIndex:2]; NSString *locale_code = [[[NSLocale preferredLanguages] objectAtIndex:0] substringToIndex:2];
OSIPhone::get_singleton()->set_locale(String::utf8([locale_code UTF8String])); OSIPhone::get_singleton()->set_locale(String::utf8([locale_code UTF8String]));
@ -218,7 +218,7 @@ static int frame_count = 0;
[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; [application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
// disable idle timer // disable idle timer
//application.idleTimerDisabled = YES; //application.idleTimerDisabled = YES;
//Create a full-screen window //Create a full-screen window
window = [[UIWindow alloc] initWithFrame:rect]; window = [[UIWindow alloc] initWithFrame:rect];
//window.autoresizesSubviews = YES; //window.autoresizesSubviews = YES;
@ -236,9 +236,9 @@ static int frame_count = 0;
int backingHeight; int backingHeight;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth); glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight); glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
iphone_main(backingWidth, backingHeight, gargc, gargv); iphone_main(backingWidth, backingHeight, gargc, gargv);
view_controller = [[ViewController alloc] init]; view_controller = [[ViewController alloc] init];
view_controller.view = glView; view_controller.view = glView;
window.rootViewController = view_controller; window.rootViewController = view_controller;
@ -248,7 +248,7 @@ static int frame_count = 0;
printf("cadisaplylink: %d", glView.useCADisplayLink); printf("cadisaplylink: %d", glView.useCADisplayLink);
glView.animationInterval = 1.0 / kRenderingFrequency; glView.animationInterval = 1.0 / kRenderingFrequency;
[glView startAnimation]; [glView startAnimation];
//Show the window //Show the window
[window makeKeyAndVisible]; [window makeKeyAndVisible];
@ -261,9 +261,9 @@ static int frame_count = 0;
//OSIPhone::screen_width = rect.size.width - rect.origin.x; //OSIPhone::screen_width = rect.size.width - rect.origin.x;
//OSIPhone::screen_height = rect.size.height - rect.origin.y; //OSIPhone::screen_height = rect.size.height - rect.origin.y;
mainViewController = view_controller; mainViewController = view_controller;
#ifdef MODULE_GAME_ANALYTICS_ENABLED #ifdef MODULE_GAME_ANALYTICS_ENABLED
printf("********************* didFinishLaunchingWithOptions\n"); printf("********************* didFinishLaunchingWithOptions\n");
if(!Globals::get_singleton()->has("mobileapptracker/advertiser_id")) if(!Globals::get_singleton()->has("mobileapptracker/advertiser_id"))
@ -274,24 +274,24 @@ static int frame_count = 0;
{ {
return; return;
} }
String adid = GLOBAL_DEF("mobileapptracker/advertiser_id",""); String adid = GLOBAL_DEF("mobileapptracker/advertiser_id","");
String convkey = GLOBAL_DEF("mobileapptracker/conversion_key",""); String convkey = GLOBAL_DEF("mobileapptracker/conversion_key","");
NSString * advertiser_id = [NSString stringWithUTF8String:adid.utf8().get_data()]; NSString * advertiser_id = [NSString stringWithUTF8String:adid.utf8().get_data()];
NSString * conversion_key = [NSString stringWithUTF8String:convkey.utf8().get_data()]; NSString * conversion_key = [NSString stringWithUTF8String:convkey.utf8().get_data()];
// Account Configuration info - must be set // Account Configuration info - must be set
[MobileAppTracker initializeWithMATAdvertiserId:advertiser_id [MobileAppTracker initializeWithMATAdvertiserId:advertiser_id
MATConversionKey:conversion_key]; MATConversionKey:conversion_key];
// Used to pass us the IFA, enables highly accurate 1-to-1 attribution. // Used to pass us the IFA, enables highly accurate 1-to-1 attribution.
// Required for many advertising networks. // Required for many advertising networks.
[MobileAppTracker setAppleAdvertisingIdentifier:[[ASIdentifierManager sharedManager] advertisingIdentifier] [MobileAppTracker setAppleAdvertisingIdentifier:[[ASIdentifierManager sharedManager] advertisingIdentifier]
advertisingTrackingEnabled:[[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]]; advertisingTrackingEnabled:[[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]];
#endif #endif
}; };
- (void)applicationWillTerminate:(UIApplication*)application { - (void)applicationWillTerminate:(UIApplication*)application {
@ -389,7 +389,7 @@ static int frame_count = 0;
[PFPush handlePush:userInfo]; [PFPush handlePush:userInfo];
NSDictionary *aps = [userInfo objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; NSDictionary *aps = [userInfo objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSLog(@"Push Notification Payload (app active) %@", aps); NSLog(@"Push Notification Payload (app active) %@", aps);
[defaults setObject:aps forKey:@"notificationInfo"]; [defaults setObject:aps forKey:@"notificationInfo"];
[defaults synchronize]; [defaults synchronize];

View file

@ -108,7 +108,7 @@ def configure(env):
if env['store_kit'] == 'yes': if env['store_kit'] == 'yes':
env.Append(CPPFLAGS=['-DSTOREKIT_ENABLED']) env.Append(CPPFLAGS=['-DSTOREKIT_ENABLED'])
env.Append(LINKFLAGS=['-framework', 'StoreKit']) env.Append(LINKFLAGS=['-framework', 'StoreKit'])
if env['icloud'] == 'yes': if env['icloud'] == 'yes':
env.Append(CPPFLAGS=['-DICLOUD_ENABLED']) env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
@ -117,7 +117,7 @@ def configure(env):
if (env["target"]=="release"): if (env["target"]=="release"):
env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1','-Wall', '-gdwarf-2']) # removed -ffast-math env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1','-Wall', '-gdwarf-2']) # removed -ffast-math
env.Append(LINKFLAGS=['-O3']) # env.Append(LINKFLAGS=['-O3']) #
elif env["target"] == "release_debug": elif env["target"] == "release_debug":
env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED'])
@ -151,7 +151,7 @@ def configure(env):
env.Append(CPPFLAGS=['-fno-exceptions']) env.Append(CPPFLAGS=['-fno-exceptions'])
#env['neon_enabled']=True #env['neon_enabled']=True
env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc' env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc'
import methods import methods
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )

View file

@ -94,10 +94,10 @@ Error GameCenter::connect() {
ret["error_description"] = [error.localizedDescription UTF8String]; ret["error_description"] = [error.localizedDescription UTF8String];
GameCenter::get_singleton()->connected = false; GameCenter::get_singleton()->connected = false;
}; };
pending_events.push_back(ret); pending_events.push_back(ret);
}; };
}); });
return OK; return OK;
@ -156,7 +156,7 @@ Error GameCenter::award_achievement(Variant p_params) {
if (params.has("show_completion_banner")) { if (params.has("show_completion_banner")) {
achievement.showsCompletionBanner = params["show_completion_banner"] ? YES : NO; achievement.showsCompletionBanner = params["show_completion_banner"] ? YES : NO;
} }
[GKAchievement reportAchievements:@[achievement] withCompletionHandler:^(NSError *error) { [GKAchievement reportAchievements:@[achievement] withCompletionHandler:^(NSError *error) {
Dictionary ret; Dictionary ret;
@ -189,30 +189,30 @@ void GameCenter::request_achievement_descriptions() {
IntArray maximum_points; IntArray maximum_points;
Array hidden; Array hidden;
Array replayable; Array replayable;
for (int i=0; i<[descriptions count]; i++) { for (int i=0; i<[descriptions count]; i++) {
GKAchievementDescription* description = [descriptions objectAtIndex:i]; GKAchievementDescription* description = [descriptions objectAtIndex:i];
const char* str = [description.identifier UTF8String]; const char* str = [description.identifier UTF8String];
names.push_back(String::utf8(str != NULL ? str : "")); names.push_back(String::utf8(str != NULL ? str : ""));
str = [description.title UTF8String]; str = [description.title UTF8String];
titles.push_back(String::utf8(str != NULL ? str : "")); titles.push_back(String::utf8(str != NULL ? str : ""));
str = [description.unachievedDescription UTF8String]; str = [description.unachievedDescription UTF8String];
unachieved_descriptions.push_back(String::utf8(str != NULL ? str : "")); unachieved_descriptions.push_back(String::utf8(str != NULL ? str : ""));
str = [description.achievedDescription UTF8String]; str = [description.achievedDescription UTF8String];
achieved_descriptions.push_back(String::utf8(str != NULL ? str : "")); achieved_descriptions.push_back(String::utf8(str != NULL ? str : ""));
maximum_points.push_back(description.maximumPoints); maximum_points.push_back(description.maximumPoints);
hidden.push_back(description.hidden == YES); hidden.push_back(description.hidden == YES);
replayable.push_back(description.replayable == YES); replayable.push_back(description.replayable == YES);
} }
ret["names"] = names; ret["names"] = names;
ret["titles"] = titles; ret["titles"] = titles;
ret["unachieved_descriptions"] = unachieved_descriptions; ret["unachieved_descriptions"] = unachieved_descriptions;
@ -220,7 +220,7 @@ void GameCenter::request_achievement_descriptions() {
ret["maximum_points"] = maximum_points; ret["maximum_points"] = maximum_points;
ret["hidden"] = hidden; ret["hidden"] = hidden;
ret["replayable"] = replayable; ret["replayable"] = replayable;
} else { } else {
ret["result"] = "error"; ret["result"] = "error";
ret["error_code"] = error.code; ret["error_code"] = error.code;
@ -241,19 +241,19 @@ void GameCenter::request_achievements() {
ret["result"] = "ok"; ret["result"] = "ok";
StringArray names; StringArray names;
RealArray percentages; RealArray percentages;
for (int i=0; i<[achievements count]; i++) { for (int i=0; i<[achievements count]; i++) {
GKAchievement* achievement = [achievements objectAtIndex:i]; GKAchievement* achievement = [achievements objectAtIndex:i];
const char* str = [achievement.identifier UTF8String]; const char* str = [achievement.identifier UTF8String];
names.push_back(String::utf8(str != NULL ? str : "")); names.push_back(String::utf8(str != NULL ? str : ""));
percentages.push_back(achievement.percentComplete); percentages.push_back(achievement.percentComplete);
} }
ret["names"] = names; ret["names"] = names;
ret["progress"] = percentages; ret["progress"] = percentages;
} else { } else {
ret["result"] = "error"; ret["result"] = "error";
ret["error_code"] = error.code; ret["error_code"] = error.code;
@ -275,7 +275,7 @@ void GameCenter::reset_achievements() {
ret["result"] = "error"; ret["result"] = "error";
ret["error_code"] = error.code; ret["error_code"] = error.code;
}; };
pending_events.push_back(ret); pending_events.push_back(ret);
}]; }];
}; };
@ -311,7 +311,7 @@ Error GameCenter::show_game_center(Variant p_params) {
ViewController *root_controller=(ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController; ViewController *root_controller=(ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController;
ERR_FAIL_COND_V(!root_controller, FAILED); ERR_FAIL_COND_V(!root_controller, FAILED);
controller.gameCenterDelegate = root_controller; controller.gameCenterDelegate = root_controller;
controller.viewState = view_state; controller.viewState = view_state;
if (view_state == GKGameCenterViewControllerStateLeaderboards) { if (view_state == GKGameCenterViewControllerStateLeaderboards) {
@ -322,14 +322,14 @@ Error GameCenter::show_game_center(Variant p_params) {
controller.leaderboardIdentifier = name_str; controller.leaderboardIdentifier = name_str;
} }
} }
[root_controller presentViewController: controller animated: YES completion:nil]; [root_controller presentViewController: controller animated: YES completion:nil];
return OK; return OK;
}; };
void GameCenter::game_center_closed() { void GameCenter::game_center_closed() {
Dictionary ret; Dictionary ret;
ret["type"] = "show_game_center"; ret["type"] = "show_game_center";
ret["result"] = "ok"; ret["result"] = "ok";

View file

@ -107,7 +107,7 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
{ {
NSString* language = [[track locale] localeIdentifier]; NSString* language = [[track locale] localeIdentifier];
NSLog(@"subtitle lang: %@", language); NSLog(@"subtitle lang: %@", language);
if ([language isEqualToString:[NSString stringWithUTF8String:p_audio_track.utf8()]]) if ([language isEqualToString:[NSString stringWithUTF8String:p_audio_track.utf8()]])
{ {
AVMutableAudioMixInputParameters *audioInputParams = [AVMutableAudioMixInputParameters audioMixInputParameters]; AVMutableAudioMixInputParameters *audioInputParams = [AVMutableAudioMixInputParameters audioMixInputParameters];
@ -132,7 +132,7 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
{ {
NSString* language = [[track locale] localeIdentifier]; NSString* language = [[track locale] localeIdentifier];
NSLog(@"subtitle lang: %@", language); NSLog(@"subtitle lang: %@", language);
if ([language isEqualToString:[NSString stringWithUTF8String:p_subtitle_track.utf8()]]) if ([language isEqualToString:[NSString stringWithUTF8String:p_subtitle_track.utf8()]])
{ {
[_instance.avPlayer.currentItem selectMediaOption:track inMediaSelectionGroup: subtitlesGroup]; [_instance.avPlayer.currentItem selectMediaOption:track inMediaSelectionGroup: subtitlesGroup];
@ -147,7 +147,7 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
bool _is_video_playing() { bool _is_video_playing() {
if (_instance.avPlayer.error) { if (_instance.avPlayer.error) {
printf("Error during playback\n"); printf("Error during playback\n");
} }
return (_instance.avPlayer.rate > 0 && !_instance.avPlayer.error); return (_instance.avPlayer.rate > 0 && !_instance.avPlayer.error);
} }
@ -257,7 +257,7 @@ static void clear_touches() {
if((self = [super initWithCoder:coder])) if((self = [super initWithCoder:coder]))
{ {
self = [self initGLES]; self = [self initGLES];
} }
return self; return self;
} }
@ -265,14 +265,14 @@ static void clear_touches() {
{ {
// Get our backing layer // Get our backing layer
CAEAGLLayer *eaglLayer = (CAEAGLLayer*) self.layer; CAEAGLLayer *eaglLayer = (CAEAGLLayer*) self.layer;
// Configure it so that it is opaque, does not retain the contents of the backbuffer when displayed, and uses RGBA8888 color. // Configure it so that it is opaque, does not retain the contents of the backbuffer when displayed, and uses RGBA8888 color.
eaglLayer.opaque = YES; eaglLayer.opaque = YES;
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking,
kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat,
nil]; nil];
// Create our EAGLContext, and if successful make it current and create our framebuffer. // Create our EAGLContext, and if successful make it current and create our framebuffer.
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
@ -281,7 +281,7 @@ static void clear_touches() {
[self release]; [self release];
return nil; return nil;
} }
// Default the animation interval to 1/60th of a second. // Default the animation interval to 1/60th of a second.
animationInterval = 1.0 / 60.0; animationInterval = 1.0 / 60.0;
return self; return self;
@ -327,17 +327,17 @@ static void clear_touches() {
glGenFramebuffersOES(1, &viewFramebuffer); glGenFramebuffersOES(1, &viewFramebuffer);
glGenRenderbuffersOES(1, &viewRenderbuffer); glGenRenderbuffersOES(1, &viewRenderbuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer); glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer); glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
// This call associates the storage for the current render buffer with the EAGLDrawable (our CAEAGLLayer) // This call associates the storage for the current render buffer with the EAGLDrawable (our CAEAGLLayer)
// allowing us to draw into a buffer that will later be rendered to screen whereever the layer is (which corresponds with our view). // allowing us to draw into a buffer that will later be rendered to screen whereever the layer is (which corresponds with our view).
[context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(id<EAGLDrawable>)self.layer]; [context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(id<EAGLDrawable>)self.layer];
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer); glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth); glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight); glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
// For this sample, we also need a depth buffer, so we'll create and attach one via another renderbuffer. // For this sample, we also need a depth buffer, so we'll create and attach one via another renderbuffer.
glGenRenderbuffersOES(1, &depthRenderbuffer); glGenRenderbuffersOES(1, &depthRenderbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer); glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
@ -371,7 +371,7 @@ static void clear_touches() {
viewFramebuffer = 0; viewFramebuffer = 0;
glDeleteRenderbuffersOES(1, &viewRenderbuffer); glDeleteRenderbuffersOES(1, &viewRenderbuffer);
viewRenderbuffer = 0; viewRenderbuffer = 0;
if(depthRenderbuffer) if(depthRenderbuffer)
{ {
glDeleteRenderbuffersOES(1, &depthRenderbuffer); glDeleteRenderbuffersOES(1, &depthRenderbuffer);
@ -461,21 +461,21 @@ static void clear_touches() {
// Make sure that you are drawing to the current context // Make sure that you are drawing to the current context
[EAGLContext setCurrentContext:context]; [EAGLContext setCurrentContext:context];
// If our drawing delegate needs to have the view setup, then call -setupView: and flag that it won't need to be called again. // If our drawing delegate needs to have the view setup, then call -setupView: and flag that it won't need to be called again.
if(!delegateSetup) if(!delegateSetup)
{ {
[delegate setupView:self]; [delegate setupView:self];
delegateSetup = YES; delegateSetup = YES;
} }
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer); glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
[delegate drawView:self]; [delegate drawView:self];
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer); glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES]; [context presentRenderbuffer:GL_RENDERBUFFER_OES];
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
GLenum err = glGetError(); GLenum err = glGetError();
if(err) if(err)
@ -487,9 +487,9 @@ static void clear_touches() {
{ {
NSArray* tlist = [[event allTouches] allObjects]; NSArray* tlist = [[event allTouches] allObjects];
for (unsigned int i=0; i< [tlist count]; i++) { for (unsigned int i=0; i< [tlist count]; i++) {
if ( [touches containsObject:[tlist objectAtIndex:i]] ) { if ( [touches containsObject:[tlist objectAtIndex:i]] ) {
UITouch* touch = [tlist objectAtIndex:i]; UITouch* touch = [tlist objectAtIndex:i];
if (touch.phase != UITouchPhaseBegan) if (touch.phase != UITouchPhaseBegan)
continue; continue;
@ -506,9 +506,9 @@ static void clear_touches() {
NSArray* tlist = [[event allTouches] allObjects]; NSArray* tlist = [[event allTouches] allObjects];
for (unsigned int i=0; i< [tlist count]; i++) { for (unsigned int i=0; i< [tlist count]; i++) {
if ( [touches containsObject:[tlist objectAtIndex:i]] ) { if ( [touches containsObject:[tlist objectAtIndex:i]] ) {
UITouch* touch = [tlist objectAtIndex:i]; UITouch* touch = [tlist objectAtIndex:i];
if (touch.phase != UITouchPhaseMoved) if (touch.phase != UITouchPhaseMoved)
continue; continue;
@ -527,9 +527,9 @@ static void clear_touches() {
{ {
NSArray* tlist = [[event allTouches] allObjects]; NSArray* tlist = [[event allTouches] allObjects];
for (unsigned int i=0; i< [tlist count]; i++) { for (unsigned int i=0; i< [tlist count]; i++) {
if ( [touches containsObject:[tlist objectAtIndex:i]] ) { if ( [touches containsObject:[tlist objectAtIndex:i]] ) {
UITouch* touch = [tlist objectAtIndex:i]; UITouch* touch = [tlist objectAtIndex:i];
if (touch.phase != UITouchPhaseEnded) if (touch.phase != UITouchPhaseEnded)
continue; continue;
@ -543,7 +543,7 @@ static void clear_touches() {
} }
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
OSIPhone::get_singleton()->touches_cancelled(); OSIPhone::get_singleton()->touches_cancelled();
clear_touches(); clear_touches();
}; };
@ -652,12 +652,12 @@ static void clear_touches() {
- (void)dealloc - (void)dealloc
{ {
[self stopAnimation]; [self stopAnimation];
if([EAGLContext currentContext] == context) if([EAGLContext currentContext] == context)
{ {
[EAGLContext setCurrentContext:nil]; [EAGLContext setCurrentContext:nil];
} }
[context release]; [context release];
context = nil; context = nil;
@ -673,8 +673,8 @@ static void clear_touches() {
video_found_error = true; video_found_error = true;
} }
if(_instance.avPlayer.status == AVPlayerStatusReadyToPlay && if(_instance.avPlayer.status == AVPlayerStatusReadyToPlay &&
_instance.avPlayerItem.status == AVPlayerItemStatusReadyToPlay && _instance.avPlayerItem.status == AVPlayerItemStatusReadyToPlay &&
CMTIME_COMPARE_INLINE(video_current_time, ==, kCMTimeZero)) { CMTIME_COMPARE_INLINE(video_current_time, ==, kCMTimeZero)) {
//NSLog(@"time: %@", video_current_time); //NSLog(@"time: %@", video_current_time);
@ -703,7 +703,7 @@ static void clear_touches() {
/* /*
- (void)moviePlayBackDidFinish:(NSNotification*)notification { - (void)moviePlayBackDidFinish:(NSNotification*)notification {
NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey]; NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
switch ([reason intValue]) { switch ([reason intValue]) {

View file

@ -49,7 +49,7 @@ void ICloud::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_key_value"),&ICloud::get_key_value); ObjectTypeDB::bind_method(_MD("get_key_value"),&ICloud::get_key_value);
ObjectTypeDB::bind_method(_MD("synchronize_key_values"),&ICloud::synchronize_key_values); ObjectTypeDB::bind_method(_MD("synchronize_key_values"),&ICloud::synchronize_key_values);
ObjectTypeDB::bind_method(_MD("get_all_key_values"),&ICloud::get_all_key_values); ObjectTypeDB::bind_method(_MD("get_all_key_values"),&ICloud::get_all_key_values);
ObjectTypeDB::bind_method(_MD("get_pending_event_count"),&ICloud::get_pending_event_count); ObjectTypeDB::bind_method(_MD("get_pending_event_count"),&ICloud::get_pending_event_count);
ObjectTypeDB::bind_method(_MD("pop_pending_event"),&ICloud::pop_pending_event); ObjectTypeDB::bind_method(_MD("pop_pending_event"),&ICloud::pop_pending_event);
}; };
@ -83,7 +83,7 @@ Variant nsobject_to_variant(NSObject* object) {
if ([data length] > 0) { if ([data length] > 0) {
ret.resize([data length]); ret.resize([data length]);
{ {
ByteArray::Write w = ret.write(); ByteArray::Write w = ret.write();
copymem(w.ptr(), [data bytes], [data length]); copymem(w.ptr(), [data bytes], [data length]);
} }
} }
@ -101,14 +101,14 @@ Variant nsobject_to_variant(NSObject* object) {
else if ([object isKindOfClass:[NSDictionary class]]) { else if ([object isKindOfClass:[NSDictionary class]]) {
Dictionary result; Dictionary result;
NSDictionary* dic = (NSDictionary*)object; NSDictionary* dic = (NSDictionary*)object;
NSArray* keys = [dic allKeys]; NSArray* keys = [dic allKeys];
int count = [keys count]; int count = [keys count];
for (int i=0; i < count; ++i) { for (int i=0; i < count; ++i) {
NSObject* k = [ keys objectAtIndex:i]; NSObject* k = [ keys objectAtIndex:i];
NSObject* v = [dic objectForKey:k]; NSObject* v = [dic objectForKey:k];
result[nsobject_to_variant(k)] = nsobject_to_variant(v); result[nsobject_to_variant(k)] = nsobject_to_variant(v);
} }
return result; return result;
@ -121,29 +121,29 @@ Variant nsobject_to_variant(NSObject* object) {
NSNumber* num = (NSNumber*)object; NSNumber* num = (NSNumber*)object;
if(strcmp([num objCType], @encode(BOOL)) == 0) { if(strcmp([num objCType], @encode(BOOL)) == 0) {
return Variant((int)[num boolValue]); return Variant((int)[num boolValue]);
} }
else if(strcmp([num objCType], @encode(char)) == 0) { else if(strcmp([num objCType], @encode(char)) == 0) {
return Variant((int)[num charValue]); return Variant((int)[num charValue]);
} }
else if(strcmp([num objCType], @encode(int)) == 0) { else if(strcmp([num objCType], @encode(int)) == 0) {
return Variant([num intValue]); return Variant([num intValue]);
} }
else if(strcmp([num objCType], @encode(unsigned int)) == 0) { else if(strcmp([num objCType], @encode(unsigned int)) == 0) {
return Variant((int)[num unsignedIntValue]); return Variant((int)[num unsignedIntValue]);
} }
else if(strcmp([num objCType], @encode(long long)) == 0) { else if(strcmp([num objCType], @encode(long long)) == 0) {
return Variant((int)[num longValue]); return Variant((int)[num longValue]);
} }
else if(strcmp([num objCType], @encode(float)) == 0) { else if(strcmp([num objCType], @encode(float)) == 0) {
return Variant([num floatValue]); return Variant([num floatValue]);
} }
else if(strcmp([num objCType], @encode(double)) == 0) { else if(strcmp([num objCType], @encode(double)) == 0) {
return Variant((float)[num doubleValue]); return Variant((float)[num doubleValue]);
} }
} }
else if ([object isKindOfClass:[NSDate class]]) { else if ([object isKindOfClass:[NSDate class]]) {
//this is a type that icloud supports...but how did you submit it in the first place? //this is a type that icloud supports...but how did you submit it in the first place?
//I guess this is a type that *might* show up, if you were, say, trying to make your game //I guess this is a type that *might* show up, if you were, say, trying to make your game
//compatible with existing cloud data written by another engine's version of your game //compatible with existing cloud data written by another engine's version of your game
WARN_PRINT("NSDate unsupported, returning null Variant") WARN_PRINT("NSDate unsupported, returning null Variant")
return Variant(); return Variant();
@ -177,13 +177,13 @@ NSObject* variant_to_nsobject(Variant v) {
for (unsigned int i = 0; i < keys.size(); ++i) { for (unsigned int i = 0; i < keys.size(); ++i) {
NSString* key = [[[NSString alloc] initWithUTF8String:((String)(keys[i])).utf8().get_data()] autorelease]; NSString* key = [[[NSString alloc] initWithUTF8String:((String)(keys[i])).utf8().get_data()] autorelease];
NSObject* value = variant_to_nsobject(dic[keys[i]]); NSObject* value = variant_to_nsobject(dic[keys[i]]);
if (key == NULL || value == NULL) { if (key == NULL || value == NULL) {
return NULL; return NULL;
} }
[result setObject:value forKey:key]; [result setObject:value forKey:key];
} }
return result; return result;
} }
else if (v.get_type() == Variant::ARRAY) { else if (v.get_type() == Variant::ARRAY) {
@ -213,13 +213,13 @@ NSObject* variant_to_nsobject(Variant v) {
Error ICloud::remove_key(Variant p_param) { Error ICloud::remove_key(Variant p_param) {
String param = p_param; String param = p_param;
NSString* key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease]; NSString* key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease];
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
if (![[store dictionaryRepresentation] objectForKey:key]) { if (![[store dictionaryRepresentation] objectForKey:key]) {
return ERR_INVALID_PARAMETER; return ERR_INVALID_PARAMETER;
} }
[store removeObjectForKey:key]; [store removeObjectForKey:key];
return OK; return OK;
} }
@ -228,26 +228,26 @@ Error ICloud::remove_key(Variant p_param) {
Variant ICloud::set_key_values(Variant p_params) { Variant ICloud::set_key_values(Variant p_params) {
Dictionary params = p_params; Dictionary params = p_params;
Array keys = params.keys(); Array keys = params.keys();
Array error_keys; Array error_keys;
for (unsigned int i = 0; i < keys.size(); ++i) { for (unsigned int i = 0; i < keys.size(); ++i) {
String variant_key = keys[i]; String variant_key = keys[i];
Variant variant_value = params[variant_key]; Variant variant_value = params[variant_key];
NSString* key = [[[NSString alloc] initWithUTF8String:variant_key.utf8().get_data()] autorelease]; NSString* key = [[[NSString alloc] initWithUTF8String:variant_key.utf8().get_data()] autorelease];
if (key == NULL) { if (key == NULL) {
error_keys.push_back(variant_key); error_keys.push_back(variant_key);
continue; continue;
} }
NSObject* value = variant_to_nsobject(variant_value); NSObject* value = variant_to_nsobject(variant_value);
if (value == NULL) { if (value == NULL) {
error_keys.push_back(variant_key); error_keys.push_back(variant_key);
continue; continue;
} }
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
[store setObject:value forKey:key]; [store setObject:value forKey:key];
} }
@ -257,37 +257,37 @@ Variant ICloud::set_key_values(Variant p_params) {
Variant ICloud::get_key_value(Variant p_param) { Variant ICloud::get_key_value(Variant p_param) {
String param = p_param; String param = p_param;
NSString* key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease]; NSString* key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease];
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
if (![[store dictionaryRepresentation] objectForKey:key]) { if (![[store dictionaryRepresentation] objectForKey:key]) {
return Variant(); return Variant();
} }
Variant result = nsobject_to_variant([[store dictionaryRepresentation] objectForKey:key]); Variant result = nsobject_to_variant([[store dictionaryRepresentation] objectForKey:key]);
return result; return result;
} }
Variant ICloud::get_all_key_values() { Variant ICloud::get_all_key_values() {
Dictionary result; Dictionary result;
NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore]; NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore];
NSDictionary* store_dictionary = [store dictionaryRepresentation]; NSDictionary* store_dictionary = [store dictionaryRepresentation];
NSArray* keys = [store_dictionary allKeys]; NSArray* keys = [store_dictionary allKeys];
int count = [keys count]; int count = [keys count];
for (int i=0; i < count; ++i) { for (int i=0; i < count; ++i) {
NSString* k = [ keys objectAtIndex:i]; NSString* k = [ keys objectAtIndex:i];
NSObject* v = [store_dictionary objectForKey:k]; NSObject* v = [store_dictionary objectForKey:k];
const char* str = [k UTF8String]; const char* str = [k UTF8String];
if (str != NULL) { if (str != NULL) {
result[String::utf8(str)] = nsobject_to_variant(v); result[String::utf8(str)] = nsobject_to_variant(v);
} }
} }
return result; return result;
} }
@ -320,7 +320,7 @@ ICloud::ICloud() {
ERR_FAIL_COND(instance != NULL); ERR_FAIL_COND(instance != NULL);
instance = this; instance = this;
//connected = false; //connected = false;
[ [
//[NSNotificationCenter defaultCenter] addObserverForName: @"notify" //[NSNotificationCenter defaultCenter] addObserverForName: @"notify"
[NSNotificationCenter defaultCenter] addObserverForName: NSUbiquitousKeyValueStoreDidChangeExternallyNotification [NSNotificationCenter defaultCenter] addObserverForName: NSUbiquitousKeyValueStoreDidChangeExternallyNotification
@ -337,7 +337,7 @@ ICloud::ICloud() {
//Array result_values; //Array result_values;
Dictionary keyValues; Dictionary keyValues;
String reason = ""; String reason = "";
if (change == NSUbiquitousKeyValueStoreServerChange) { if (change == NSUbiquitousKeyValueStoreServerChange) {
reason = "server"; reason = "server";
} }
@ -350,27 +350,27 @@ ICloud::ICloud() {
else if (change == NSUbiquitousKeyValueStoreAccountChange) { else if (change == NSUbiquitousKeyValueStoreAccountChange) {
reason = "account"; reason = "account";
} }
ret["reason"] = reason; ret["reason"] = reason;
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
NSArray * keys = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangedKeysKey]; NSArray * keys = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangedKeysKey];
for (NSString* key in keys) { for (NSString* key in keys) {
const char* str = [key UTF8String]; const char* str = [key UTF8String];
if (str == NULL) { if (str == NULL) {
continue; continue;
} }
NSObject* object = [store objectForKey:key]; NSObject* object = [store objectForKey:key];
//figure out what kind of object it is //figure out what kind of object it is
Variant value = nsobject_to_variant(object); Variant value = nsobject_to_variant(object);
keyValues[String::utf8(str)] = value; keyValues[String::utf8(str)] = value;
} }
ret["changed_values"] = keyValues; ret["changed_values"] = keyValues;
pending_events.push_back(ret); pending_events.push_back(ret);
} }

View file

@ -179,35 +179,35 @@ Error InAppStore::request_product_info(Variant p_params) {
ret["result"] = "ok"; ret["result"] = "ok";
ret["product_id"] = pid; ret["product_id"] = pid;
ret["transaction_id"] = transactionId; ret["transaction_id"] = transactionId;
NSData* receipt = nil; NSData* receipt = nil;
int sdk_version = 6; int sdk_version = 6;
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0){ if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0){
NSURL *receiptFileURL = nil; NSURL *receiptFileURL = nil;
NSBundle *bundle = [NSBundle mainBundle]; NSBundle *bundle = [NSBundle mainBundle];
if ([bundle respondsToSelector:@selector(appStoreReceiptURL)]) { if ([bundle respondsToSelector:@selector(appStoreReceiptURL)]) {
// Get the transaction receipt file path location in the app bundle. // Get the transaction receipt file path location in the app bundle.
receiptFileURL = [bundle appStoreReceiptURL]; receiptFileURL = [bundle appStoreReceiptURL];
// Read in the contents of the transaction file. // Read in the contents of the transaction file.
receipt = [NSData dataWithContentsOfURL:receiptFileURL]; receipt = [NSData dataWithContentsOfURL:receiptFileURL];
sdk_version = 7; sdk_version = 7;
} else { } else {
// Fall back to deprecated transaction receipt, // Fall back to deprecated transaction receipt,
// which is still available in iOS 7. // which is still available in iOS 7.
// Use SKPaymentTransaction's transactionReceipt. // Use SKPaymentTransaction's transactionReceipt.
receipt = transaction.transactionReceipt; receipt = transaction.transactionReceipt;
} }
}else{ }else{
receipt = transaction.transactionReceipt; receipt = transaction.transactionReceipt;
} }
NSString* receipt_to_send = nil; NSString* receipt_to_send = nil;
if (receipt != nil) if (receipt != nil)
{ {
@ -217,16 +217,16 @@ Error InAppStore::request_product_info(Variant p_params) {
receipt_ret["receipt"] = String::utf8(receipt_to_send != nil ? [receipt_to_send UTF8String] : ""); receipt_ret["receipt"] = String::utf8(receipt_to_send != nil ? [receipt_to_send UTF8String] : "");
receipt_ret["sdk"] = sdk_version; receipt_ret["sdk"] = sdk_version;
ret["receipt"] = receipt_ret; ret["receipt"] = receipt_ret;
InAppStore::get_singleton()->_post_event(ret); InAppStore::get_singleton()->_post_event(ret);
if (auto_finish_transactions){ if (auto_finish_transactions){
[[SKPaymentQueue defaultQueue] finishTransaction:transaction]; [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
} }
else{ else{
[pending_transactions setObject:transaction forKey:transaction.payment.productIdentifier]; [pending_transactions setObject:transaction forKey:transaction.payment.productIdentifier];
} }
#ifdef MODULE_FUSEBOXX_ENABLED #ifdef MODULE_FUSEBOXX_ENABLED
printf("Registering transaction on Fuseboxx!\n"); printf("Registering transaction on Fuseboxx!\n");
[FuseSDK registerInAppPurchase: transaction]; [FuseSDK registerInAppPurchase: transaction];
@ -251,7 +251,7 @@ Error InAppStore::request_product_info(Variant p_params) {
default: default:
printf("status default %i!\n", (int)transaction.transactionState); printf("status default %i!\n", (int)transaction.transactionState);
break; break;
}; };
}; };
@ -322,7 +322,7 @@ InAppStore::InAppStore() {
void InAppStore::finish_transaction(String product_id){ void InAppStore::finish_transaction(String product_id){
NSString* prod_id = [NSString stringWithCString:product_id.utf8().get_data() encoding:NSUTF8StringEncoding]; NSString* prod_id = [NSString stringWithCString:product_id.utf8().get_data() encoding:NSUTF8StringEncoding];
if ([pending_transactions objectForKey:prod_id]){ if ([pending_transactions objectForKey:prod_id]){
[[SKPaymentQueue defaultQueue] finishTransaction:[pending_transactions objectForKey:prod_id]]; [[SKPaymentQueue defaultQueue] finishTransaction:[pending_transactions objectForKey:prod_id]];
[pending_transactions removeObjectForKey:prod_id]; [pending_transactions removeObjectForKey:prod_id];

View file

@ -4,10 +4,10 @@ import sys
def is_active(): def is_active():
return False return False
def get_name(): def get_name():
return "iSIM" return "iSIM"
def can_build(): def can_build():

View file

@ -4,7 +4,7 @@ import string
def is_active(): def is_active():
return True return True
def get_name(): def get_name():
return "JavaScript" return "JavaScript"
@ -95,7 +95,7 @@ def configure(env):
env.Append(LINKFLAGS=['-s','ASM_JS=1']) env.Append(LINKFLAGS=['-s','ASM_JS=1'])
env.Append(LINKFLAGS=['-O2']) env.Append(LINKFLAGS=['-O2'])
#env.Append(LINKFLAGS=['-g4']) #env.Append(LINKFLAGS=['-g4'])
#print "CCCOM is:", env.subst('$CCCOM') #print "CCCOM is:", env.subst('$CCCOM')
#print "P: ", env['p'], " Platofrm: ", env['platform'] #print "P: ", env['p'], " Platofrm: ", env['platform']

View file

@ -3,7 +3,7 @@ import sys
def is_active(): def is_active():
return True return True
def get_name(): def get_name():
return "NaCl" return "NaCl"

View file

@ -5,7 +5,7 @@ import sys
def is_active(): def is_active():
return True return True
def get_name(): def get_name():
return "OSX" return "OSX"

View file

@ -47,9 +47,9 @@ DirAccess *DirAccessOSX::create_fs() {
} }
bool DirAccessOSX::list_dir_begin() { bool DirAccessOSX::list_dir_begin() {
list_dir_end(); //close any previous dir opening! list_dir_end(); //close any previous dir opening!
// char real_current_dir_name[2048]; //is this enough?! // char real_current_dir_name[2048]; //is this enough?!
//getcwd(real_current_dir_name,2048); //getcwd(real_current_dir_name,2048);
@ -63,7 +63,7 @@ bool DirAccessOSX::list_dir_begin() {
} }
bool DirAccessOSX::file_exists(String p_file) { bool DirAccessOSX::file_exists(String p_file) {
GLOBAL_LOCK_FUNCTION GLOBAL_LOCK_FUNCTION
@ -207,7 +207,7 @@ Error DirAccessOSX::make_dir(String p_dir) {
GLOBAL_LOCK_FUNCTION GLOBAL_LOCK_FUNCTION
p_dir=fix_path(p_dir); p_dir=fix_path(p_dir);
char real_current_dir_name[2048]; char real_current_dir_name[2048];
getcwd(real_current_dir_name,2048); getcwd(real_current_dir_name,2048);
chdir(current_dir.utf8().get_data()); //ascii since this may be unicode or wathever the host os wants chdir(current_dir.utf8().get_data()); //ascii since this may be unicode or wathever the host os wants
@ -326,7 +326,7 @@ size_t DirAccessOSX::get_space_left() {
#else #else
#warning THIS IS BROKEN #warning THIS IS BROKEN
return 0; return 0;
#endif #endif
}; };

View file

@ -50,7 +50,7 @@ static NSString *getApplicationName(void)
dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
if (dict) if (dict)
appName = [dict objectForKey: @"CFBundleName"]; appName = [dict objectForKey: @"CFBundleName"];
if (![appName length]) if (![appName length])
appName = [[NSProcessInfo processInfo] processName]; appName = [[NSProcessInfo processInfo] processName];
@ -67,10 +67,10 @@ static void setApplicationMenu(void)
NSMenuItem *menuItem; NSMenuItem *menuItem;
NSString *title; NSString *title;
NSString *appName; NSString *appName;
appName = getApplicationName(); appName = getApplicationName();
appleMenu = [[NSMenu alloc] initWithTitle:@""]; appleMenu = [[NSMenu alloc] initWithTitle:@""];
/* Add menu items */ /* Add menu items */
title = [@"About " stringByAppendingString:appName]; title = [@"About " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
@ -90,7 +90,7 @@ static void setApplicationMenu(void)
title = [@"Quit " stringByAppendingString:appName]; title = [@"Quit " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
/* Put menu into the menubar */ /* Put menu into the menubar */
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
[menuItem setSubmenu:appleMenu]; [menuItem setSubmenu:appleMenu];
@ -112,17 +112,17 @@ static void setupWindowMenu(void)
NSMenuItem *menuItem; NSMenuItem *menuItem;
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
/* "Minimize" item */ /* "Minimize" item */
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
[windowMenu addItem:menuItem]; [windowMenu addItem:menuItem];
[menuItem release]; [menuItem release];
/* Put menu into the menubar */ /* Put menu into the menubar */
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
[windowMenuItem setSubmenu:windowMenu]; [windowMenuItem setSubmenu:windowMenu];
[[NSApp mainMenu] addItem:windowMenuItem]; [[NSApp mainMenu] addItem:windowMenuItem];
/* Tell the application object that this is now the window menu */ /* Tell the application object that this is now the window menu */
[NSApp setWindowsMenu:windowMenu]; [NSApp setWindowsMenu:windowMenu];
@ -139,7 +139,7 @@ static void CustomApplicationMain (int argc, char **argv)
/* Ensure the application object is initialised */ /* Ensure the application object is initialised */
[NSApplication sharedApplication]; [NSApplication sharedApplication];
/* Set up the menubar */ /* Set up the menubar */
[NSApp setMainMenu:[[NSMenu alloc] init]]; [NSApp setMainMenu:[[NSMenu alloc] init]];
setApplicationMenu(); setApplicationMenu();
@ -147,10 +147,10 @@ static void CustomApplicationMain (int argc, char **argv)
main = [[main alloc] init]; main = [[main alloc] init];
[NSApp setDelegate:main]; [NSApp setDelegate:main];
/* Start the main event loop */ /* Start the main event loop */
[NSApp run]; [NSApp run];
[main release]; [main release];
[pool release]; [pool release];
} }

View file

@ -892,7 +892,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
NULL, keyboardLayoutChanged, NULL, keyboardLayoutChanged,
kTISNotifySelectedKeyboardInputSourceChanged, NULL, kTISNotifySelectedKeyboardInputSourceChanged, NULL,
CFNotificationSuspensionBehaviorDeliverImmediately); CFNotificationSuspensionBehaviorDeliverImmediately);
window_delegate = [[GodotWindowDelegate alloc] init]; window_delegate = [[GodotWindowDelegate alloc] init];
// Don't use accumulation buffer support; it's not accelerated // Don't use accumulation buffer support; it's not accelerated
@ -1170,7 +1170,7 @@ void OS_OSX::warp_mouse_pos(const Point2& p_to) {
mouse_y = p_to.y; mouse_y = p_to.y;
} }
else{ //set OS position else{ //set OS position
/* this code has not been tested, please be a kind soul and fix it if it fails! */ /* this code has not been tested, please be a kind soul and fix it if it fails! */
//local point in window coords //local point in window coords

View file

@ -1,11 +1,11 @@
import os import os
import sys import sys
def is_active(): def is_active():
return True return True
def get_name(): def get_name():
return "Server" return "Server"
@ -16,20 +16,20 @@ def can_build():
return False return False
return True # enabled return True # enabled
def get_opts(): def get_opts():
return [ return [
('use_llvm','Use llvm compiler','no'), ('use_llvm','Use llvm compiler','no'),
('force_32_bits','Force 32 bits binary','no') ('force_32_bits','Force 32 bits binary','no')
] ]
def get_flags(): def get_flags():
return [ return [
('builtin_zlib', 'no'), ('builtin_zlib', 'no'),
] ]
def configure(env): def configure(env):

View file

@ -1,4 +1,4 @@
# #
# tested on | Windows native | Linux cross-compilation # tested on | Windows native | Linux cross-compilation
# ------------------------+-------------------+--------------------------- # ------------------------+-------------------+---------------------------
# MSVS C++ 2010 Express | WORKS | n/a # MSVS C++ 2010 Express | WORKS | n/a
@ -24,11 +24,11 @@
# ( example : "C:/Mingw-w32", "C:/Mingw-w64" ) # ( example : "C:/Mingw-w32", "C:/Mingw-w64" )
# #
# - if you want to compile faster using the "-j" option, don't forget # - if you want to compile faster using the "-j" option, don't forget
# to install the appropriate version of the Pywin32 python extension # to install the appropriate version of the Pywin32 python extension
# available from : http://sourceforge.net/projects/pywin32/files/ # available from : http://sourceforge.net/projects/pywin32/files/
# #
# - before running scons, you must add into the environment path # - before running scons, you must add into the environment path
# the path to the "/bin" directory of the Mingw version you want # the path to the "/bin" directory of the Mingw version you want
# to use : # to use :
# #
# set PATH=C:/Mingw-w32/bin;%PATH% # set PATH=C:/Mingw-w32/bin;%PATH%
@ -37,9 +37,9 @@
# - Mingw-w32 only compiles 32bits. # - Mingw-w32 only compiles 32bits.
# - Mingw-w64 only compiles 64bits. # - Mingw-w64 only compiles 64bits.
# #
# - it is possible to add them both at the same time into the PATH env, # - it is possible to add them both at the same time into the PATH env,
# if you also define the MINGW32_PREFIX and MINGW64_PREFIX environment # if you also define the MINGW32_PREFIX and MINGW64_PREFIX environment
# variables. # variables.
# For instance, you could store that set of commands into a .bat script # For instance, you could store that set of commands into a .bat script
# that you would run just before scons : # that you would run just before scons :
# #
@ -61,14 +61,14 @@
# #
# - it is possible to manually override prefixes by defining # - it is possible to manually override prefixes by defining
# the MINGW32_PREFIX and MINGW64_PREFIX environment variables. # the MINGW32_PREFIX and MINGW64_PREFIX environment variables.
# #
##### #####
# Notes about Mingw under Windows : # Notes about Mingw under Windows :
# #
# - this is the MinGW version from http://mingw.org/ # - this is the MinGW version from http://mingw.org/
# - install it into a path that does not contain spaces # - install it into a path that does not contain spaces
# ( example : "C:/MinGW" ) # ( example : "C:/MinGW" )
# - several DirectX headers might be missing. You can copy them into # - several DirectX headers might be missing. You can copy them into
# the C:/MinGW/include" directory from this page : # the C:/MinGW/include" directory from this page :
# https://code.google.com/p/mingw-lib/source/browse/trunk/working/avcodec_to_widget_5/directx_include/ # https://code.google.com/p/mingw-lib/source/browse/trunk/working/avcodec_to_widget_5/directx_include/
# - before running scons, add the path to the "/bin" directory : # - before running scons, add the path to the "/bin" directory :
@ -84,7 +84,7 @@
# - confirm it works well with other Visual Studio versions. # - confirm it works well with other Visual Studio versions.
# - update the wiki about the pywin32 extension required for the "-j" option under Windows. # - update the wiki about the pywin32 extension required for the "-j" option under Windows.
# - update the wiki to document MINGW32_PREFIX and MINGW64_PREFIX # - update the wiki to document MINGW32_PREFIX and MINGW64_PREFIX
# #
import os import os
@ -93,16 +93,16 @@ import sys
def is_active(): def is_active():
return True return True
def get_name(): def get_name():
return "Windows" return "Windows"
def can_build(): def can_build():
if (os.name=="nt"): if (os.name=="nt"):
#building natively on windows! #building natively on windows!
if (os.getenv("VSINSTALLDIR")): if (os.getenv("VSINSTALLDIR")):
return True return True
else: else:
print("\nMSVC not detected, attempting Mingw.") print("\nMSVC not detected, attempting Mingw.")
mingw32 = "" mingw32 = ""
@ -111,7 +111,7 @@ def can_build():
mingw32 = os.getenv("MINGW32_PREFIX") mingw32 = os.getenv("MINGW32_PREFIX")
if ( os.getenv("MINGW64_PREFIX") ) : if ( os.getenv("MINGW64_PREFIX") ) :
mingw64 = os.getenv("MINGW64_PREFIX") mingw64 = os.getenv("MINGW64_PREFIX")
test = "gcc --version > NUL 2>&1" test = "gcc --version > NUL 2>&1"
if os.system(test)!= 0 and os.system(mingw32+test)!=0 and os.system(mingw64+test)!=0 : if os.system(test)!= 0 and os.system(mingw32+test)!=0 and os.system(mingw64+test)!=0 :
print("- could not detect gcc.") print("- could not detect gcc.")
@ -119,27 +119,27 @@ def can_build():
return False return False
else: else:
print("- gcc detected.") print("- gcc detected.")
return True return True
if (os.name=="posix"): if (os.name=="posix"):
mingw = "i586-mingw32msvc-" mingw = "i586-mingw32msvc-"
mingw64 = "x86_64-w64-mingw32-" mingw64 = "x86_64-w64-mingw32-"
mingw32 = "i686-w64-mingw32-" mingw32 = "i686-w64-mingw32-"
if (os.getenv("MINGW32_PREFIX")): if (os.getenv("MINGW32_PREFIX")):
mingw32=os.getenv("MINGW32_PREFIX") mingw32=os.getenv("MINGW32_PREFIX")
mingw = mingw32 mingw = mingw32
if (os.getenv("MINGW64_PREFIX")): if (os.getenv("MINGW64_PREFIX")):
mingw64=os.getenv("MINGW64_PREFIX") mingw64=os.getenv("MINGW64_PREFIX")
test = "gcc --version &>/dev/null" test = "gcc --version &>/dev/null"
if (os.system(mingw+test) == 0 or os.system(mingw64+test) == 0 or os.system(mingw32+test) == 0): if (os.system(mingw+test) == 0 or os.system(mingw64+test) == 0 or os.system(mingw32+test) == 0):
return True return True
return False return False
def get_opts(): def get_opts():
mingw="" mingw=""
@ -149,10 +149,10 @@ def get_opts():
mingw = "i586-mingw32msvc-" mingw = "i586-mingw32msvc-"
mingw32 = "i686-w64-mingw32-" mingw32 = "i686-w64-mingw32-"
mingw64 = "x86_64-w64-mingw32-" mingw64 = "x86_64-w64-mingw32-"
if os.system(mingw32+"gcc --version &>/dev/null") != 0 : if os.system(mingw32+"gcc --version &>/dev/null") != 0 :
mingw32 = mingw mingw32 = mingw
if (os.getenv("MINGW32_PREFIX")): if (os.getenv("MINGW32_PREFIX")):
mingw32=os.getenv("MINGW32_PREFIX") mingw32=os.getenv("MINGW32_PREFIX")
mingw = mingw32 mingw = mingw32
@ -164,14 +164,14 @@ def get_opts():
('mingw_prefix','Mingw Prefix',mingw32), ('mingw_prefix','Mingw Prefix',mingw32),
('mingw_prefix_64','Mingw Prefix 64 bits',mingw64), ('mingw_prefix_64','Mingw Prefix 64 bits',mingw64),
] ]
def get_flags(): def get_flags():
return [ return [
('freetype','builtin'), #use builtin freetype ('freetype','builtin'), #use builtin freetype
('openssl','builtin'), #use builtin openssl ('openssl','builtin'), #use builtin openssl
] ]
def build_res_file( target, source, env ): def build_res_file( target, source, env ):
cmdbase = "" cmdbase = ""
@ -245,7 +245,7 @@ def configure(env):
env.Append(CCFLAGS=['/DGLEW_ENABLED']) env.Append(CCFLAGS=['/DGLEW_ENABLED'])
LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32', 'shell32','advapi32','dinput8','dxguid'] LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32', 'shell32','advapi32','dinput8','dxguid']
env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS]) env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS])
env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"]) env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"])
if (os.getenv("DXSDK_DIR")): if (os.getenv("DXSDK_DIR")):
DIRECTX_PATH=os.getenv("DXSDK_DIR") DIRECTX_PATH=os.getenv("DXSDK_DIR")
@ -304,7 +304,7 @@ def configure(env):
# sys.exit(255) # sys.exit(255)
if (env["target"]=="release"): if (env["target"]=="release"):
env.Append(CCFLAGS=['-msse2']) env.Append(CCFLAGS=['-msse2'])
if (env["bits"]=="64"): if (env["bits"]=="64"):
@ -319,7 +319,7 @@ def configure(env):
env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED']) env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
elif (env["target"]=="debug"): elif (env["target"]=="debug"):
env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
if (env["freetype"]!="no"): if (env["freetype"]!="no"):
@ -366,4 +366,4 @@ def configure(env):
env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } ) 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') } ) env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )

View file

@ -2,13 +2,13 @@
import os import os
import sys import sys
import string import string
def is_active(): def is_active():
return True return True
def get_name(): def get_name():
return "WinRT" return "WinRT"
@ -16,12 +16,12 @@ def can_build():
if (os.name=="nt"): if (os.name=="nt"):
#building natively on windows! #building natively on windows!
if (os.getenv("VSINSTALLDIR")): if (os.getenv("VSINSTALLDIR")):
return True return True
return False return False
def get_opts(): def get_opts():
return [] return []
def get_flags(): def get_flags():
return [] return []

View file

@ -1,12 +1,12 @@
import os import os
import sys import sys
import platform import platform
def is_active(): def is_active():
return True return True
def get_name(): def get_name():
return "X11" return "X11"
@ -20,11 +20,11 @@ def can_build():
return False # no x11 on mac for now return False # no x11 on mac for now
errorval=os.system("pkg-config --version > /dev/null") errorval=os.system("pkg-config --version > /dev/null")
if (errorval): if (errorval):
print("pkg-config not found.. x11 disabled.") print("pkg-config not found.. x11 disabled.")
return False return False
x11_error=os.system("pkg-config x11 --modversion > /dev/null ") x11_error=os.system("pkg-config x11 --modversion > /dev/null ")
if (x11_error): if (x11_error):
print("X11 not found.. x11 disabled.") print("X11 not found.. x11 disabled.")
@ -39,7 +39,7 @@ def can_build():
if (x11_error): if (x11_error):
print("xcursor not found.. x11 disabled.") print("xcursor not found.. x11 disabled.")
return False return False
x11_error=os.system("pkg-config xinerama --modversion > /dev/null ") x11_error=os.system("pkg-config xinerama --modversion > /dev/null ")
if (x11_error): if (x11_error):
print("xinerama not found.. x11 disabled.") print("xinerama not found.. x11 disabled.")
@ -47,7 +47,7 @@ def can_build():
return True # X11 enabled return True # X11 enabled
def get_opts(): def get_opts():
return [ return [
@ -60,7 +60,7 @@ def get_opts():
('new_wm_api', 'Use experimental window management API','no'), ('new_wm_api', 'Use experimental window management API','no'),
('debug_release', 'Add debug symbols to release version','no'), ('debug_release', 'Add debug symbols to release version','no'),
] ]
def get_flags(): def get_flags():
return [ return [
@ -68,7 +68,7 @@ def get_flags():
("openssl", "yes"), ("openssl", "yes"),
#("theora","no"), #("theora","no"),
] ]
def configure(env): def configure(env):

View file

@ -38,7 +38,7 @@ while (fname!=""):
l = fr.readline() l = fr.readline()
bc=False bc=False
fsingle = fname.strip() fsingle = fname.strip()
if (fsingle.find("/")!=-1): if (fsingle.find("/")!=-1):
fsingle=fsingle[fsingle.rfind("/")+1:] fsingle=fsingle[fsingle.rfind("/")+1:]
rep_fl="$filename" rep_fl="$filename"
@ -51,19 +51,19 @@ while (fname!=""):
elif (len_fl<len_fi): elif (len_fl<len_fi):
for x in range(len_fi-len_fl): for x in range(len_fi-len_fl):
rep_fl+=" " rep_fl+=" "
if (header.find(rep_fl)!=-1): if (header.find(rep_fl)!=-1):
text=header.replace(rep_fl,rep_fi) text=header.replace(rep_fl,rep_fi)
else: else:
text=header.replace("$filename",fsingle) text=header.replace("$filename",fsingle)
while (l!=""): while (l!=""):
if ((l.find("//")!=0 and l.find("/*")!=0 and l.strip()!="") or bc): if ((l.find("//")!=0 and l.find("/*")!=0 and l.strip()!="") or bc):
text+=l text+=l
bc=True bc=True
l=fr.readline() l=fr.readline()
fr.close() fr.close()
fr=open(fname.strip(),"wb") fr=open(fname.strip(),"wb")
fr.write(text) fr.write(text)
fr.close() fr.close()

View file

@ -4,7 +4,7 @@ import sys
if (len(sys.argv)!=2): if (len(sys.argv)!=2):
print("Pass me a .fnt argument!") print("Pass me a .fnt argument!")
f = open(sys.argv[1],"rb") f = open(sys.argv[1],"rb")
name = sys.argv[1].lower().replace(".fnt","") name = sys.argv[1].lower().replace(".fnt","")
@ -24,7 +24,7 @@ while(l!=""):
l=f.readline() l=f.readline()
continue continue
t = l[0:fs] t = l[0:fs]
dv = l[fs+1:].split(" ") dv = l[fs+1:].split(" ")
d = {} d = {}
for x in dv: for x in dv:
@ -32,12 +32,12 @@ while(l!=""):
continue continue
s = x.split("=") s = x.split("=")
d[ s[0] ] = s[1] d[ s[0] ] = s[1]
if (t=="common"): if (t=="common"):
font_height=d["lineHeight"] font_height=d["lineHeight"]
font_ascent=d["base"] font_ascent=d["base"]
if (t=="char"): if (t=="char"):
font_chars.append(d["id"]) font_chars.append(d["id"])
font_chars.append(d["x"]) font_chars.append(d["x"])
@ -48,11 +48,11 @@ while(l!=""):
font_chars.append(d["yoffset"]) font_chars.append(d["yoffset"])
font_chars.append(d["xadvance"]) font_chars.append(d["xadvance"])
font_cc+=1 font_cc+=1
l = f.readline() l = f.readline()
print("static const int _bi_font_"+name+"_height="+str(font_height)+";") print("static const int _bi_font_"+name+"_height="+str(font_height)+";")
print("static const int _bi_font_"+name+"_ascent="+str(font_ascent)+";") print("static const int _bi_font_"+name+"_ascent="+str(font_ascent)+";")
@ -60,11 +60,11 @@ print("static const int _bi_font_"+name+"_charcount="+str(font_cc)+";")
cstr="static const int _bi_font_"+name+"_characters={" cstr="static const int _bi_font_"+name+"_characters={"
for i in range(len(font_chars)): for i in range(len(font_chars)):
c=font_chars[i] c=font_chars[i]
if (i>0): if (i>0):
cstr+=", " cstr+=", "
cstr+=c cstr+=c
cstr+=("};") cstr+=("};")
print(cstr) print(cstr)

View file

@ -10,29 +10,29 @@ f.write("#include \"editor_icons.h\"\n\n")
f.write("#include \"scene/resources/theme.h\"\n\n") f.write("#include \"scene/resources/theme.h\"\n\n")
for x in pixmaps: for x in pixmaps:
var_str=x[:-4]+"_png"; var_str=x[:-4]+"_png";
f.write("static const unsigned char "+ var_str +"[]={\n"); f.write("static const unsigned char "+ var_str +"[]={\n");
pngf=open(x,"rb"); pngf=open(x,"rb");
b=pngf.read(1); b=pngf.read(1);
while(len(b)==1): while(len(b)==1):
f.write(hex(ord(b))) f.write(hex(ord(b)))
b=pngf.read(1); b=pngf.read(1);
if (len(b)==1): if (len(b)==1):
f.write(",") f.write(",")
f.write("\n};\n\n\n"); f.write("\n};\n\n\n");
pngf.close(); pngf.close();
f.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png) {\n") f.write("static Ref<ImageTexture> make_icon(const uint8_t* p_png) {\n")
f.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n") f.write("\tRef<ImageTexture> texture( memnew( ImageTexture ) );\n")
f.write("\ttexture->create_from_image( Image(p_png),ImageTexture::FLAG_FILTER );\n") f.write("\ttexture->create_from_image( Image(p_png),ImageTexture::FLAG_FILTER );\n")
f.write("\treturn texture;\n") f.write("\treturn texture;\n")
f.write("}\n\n") f.write("}\n\n")
f.write("void editor_register_icons(Ref<Theme> p_theme) {\n\n") f.write("void editor_register_icons(Ref<Theme> p_theme) {\n\n")

View file

@ -41,9 +41,9 @@ class godot_export_manager(bpy.types.Panel):
bl_space_type = 'PROPERTIES' bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW' bl_region_type = 'WINDOW'
bl_context = "scene" bl_context = "scene"
bpy.types.Scene.godot_export_on_save = BoolProperty(default=False) bpy.types.Scene.godot_export_on_save = BoolProperty(default=False)
### draw function for all ui elements ### draw function for all ui elements
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@ -51,56 +51,56 @@ class godot_export_manager(bpy.types.Panel):
scene = bpy.data.scenes[0] scene = bpy.data.scenes[0]
ob = context.object ob = context.object
scene = context.scene scene = context.scene
row = layout.row() row = layout.row()
col = row.column() col = row.column()
col.prop(scene,"godot_export_on_save",text="Export Groups on save") col.prop(scene,"godot_export_on_save",text="Export Groups on save")
row = layout.row() row = layout.row()
col = row.column(align=True) col = row.column(align=True)
op = col.operator("scene.godot_add_objects_to_group",text="Add selected objects to Group",icon="COPYDOWN") op = col.operator("scene.godot_add_objects_to_group",text="Add selected objects to Group",icon="COPYDOWN")
op = col.operator("scene.godot_delete_objects_from_group",text="Delete selected objects from Group",icon="PASTEDOWN") op = col.operator("scene.godot_delete_objects_from_group",text="Delete selected objects from Group",icon="PASTEDOWN")
row = layout.row() row = layout.row()
col = row.column() col = row.column()
col.label(text="Export Groups:") col.label(text="Export Groups:")
row = layout.row() row = layout.row()
col = row.column() col = row.column()
col.template_list("UI_List_Godot","dummy",scene, "godot_export_groups", scene, "godot_export_groups_index",rows=1,maxrows=10,type='DEFAULT') col.template_list("UI_List_Godot","dummy",scene, "godot_export_groups", scene, "godot_export_groups_index",rows=1,maxrows=10,type='DEFAULT')
col = row.column(align=True) col = row.column(align=True)
col.operator("scene.godot_add_export_group",text="",icon="ZOOMIN") col.operator("scene.godot_add_export_group",text="",icon="ZOOMIN")
col.operator("scene.godot_delete_export_group",text="",icon="ZOOMOUT") col.operator("scene.godot_delete_export_group",text="",icon="ZOOMOUT")
col.operator("scene.godot_export_all_groups",text="",icon="EXPORT") col.operator("scene.godot_export_all_groups",text="",icon="EXPORT")
if len(scene.godot_export_groups) > 0: if len(scene.godot_export_groups) > 0:
row = layout.row() row = layout.row()
col = row.column() col = row.column()
group = scene.godot_export_groups[scene.godot_export_groups_index] group = scene.godot_export_groups[scene.godot_export_groups_index]
col.prop(group,"name",text="Group Name") col.prop(group,"name",text="Group Name")
col.prop(group,"export_name",text="Export Name") col.prop(group,"export_name",text="Export Name")
col.prop(group,"export_path",text="Export Filepath") col.prop(group,"export_path",text="Export Filepath")
row = layout.row() row = layout.row()
col = row.column() col = row.column()
row = layout.row() row = layout.row()
col = row.column() col = row.column()
col.label(text="Export Settings:") col.label(text="Export Settings:")
col = col.row(align=True) col = col.row(align=True)
col.prop(group,"apply_loc",toggle=True,icon="MAN_TRANS") col.prop(group,"apply_loc",toggle=True,icon="MAN_TRANS")
col.prop(group,"apply_rot",toggle=True,icon="MAN_ROT") col.prop(group,"apply_rot",toggle=True,icon="MAN_ROT")
col.prop(group,"apply_scale",toggle=True,icon="MAN_SCALE") col.prop(group,"apply_scale",toggle=True,icon="MAN_SCALE")
row = layout.row() row = layout.row()
col = row.column() col = row.column()
col.prop(group,"use_include_particle_duplicates") col.prop(group,"use_include_particle_duplicates")
col.prop(group,"use_mesh_modifiers") col.prop(group,"use_mesh_modifiers")
col.prop(group,"use_tangent_arrays") col.prop(group,"use_tangent_arrays")
@ -120,25 +120,25 @@ class UI_List_Godot(bpy.types.UIList):
ob = data ob = data
slot = item slot = item
col = layout.row(align=True) col = layout.row(align=True)
col.label(text=item.name,icon="GROUP") col.label(text=item.name,icon="GROUP")
col.prop(item,"active",text="") col.prop(item,"active",text="")
op = col.operator("scene.godot_select_group_objects",text="",emboss=False,icon="RESTRICT_SELECT_OFF") op = col.operator("scene.godot_select_group_objects",text="",emboss=False,icon="RESTRICT_SELECT_OFF")
op.idx = index op.idx = index
op = col.operator("scene.godot_export_group",text="",emboss=False,icon="EXPORT") op = col.operator("scene.godot_export_group",text="",emboss=False,icon="EXPORT")
op.idx = index op.idx = index
class add_objects_to_group(bpy.types.Operator): class add_objects_to_group(bpy.types.Operator):
bl_idname = "scene.godot_add_objects_to_group" bl_idname = "scene.godot_add_objects_to_group"
bl_label = "Add Objects to Group" bl_label = "Add Objects to Group"
bl_description = "Adds the selected Objects to the active group below." bl_description = "Adds the selected Objects to the active group below."
undo = BoolProperty(default=True) undo = BoolProperty(default=True)
def execute(self,context): def execute(self,context):
scene = context.scene scene = context.scene
objects_str = "" objects_str = ""
if len(scene.godot_export_groups) > 0: if len(scene.godot_export_groups) > 0:
for i,object in enumerate(context.selected_objects): for i,object in enumerate(context.selected_objects):
@ -148,57 +148,57 @@ class add_objects_to_group(bpy.types.Operator):
if i == 0: if i == 0:
objects_str += object.name objects_str += object.name
else: else:
objects_str += ", "+object.name objects_str += ", "+object.name
self.report({'INFO'}, objects_str + " added to group." ) self.report({'INFO'}, objects_str + " added to group." )
if self.undo: if self.undo:
bpy.ops.ed.undo_push(message="Objects added to group") bpy.ops.ed.undo_push(message="Objects added to group")
else: else:
self.report({'WARNING'}, "Create a group first." ) self.report({'WARNING'}, "Create a group first." )
return{'FINISHED'} return{'FINISHED'}
class del_objects_from_group(bpy.types.Operator): class del_objects_from_group(bpy.types.Operator):
bl_idname = "scene.godot_delete_objects_from_group" bl_idname = "scene.godot_delete_objects_from_group"
bl_label = "Delete Objects from Group" bl_label = "Delete Objects from Group"
bl_description = "Delets the selected Objects from the active group below." bl_description = "Delets the selected Objects from the active group below."
def execute(self,context): def execute(self,context):
scene = context.scene scene = context.scene
if len(scene.godot_export_groups) > 0: if len(scene.godot_export_groups) > 0:
selected_objects = [] selected_objects = []
for object in context.selected_objects: for object in context.selected_objects:
selected_objects.append(object.name) selected_objects.append(object.name)
objects_str = "" objects_str = ""
j = 0 j = 0
for i,node in enumerate(scene.godot_export_groups[scene.godot_export_groups_index].nodes): for i,node in enumerate(scene.godot_export_groups[scene.godot_export_groups_index].nodes):
if node.name in selected_objects: if node.name in selected_objects:
scene.godot_export_groups[scene.godot_export_groups_index].nodes.remove(i) scene.godot_export_groups[scene.godot_export_groups_index].nodes.remove(i)
if j == 0: if j == 0:
objects_str += object.name objects_str += object.name
else: else:
objects_str += ", "+object.name objects_str += ", "+object.name
j+=1 j+=1
self.report({'INFO'}, objects_str + " deleted from group." ) self.report({'INFO'}, objects_str + " deleted from group." )
bpy.ops.ed.undo_push(message="Objects deleted from group") bpy.ops.ed.undo_push(message="Objects deleted from group")
else: else:
self.report({'WARNING'}, "There is no group to delete from." ) self.report({'WARNING'}, "There is no group to delete from." )
return{'FINISHED'} return{'FINISHED'}
class select_group_objects(bpy.types.Operator): class select_group_objects(bpy.types.Operator):
bl_idname = "scene.godot_select_group_objects" bl_idname = "scene.godot_select_group_objects"
bl_label = "Select Group Objects" bl_label = "Select Group Objects"
bl_description = "Will select all group Objects in the scene." bl_description = "Will select all group Objects in the scene."
idx = IntProperty() idx = IntProperty()
def execute(self,context): def execute(self,context):
scene = context.scene scene = context.scene
for object in context.scene.objects: for object in context.scene.objects:
@ -208,12 +208,12 @@ class select_group_objects(bpy.types.Operator):
bpy.data.objects[node.name].select = True bpy.data.objects[node.name].select = True
context.scene.objects.active = bpy.data.objects[node.name] context.scene.objects.active = bpy.data.objects[node.name]
return{'FINISHED'} return{'FINISHED'}
class export_groups_autosave(bpy.types.Operator): class export_groups_autosave(bpy.types.Operator):
bl_idname = "scene.godot_export_groups_autosave" bl_idname = "scene.godot_export_groups_autosave"
bl_label = "Export All Groups" bl_label = "Export All Groups"
bl_description = "Exports all groups to Collada." bl_description = "Exports all groups to Collada."
def execute(self,context): def execute(self,context):
scene = context.scene scene = context.scene
if scene.godot_export_on_save: if scene.godot_export_on_save:
@ -221,57 +221,57 @@ class export_groups_autosave(bpy.types.Operator):
if scene.godot_export_groups[i].active: if scene.godot_export_groups[i].active:
bpy.ops.scene.godot_export_group(idx=i) bpy.ops.scene.godot_export_group(idx=i)
self.report({'INFO'}, "All Groups exported." ) self.report({'INFO'}, "All Groups exported." )
bpy.ops.ed.undo_push(message="Export all Groups") bpy.ops.ed.undo_push(message="Export all Groups")
return{'FINISHED'} return{'FINISHED'}
class export_all_groups(bpy.types.Operator): class export_all_groups(bpy.types.Operator):
bl_idname = "scene.godot_export_all_groups" bl_idname = "scene.godot_export_all_groups"
bl_label = "Export All Groups" bl_label = "Export All Groups"
bl_description = "Exports all groups to Collada." bl_description = "Exports all groups to Collada."
def execute(self,context): def execute(self,context):
scene = context.scene scene = context.scene
for i in range(0,len(scene.godot_export_groups)): for i in range(0,len(scene.godot_export_groups)):
bpy.ops.scene.godot_export_group(idx=i,export_all=True) bpy.ops.scene.godot_export_group(idx=i,export_all=True)
self.report({'INFO'}, "All Groups exported." ) self.report({'INFO'}, "All Groups exported." )
return{'FINISHED'} return{'FINISHED'}
class export_group(bpy.types.Operator): class export_group(bpy.types.Operator):
bl_idname = "scene.godot_export_group" bl_idname = "scene.godot_export_group"
bl_label = "Export Group" bl_label = "Export Group"
bl_description = "Exports the active group to destination folder as Collada file." bl_description = "Exports the active group to destination folder as Collada file."
idx = IntProperty(default=0) idx = IntProperty(default=0)
export_all = BoolProperty(default=False) export_all = BoolProperty(default=False)
def copy_object_recursive(self,ob,parent,single_user = True): def copy_object_recursive(self,ob,parent,single_user = True):
new_ob = bpy.data.objects[ob.name].copy() new_ob = bpy.data.objects[ob.name].copy()
if single_user or ob.type=="ARMATURE": if single_user or ob.type=="ARMATURE":
new_mesh_data = new_ob.data.copy() new_mesh_data = new_ob.data.copy()
new_ob.data = new_mesh_data new_ob.data = new_mesh_data
bpy.context.scene.objects.link(new_ob) bpy.context.scene.objects.link(new_ob)
if ob != parent: if ob != parent:
new_ob.parent = parent new_ob.parent = parent
else: else:
new_ob.parent = None new_ob.parent = None
for child in ob.children: for child in ob.children:
self.copy_object_recursive(child,new_ob,single_user) self.copy_object_recursive(child,new_ob,single_user)
new_ob.select = True new_ob.select = True
return new_ob return new_ob
def delete_object(self,ob): def delete_object(self,ob):
if ob != None: if ob != None:
for child in ob.children: for child in ob.children:
self.delete_object(child) self.delete_object(child)
bpy.context.scene.objects.unlink(ob) bpy.context.scene.objects.unlink(ob)
bpy.data.objects.remove(ob) bpy.data.objects.remove(ob)
def convert_group_to_node(self,group): def convert_group_to_node(self,group):
if group.dupli_group != None: if group.dupli_group != None:
for object in group.dupli_group.objects: for object in group.dupli_group.objects:
@ -281,48 +281,48 @@ class export_group(bpy.types.Operator):
object.matrix_local = Matrix() object.matrix_local = Matrix()
object.matrix_local *= group.matrix_local object.matrix_local *= group.matrix_local
object.matrix_local *= matrix object.matrix_local *= matrix
self.delete_object(group) self.delete_object(group)
def execute(self,context): def execute(self,context):
scene = context.scene scene = context.scene
group = context.scene.godot_export_groups group = context.scene.godot_export_groups
if not group[self.idx].active and self.export_all: if not group[self.idx].active and self.export_all:
return{'FINISHED'} return{'FINISHED'}
for i,object in enumerate(group[self.idx].nodes): for i,object in enumerate(group[self.idx].nodes):
if object.name in bpy.data.objects: if object.name in bpy.data.objects:
pass pass
else: else:
group[self.idx].nodes.remove(i) group[self.idx].nodes.remove(i)
bpy.ops.ed.undo_push(message="Clear not existent Group Nodes.") bpy.ops.ed.undo_push(message="Clear not existent Group Nodes.")
path = group[self.idx].export_path path = group[self.idx].export_path
if (path.find("//")==0 or path.find("\\\\")==0): if (path.find("//")==0 or path.find("\\\\")==0):
#if relative, convert to absolute #if relative, convert to absolute
path = bpy.path.abspath(path) path = bpy.path.abspath(path)
path = path.replace("\\","/") path = path.replace("\\","/")
### if path exists and group export name is set the group will be exported ### if path exists and group export name is set the group will be exported
if os.path.exists(path) and group[self.idx].export_name != "": if os.path.exists(path) and group[self.idx].export_name != "":
context.scene.layers = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True] context.scene.layers = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
if group[self.idx].export_name.endswith(".dae"): if group[self.idx].export_name.endswith(".dae"):
path = os.path.join(path,group[self.idx].export_name) path = os.path.join(path,group[self.idx].export_name)
else: else:
path = os.path.join(path,group[self.idx].export_name+".dae") path = os.path.join(path,group[self.idx].export_name+".dae")
hide_select = [] hide_select = []
for object in context.scene.objects: for object in context.scene.objects:
hide_select.append(object.hide_select) hide_select.append(object.hide_select)
object.hide_select = False object.hide_select = False
object.select = False object.select = False
context.scene.objects.active = None context.scene.objects.active = None
### make particle duplicates, parent and select them ### make particle duplicates, parent and select them
nodes_to_be_added = [] nodes_to_be_added = []
if group[self.idx].use_include_particle_duplicates: if group[self.idx].use_include_particle_duplicates:
@ -341,79 +341,79 @@ class export_group(bpy.types.Operator):
context.scene.objects.active = None context.scene.objects.active = None
for object in nodes_to_be_added: for object in nodes_to_be_added:
object.select = True object.select = True
### select all other nodes from the group ### select all other nodes from the group
for i,object in enumerate(group[self.idx].nodes): for i,object in enumerate(group[self.idx].nodes):
if bpy.data.objects[object.name].type == "EMPTY": if bpy.data.objects[object.name].type == "EMPTY":
self.convert_group_to_node(bpy.data.objects[object.name]) self.convert_group_to_node(bpy.data.objects[object.name])
else: else:
bpy.data.objects[object.name].select = True bpy.data.objects[object.name].select = True
bpy.ops.object.transform_apply(location=group[self.idx].apply_loc, rotation=group[self.idx].apply_rot, scale=group[self.idx].apply_scale) bpy.ops.object.transform_apply(location=group[self.idx].apply_loc, rotation=group[self.idx].apply_rot, scale=group[self.idx].apply_scale)
bpy.ops.export_scene.dae(check_existing=True, filepath=path, filter_glob="*.dae", object_types=group[self.idx].object_types, use_export_selected=group[self.idx].use_export_selected, use_mesh_modifiers=group[self.idx].use_mesh_modifiers, use_tangent_arrays=group[self.idx].use_tangent_arrays, use_triangles=group[self.idx].use_triangles, use_copy_images=group[self.idx].use_copy_images, use_active_layers=group[self.idx].use_active_layers, use_anim=group[self.idx].use_anim, use_anim_action_all=group[self.idx].use_anim_action_all, use_anim_skip_noexp=group[self.idx].use_anim_skip_noexp, use_anim_optimize=group[self.idx].use_anim_optimize, anim_optimize_precision=group[self.idx].anim_optimize_precision, use_metadata=group[self.idx].use_metadata) bpy.ops.export_scene.dae(check_existing=True, filepath=path, filter_glob="*.dae", object_types=group[self.idx].object_types, use_export_selected=group[self.idx].use_export_selected, use_mesh_modifiers=group[self.idx].use_mesh_modifiers, use_tangent_arrays=group[self.idx].use_tangent_arrays, use_triangles=group[self.idx].use_triangles, use_copy_images=group[self.idx].use_copy_images, use_active_layers=group[self.idx].use_active_layers, use_anim=group[self.idx].use_anim, use_anim_action_all=group[self.idx].use_anim_action_all, use_anim_skip_noexp=group[self.idx].use_anim_skip_noexp, use_anim_optimize=group[self.idx].use_anim_optimize, anim_optimize_precision=group[self.idx].anim_optimize_precision, use_metadata=group[self.idx].use_metadata)
self.report({'INFO'}, '"'+group[self.idx].name+'"' + " Group exported." ) self.report({'INFO'}, '"'+group[self.idx].name+'"' + " Group exported." )
msg = "Export Group "+group[self.idx].name msg = "Export Group "+group[self.idx].name
bpy.ops.ed.undo_push(message="") bpy.ops.ed.undo_push(message="")
bpy.ops.ed.undo() bpy.ops.ed.undo()
bpy.ops.ed.undo_push(message=msg) bpy.ops.ed.undo_push(message=msg)
else: else:
self.report({'INFO'}, "Define Export Name and Export Path." ) self.report({'INFO'}, "Define Export Name and Export Path." )
return{'FINISHED'} return{'FINISHED'}
class add_export_group(bpy.types.Operator): class add_export_group(bpy.types.Operator):
bl_idname = "scene.godot_add_export_group" bl_idname = "scene.godot_add_export_group"
bl_label = "Adds a new export Group" bl_label = "Adds a new export Group"
bl_description = "Creates a new Export Group with the selected Objects assigned to it." bl_description = "Creates a new Export Group with the selected Objects assigned to it."
def execute(self,context): def execute(self,context):
scene = context.scene scene = context.scene
item = scene.godot_export_groups.add() item = scene.godot_export_groups.add()
item.name = "New Group" item.name = "New Group"
for object in context.selected_objects: for object in context.selected_objects:
node = item.nodes.add() node = item.nodes.add()
node.name = object.name node.name = object.name
scene.godot_export_groups_index = len(scene.godot_export_groups)-1 scene.godot_export_groups_index = len(scene.godot_export_groups)-1
bpy.ops.ed.undo_push(message="Create New Export Group") bpy.ops.ed.undo_push(message="Create New Export Group")
return{'FINISHED'} return{'FINISHED'}
class del_export_group(bpy.types.Operator): class del_export_group(bpy.types.Operator):
bl_idname = "scene.godot_delete_export_group" bl_idname = "scene.godot_delete_export_group"
bl_label = "Delets the selected export Group" bl_label = "Delets the selected export Group"
bl_description = "Delets the active Export Group." bl_description = "Delets the active Export Group."
def invoke(self, context, event): def invoke(self, context, event):
wm = context.window_manager wm = context.window_manager
return wm.invoke_confirm(self,event) return wm.invoke_confirm(self,event)
def execute(self,context): def execute(self,context):
scene = context.scene scene = context.scene
scene.godot_export_groups.remove(scene.godot_export_groups_index) scene.godot_export_groups.remove(scene.godot_export_groups_index)
if scene.godot_export_groups_index > 0: if scene.godot_export_groups_index > 0:
scene.godot_export_groups_index -= 1 scene.godot_export_groups_index -= 1
bpy.ops.ed.undo_push(message="Delete Export Group") bpy.ops.ed.undo_push(message="Delete Export Group")
return{'FINISHED'} return{'FINISHED'}
class godot_node_list(bpy.types.PropertyGroup): class godot_node_list(bpy.types.PropertyGroup):
name = StringProperty() name = StringProperty()
class godot_export_groups(bpy.types.PropertyGroup): class godot_export_groups(bpy.types.PropertyGroup):
name = StringProperty(name="Group Name") name = StringProperty(name="Group Name")
export_name = StringProperty(name="scene_name") export_name = StringProperty(name="scene_name")
nodes = CollectionProperty(type=godot_node_list) nodes = CollectionProperty(type=godot_node_list)
export_path = StringProperty(subtype="DIR_PATH") export_path = StringProperty(subtype="DIR_PATH")
active = BoolProperty(default=True,description="Export Group") active = BoolProperty(default=True,description="Export Group")
object_types = EnumProperty(name="Object Types",options={'ENUM_FLAG'},items=(('EMPTY', "Empty", ""),('CAMERA', "Camera", ""),('LAMP', "Lamp", ""),('ARMATURE', "Armature", ""),('MESH', "Mesh", ""),('CURVE', "Curve", ""),),default={'EMPTY', 'CAMERA', 'LAMP', 'ARMATURE', 'MESH','CURVE'}) object_types = EnumProperty(name="Object Types",options={'ENUM_FLAG'},items=(('EMPTY', "Empty", ""),('CAMERA', "Camera", ""),('LAMP', "Lamp", ""),('ARMATURE', "Armature", ""),('MESH', "Mesh", ""),('CURVE', "Curve", ""),),default={'EMPTY', 'CAMERA', 'LAMP', 'ARMATURE', 'MESH','CURVE'})
apply_scale = BoolProperty(name="Apply Scale",description="Apply Scale before export.",default=False) apply_scale = BoolProperty(name="Apply Scale",description="Apply Scale before export.",default=False)
apply_rot = BoolProperty(name="Apply Rotation",description="Apply Rotation before export.",default=False) apply_rot = BoolProperty(name="Apply Rotation",description="Apply Rotation before export.",default=False)
apply_loc = BoolProperty(name="Apply Location",description="Apply Location before export.",default=False) apply_loc = BoolProperty(name="Apply Location",description="Apply Location before export.",default=False)
use_export_selected = BoolProperty(name="Selected Objects",description="Export only selected objects (and visible in active layers if that applies).",default=True) use_export_selected = BoolProperty(name="Selected Objects",description="Export only selected objects (and visible in active layers if that applies).",default=True)
use_mesh_modifiers = BoolProperty(name="Apply Modifiers",description="Apply modifiers to mesh objects (on a copy!).",default=True) use_mesh_modifiers = BoolProperty(name="Apply Modifiers",description="Apply modifiers to mesh objects (on a copy!).",default=True)
use_tangent_arrays = BoolProperty(name="Tangent Arrays",description="Export Tangent and Binormal arrays (for normalmapping).",default=False) use_tangent_arrays = BoolProperty(name="Tangent Arrays",description="Export Tangent and Binormal arrays (for normalmapping).",default=False)
@ -431,7 +431,7 @@ class godot_export_groups(bpy.types.PropertyGroup):
use_metadata = BoolProperty(name="Use Metadata",default=True,options={'HIDDEN'}) use_metadata = BoolProperty(name="Use Metadata",default=True,options={'HIDDEN'})
use_include_particle_duplicates = BoolProperty(name="Include Particle Duplicates",default=True) use_include_particle_duplicates = BoolProperty(name="Include Particle Duplicates",default=True)
def register(): def register():
bpy.utils.register_class(godot_export_manager) bpy.utils.register_class(godot_export_manager)
bpy.utils.register_class(godot_node_list) bpy.utils.register_class(godot_node_list)
bpy.utils.register_class(godot_export_groups) bpy.utils.register_class(godot_export_groups)
@ -465,7 +465,7 @@ def unregister():
@persistent @persistent
def auto_export(dummy): def auto_export(dummy):
bpy.ops.scene.godot_export_groups_autosave() bpy.ops.scene.godot_export_groups_autosave()
bpy.app.handlers.save_post.append(auto_export) bpy.app.handlers.save_post.append(auto_export)
if __name__ == "__main__": if __name__ == "__main__":

View file

@ -59,7 +59,7 @@ class ExportDAE(bpy.types.Operator, ExportHelper):
# List of operator properties, the attributes will be assigned # List of operator properties, the attributes will be assigned
# to the class instance from the operator settings before calling. # to the class instance from the operator settings before calling.
object_types = EnumProperty( object_types = EnumProperty(
name="Object Types", name="Object Types",
options={'ENUM_FLAG'}, options={'ENUM_FLAG'},

View file

@ -171,38 +171,38 @@ class DaeExporter:
def export_image(self,image): def export_image(self,image):
if (image in self.image_cache): if (image in self.image_cache):
return self.image_cache[image] return self.image_cache[image]
imgpath = image.filepath imgpath = image.filepath
if (imgpath.find("//")==0 or imgpath.find("\\\\")==0): if (imgpath.find("//")==0 or imgpath.find("\\\\")==0):
#if relative, convert to absolute #if relative, convert to absolute
imgpath = bpy.path.abspath(imgpath) imgpath = bpy.path.abspath(imgpath)
#path is absolute, now do something! #path is absolute, now do something!
if (self.config["use_copy_images"]): if (self.config["use_copy_images"]):
#copy image #copy image
basedir = os.path.dirname(self.path)+"/images" basedir = os.path.dirname(self.path)+"/images"
if (not os.path.isdir(basedir)): if (not os.path.isdir(basedir)):
os.makedirs(basedir) os.makedirs(basedir)
if os.path.isfile(imgpath): if os.path.isfile(imgpath):
dstfile=basedir+"/"+os.path.basename(imgpath) dstfile=basedir+"/"+os.path.basename(imgpath)
if (not os.path.isfile(dstfile)): if (not os.path.isfile(dstfile)):
shutil.copy(imgpath,dstfile) shutil.copy(imgpath,dstfile)
imgpath="images/"+os.path.basename(imgpath) imgpath="images/"+os.path.basename(imgpath)
else: else:
### if file is not found save it as png file in the destination folder ### if file is not found save it as png file in the destination folder
img_tmp_path = image.filepath img_tmp_path = image.filepath
if img_tmp_path.endswith((".bmp",".rgb",".png",".jpeg",".jpg",".jp2",".tga",".cin",".dpx",".exr",".hdr",".tif")): if img_tmp_path.endswith((".bmp",".rgb",".png",".jpeg",".jpg",".jp2",".tga",".cin",".dpx",".exr",".hdr",".tif")):
image.filepath = basedir+"/"+os.path.basename(img_tmp_path) image.filepath = basedir+"/"+os.path.basename(img_tmp_path)
else: else:
image.filepath = basedir+"/"+image.name+".png" image.filepath = basedir+"/"+image.name+".png"
dstfile=basedir+"/"+os.path.basename(image.filepath) dstfile=basedir+"/"+os.path.basename(image.filepath)
if (not os.path.isfile(dstfile)): if (not os.path.isfile(dstfile)):
image.save() image.save()
imgpath="images/"+os.path.basename(image.filepath) imgpath="images/"+os.path.basename(image.filepath)
image.filepath = img_tmp_path image.filepath = img_tmp_path
@ -211,15 +211,15 @@ class DaeExporter:
#export relative, always, no one wants absolute paths. #export relative, always, no one wants absolute paths.
try: try:
imgpath = os.path.relpath(imgpath,os.path.dirname(self.path)).replace("\\","/") # export unix compatible always imgpath = os.path.relpath(imgpath,os.path.dirname(self.path)).replace("\\","/") # export unix compatible always
except: except:
pass #fails sometimes, not sure why pass #fails sometimes, not sure why
imgid = self.new_id("image") imgid = self.new_id("image")
print("FOR: "+imgpath) print("FOR: "+imgpath)
# if (not os.path.isfile(imgpath)): # if (not os.path.isfile(imgpath)):
# print("NOT FILE?") # print("NOT FILE?")
# if imgpath.endswith((".bmp",".rgb",".png",".jpeg",".jpg",".jp2",".tga",".cin",".dpx",".exr",".hdr",".tif")): # if imgpath.endswith((".bmp",".rgb",".png",".jpeg",".jpg",".jp2",".tga",".cin",".dpx",".exr",".hdr",".tif")):
@ -956,7 +956,7 @@ class DaeExporter:
self.writel(S_NODES,il,'<instance_controller url="#'+meshdata["morph_id"]+'">') self.writel(S_NODES,il,'<instance_controller url="#'+meshdata["morph_id"]+'">')
close_controller=True close_controller=True
elif (armature==None): elif (armature==None):
self.writel(S_NODES,il,'<instance_geometry url="#'+meshdata["id"]+'">') self.writel(S_NODES,il,'<instance_geometry url="#'+meshdata["id"]+'">')
if (len(meshdata["material_assign"])>0): if (len(meshdata["material_assign"])>0):
@ -1520,7 +1520,7 @@ class DaeExporter:
tmp_bone_mat.append(Matrix(bone.matrix_basis)) tmp_bone_mat.append(Matrix(bone.matrix_basis))
bone.matrix_basis = Matrix() bone.matrix_basis = Matrix()
tmp_mat.append([Matrix(s.matrix_local),tmp_bone_mat]) tmp_mat.append([Matrix(s.matrix_local),tmp_bone_mat])
self.writel(S_ANIM,0,'<library_animations>') self.writel(S_ANIM,0,'<library_animations>')
@ -1561,11 +1561,11 @@ class DaeExporter:
if (not y in allowed_skeletons): if (not y in allowed_skeletons):
allowed_skeletons.append(y) allowed_skeletons.append(y)
y.animation_data.action=x; y.animation_data.action=x;
y.matrix_local = tmp_mat[i][0] y.matrix_local = tmp_mat[i][0]
for j,bone in enumerate(s.pose.bones): for j,bone in enumerate(s.pose.bones):
bone.matrix_basis = Matrix() bone.matrix_basis = Matrix()
#print("allowed skeletons "+str(allowed_skeletons)) #print("allowed skeletons "+str(allowed_skeletons))
@ -1600,9 +1600,9 @@ class DaeExporter:
else: else:
self.export_animation(self.scene.frame_start,self.scene.frame_end) self.export_animation(self.scene.frame_start,self.scene.frame_end)
self.writel(S_ANIM,0,'</library_animations>') self.writel(S_ANIM,0,'</library_animations>')
def export(self): def export(self):
@ -1684,7 +1684,7 @@ class DaeExporter:
self.valid_nodes=[] self.valid_nodes=[]
self.armature_for_morph={} self.armature_for_morph={}
self.used_bones=[] self.used_bones=[]
self.wrongvtx_report=False self.wrongvtx_report=False

View file

@ -4,27 +4,27 @@ import sys
if (len(sys.argv)<2): if (len(sys.argv)<2):
print("usage: makewrapper.py <headers>") print("usage: makewrapper.py <headers>")
sys.exit(255) sys.exit(255)
functions=[] functions=[]
types=[] types=[]
constants=[] constants=[]
READ_FUNCTIONS=0 READ_FUNCTIONS=0
READ_TYPES=1 READ_TYPES=1
READ_CONSTANTS=2 READ_CONSTANTS=2
read_what=READ_TYPES read_what=READ_TYPES
for x in (range(len(sys.argv)-1)): for x in (range(len(sys.argv)-1)):
f=open(sys.argv[x+1],"r") f=open(sys.argv[x+1],"r")
while(True): while(True):
line=f.readline() line=f.readline()
if (line==""): if (line==""):
break break
line=line.replace("\n","").strip() line=line.replace("\n","").strip()
""" """
if (line.find("[types]")!=-1): if (line.find("[types]")!=-1):
@ -37,7 +37,7 @@ for x in (range(len(sys.argv)-1)):
read_what=READ_FUNCTIONS read_what=READ_FUNCTIONS
continue continue
""" """
if (line.find("#define")!=-1): if (line.find("#define")!=-1):
if (line.find("0x")==-1 and line.find("GL_VERSION")==-1): if (line.find("0x")==-1 and line.find("GL_VERSION")==-1):
continue continue
@ -51,48 +51,48 @@ for x in (range(len(sys.argv)-1)):
if (line.find("ARB")!=-1 or line.find("EXT")!=-1 or line.find("NV")!=-1): if (line.find("ARB")!=-1 or line.find("EXT")!=-1 or line.find("NV")!=-1):
continue continue
line=line.replace("APIENTRY","") line=line.replace("APIENTRY","")
line=line.replace("GLAPI","") line=line.replace("GLAPI","")
glpos=line.find(" gl") glpos=line.find(" gl")
if (glpos==-1): if (glpos==-1):
glpos=line.find("\tgl") glpos=line.find("\tgl")
if (glpos==-1): if (glpos==-1):
continue continue
ret=line[:glpos].strip(); ret=line[:glpos].strip();
line=line[glpos:].strip() line=line[glpos:].strip()
namepos=line.find("(") namepos=line.find("(")
if (namepos==-1): if (namepos==-1):
continue continue
name=line[:namepos].strip() name=line[:namepos].strip()
line=line[namepos:] line=line[namepos:]
argpos=line.rfind(")") argpos=line.rfind(")")
if (argpos==-1): if (argpos==-1):
continue continue
args=line[1:argpos] args=line[1:argpos]
funcdata={} funcdata={}
funcdata["ret"]=ret funcdata["ret"]=ret
funcdata["name"]=name funcdata["name"]=name
funcdata["args"]=args funcdata["args"]=args
functions.append(funcdata) functions.append(funcdata)
print(funcdata) print(funcdata)
#print(types) #print(types)
#print(constants) #print(constants)
#print(functions) #print(functions)
f=open("glwrapper.h","w") f=open("glwrapper.h","w")
f.write("#ifndef GL_WRAPPER\n") f.write("#ifndef GL_WRAPPER\n")
@ -109,10 +109,10 @@ header_code="""\
#error glATI.h included before glwrapper.h #error glATI.h included before glwrapper.h
#endif #endif
#define __gl_h_ #define __gl_h_
#define __GL_H__ #define __GL_H__
#define __glext_h_ #define __glext_h_
#define __GLEXT_H_ #define __GLEXT_H_
#define __gl_ATI_h_ #define __gl_ATI_h_
#define GL_TRUE 1 #define GL_TRUE 1
@ -138,7 +138,7 @@ f.write("#define GLWRP_APIENTRY \n")
f.write("#endif\n\n"); f.write("#endif\n\n");
for x in types: for x in types:
f.write(x+"\n") f.write(x+"\n")
f.write("\n\n") f.write("\n\n")
for x in constants: for x in constants:
@ -153,24 +153,24 @@ for x in functions:
f.write("\n\n") f.write("\n\n")
f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n"); f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n");
f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) );\n") f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) );\n")
f.write("#ifdef __cplusplus\n}\n#endif\n") f.write("#ifdef __cplusplus\n}\n#endif\n")
f.write("#endif\n\n") f.write("#endif\n\n")
f=open("glwrapper.c","w") f=open("glwrapper.c","w")
f.write("\n\n") f.write("\n\n")
f.write("#include \"glwrapper.h\"\n") f.write("#include \"glwrapper.h\"\n")
f.write("\n\n") f.write("\n\n")
for x in functions: for x in functions:
f.write(x["ret"]+" GLWRP_APIENTRY (*__wrapper_"+x["name"]+")("+x["args"]+")=NULL;\n") f.write(x["ret"]+" GLWRP_APIENTRY (*__wrapper_"+x["name"]+")("+x["args"]+")=NULL;\n")
f.write("\n\n") f.write("\n\n")
f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) ) {\n") f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) ) {\n")
f.write("\n") f.write("\n")
for x in functions: for x in functions:
f.write("\t__wrapper_"+x["name"]+"=("+x["ret"]+" GLWRP_APIENTRY (*)("+x["args"]+"))wrapperFunc(\""+x["name"]+"\");\n") f.write("\t__wrapper_"+x["name"]+"=("+x["ret"]+" GLWRP_APIENTRY (*)("+x["args"]+"))wrapperFunc(\""+x["name"]+"\");\n")
@ -180,5 +180,4 @@ f.write("\n\n")

View file

@ -50,7 +50,7 @@ Module.expectedDataFileDownloads++;
function handleError(error) { function handleError(error) {
console.error('package error:', error); console.error('package error:', error);
}; };
var fetched = null, fetchedCallback = null; var fetched = null, fetchedCallback = null;
fetchRemotePackage('data.pck', function(data) { fetchRemotePackage('data.pck', function(data) {
if (fetchedCallback) { if (fetchedCallback) {
@ -60,7 +60,7 @@ Module.expectedDataFileDownloads++;
fetched = data; fetched = data;
} }
}, handleError); }, handleError);
function runWithFS() { function runWithFS() {
function assert(check, msg) { function assert(check, msg) {
@ -113,13 +113,13 @@ function assert(check, msg) {
var PACKAGE_NAME = 'data.pck'; var PACKAGE_NAME = 'data.pck';
var REMOTE_PACKAGE_NAME = 'data.pck'; var REMOTE_PACKAGE_NAME = 'data.pck';
var PACKAGE_UUID = 'b39761ce-0348-4959-9b16-302ed8e1592e'; var PACKAGE_UUID = 'b39761ce-0348-4959-9b16-302ed8e1592e';
function processPackageData(arrayBuffer) { function processPackageData(arrayBuffer) {
Module.finishedDataFileDownloads++; Module.finishedDataFileDownloads++;
assert(arrayBuffer, 'Loading data file failed.'); assert(arrayBuffer, 'Loading data file failed.');
var byteArray = new Uint8Array(arrayBuffer); var byteArray = new Uint8Array(arrayBuffer);
var curr; var curr;
// Reuse the bytearray from the XHR as the source for file reads. // Reuse the bytearray from the XHR as the source for file reads.
DataRequest.prototype.byteArray = byteArray; DataRequest.prototype.byteArray = byteArray;
DataRequest.prototype.requests["/data.pck"].onload(); DataRequest.prototype.requests["/data.pck"].onload();
@ -127,9 +127,9 @@ function assert(check, msg) {
}; };
Module['addRunDependency']('datafile_datapack'); Module['addRunDependency']('datafile_datapack');
if (!Module.preloadResults) Module.preloadResults = {}; if (!Module.preloadResults) Module.preloadResults = {};
Module.preloadResults[PACKAGE_NAME] = {fromCache: false}; Module.preloadResults[PACKAGE_NAME] = {fromCache: false};
if (fetched) { if (fetched) {
processPackageData(fetched); processPackageData(fetched);
@ -137,7 +137,7 @@ function assert(check, msg) {
} else { } else {
fetchedCallback = processPackageData; fetchedCallback = processPackageData;
} }
} }
if (Module['calledRun']) { if (Module['calledRun']) {
runWithFS(); runWithFS();

View file

@ -33,4 +33,3 @@ while(l!=""):
for x in sum: for x in sum:
print(x.strip()+"("+str(cnt[x])+"):\n: "+str(sum[x])) print(x.strip()+"("+str(cnt[x])+"):\n: "+str(sum[x]))

View file

@ -40,7 +40,7 @@ text="""
visual_server->m_func($argp);\\ visual_server->m_func($argp);\\
}\\ }\\
} }
#define FUNC$num(m_func,$argt)\\ #define FUNC$num(m_func,$argt)\\
virtual void m_func($argtp) { \\ virtual void m_func($argtp) { \\
@ -59,8 +59,8 @@ text="""
visual_server->m_func($argp);\\ visual_server->m_func($argp);\\
}\\ }\\
} }
""" """
@ -81,7 +81,7 @@ for i in range(1,8):
t = text.replace("$argtp",tp).replace("$argp",p).replace("$argt",t).replace("$num",str(i)) t = text.replace("$argtp",tp).replace("$argp",p).replace("$argt",t).replace("$num",str(i))
print(t) print(t)