diff --git a/SConstruct b/SConstruct index 110988ddfae..6d6fe2859c6 100644 --- a/SConstruct +++ b/SConstruct @@ -329,7 +329,7 @@ if selected_platform in platform_list: if (env['theora']=='yes'): env['theoralib']='yes' - env.Append(CPPFLAGS=['-DTHEORA_ENABLED']); + env.Append(CPPFLAGS=['-DTHEORA_ENABLED']); if (env['theoralib']=='yes'): env.Append(CPPFLAGS=['-DTHEORALIB_ENABLED']); diff --git a/core/make_binders.py b/core/make_binders.py index ebd48777b67..93371dc0a31 100644 --- a/core/make_binders.py +++ b/core/make_binders.py @@ -6,7 +6,7 @@ template_typed=""" template class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind { public: - + $ifret R$ $ifnoret void$ (T::*method)($arg, P@$) $ifconst const$; #ifdef DEBUG_METHODS_ENABLED virtual Variant::Type _gen_argument_type(int p_arg) const { return _get_argument_type(p_arg); } @@ -16,13 +16,13 @@ public: $ return Variant::NIL; } -#endif +#endif virtual String get_instance_type() const { return T::get_type_static(); } virtual Variant call(Object* p_object,const Variant** p_args,int p_arg_count, Variant::CallError& r_error) { - + T *instance=p_object->cast_to(); r_error.error=Variant::CallError::CALL_OK; #ifdef DEBUG_METHODS_ENABLED @@ -47,7 +47,7 @@ public: $ifret return Variant(ret);$ $ifnoret return Variant();$ } - + MethodBind$argc$$ifret R$$ifconst C$ () { #ifdef DEBUG_METHODS_ENABLED @@ -55,14 +55,14 @@ public: _generate_argument_types($argc$); #else set_argument_count($argc$); -#endif +#endif }; }; template MethodBind* create_method_bind($ifret R$ $ifnoret void$ (T::*p_method)($arg, P@$) $ifconst const$ ) { - MethodBind$argc$$ifret R$$ifconst C$ * a = memnew( (MethodBind$argc$$ifret R$$ifconst C$) ); + MethodBind$argc$$ifret R$$ifconst C$ * a = memnew( (MethodBind$argc$$ifret R$$ifconst C$) ); a->method=p_method; return a; } @@ -88,7 +88,7 @@ public: $ return Variant::NIL; } -#endif +#endif virtual String get_instance_type() const { return type_name; } @@ -105,15 +105,15 @@ public: r_error.error=Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; r_error.argument=get_argument_count(); return Variant(); - } - + } + if (p_arg_count<(get_argument_count()-get_default_argument_count())) { r_error.error=Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument=get_argument_count()-get_default_argument_count(); return Variant(); } - + $arg CHECK_ARG(@); $ #endif @@ -128,7 +128,7 @@ public: _generate_argument_types($argc$); #else 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): - + intext=template from_pos=0 outtext="" - - while(True): + + while(True): to_pos=intext.find("$",from_pos) if (to_pos==-1): outtext+=intext[from_pos:] @@ -169,13 +169,13 @@ def make_version(template,nargs,argmax,const,ret): macro=intext[to_pos+1:end] cmd="" data="" - + if (macro.find(" ")!=-1): cmd=macro[0:macro.find(" ")] data=macro[macro.find(" ")+1:] else: cmd=macro - + if (cmd=="argc"): outtext+=str(nargs) if (cmd=="ifret" and ret): @@ -206,11 +206,11 @@ def make_version(template,nargs,argmax,const,ret): elif (cmd=="noarg"): for i in range(nargs+1,argmax+1): outtext+=data.replace("@",str(i)) - + from_pos=end+1 - + return outtext - + def run(target, source, env): @@ -244,9 +244,9 @@ def run(target, source, env): f.write(text_ext) f.close() - - - - - + + + + + diff --git a/doc/tools/doc_merge.py b/doc/tools/doc_merge.py index 6cc70193245..b55902ce4fc 100644 --- a/doc/tools/doc_merge.py +++ b/doc/tools/doc_merge.py @@ -30,7 +30,7 @@ def escape(ret): ret=ret.replace("'","'"); ret=ret.replace("\"","""); return ret - + def inc_tab(): global tab @@ -50,34 +50,34 @@ def get_tag(node,name): return tag 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): for m in list(methods): if (m.attrib["name"]==name): description=m.find("description") if (description!=None and description.text.strip()!=""): return description.text - + return None 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): for m in list(signals): if (m.attrib["name"]==name): description=m.find("description") if (description!=None and description.text.strip()!=""): return description.text - + return None def find_constant_descr(old_class,name): if (old_class==None): - return None - constants = old_class.find("constants") + return None + constants = old_class.find("constants") if(constants!=None and len(list(constants))>0): for m in list(constants): if (m.attrib["name"]==name): @@ -98,31 +98,31 @@ def write_class(c): inherits=get_tag(c,"inherits") write_string(f,'') inc_tab() - + write_string(f,"") if (old_class!=None): old_brief_descr=old_class.find("brief_description") if (old_brief_descr!=None): write_string(f,escape(old_brief_descr.text.strip())) - - + + write_string(f,"") - + write_string(f,"") if (old_class!=None): old_descr=old_class.find("description") if (old_descr!=None): write_string(f,escape(old_descr.text.strip())) - + write_string(f,"") - methods = c.find("methods") + methods = c.find("methods") if(methods!=None and len(list(methods))>0): write_string(f,"") inc_tab() - + for m in list(methods): qualifiers=get_tag(m,"qualifiers") @@ -135,7 +135,7 @@ def write_class(c): write_string(f,''); write_string(f,''); elif (a.tag=="argument"): - + default=get_tag(a,"default") write_string(f,''); @@ -146,20 +146,20 @@ def write_class(c): old_method_descr=find_method_descr(old_class,m.attrib["name"]) if (old_method_descr): write_string(f,escape(escape(old_method_descr.strip()))) - + write_string(f,''); - dec_tab() + dec_tab() write_string(f,"") dec_tab() write_string(f,"") - signals = c.find("signals") + signals = c.find("signals") if(signals!=None and len(list(signals))>0): write_string(f,"") inc_tab() - - for m in list(signals): + + for m in list(signals): write_string(f,'') inc_tab() @@ -176,18 +176,18 @@ def write_class(c): if (old_signal_descr): write_string(f,escape(old_signal_descr.strip())) write_string(f,''); - dec_tab() + dec_tab() write_string(f,"") dec_tab() write_string(f,"") - constants = c.find("constants") + constants = c.find("constants") if(constants!=None and len(list(constants))>0): write_string(f,"") inc_tab() - - for m in list(constants): + + for m in list(constants): write_string(f,'') old_constant_descr=find_constant_descr(old_class,m.attrib["name"]) diff --git a/doc/tools/main.css b/doc/tools/main.css index a76e6bbed89..5eb3df21598 100644 --- a/doc/tools/main.css +++ b/doc/tools/main.css @@ -29,12 +29,12 @@ div.method_description { list.inh_class_list { margin-left: 30px; - + } div.inh_class_list { margin-left: 30px; - + } div.method_doc div.method { diff --git a/doc/tools/makedoku.py b/doc/tools/makedoku.py index 1ab16841b15..97819d7da3f 100644 --- a/doc/tools/makedoku.py +++ b/doc/tools/makedoku.py @@ -19,14 +19,14 @@ def validate_tag(elem,tag): if (elem.tag != tag): print("Tag mismatch, expected '"+tag+"', got "+elem.tag); sys.exit(255) - + class_names=[] classes={} def make_class_list(class_list,columns): - + f=open("class_list.txt","wb") prev=0 col_max = len(class_list) / columns + 1 @@ -35,13 +35,13 @@ def make_class_list(class_list,columns): row_count = 0 last_initial = "" fit_columns=[] - + for n in range(0,columns): fit_columns+=[[]] indexers=[] last_initial="" - + idx=0 for n in class_list: col = idx/col_max @@ -52,36 +52,36 @@ def make_class_list(class_list,columns): if (n[:1]!=last_initial): indexers+=[n] last_initial=n[:1] - + row_max=0 - + for n in range(0,columns): if (len(fit_columns[n])>row_max): row_max=len(fit_columns[n]) - + for r in range(0,row_max): s="|" - for c in range(0,columns): + for c in range(0,columns): if (r>=len(fit_columns[c])): continue - + classname = fit_columns[c][r] initial=classname[0] if (classname in indexers): s+="**"+initial+"**|" else: s+=" |" - + s+="[["+classname.lower()+"|"+classname+"]]|" - + s+="\n" f.write(s) - - + + def dokuize_text(txt): - + return txt @@ -95,13 +95,13 @@ def dokuize_text(text): endq_pos=text.find("]",pos+1) if (endq_pos==-1): break - + pre_text=text[:pos] post_text=text[endq_pos+1:] tag_text=text[pos+1:endq_pos] if (tag_text in class_names): - tag_text="[["+tag_text.lower()+"|"+tag_text+"]]" + tag_text="[["+tag_text.lower()+"|"+tag_text+"]]" else: #command cmd=tag_text space_pos=tag_text.find(" ") @@ -112,7 +112,7 @@ def dokuize_text(text): elif(cmd.find("method")==0): cmd=tag_text[:space_pos] param=tag_text[space_pos+1:] - + if (param.find(".")!=-1): class_param,method_param=param.split(".") tag_text="[["+class_param.lower()+"#"+method_param+"|"+class_param+'.'+method_param+"]]" @@ -123,7 +123,7 @@ def dokuize_text(text): elif (cmd.find("url=")==0): tag_text="[["+cmd[4:]+"|" elif (cmd=="/url"): - tag_text="]]>" + tag_text="]]>" elif (cmd=="center"): tag_text="" elif (cmd=="/center"): @@ -138,25 +138,25 @@ def dokuize_text(text): tag_text="__" else: tag_text="["+tag_text+"]" - - + + text=pre_text+tag_text+post_text pos=len(pre_text)+len(tag_text) - + #tnode = ET.SubElement(parent,"div") #tnode.text=text return text - - + + def make_type(t): global class_names if (t in class_names): return "[["+t.lower()+"|"+t+"]]" return t - - + + def make_method(f,name,m,declare,event=False): - + s=" * " ret_type="void" args=list(m) @@ -169,66 +169,66 @@ def make_method(f,name,m,declare,event=False): idx=int(a.attrib["index"]) else: continue - + mdata["argidx"].append(idx) mdata[idx]=a - - - if (not event): + + + if (not event): if (-1 in mdata["argidx"]): s+=make_type(mdata[-1].attrib["type"]) - else: + else: s+="void" s+=" " - + if (declare): - + #span.attrib["class"]="funcdecl" #a=ET.SubElement(span,"a") #a.attrib["name"]=name+"_"+m.attrib["name"] #a.text=name+"::"+m.attrib["name"] s+="**"+m.attrib["name"]+"**" - else: + else: s+="[[#"+m.attrib["name"]+"|"+m.attrib["name"]+"]]" - + s+="**(**" argfound=False for a in mdata["argidx"]: arg=mdata[a] if (a<0): continue - if (a>0): + if (a>0): s+=", " else: s+=" " - + s+=make_type(arg.attrib["type"]) if ("name" in arg.attrib): s+=" "+arg.attrib["name"] else: s+=" arg"+str(a) - + if ("default" in arg.attrib): s+="="+arg.attrib["default"] - - + + argfound=True - + if (argfound): s+=" " s+="**)**" - + if ("qualifiers" in m.attrib): s+=" "+m.attrib["qualifiers"] - + f.write(s+"\n") - - + + def make_doku_class(node): name = node.attrib["name"] - + f=open(name.lower()+".txt","wb") f.write("====== "+name+" ======\n") @@ -238,26 +238,26 @@ def make_doku_class(node): f.write("**Inherits:** [["+inh.lower()+"|"+inh+"]]\\\\\n") if ("category" in node.attrib): f.write("**Category:** "+node.attrib["category"].strip()+"\\\\\n") - + briefd = node.find("brief_description") if (briefd!=None): f.write("===== Brief Description ======\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): f.write("===== Member Functions ======\n") for m in list(methods): make_method(f,node.attrib["name"],m,False) - - events = node.find("signals") - if(events!=None and len(list(events))>0): + + events = node.find("signals") + if(events!=None and len(list(events))>0): f.write("===== Signals ======\n") for m in list(events): 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): f.write("===== Member Variables ======\n") @@ -269,33 +269,33 @@ def make_doku_class(node): if (c.text.strip()!=""): s+=" - "+c.text.strip() f.write(s+"\n") - - - - constants = node.find("constants") + + + + constants = node.find("constants") if(constants!=None and len(list(constants))>0): f.write("===== Numeric Constants ======\n") for c in list(constants): s = " * " s+="**"+c.attrib["name"]+"**" if ("value" in c.attrib): - s+=" = **"+c.attrib["value"]+"**" + s+=" = **"+c.attrib["value"]+"**" if (c.text.strip()!=""): s+=" - "+c.text.strip() f.write(s+"\n") - - + + descr=node.find("description") if (descr!=None and descr.text.strip()!=""): f.write("===== Description ======\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): f.write("===== Member Function Description ======\n") for m in list(methods): - + d=m.find("description") if (d==None or d.text.strip()==""): continue @@ -304,18 +304,18 @@ def make_doku_class(node): f.write("\\\\\n") f.write(dokuize_text(d.text.strip())) f.write("\n") - - - - + + + + """ div=ET.Element("div") div.attrib["class"]="class"; a=ET.SubElement(div,"a") a.attrib["name"]=node.attrib["name"] - + h3=ET.SubElement(a,"h3") h3.attrib["class"]="title class_title" h3.text=node.attrib["name"] @@ -325,63 +325,63 @@ def make_doku_class(node): div2=ET.SubElement(div,"div") div2.attrib["class"]="description class_description" div2.text=briefd.text - + if ("inherits" in node.attrib): ET.SubElement(div,"br") - div2=ET.SubElement(div,"div") + div2=ET.SubElement(div,"div") div2.attrib["class"]="inheritance"; span=ET.SubElement(div2,"span") span.text="Inherits: " - + make_type(node.attrib["inherits"],div2) - + if ("category" in node.attrib): ET.SubElement(div,"br") - - div3=ET.SubElement(div,"div") + + div3=ET.SubElement(div,"div") div3.attrib["class"]="category"; - + span=ET.SubElement(div3,"span") span.attrib["class"]="category" span.text="Category: " - + a = ET.SubElement(div3,"a") a.attrib["class"]="category_ref" a.text=node.attrib["category"] catname=a.text if (catname.rfind("/")!=-1): - catname=catname[catname.rfind("/"):] + catname=catname[catname.rfind("/"):] catname="CATEGORY_"+catname - + if (single_page): a.attrib["href"]="#"+catname else: a.attrib["href"]="category.html#"+catname - - - methods = node.find("methods") - + + + methods = node.find("methods") + if(methods!=None and len(list(methods))>0): h4=ET.SubElement(div,"h4") h4.text="Public Methods:" - method_table=ET.SubElement(div,"table") + method_table=ET.SubElement(div,"table") method_table.attrib["class"]="method_list"; for m in list(methods): # li = ET.SubElement(div2, "li") 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): h4=ET.SubElement(div,"h4") h4.text="Events:" - event_table=ET.SubElement(div,"table") + event_table=ET.SubElement(div,"table") event_table.attrib["class"]="method_list"; 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) ) - members = node.find("members") + members = node.find("members") if(members!=None and len(list(members))>0): h4=ET.SubElement(div,"h4") h4.text="Public Variables:" - div2=ET.SubElement(div,"div") + div2=ET.SubElement(div,"div") div2.attrib["class"]="member_list"; - + for c in list(members): - + li = ET.SubElement(div2, "li") div3=ET.SubElement(li,"div") div3.attrib["class"]="member"; - make_type(c.attrib["type"],div3) + make_type(c.attrib["type"],div3) span=ET.SubElement(div3,"span") span.attrib["class"]="identifier member_name" span.text=" "+c.attrib["name"]+" " @@ -411,19 +411,19 @@ def make_doku_class(node): span.text=c.text - constants = node.find("constants") + constants = node.find("constants") if(constants!=None and len(list(constants))>0): h4=ET.SubElement(div,"h4") h4.text="Constants:" - div2=ET.SubElement(div,"div") + div2=ET.SubElement(div,"div") div2.attrib["class"]="constant_list"; - + for c in list(constants): li = ET.SubElement(div2, "li") div3=ET.SubElement(li,"div") div3.attrib["class"]="constant"; - + span=ET.SubElement(div3,"span") span.attrib["class"]="identifier constant_name" span.text=c.attrib["name"]+" " @@ -437,23 +437,23 @@ def make_doku_class(node): span=ET.SubElement(div3,"span") span.attrib["class"]="constant_description" span.text=c.text - + # ET.SubElement(div,"br") - - + + descr=node.find("description") if (descr!=None and descr.text.strip()!=""): h4=ET.SubElement(div,"h4") h4.text="Description:" - + make_text_def(node.attrib["name"],div,descr.text) -# div2=ET.SubElement(div,"div") +# div2=ET.SubElement(div,"div") # div2.attrib["class"]="description"; # div2.text=descr.text - - - + + + if(methods!=None or events!=None): h4=ET.SubElement(div,"h4") @@ -467,7 +467,7 @@ def make_doku_class(node): for m in iter_list: descr=m.find("description") - + if (descr==None or descr.text.strip()==""): continue; @@ -479,11 +479,11 @@ def make_doku_class(node): #anchor = ET.SubElement(div2, "a") #anchor.attrib["name"] = make_text_def(node.attrib["name"],div2,descr.text) - #div3=ET.SubElement(div2,"div") + #div3=ET.SubElement(div2,"div") #div3.attrib["class"]="description"; #div3.text=descr.text - - + + return div """ for file in input_list: @@ -501,14 +501,14 @@ for file in input_list: continue class_names.append(c.attrib["name"]) classes[c.attrib["name"]]=c - + class_names.sort() - + make_class_list(class_names,4) for cn in class_names: c=classes[cn] make_doku_class(c) - + diff --git a/doc/tools/makehtml.py b/doc/tools/makehtml.py index 34db47e4240..26edda0935b 100644 --- a/doc/tools/makehtml.py +++ b/doc/tools/makehtml.py @@ -43,21 +43,21 @@ def validate_tag(elem,tag): def make_html_bottom(body): #make_html_top(body,True) - ET.SubElement(body,"hr") - copyright = ET.SubElement(body,"span") + ET.SubElement(body,"hr") + copyright = ET.SubElement(body,"span") copyright.text = "Copyright 2008-2010 Codenix SRL" - + def make_html_top(body,bottom=False): if (bottom): ET.SubElement(body,"hr") - - table = ET.SubElement(body,"table") + + table = ET.SubElement(body,"table") table.attrib["class"]="top_table" tr = ET.SubElement(table,"tr") td = ET.SubElement(tr,"td") td.attrib["class"]="top_table" - + img = ET.SubElement(td,"image") img.attrib["src"]="images/logo.png" td = ET.SubElement(tr,"td") @@ -81,18 +81,18 @@ def make_html_top(body,bottom=False): a.text="Inheritance" if (not bottom): ET.SubElement(body,"hr") - - - + + + def make_html_class_list(class_list,columns): - + div=ET.Element("div") div.attrib["class"]="ClassList"; - + h1=ET.SubElement(div,"h2") h1.text="Alphabetical Class List" - + table=ET.SubElement(div,"table") table.attrib["class"]="class_table" table.attrib["width"]="100%" @@ -104,13 +104,13 @@ def make_html_class_list(class_list,columns): row_count = 0 last_initial = "" fit_columns=[] - + for n in range(0,columns): fit_columns+=[[]] indexers=[] last_initial="" - + idx=0 for n in class_list: col = int(idx/col_max) @@ -123,25 +123,25 @@ def make_html_class_list(class_list,columns): last_initial=n[:1] row_max=0 - + for n in range(0,columns): if (len(fit_columns[n])>row_max): row_max=len(fit_columns[n]) - + for r in range(0,row_max): tr = ET.SubElement(table,"tr") - for c in range(0,columns): - tdi = ET.SubElement(tr,"td") + for c in range(0,columns): + tdi = ET.SubElement(tr,"td") tdi.attrib["align"]="right" - td = ET.SubElement(tr,"td") + td = ET.SubElement(tr,"td") if (r>=len(fit_columns[c])): continue - + classname = fit_columns[c][r] print(classname) if (classname in indexers): - + span = ET.SubElement(tdi, "span") span.attrib["class"] = "class_index_letter" 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.attrib["href"] = "main.css" csscc.attrib["rel"] = "stylesheet" - csscc.attrib["type"] = "text/css" + csscc.attrib["type"] = "text/css" bodycc = ET.SubElement(cat_class_list, "body") make_html_top(bodycc) - + cat_class_parent=bodycc else: cat_class_parent=div - - - - + + + + h1=ET.SubElement(cat_class_parent,"h2") h1.text="Class List By Category" - + class_cat_table={} class_cat_list=[] - + for c in class_list: clss = classes[c] 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_table[class_cat]=[] class_cat_table[class_cat].append(c) - + class_cat_list.sort() - + ct = ET.SubElement(cat_class_parent,"table") for cl in class_cat_list: l = class_cat_table[cl] @@ -201,7 +201,7 @@ def make_html_class_list(class_list,columns): tr.attrib["class"]="category_title" td = ET.SubElement(ct,"td") td.attrib["class"]="category_title" - + a = ET.SubElement(td,"a") a.attrib["class"]="category_title" a.text=cl @@ -221,45 +221,45 @@ def make_html_class_list(class_list,columns): bdtext=bd.text td = ET.SubElement(ct,"td") td.text=bdtext - + if (not single_page): - make_html_bottom(bodycc) + make_html_bottom(bodycc) catet_out = ET.ElementTree(cat_class_list) catet_out.write("category.html") - + if (not single_page): inh_class_list=ET.Element("html") cssic = ET.SubElement(inh_class_list, "link") cssic.attrib["href"] = "main.css" cssic.attrib["rel"] = "stylesheet" - cssic.attrib["type"] = "text/css" + cssic.attrib["type"] = "text/css" bodyic = ET.SubElement(inh_class_list, "body") make_html_top(bodyic) inh_class_parent=bodyic else: inh_class_parent=div - - - - + + + + h1=ET.SubElement(inh_class_parent,"h2") h1.text="Class List By Inheritance" - + itemlist = ET.SubElement(inh_class_parent,"list") - + class_inh_table={} def add_class(clss): if (clss.attrib["name"] in class_inh_table): return #already added parent_list=None - + if ("inherits" in clss.attrib): inhc = clss.attrib["inherits"] if (not (inhc in class_inh_table)): add_class(classes[inhc]) - + parent_list = class_inh_table[inhc].find("div") if (parent_list == None): 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" else: parent_list = parent_list.find("list") - - + + else: parent_list=itemlist - + item = ET.SubElement(parent_list,"li") # 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) - - - for c in class_list: + + + for c in class_list: add_class(classes[c]) - + if (not single_page): - make_html_bottom(bodyic) + make_html_bottom(bodyic) catet_out = ET.ElementTree(inh_class_list) catet_out.write("inheritance.html") - - - - + + + + #h1=ET.SubElement(div,"h2") #h1.text="Class List By Inheritance" - return div + return div def make_type(p_type,p_parent): if (p_type=="RefPtr"): p_type="Resource" - + if (p_type in class_names): a=ET.SubElement(p_parent,"a") a.attrib["class"]="datatype_existing" @@ -326,7 +326,7 @@ def make_text_def(class_name,parent,text): endq_pos=text.find("]",pos+1) if (endq_pos==-1): break - + pre_text=text[:pos] post_text=text[endq_pos+1:] tag_text=text[pos+1:endq_pos] @@ -346,7 +346,7 @@ def make_text_def(class_name,parent,text): elif(cmd.find("method")==0): cmd=tag_text[:space_pos] param=tag_text[space_pos+1:] - + if (not single_page and param.find(".")!=-1): class_param,method_param=param.split(".") tag_text=tag_text=''+class_param+'.'+method_param+'()' @@ -358,22 +358,22 @@ def make_text_def(class_name,parent,text): elif (cmd.find("url=")==0): tag_text="" elif (cmd=="/url"): - tag_text="" + tag_text="" elif (cmd=="center"): - tag_text="
" + tag_text="
" elif (cmd=="/center"): tag_text="
" elif (cmd=="br"): - tag_text="
" + tag_text="
" 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 else: tag_text="["+tag_text+"]" - - + + text=pre_text+tag_text+post_text pos=len(pre_text)+len(tag_text) - + #tnode = ET.SubElement(parent,"div") #tnode.text=text text="
"+text+"
" @@ -383,19 +383,19 @@ def make_text_def(class_name,parent,text): except: print("Error parsing description text: '"+text+"'") sys.exit(255) - - + + return tnode - - + + def make_method_def(name,m,declare,event=False): mdata={} - - if (not declare): + + if (not declare): div=ET.Element("tr") div.attrib["class"]="method" ret_parent=ET.SubElement(div,"td") @@ -406,13 +406,13 @@ def make_method_def(name,m,declare,event=False): div.attrib["class"]="method" ret_parent=div func_parent=div - + mdata["argidx"]=[] mdata["name"]=m.attrib["name"] qualifiers="" if ("qualifiers" in m.attrib): qualifiers=m.attrib["qualifiers"] - + args=list(m) for a in args: if (a.tag=="return"): @@ -421,11 +421,11 @@ def make_method_def(name,m,declare,event=False): idx=int(a.attrib["index"]) else: continue - + mdata["argidx"].append(idx) mdata[idx]=a - if (not event): + if (not event): if (-1 in mdata["argidx"]): make_type(mdata[-1].attrib["type"],ret_parent) mdata["argidx"].remove(-1) @@ -443,29 +443,29 @@ def make_method_def(name,m,declare,event=False): a=ET.SubElement(span,"a") a.attrib["href"]="#"+name+"_"+m.attrib["name"] a.text=m.attrib["name"] - + span=ET.SubElement(func_parent,"span") span.attrib["class"]="symbol" span.text=" (" - + for a in mdata["argidx"]: arg=mdata[a] - if (a>0): + if (a>0): span=ET.SubElement(func_parent,"span") span.text=", " else: span=ET.SubElement(func_parent,"span") span.text=" " - - + + make_type(arg.attrib["type"],func_parent) span=ET.SubElement(func_parent,"span") span.text=arg.attrib["name"] if ("default" in arg.attrib): span.text=span.text+"="+arg.attrib["default"] - - + + span=ET.SubElement(func_parent,"span") span.attrib["class"]="symbol" if (len(mdata["argidx"])): @@ -477,9 +477,9 @@ def make_method_def(name,m,declare,event=False): span=ET.SubElement(func_parent,"span") span.attrib["class"]="qualifier" span.text=" "+qualifiers - + return div - + def make_html_class(node): @@ -488,7 +488,7 @@ def make_html_class(node): a=ET.SubElement(div,"a") a.attrib["name"]=node.attrib["name"] - + h3=ET.SubElement(a,"h3") h3.attrib["class"]="title class_title" h3.text=node.attrib["name"] @@ -498,63 +498,63 @@ def make_html_class(node): div2=ET.SubElement(div,"div") div2.attrib["class"]="description class_description" div2.text=briefd.text - + if ("inherits" in node.attrib): ET.SubElement(div,"br") - div2=ET.SubElement(div,"div") + div2=ET.SubElement(div,"div") div2.attrib["class"]="inheritance"; span=ET.SubElement(div2,"span") span.text="Inherits: " - + make_type(node.attrib["inherits"],div2) - + if ("category" in node.attrib): ET.SubElement(div,"br") - - div3=ET.SubElement(div,"div") + + div3=ET.SubElement(div,"div") div3.attrib["class"]="category"; - + span=ET.SubElement(div3,"span") span.attrib["class"]="category" span.text="Category: " - + a = ET.SubElement(div3,"a") a.attrib["class"]="category_ref" a.text=node.attrib["category"] catname=a.text if (catname.rfind("/")!=-1): - catname=catname[catname.rfind("/"):] + catname=catname[catname.rfind("/"):] catname="CATEGORY_"+catname - + if (single_page): a.attrib["href"]="#"+catname else: a.attrib["href"]="category.html#"+catname - - - methods = node.find("methods") - + + + methods = node.find("methods") + if(methods!=None and len(list(methods))>0): h4=ET.SubElement(div,"h4") h4.text="Public Methods:" - method_table=ET.SubElement(div,"table") + method_table=ET.SubElement(div,"table") method_table.attrib["class"]="method_list"; for m in list(methods): # li = ET.SubElement(div2, "li") 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): h4=ET.SubElement(div,"h4") h4.text="Events:" - event_table=ET.SubElement(div,"table") + event_table=ET.SubElement(div,"table") event_table.attrib["class"]="method_list"; 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) ) - members = node.find("members") + members = node.find("members") if(members!=None and len(list(members))>0): h4=ET.SubElement(div,"h4") h4.text="Public Variables:" - div2=ET.SubElement(div,"div") + div2=ET.SubElement(div,"div") div2.attrib["class"]="member_list"; - + for c in list(members): - + li = ET.SubElement(div2, "li") div3=ET.SubElement(li,"div") div3.attrib["class"]="member"; - make_type(c.attrib["type"],div3) + make_type(c.attrib["type"],div3) span=ET.SubElement(div3,"span") span.attrib["class"]="identifier member_name" span.text=" "+c.attrib["name"]+" " @@ -584,19 +584,19 @@ def make_html_class(node): span.text=c.text - constants = node.find("constants") + constants = node.find("constants") if(constants!=None and len(list(constants))>0): h4=ET.SubElement(div,"h4") h4.text="Constants:" - div2=ET.SubElement(div,"div") + div2=ET.SubElement(div,"div") div2.attrib["class"]="constant_list"; - + for c in list(constants): li = ET.SubElement(div2, "li") div3=ET.SubElement(li,"div") div3.attrib["class"]="constant"; - + span=ET.SubElement(div3,"span") span.attrib["class"]="identifier constant_name" span.text=c.attrib["name"]+" " @@ -610,22 +610,22 @@ def make_html_class(node): span=ET.SubElement(div3,"span") span.attrib["class"]="constant_description" span.text=c.text - + # ET.SubElement(div,"br") - - + + descr=node.find("description") if (descr!=None and descr.text.strip()!=""): h4=ET.SubElement(div,"h4") h4.text="Description:" - + make_text_def(node.attrib["name"],div,descr.text) -# div2=ET.SubElement(div,"div") +# div2=ET.SubElement(div,"div") # div2.attrib["class"]="description"; # div2.text=descr.text - - - + + + if(methods!=None or events!=None): h4=ET.SubElement(div,"h4") @@ -639,7 +639,7 @@ def make_html_class(node): for m in iter_list: descr=m.find("description") - + if (descr==None or descr.text.strip()==""): continue; @@ -651,11 +651,11 @@ def make_html_class(node): #anchor = ET.SubElement(div2, "a") #anchor.attrib["name"] = make_text_def(node.attrib["name"],div2,descr.text) - #div3=ET.SubElement(div2,"div") + #div3=ET.SubElement(div2,"div") #div3.attrib["class"]="description"; #div3.text=descr.text - - + + return div class_names=[] @@ -676,7 +676,7 @@ for file in input_list: continue class_names.append(c.attrib["name"]) classes[c.attrib["name"]]=c - + html = ET.Element("html") css = ET.SubElement(html, "link") css.attrib["href"] = "main.css" @@ -690,7 +690,7 @@ if (not single_page): class_names.sort() - + body.append( make_html_class_list(class_names,5) ) for cn in class_names: @@ -704,9 +704,9 @@ for cn in class_names: css.attrib["rel"] = "stylesheet" css.attrib["type"] = "text/css" body2 = ET.SubElement(html2, "body" ) - make_html_top(body2) - body2.append( make_html_class(c) ); - make_html_bottom(body2) + make_html_top(body2) + body2.append( make_html_class(c) ); + make_html_bottom(body2) et_out = ET.ElementTree(html2) et_out.write(c.attrib["name"]+".html") diff --git a/doc/tools/makemd.py b/doc/tools/makemd.py index e012287b0e2..38b493b0bff 100644 --- a/doc/tools/makemd.py +++ b/doc/tools/makemd.py @@ -54,7 +54,7 @@ def make_class_list(class_list, columns): row_max = 0 f.write("\n") - + for n in range(0, columns): if len(fit_columns[n]) > row_max: row_max = len(fit_columns[n]) @@ -63,7 +63,7 @@ def make_class_list(class_list, columns): for n in range(0, columns): f.write(" | |") - f.write("\n") + f.write("\n") f.write("| ") for n in range(0, columns): f.write(" --- | ------- |") diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index 6311be767cc..060dbc805de 100644 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -60,7 +60,7 @@ def make_class_list(class_list, columns): row_max = 0 f.write("\n") - + for n in range(0, columns): if len(fit_columns[n]) > row_max: row_max = len(fit_columns[n]) @@ -69,7 +69,7 @@ def make_class_list(class_list, columns): for n in range(0, columns): f.write(" | |") - f.write("\n") + f.write("\n") f.write("+") for n in range(0, columns): f.write("--+-------+") @@ -265,7 +265,7 @@ def make_method( t = '- ' else: t = "" - + ret_type = 'void' args = list(m) mdata = {} @@ -332,7 +332,7 @@ def make_method( if (not declare): if (pp!=None): pp.append( (t,s) ) - else: + else: f.write("- "+t+" "+s+"\n") else: f.write(t+s+"\n") @@ -366,24 +366,24 @@ def make_rst_class(node): f.write(" **<** ") else: first=False - + f.write(make_type(inh)) inode = classes[inh] if ('inherits' in inode.attrib): inh=inode.attrib['inherits'].strip() else: inh=None - - + + f.write("\n\n") - + inherited=[] for cn in classes: - c=classes[cn] + c=classes[cn] if 'inherits' in c.attrib: if (c.attrib['inherits'].strip()==name): inherited.append(c.attrib['name']) - + if (len(inherited)): f.write('**Inherited By:** ') for i in range(len(inherited)): @@ -415,7 +415,7 @@ def make_rst_class(node): tl = len(s[1]) if (tl>longest_t): longest_t=tl - + sep="+" for i in range(longest_s+2): sep+="-" diff --git a/methods.py b/methods.py index 39230b6e2f2..a4283384998 100755 --- a/methods.py +++ b/methods.py @@ -15,19 +15,19 @@ def add_source_files(self, sources, filetype, lib_env = None, shared = False): else: for f in filetype: sources.append(self.Object(f)) - -def build_shader_header( target, source, env ): + +def build_shader_header( target, source, env ): for x in source: print x - + name = str(x) name = name[ name.rfind("/")+1: ] name = name[ name.rfind("\\")+1: ] name = name.replace(".","_") - - + + fs = open(str(x),"r") fd = open(str(x)+".h","w") 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("\"","\\\"") fd.write("\""+line+"\\n\"\n") line=fs.readline() - + fd.write(";\n") - + return 0 - - -def build_glsl_header( filename ): - - fs = open(filename,"r") + + +def build_glsl_header( filename ): + + fs = open(filename,"r") line=fs.readline() - + vertex_lines=[] fragment_lines=[] uniforms=[] @@ -68,21 +68,21 @@ def build_glsl_header( filename ): fragment_offset=0 while(line): - + if (line.find("[vertex]")!=-1): reading="vertex" line=fs.readline() line_offset+=1 vertex_offset=line_offset continue - + if (line.find("[fragment]")!=-1): reading="fragment" line=fs.readline() line_offset+=1 fragment_offset=line_offset continue - + if (line.find("#ifdef ")!=-1): ifdefline = line.replace("#ifdef ","").strip() if (not ifdefline in conditionals): @@ -159,49 +159,49 @@ def build_glsl_header( filename ): uline = uline.replace("attribute ",""); uline = uline.replace(";",""); uline = uline[ uline.find(" "): ].strip() - - + + if (uline.find("//")!=-1): name,bind = uline.split("//") if (bind.find("attrib:")!=-1): name=name.strip() bind=bind.replace("attrib:","").strip() attributes+=[(name,bind)] - + if (line.strip().find("out ")==0): uline = line.replace("out","").strip(); uline = uline.replace(";",""); uline = uline[ uline.find(" "): ].strip() - - + + if (uline.find("//")!=-1): name,bind = uline.split("//") if (bind.find("drawbuffer:")!=-1): name=name.strip() bind=bind.replace("drawbuffer:","").strip() fbos+=[(name,bind)] - + line=line.replace("\r","") line=line.replace("\n","") line=line.replace("\\","\\\\") line=line.replace("\"","\\\"") #line=line+"\\n\\" no need to anymore - + if (reading=="vertex"): vertex_lines+=[line] if (reading=="fragment"): fragment_lines+=[line] - + line=fs.readline() line_offset+=1 fs.close(); - + out_file = filename+".h" fd = open(out_file,"w") - + fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n"); - + 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: ] @@ -209,14 +209,14 @@ def build_glsl_header( filename ): out_file_ifdef = out_file_base.replace(".","_").upper() fd.write("#ifndef "+out_file_ifdef+"\n") fd.write("#define "+out_file_ifdef+"\n") - + out_file_class = out_file_base.replace(".glsl.h","").title().replace("_","").replace(".","")+"ShaderGL"; fd.write("\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("\t virtual String get_shader_name() const { return \""+out_file_class+"\"; }\n"); fd.write("public:\n\n"); - + if (len(conditionals)): fd.write("\tenum Conditionals {\n"); for x in conditionals: @@ -227,11 +227,11 @@ def build_glsl_header( filename ): for x in uniforms: fd.write("\t\t"+x.upper()+",\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)): - 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_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"); @@ -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, 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, const Transform& p_transform) { _FU const Transform &tr = p_transform; - + GLfloat matrix[16]={ /* build a 16x16 matrix */ tr.basis.elements[0][0], tr.basis.elements[1][0], @@ -272,15 +272,15 @@ def build_glsl_header( filename ): tr.origin.x, tr.origin.y, tr.origin.z, - 1 + 1 }; - - + + glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); - - + + } - + """); 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 - + GLfloat matrix[16]; - + for (int i=0;i<4;i++) { for (int j=0;j<4;j++) { - + matrix[i*4+j]=p_matrix.matrix[i][j]; - } + } } - + glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix); }; """); - + fd.write("\n\n#undef _FU\n\n\n"); - - + + fd.write("\tvirtual void init() {\n\n"); if (len(conditionals)): - + fd.write("\t\tstatic const char* _conditional_strings[]={\n") if (len(conditionals)): for x in conditionals: @@ -341,9 +341,9 @@ def build_glsl_header( filename ): fd.write("\t\t};\n\n"); else: fd.write("\t\tstatic const char **_conditional_strings=NULL;\n") - + if (len(uniforms)): - + fd.write("\t\tstatic const char* _uniform_strings[]={\n") if (len(uniforms)): for x in uniforms: @@ -351,18 +351,18 @@ def build_glsl_header( filename ): fd.write("\t\t};\n\n"); else: fd.write("\t\tstatic const char **_uniform_strings=NULL;\n") - + if (len(attributes)): - + fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n") for x in attributes: fd.write("\t\t\t{\""+x[0]+"\","+x[1]+"},\n"); fd.write("\t\t};\n\n"); else: fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n") - - + + if (len(fbos)): fd.write("\t\tstatic FBOPair _fbo_pairs[]={\n") 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};\n\n") - + fd.write("};\n\n"); fd.write("#endif\n\n"); fd.close(); - -def build_glsl_headers( target, source, env ): + +def build_glsl_headers( target, source, env ): for x in source: - + build_glsl_header(str(x)); - - return 0 + + return 0 @@ -1084,12 +1084,12 @@ def build_gles2_headers( target, source, env ): def update_version(): rev = "custom_build" - + if (os.getenv("BUILD_REVISION")!=None): rev=os.getenv("BUILD_REVISION") print("Using custom revision: "+rev) import version - + f=open("core/version.h","wb") 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(); - + def build_cg_shader(sname): vp_uniforms = [] @@ -1172,7 +1172,7 @@ def build_cg_shader(sname): fd.write("\t};\n"); - + import glob def detect_modules(): @@ -1371,7 +1371,7 @@ def save_active_platforms(apnames,ap): str+="," str+="};\n" - + wf = x+"/logo.h" logow = open(wf,"wb") logow.write(str) diff --git a/modules/SCsub b/modules/SCsub index 9215bfd48fe..f37c3a55c70 100644 --- a/modules/SCsub +++ b/modules/SCsub @@ -1,21 +1,21 @@ -Import('env') - -env_modules = env.Clone() - -Export('env_modules') - -env.modules_sources=[ - "register_module_types.cpp", -] -#env.add_source_files(env.modules_sources,"*.cpp") -Export('env') - -for x in env.module_list: - if (x in env.disabled_modules): - continue - env_modules.Append(CPPFLAGS=["-DMODULE_"+x.upper()+"_ENABLED"]) - SConscript(x+"/SCsub") - -lib = env_modules.Library("modules",env.modules_sources) - -env.Prepend(LIBS=[lib]) +Import('env') + +env_modules = env.Clone() + +Export('env_modules') + +env.modules_sources=[ + "register_module_types.cpp", +] +#env.add_source_files(env.modules_sources,"*.cpp") +Export('env') + +for x in env.module_list: + if (x in env.disabled_modules): + continue + env_modules.Append(CPPFLAGS=["-DMODULE_"+x.upper()+"_ENABLED"]) + SConscript(x+"/SCsub") + +lib = env_modules.Library("modules",env.modules_sources) + +env.Prepend(LIBS=[lib]) diff --git a/modules/gdscript/config.py b/modules/gdscript/config.py index f9bd7da08d3..ea7e83378a9 100644 --- a/modules/gdscript/config.py +++ b/modules/gdscript/config.py @@ -2,10 +2,10 @@ def can_build(platform): return True - - + + def configure(env): pass - - - + + + diff --git a/modules/gridmap/config.py b/modules/gridmap/config.py index f9bd7da08d3..ea7e83378a9 100644 --- a/modules/gridmap/config.py +++ b/modules/gridmap/config.py @@ -2,10 +2,10 @@ def can_build(platform): return True - - + + def configure(env): pass - - - + + + diff --git a/platform/android/detect.py b/platform/android/detect.py index 15ef478e196..e3f1941142e 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -5,7 +5,7 @@ import platform def is_active(): return True - + def get_name(): return "Android" @@ -55,9 +55,9 @@ def configure(env): # http://www.scons.org/wiki/LongCmdLinesOnWin32 import os if (os.name=="nt"): - + import subprocess - + def mySubProcess(cmdline,env): #print "SPAWNED : " + cmdline startupinfo = subprocess.STARTUPINFO() @@ -71,26 +71,26 @@ def configure(env): print err print "=====" return rv - + def mySpawn(sh, escape, cmd, args, env): - + newargs = ' '.join(args[1:]) cmdline = cmd + " " + newargs - + rv=0 if len(cmdline) > 32000 and cmd.endswith("ar") : cmdline = cmd + " " + args[1] + " " + args[2] + " " for i in range(3,len(args)) : rv = mySubProcess( cmdline + args[i], env ) if rv : - break - else: + break + else: rv = mySubProcess( cmdline, env ) - + return rv - + env['SPAWN'] = mySpawn - + ndk_platform=env['ndk_platform'] if env['android_arch'] not in ['armv7','armv6','x86']: @@ -113,7 +113,7 @@ def configure(env): print("Godot Android!!!!! ("+env['android_arch']+")"+neon_text) env.Append(CPPPATH=['#platform/android']) - + if env['android_arch']=='x86': env.extra_suffix=".x86"+env.extra_suffix elif env['android_arch']=='armv6': @@ -125,7 +125,7 @@ def configure(env): env.extra_suffix=".armv7"+env.extra_suffix gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/"; - + import os 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 @@ -137,8 +137,8 @@ def configure(env): env['SHLINKFLAGS'][1] = '-shared' elif (os.name=="nt"): gcc_path=gcc_path+"/windows-x86_64/bin" #this may be wrong - - + + env['ENV']['PATH'] = gcc_path+":"+env['ENV']['PATH'] if env['android_arch']=='x86': @@ -223,7 +223,7 @@ def configure(env): 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(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a"]) - + env.Append(LIBS=["gnustl_static","supc++"]) env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"]) diff --git a/platform/bb10/detect.py b/platform/bb10/detect.py index f134a9df19d..9ab94e619ab 100644 --- a/platform/bb10/detect.py +++ b/platform/bb10/detect.py @@ -6,7 +6,7 @@ import methods def is_active(): return True - + def get_name(): return "BlackBerry 10" @@ -36,7 +36,7 @@ def get_flags(): ('tools', 'no'), ('nedmalloc', 'no'), ('theora', 'no'), - + ] def configure(env): diff --git a/platform/flash/detect.py b/platform/flash/detect.py index f079f21fdd2..7f558a2b75e 100644 --- a/platform/flash/detect.py +++ b/platform/flash/detect.py @@ -4,7 +4,7 @@ import string def is_active(): return True - + def get_name(): return "Flash" @@ -18,7 +18,7 @@ def can_build(): def get_opts(): return [] - + def get_flags(): @@ -52,7 +52,7 @@ def configure(env): if (ccroot.find("/cygdrive")==0): unit = ccroot[ ccroot.find("/") + 1 ] ccroot=ccroot.replace("/cygdrive/"+unit,unit+":") - + env['FLASCC_ROOT'] = ccroot if env['PLATFORM'] == 'win32': import methods @@ -71,11 +71,11 @@ def configure(env): env['AR'] = ccroot+'/sdk/usr/bin/ar' env['LINK'] = ccroot+'/sdk/usr/bin/gcc' - + env['OBJSUFFIX'] = ".fl.o" env['LIBSUFFIX'] = ".fl.a" env['PROGSUFFIX'] = "_flash" - + #env["CXX"]='gcc-4' import string #include path diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index a3af8ff163a..dab75e08c83 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -100,7 +100,7 @@ static int frame_count = 0; int backingHeight; glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth); glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight); - + OS::VideoMode vm; vm.fullscreen = true; @@ -118,7 +118,7 @@ static int frame_count = 0; NSString *documentsDirectory = [paths objectAtIndex:0]; //NSString *documentsDirectory = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; OSIPhone::get_singleton()->set_data_dir(String::utf8([documentsDirectory UTF8String])); - + NSString *locale_code = [[[NSLocale preferredLanguages] objectAtIndex:0] substringToIndex:2]; OSIPhone::get_singleton()->set_locale(String::utf8([locale_code UTF8String])); @@ -218,7 +218,7 @@ static int frame_count = 0; [application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; // disable idle timer //application.idleTimerDisabled = YES; - + //Create a full-screen window window = [[UIWindow alloc] initWithFrame:rect]; //window.autoresizesSubviews = YES; @@ -236,9 +236,9 @@ static int frame_count = 0; int backingHeight; glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth); glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight); - + iphone_main(backingWidth, backingHeight, gargc, gargv); - + view_controller = [[ViewController alloc] init]; view_controller.view = glView; window.rootViewController = view_controller; @@ -248,7 +248,7 @@ static int frame_count = 0; printf("cadisaplylink: %d", glView.useCADisplayLink); glView.animationInterval = 1.0 / kRenderingFrequency; [glView startAnimation]; - + //Show the window [window makeKeyAndVisible]; @@ -261,9 +261,9 @@ static int frame_count = 0; //OSIPhone::screen_width = rect.size.width - rect.origin.x; //OSIPhone::screen_height = rect.size.height - rect.origin.y; - + mainViewController = view_controller; - + #ifdef MODULE_GAME_ANALYTICS_ENABLED printf("********************* didFinishLaunchingWithOptions\n"); if(!Globals::get_singleton()->has("mobileapptracker/advertiser_id")) @@ -274,24 +274,24 @@ static int frame_count = 0; { return; } - + String adid = GLOBAL_DEF("mobileapptracker/advertiser_id",""); String convkey = GLOBAL_DEF("mobileapptracker/conversion_key",""); - + NSString * advertiser_id = [NSString stringWithUTF8String:adid.utf8().get_data()]; NSString * conversion_key = [NSString stringWithUTF8String:convkey.utf8().get_data()]; - + // Account Configuration info - must be set [MobileAppTracker initializeWithMATAdvertiserId:advertiser_id MATConversionKey:conversion_key]; - + // Used to pass us the IFA, enables highly accurate 1-to-1 attribution. // Required for many advertising networks. [MobileAppTracker setAppleAdvertisingIdentifier:[[ASIdentifierManager sharedManager] advertisingIdentifier] advertisingTrackingEnabled:[[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]]; - + #endif - + }; - (void)applicationWillTerminate:(UIApplication*)application { @@ -389,7 +389,7 @@ static int frame_count = 0; [PFPush handlePush:userInfo]; NSDictionary *aps = [userInfo objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - + NSLog(@"Push Notification Payload (app active) %@", aps); [defaults setObject:aps forKey:@"notificationInfo"]; [defaults synchronize]; diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 9472f05e169..c3ee098350d 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -108,7 +108,7 @@ def configure(env): if env['store_kit'] == 'yes': env.Append(CPPFLAGS=['-DSTOREKIT_ENABLED']) env.Append(LINKFLAGS=['-framework', 'StoreKit']) - + if env['icloud'] == 'yes': env.Append(CPPFLAGS=['-DICLOUD_ENABLED']) @@ -117,7 +117,7 @@ def configure(env): if (env["target"]=="release"): 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": env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED']) @@ -151,7 +151,7 @@ def configure(env): env.Append(CPPFLAGS=['-fno-exceptions']) #env['neon_enabled']=True env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc' - + import methods 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') } ) diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm index 3756b586991..a5b90514dae 100644 --- a/platform/iphone/game_center.mm +++ b/platform/iphone/game_center.mm @@ -94,10 +94,10 @@ Error GameCenter::connect() { ret["error_description"] = [error.localizedDescription UTF8String]; GameCenter::get_singleton()->connected = false; }; - + pending_events.push_back(ret); }; - + }); return OK; @@ -156,7 +156,7 @@ Error GameCenter::award_achievement(Variant p_params) { if (params.has("show_completion_banner")) { achievement.showsCompletionBanner = params["show_completion_banner"] ? YES : NO; } - + [GKAchievement reportAchievements:@[achievement] withCompletionHandler:^(NSError *error) { Dictionary ret; @@ -189,30 +189,30 @@ void GameCenter::request_achievement_descriptions() { IntArray maximum_points; Array hidden; Array replayable; - + for (int i=0; i<[descriptions count]; i++) { GKAchievementDescription* description = [descriptions objectAtIndex:i]; - + const char* str = [description.identifier UTF8String]; names.push_back(String::utf8(str != NULL ? str : "")); - + str = [description.title UTF8String]; titles.push_back(String::utf8(str != NULL ? str : "")); - + str = [description.unachievedDescription UTF8String]; unachieved_descriptions.push_back(String::utf8(str != NULL ? str : "")); - + str = [description.achievedDescription UTF8String]; achieved_descriptions.push_back(String::utf8(str != NULL ? str : "")); - + maximum_points.push_back(description.maximumPoints); - + hidden.push_back(description.hidden == YES); - + replayable.push_back(description.replayable == YES); } - + ret["names"] = names; ret["titles"] = titles; ret["unachieved_descriptions"] = unachieved_descriptions; @@ -220,7 +220,7 @@ void GameCenter::request_achievement_descriptions() { ret["maximum_points"] = maximum_points; ret["hidden"] = hidden; ret["replayable"] = replayable; - + } else { ret["result"] = "error"; ret["error_code"] = error.code; @@ -241,19 +241,19 @@ void GameCenter::request_achievements() { ret["result"] = "ok"; StringArray names; RealArray percentages; - + for (int i=0; i<[achievements count]; i++) { GKAchievement* achievement = [achievements objectAtIndex:i]; const char* str = [achievement.identifier UTF8String]; names.push_back(String::utf8(str != NULL ? str : "")); - + percentages.push_back(achievement.percentComplete); } - + ret["names"] = names; ret["progress"] = percentages; - + } else { ret["result"] = "error"; ret["error_code"] = error.code; @@ -275,7 +275,7 @@ void GameCenter::reset_achievements() { ret["result"] = "error"; ret["error_code"] = error.code; }; - + 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; ERR_FAIL_COND_V(!root_controller, FAILED); - + controller.gameCenterDelegate = root_controller; controller.viewState = view_state; if (view_state == GKGameCenterViewControllerStateLeaderboards) { @@ -322,14 +322,14 @@ Error GameCenter::show_game_center(Variant p_params) { controller.leaderboardIdentifier = name_str; } } - + [root_controller presentViewController: controller animated: YES completion:nil]; - - return OK; + + return OK; }; void GameCenter::game_center_closed() { - + Dictionary ret; ret["type"] = "show_game_center"; ret["result"] = "ok"; diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm index 94fbb9e174b..607352ab0ba 100755 --- a/platform/iphone/gl_view.mm +++ b/platform/iphone/gl_view.mm @@ -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]; NSLog(@"subtitle lang: %@", language); - + if ([language isEqualToString:[NSString stringWithUTF8String:p_audio_track.utf8()]]) { 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]; NSLog(@"subtitle lang: %@", language); - + if ([language isEqualToString:[NSString stringWithUTF8String:p_subtitle_track.utf8()]]) { [_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() { if (_instance.avPlayer.error) { - printf("Error during playback\n"); + printf("Error during playback\n"); } return (_instance.avPlayer.rate > 0 && !_instance.avPlayer.error); } @@ -257,7 +257,7 @@ static void clear_touches() { if((self = [super initWithCoder:coder])) { self = [self initGLES]; - } + } return self; } @@ -265,14 +265,14 @@ static void clear_touches() { { // Get our backing 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. eaglLayer.opaque = YES; eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil]; - + // Create our EAGLContext, and if successful make it current and create our framebuffer. context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; @@ -281,7 +281,7 @@ static void clear_touches() { [self release]; return nil; } - + // Default the animation interval to 1/60th of a second. animationInterval = 1.0 / 60.0; return self; @@ -327,17 +327,17 @@ static void clear_touches() { glGenFramebuffersOES(1, &viewFramebuffer); glGenRenderbuffersOES(1, &viewRenderbuffer); - + glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer); glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer); // 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). [context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(id)self.layer]; 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_HEIGHT_OES, &backingHeight); - + // For this sample, we also need a depth buffer, so we'll create and attach one via another renderbuffer. glGenRenderbuffersOES(1, &depthRenderbuffer); glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer); @@ -371,7 +371,7 @@ static void clear_touches() { viewFramebuffer = 0; glDeleteRenderbuffersOES(1, &viewRenderbuffer); viewRenderbuffer = 0; - + if(depthRenderbuffer) { glDeleteRenderbuffersOES(1, &depthRenderbuffer); @@ -461,21 +461,21 @@ static void clear_touches() { // Make sure that you are drawing to the current 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(!delegateSetup) { [delegate setupView:self]; delegateSetup = YES; } - + glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer); [delegate drawView:self]; - + glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer); [context presentRenderbuffer:GL_RENDERBUFFER_OES]; - + #ifdef DEBUG_ENABLED GLenum err = glGetError(); if(err) @@ -487,9 +487,9 @@ static void clear_touches() { { NSArray* tlist = [[event allTouches] allObjects]; for (unsigned int i=0; i< [tlist count]; i++) { - + if ( [touches containsObject:[tlist objectAtIndex:i]] ) { - + UITouch* touch = [tlist objectAtIndex:i]; if (touch.phase != UITouchPhaseBegan) continue; @@ -506,9 +506,9 @@ static void clear_touches() { NSArray* tlist = [[event allTouches] allObjects]; for (unsigned int i=0; i< [tlist count]; i++) { - + if ( [touches containsObject:[tlist objectAtIndex:i]] ) { - + UITouch* touch = [tlist objectAtIndex:i]; if (touch.phase != UITouchPhaseMoved) continue; @@ -527,9 +527,9 @@ static void clear_touches() { { NSArray* tlist = [[event allTouches] allObjects]; for (unsigned int i=0; i< [tlist count]; i++) { - + if ( [touches containsObject:[tlist objectAtIndex:i]] ) { - + UITouch* touch = [tlist objectAtIndex:i]; if (touch.phase != UITouchPhaseEnded) continue; @@ -543,7 +543,7 @@ static void clear_touches() { } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { - + OSIPhone::get_singleton()->touches_cancelled(); clear_touches(); }; @@ -652,12 +652,12 @@ static void clear_touches() { - (void)dealloc { [self stopAnimation]; - + if([EAGLContext currentContext] == context) { [EAGLContext setCurrentContext:nil]; } - + [context release]; context = nil; @@ -673,8 +673,8 @@ static void clear_touches() { video_found_error = true; } - if(_instance.avPlayer.status == AVPlayerStatusReadyToPlay && - _instance.avPlayerItem.status == AVPlayerItemStatusReadyToPlay && + if(_instance.avPlayer.status == AVPlayerStatusReadyToPlay && + _instance.avPlayerItem.status == AVPlayerItemStatusReadyToPlay && CMTIME_COMPARE_INLINE(video_current_time, ==, kCMTimeZero)) { //NSLog(@"time: %@", video_current_time); @@ -703,7 +703,7 @@ static void clear_touches() { /* - (void)moviePlayBackDidFinish:(NSNotification*)notification { - + NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey]; switch ([reason intValue]) { diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm index 449670667fe..0b3efe41fc2 100644 --- a/platform/iphone/icloud.mm +++ b/platform/iphone/icloud.mm @@ -49,7 +49,7 @@ void ICloud::_bind_methods() { 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("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("pop_pending_event"),&ICloud::pop_pending_event); }; @@ -83,7 +83,7 @@ Variant nsobject_to_variant(NSObject* object) { if ([data length] > 0) { ret.resize([data length]); { - ByteArray::Write w = ret.write(); + ByteArray::Write w = ret.write(); copymem(w.ptr(), [data bytes], [data length]); } } @@ -101,14 +101,14 @@ Variant nsobject_to_variant(NSObject* object) { else if ([object isKindOfClass:[NSDictionary class]]) { Dictionary result; NSDictionary* dic = (NSDictionary*)object; - - + + NSArray* keys = [dic allKeys]; int count = [keys count]; for (int i=0; i < count; ++i) { NSObject* k = [ keys objectAtIndex:i]; NSObject* v = [dic objectForKey:k]; - + result[nsobject_to_variant(k)] = nsobject_to_variant(v); } return result; @@ -121,29 +121,29 @@ Variant nsobject_to_variant(NSObject* object) { NSNumber* num = (NSNumber*)object; if(strcmp([num objCType], @encode(BOOL)) == 0) { return Variant((int)[num boolValue]); - } + } else if(strcmp([num objCType], @encode(char)) == 0) { return Variant((int)[num charValue]); - } + } else if(strcmp([num objCType], @encode(int)) == 0) { return Variant([num intValue]); - } + } else if(strcmp([num objCType], @encode(unsigned int)) == 0) { return Variant((int)[num unsignedIntValue]); - } + } else if(strcmp([num objCType], @encode(long long)) == 0) { return Variant((int)[num longValue]); - } + } else if(strcmp([num objCType], @encode(float)) == 0) { return Variant([num floatValue]); - } + } else if(strcmp([num objCType], @encode(double)) == 0) { return Variant((float)[num doubleValue]); } } else if ([object isKindOfClass:[NSDate class]]) { //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 WARN_PRINT("NSDate unsupported, returning null Variant") return Variant(); @@ -177,13 +177,13 @@ NSObject* variant_to_nsobject(Variant v) { for (unsigned int i = 0; i < keys.size(); ++i) { NSString* key = [[[NSString alloc] initWithUTF8String:((String)(keys[i])).utf8().get_data()] autorelease]; NSObject* value = variant_to_nsobject(dic[keys[i]]); - + if (key == NULL || value == NULL) { return NULL; } - + [result setObject:value forKey:key]; - } + } return result; } else if (v.get_type() == Variant::ARRAY) { @@ -213,13 +213,13 @@ NSObject* variant_to_nsobject(Variant v) { Error ICloud::remove_key(Variant p_param) { String param = p_param; NSString* key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease]; - + NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; - + if (![[store dictionaryRepresentation] objectForKey:key]) { return ERR_INVALID_PARAMETER; } - + [store removeObjectForKey:key]; return OK; } @@ -228,26 +228,26 @@ Error ICloud::remove_key(Variant p_param) { Variant ICloud::set_key_values(Variant p_params) { Dictionary params = p_params; Array keys = params.keys(); - + Array error_keys; - + for (unsigned int i = 0; i < keys.size(); ++i) { String variant_key = keys[i]; Variant variant_value = params[variant_key]; - + NSString* key = [[[NSString alloc] initWithUTF8String:variant_key.utf8().get_data()] autorelease]; if (key == NULL) { error_keys.push_back(variant_key); continue; } - + NSObject* value = variant_to_nsobject(variant_value); - + if (value == NULL) { error_keys.push_back(variant_key); continue; } - + NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; [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) { String param = p_param; - + NSString* key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease]; NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; - + if (![[store dictionaryRepresentation] objectForKey:key]) { return Variant(); } - + Variant result = nsobject_to_variant([[store dictionaryRepresentation] objectForKey:key]); - + return result; } Variant ICloud::get_all_key_values() { Dictionary result; - + NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore]; NSDictionary* store_dictionary = [store dictionaryRepresentation]; - + NSArray* keys = [store_dictionary allKeys]; int count = [keys count]; for (int i=0; i < count; ++i) { NSString* k = [ keys objectAtIndex:i]; NSObject* v = [store_dictionary objectForKey:k]; - + const char* str = [k UTF8String]; if (str != NULL) { result[String::utf8(str)] = nsobject_to_variant(v); } } - + return result; } @@ -320,7 +320,7 @@ ICloud::ICloud() { ERR_FAIL_COND(instance != NULL); instance = this; //connected = false; - + [ //[NSNotificationCenter defaultCenter] addObserverForName: @"notify" [NSNotificationCenter defaultCenter] addObserverForName: NSUbiquitousKeyValueStoreDidChangeExternallyNotification @@ -337,7 +337,7 @@ ICloud::ICloud() { //Array result_values; Dictionary keyValues; String reason = ""; - + if (change == NSUbiquitousKeyValueStoreServerChange) { reason = "server"; } @@ -350,27 +350,27 @@ ICloud::ICloud() { else if (change == NSUbiquitousKeyValueStoreAccountChange) { reason = "account"; } - + ret["reason"] = reason; - - + + NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; - + NSArray * keys = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangedKeysKey]; for (NSString* key in keys) { const char* str = [key UTF8String]; if (str == NULL) { continue; } - + NSObject* object = [store objectForKey:key]; - + //figure out what kind of object it is Variant value = nsobject_to_variant(object); - + keyValues[String::utf8(str)] = value; } - + ret["changed_values"] = keyValues; pending_events.push_back(ret); } diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm index fec007b7b6d..a2efe2711b7 100644 --- a/platform/iphone/in_app_store.mm +++ b/platform/iphone/in_app_store.mm @@ -179,35 +179,35 @@ Error InAppStore::request_product_info(Variant p_params) { ret["result"] = "ok"; ret["product_id"] = pid; ret["transaction_id"] = transactionId; - + NSData* receipt = nil; int sdk_version = 6; - + if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0){ - + NSURL *receiptFileURL = nil; NSBundle *bundle = [NSBundle mainBundle]; if ([bundle respondsToSelector:@selector(appStoreReceiptURL)]) { - + // Get the transaction receipt file path location in the app bundle. receiptFileURL = [bundle appStoreReceiptURL]; - + // Read in the contents of the transaction file. receipt = [NSData dataWithContentsOfURL:receiptFileURL]; sdk_version = 7; - + } else { // Fall back to deprecated transaction receipt, // which is still available in iOS 7. - + // Use SKPaymentTransaction's transactionReceipt. receipt = transaction.transactionReceipt; } - + }else{ receipt = transaction.transactionReceipt; } - + NSString* receipt_to_send = 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["sdk"] = sdk_version; ret["receipt"] = receipt_ret; - + InAppStore::get_singleton()->_post_event(ret); - + if (auto_finish_transactions){ [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; } else{ [pending_transactions setObject:transaction forKey:transaction.payment.productIdentifier]; } - + #ifdef MODULE_FUSEBOXX_ENABLED printf("Registering transaction on Fuseboxx!\n"); [FuseSDK registerInAppPurchase: transaction]; @@ -251,7 +251,7 @@ Error InAppStore::request_product_info(Variant p_params) { default: printf("status default %i!\n", (int)transaction.transactionState); - + break; }; }; @@ -322,7 +322,7 @@ InAppStore::InAppStore() { void InAppStore::finish_transaction(String product_id){ NSString* prod_id = [NSString stringWithCString:product_id.utf8().get_data() encoding:NSUTF8StringEncoding]; - + if ([pending_transactions objectForKey:prod_id]){ [[SKPaymentQueue defaultQueue] finishTransaction:[pending_transactions objectForKey:prod_id]]; [pending_transactions removeObjectForKey:prod_id]; diff --git a/platform/isim/detect.py b/platform/isim/detect.py index 0adbd9f4130..809b0ac3689 100644 --- a/platform/isim/detect.py +++ b/platform/isim/detect.py @@ -4,10 +4,10 @@ import sys def is_active(): return False - + def get_name(): return "iSIM" - + def can_build(): diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 0a6c8b14577..ae33a43f0d7 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -4,7 +4,7 @@ import string def is_active(): return True - + def get_name(): return "JavaScript" @@ -95,7 +95,7 @@ def configure(env): env.Append(LINKFLAGS=['-s','ASM_JS=1']) env.Append(LINKFLAGS=['-O2']) #env.Append(LINKFLAGS=['-g4']) - + #print "CCCOM is:", env.subst('$CCCOM') #print "P: ", env['p'], " Platofrm: ", env['platform'] diff --git a/platform/nacl/detect.py b/platform/nacl/detect.py index f8849cfd259..eedb29746a8 100644 --- a/platform/nacl/detect.py +++ b/platform/nacl/detect.py @@ -3,7 +3,7 @@ import sys def is_active(): return True - + def get_name(): return "NaCl" diff --git a/platform/osx/detect.py b/platform/osx/detect.py index f7cf5111f5b..1f176dc22a1 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -5,7 +5,7 @@ import sys def is_active(): return True - + def get_name(): return "OSX" diff --git a/platform/osx/dir_access_osx.mm b/platform/osx/dir_access_osx.mm index 29f8fda6630..20dc1df8f43 100644 --- a/platform/osx/dir_access_osx.mm +++ b/platform/osx/dir_access_osx.mm @@ -47,9 +47,9 @@ DirAccess *DirAccessOSX::create_fs() { } bool DirAccessOSX::list_dir_begin() { - + list_dir_end(); //close any previous dir opening! - + // char real_current_dir_name[2048]; //is this enough?! //getcwd(real_current_dir_name,2048); @@ -63,7 +63,7 @@ bool DirAccessOSX::list_dir_begin() { } bool DirAccessOSX::file_exists(String p_file) { - + GLOBAL_LOCK_FUNCTION @@ -207,7 +207,7 @@ Error DirAccessOSX::make_dir(String p_dir) { GLOBAL_LOCK_FUNCTION p_dir=fix_path(p_dir); - + char 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 @@ -326,7 +326,7 @@ size_t DirAccessOSX::get_space_left() { #else #warning THIS IS BROKEN return 0; -#endif +#endif }; diff --git a/platform/osx/godot_osx.mm b/platform/osx/godot_osx.mm index 0c320162165..02a1382b1ac 100644 --- a/platform/osx/godot_osx.mm +++ b/platform/osx/godot_osx.mm @@ -50,7 +50,7 @@ static NSString *getApplicationName(void) dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); if (dict) appName = [dict objectForKey: @"CFBundleName"]; - + if (![appName length]) appName = [[NSProcessInfo processInfo] processName]; @@ -67,10 +67,10 @@ static void setApplicationMenu(void) NSMenuItem *menuItem; NSString *title; NSString *appName; - + appName = getApplicationName(); appleMenu = [[NSMenu alloc] initWithTitle:@""]; - + /* Add menu items */ title = [@"About " stringByAppendingString:appName]; [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; @@ -90,7 +90,7 @@ static void setApplicationMenu(void) title = [@"Quit " stringByAppendingString:appName]; [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; - + /* Put menu into the menubar */ menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; [menuItem setSubmenu:appleMenu]; @@ -112,17 +112,17 @@ static void setupWindowMenu(void) NSMenuItem *menuItem; windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; - + /* "Minimize" item */ menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; [windowMenu addItem:menuItem]; [menuItem release]; - + /* Put menu into the menubar */ windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; [windowMenuItem setSubmenu:windowMenu]; [[NSApp mainMenu] addItem:windowMenuItem]; - + /* Tell the application object that this is now the window menu */ [NSApp setWindowsMenu:windowMenu]; @@ -139,7 +139,7 @@ static void CustomApplicationMain (int argc, char **argv) /* Ensure the application object is initialised */ [NSApplication sharedApplication]; - + /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; setApplicationMenu(); @@ -147,10 +147,10 @@ static void CustomApplicationMain (int argc, char **argv) main = [[main alloc] init]; [NSApp setDelegate:main]; - + /* Start the main event loop */ [NSApp run]; - + [main release]; [pool release]; } diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 4b339af6d4a..6af2f347aad 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -892,7 +892,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi NULL, keyboardLayoutChanged, kTISNotifySelectedKeyboardInputSourceChanged, NULL, CFNotificationSuspensionBehaviorDeliverImmediately); - + window_delegate = [[GodotWindowDelegate alloc] init]; // 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; } else{ //set OS position - + /* this code has not been tested, please be a kind soul and fix it if it fails! */ //local point in window coords diff --git a/platform/server/detect.py b/platform/server/detect.py index 15c5982b144..e6fab2043b0 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -1,11 +1,11 @@ import os -import sys +import sys def is_active(): return True - + def get_name(): return "Server" @@ -16,20 +16,20 @@ def can_build(): return False return True # enabled - + def get_opts(): return [ ('use_llvm','Use llvm compiler','no'), ('force_32_bits','Force 32 bits binary','no') ] - + def get_flags(): return [ ('builtin_zlib', 'no'), ] - + def configure(env): diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 1ad0f164d25..689cad83430 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -1,4 +1,4 @@ -# +# # tested on | Windows native | Linux cross-compilation # ------------------------+-------------------+--------------------------- # MSVS C++ 2010 Express | WORKS | n/a @@ -24,11 +24,11 @@ # ( example : "C:/Mingw-w32", "C:/Mingw-w64" ) # # - 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/ # -# - before running scons, you must add into the environment path -# the path to the "/bin" directory of the Mingw version you want +# - before running scons, you must add into the environment path +# the path to the "/bin" directory of the Mingw version you want # to use : # # set PATH=C:/Mingw-w32/bin;%PATH% @@ -37,9 +37,9 @@ # - Mingw-w32 only compiles 32bits. # - Mingw-w64 only compiles 64bits. # -# - 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 -# variables. +# - 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 +# variables. # For instance, you could store that set of commands into a .bat script # that you would run just before scons : # @@ -61,14 +61,14 @@ # # - it is possible to manually override prefixes by defining # the MINGW32_PREFIX and MINGW64_PREFIX environment variables. -# +# ##### # 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 # ( 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 : # 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 : @@ -84,7 +84,7 @@ # - 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 to document MINGW32_PREFIX and MINGW64_PREFIX -# +# import os @@ -93,16 +93,16 @@ import sys def is_active(): return True - + def get_name(): return "Windows" def can_build(): - + if (os.name=="nt"): #building natively on windows! if (os.getenv("VSINSTALLDIR")): - return True + return True else: print("\nMSVC not detected, attempting Mingw.") mingw32 = "" @@ -111,7 +111,7 @@ def can_build(): mingw32 = os.getenv("MINGW32_PREFIX") if ( os.getenv("MINGW64_PREFIX") ) : mingw64 = os.getenv("MINGW64_PREFIX") - + test = "gcc --version > NUL 2>&1" if os.system(test)!= 0 and os.system(mingw32+test)!=0 and os.system(mingw64+test)!=0 : print("- could not detect gcc.") @@ -119,27 +119,27 @@ def can_build(): return False else: print("- gcc detected.") - + return True - + if (os.name=="posix"): mingw = "i586-mingw32msvc-" mingw64 = "x86_64-w64-mingw32-" mingw32 = "i686-w64-mingw32-" - + if (os.getenv("MINGW32_PREFIX")): mingw32=os.getenv("MINGW32_PREFIX") mingw = mingw32 if (os.getenv("MINGW64_PREFIX")): mingw64=os.getenv("MINGW64_PREFIX") - + test = "gcc --version &>/dev/null" if (os.system(mingw+test) == 0 or os.system(mingw64+test) == 0 or os.system(mingw32+test) == 0): return True - + return False - + def get_opts(): mingw="" @@ -149,10 +149,10 @@ def get_opts(): mingw = "i586-mingw32msvc-" mingw32 = "i686-w64-mingw32-" mingw64 = "x86_64-w64-mingw32-" - + if os.system(mingw32+"gcc --version &>/dev/null") != 0 : mingw32 = mingw - + if (os.getenv("MINGW32_PREFIX")): mingw32=os.getenv("MINGW32_PREFIX") mingw = mingw32 @@ -164,14 +164,14 @@ def get_opts(): ('mingw_prefix','Mingw Prefix',mingw32), ('mingw_prefix_64','Mingw Prefix 64 bits',mingw64), ] - + def get_flags(): return [ ('freetype','builtin'), #use builtin freetype ('openssl','builtin'), #use builtin openssl ] - + def build_res_file( target, source, env ): cmdbase = "" @@ -245,7 +245,7 @@ def configure(env): env.Append(CCFLAGS=['/DGLEW_ENABLED']) 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(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"]) if (os.getenv("DXSDK_DIR")): DIRECTX_PATH=os.getenv("DXSDK_DIR") @@ -304,7 +304,7 @@ def configure(env): # sys.exit(255) if (env["target"]=="release"): - + env.Append(CCFLAGS=['-msse2']) if (env["bits"]=="64"): @@ -319,7 +319,7 @@ def configure(env): env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED']) elif (env["target"]=="debug"): - + env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED']) 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 = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) - + diff --git a/platform/winrt/detect.py b/platform/winrt/detect.py index 7439f0cd550..86028d3af8b 100644 --- a/platform/winrt/detect.py +++ b/platform/winrt/detect.py @@ -2,13 +2,13 @@ import os -import sys +import sys import string def is_active(): return True - + def get_name(): return "WinRT" @@ -16,12 +16,12 @@ def can_build(): if (os.name=="nt"): #building natively on windows! if (os.getenv("VSINSTALLDIR")): - return True + return True return False - + def get_opts(): return [] - + def get_flags(): return [] diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 6b147db130a..6b3f7147efc 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -1,12 +1,12 @@ import os -import sys +import sys import platform def is_active(): return True - + def get_name(): return "X11" @@ -20,11 +20,11 @@ def can_build(): return False # no x11 on mac for now errorval=os.system("pkg-config --version > /dev/null") - + if (errorval): print("pkg-config not found.. x11 disabled.") return False - + x11_error=os.system("pkg-config x11 --modversion > /dev/null ") if (x11_error): print("X11 not found.. x11 disabled.") @@ -39,7 +39,7 @@ def can_build(): if (x11_error): print("xcursor not found.. x11 disabled.") return False - + x11_error=os.system("pkg-config xinerama --modversion > /dev/null ") if (x11_error): print("xinerama not found.. x11 disabled.") @@ -47,7 +47,7 @@ def can_build(): return True # X11 enabled - + def get_opts(): return [ @@ -60,7 +60,7 @@ def get_opts(): ('new_wm_api', 'Use experimental window management API','no'), ('debug_release', 'Add debug symbols to release version','no'), ] - + def get_flags(): return [ @@ -68,7 +68,7 @@ def get_flags(): ("openssl", "yes"), #("theora","no"), ] - + def configure(env): diff --git a/tools/addheader/addheader.py b/tools/addheader/addheader.py index 0252eb396d0..d040d8b5d67 100644 --- a/tools/addheader/addheader.py +++ b/tools/addheader/addheader.py @@ -38,7 +38,7 @@ while (fname!=""): l = fr.readline() bc=False fsingle = fname.strip() - + if (fsingle.find("/")!=-1): fsingle=fsingle[fsingle.rfind("/")+1:] rep_fl="$filename" @@ -51,19 +51,19 @@ while (fname!=""): elif (len_fl0): cstr+=", " cstr+=c - + cstr+=("};") - + print(cstr) \ No newline at end of file diff --git a/tools/editor/icons/make_icons.py b/tools/editor/icons/make_icons.py index 9752fef6fe2..e06cbac7208 100644 --- a/tools/editor/icons/make_icons.py +++ b/tools/editor/icons/make_icons.py @@ -10,29 +10,29 @@ f.write("#include \"editor_icons.h\"\n\n") f.write("#include \"scene/resources/theme.h\"\n\n") for x in pixmaps: - + var_str=x[:-4]+"_png"; - + f.write("static const unsigned char "+ var_str +"[]={\n"); - + pngf=open(x,"rb"); - + b=pngf.read(1); while(len(b)==1): f.write(hex(ord(b))) b=pngf.read(1); if (len(b)==1): f.write(",") - + f.write("\n};\n\n\n"); pngf.close(); - + f.write("static Ref make_icon(const uint8_t* p_png) {\n") f.write("\tRef texture( memnew( ImageTexture ) );\n") f.write("\ttexture->create_from_image( Image(p_png),ImageTexture::FLAG_FILTER );\n") f.write("\treturn texture;\n") f.write("}\n\n") - + f.write("void editor_register_icons(Ref p_theme) {\n\n") diff --git a/tools/export/blender25/godot_export_manager.py b/tools/export/blender25/godot_export_manager.py index 582d76f94fc..a249611c710 100644 --- a/tools/export/blender25/godot_export_manager.py +++ b/tools/export/blender25/godot_export_manager.py @@ -41,9 +41,9 @@ class godot_export_manager(bpy.types.Panel): bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = "scene" - + bpy.types.Scene.godot_export_on_save = BoolProperty(default=False) - + ### draw function for all ui elements def draw(self, context): layout = self.layout @@ -51,56 +51,56 @@ class godot_export_manager(bpy.types.Panel): scene = bpy.data.scenes[0] ob = context.object scene = context.scene - + row = layout.row() col = row.column() col.prop(scene,"godot_export_on_save",text="Export Groups on save") - + row = layout.row() 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_delete_objects_from_group",text="Delete selected objects from Group",icon="PASTEDOWN") - - - + + + row = layout.row() col = row.column() col.label(text="Export Groups:") - - + + row = layout.row() 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 = row.column(align=True) col.operator("scene.godot_add_export_group",text="",icon="ZOOMIN") col.operator("scene.godot_delete_export_group",text="",icon="ZOOMOUT") 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() col = row.column() group = scene.godot_export_groups[scene.godot_export_groups_index] col.prop(group,"name",text="Group Name") col.prop(group,"export_name",text="Export Name") col.prop(group,"export_path",text="Export Filepath") - + row = layout.row() col = row.column() row = layout.row() col = row.column() col.label(text="Export Settings:") - + col = col.row(align=True) col.prop(group,"apply_loc",toggle=True,icon="MAN_TRANS") col.prop(group,"apply_rot",toggle=True,icon="MAN_ROT") col.prop(group,"apply_scale",toggle=True,icon="MAN_SCALE") - + row = layout.row() col = row.column() - + col.prop(group,"use_include_particle_duplicates") col.prop(group,"use_mesh_modifiers") col.prop(group,"use_tangent_arrays") @@ -120,25 +120,25 @@ class UI_List_Godot(bpy.types.UIList): ob = data slot = item col = layout.row(align=True) - + col.label(text=item.name,icon="GROUP") col.prop(item,"active",text="") - + op = col.operator("scene.godot_select_group_objects",text="",emboss=False,icon="RESTRICT_SELECT_OFF") op.idx = index op = col.operator("scene.godot_export_group",text="",emboss=False,icon="EXPORT") op.idx = index - + class add_objects_to_group(bpy.types.Operator): bl_idname = "scene.godot_add_objects_to_group" bl_label = "Add Objects to Group" bl_description = "Adds the selected Objects to the active group below." - + undo = BoolProperty(default=True) - + def execute(self,context): scene = context.scene - + objects_str = "" if len(scene.godot_export_groups) > 0: for i,object in enumerate(context.selected_objects): @@ -148,57 +148,57 @@ class add_objects_to_group(bpy.types.Operator): if i == 0: objects_str += object.name else: - objects_str += ", "+object.name - - + objects_str += ", "+object.name + + self.report({'INFO'}, objects_str + " added to group." ) if self.undo: bpy.ops.ed.undo_push(message="Objects added to group") else: - self.report({'WARNING'}, "Create a group first." ) + self.report({'WARNING'}, "Create a group first." ) return{'FINISHED'} class del_objects_from_group(bpy.types.Operator): bl_idname = "scene.godot_delete_objects_from_group" bl_label = "Delete Objects from Group" bl_description = "Delets the selected Objects from the active group below." - + def execute(self,context): scene = context.scene - + if len(scene.godot_export_groups) > 0: - + selected_objects = [] for object in context.selected_objects: selected_objects.append(object.name) - + objects_str = "" j = 0 for i,node in enumerate(scene.godot_export_groups[scene.godot_export_groups_index].nodes): if node.name in selected_objects: scene.godot_export_groups[scene.godot_export_groups_index].nodes.remove(i) - + if j == 0: objects_str += object.name else: - objects_str += ", "+object.name + objects_str += ", "+object.name 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") else: - self.report({'WARNING'}, "There is no group to delete from." ) + self.report({'WARNING'}, "There is no group to delete from." ) return{'FINISHED'} class select_group_objects(bpy.types.Operator): bl_idname = "scene.godot_select_group_objects" bl_label = "Select Group Objects" bl_description = "Will select all group Objects in the scene." - + idx = IntProperty() - + def execute(self,context): scene = context.scene for object in context.scene.objects: @@ -208,12 +208,12 @@ class select_group_objects(bpy.types.Operator): bpy.data.objects[node.name].select = True context.scene.objects.active = bpy.data.objects[node.name] return{'FINISHED'} - + class export_groups_autosave(bpy.types.Operator): bl_idname = "scene.godot_export_groups_autosave" bl_label = "Export All Groups" bl_description = "Exports all groups to Collada." - + def execute(self,context): scene = context.scene if scene.godot_export_on_save: @@ -221,57 +221,57 @@ class export_groups_autosave(bpy.types.Operator): if scene.godot_export_groups[i].active: bpy.ops.scene.godot_export_group(idx=i) 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'} - + class export_all_groups(bpy.types.Operator): bl_idname = "scene.godot_export_all_groups" bl_label = "Export All Groups" bl_description = "Exports all groups to Collada." - + def execute(self,context): scene = context.scene - + for i in range(0,len(scene.godot_export_groups)): bpy.ops.scene.godot_export_group(idx=i,export_all=True) - + self.report({'INFO'}, "All Groups exported." ) - return{'FINISHED'} - - + return{'FINISHED'} + + class export_group(bpy.types.Operator): bl_idname = "scene.godot_export_group" bl_label = "Export Group" bl_description = "Exports the active group to destination folder as Collada file." - + idx = IntProperty(default=0) export_all = BoolProperty(default=False) - + def copy_object_recursive(self,ob,parent,single_user = True): new_ob = bpy.data.objects[ob.name].copy() if single_user or ob.type=="ARMATURE": new_mesh_data = new_ob.data.copy() new_ob.data = new_mesh_data bpy.context.scene.objects.link(new_ob) - + if ob != parent: new_ob.parent = parent else: - new_ob.parent = None - - for child in ob.children: + new_ob.parent = None + + for child in ob.children: self.copy_object_recursive(child,new_ob,single_user) - new_ob.select = True + new_ob.select = True return new_ob - + def delete_object(self,ob): if ob != None: for child in ob.children: self.delete_object(child) bpy.context.scene.objects.unlink(ob) - bpy.data.objects.remove(ob) - + bpy.data.objects.remove(ob) + def convert_group_to_node(self,group): if group.dupli_group != None: for object in group.dupli_group.objects: @@ -281,48 +281,48 @@ class export_group(bpy.types.Operator): object.matrix_local = Matrix() object.matrix_local *= group.matrix_local object.matrix_local *= matrix - - self.delete_object(group) - + + self.delete_object(group) + def execute(self,context): - + scene = context.scene group = context.scene.godot_export_groups - + if not group[self.idx].active and self.export_all: return{'FINISHED'} - + for i,object in enumerate(group[self.idx].nodes): if object.name in bpy.data.objects: pass else: group[self.idx].nodes.remove(i) bpy.ops.ed.undo_push(message="Clear not existent Group Nodes.") - + path = group[self.idx].export_path if (path.find("//")==0 or path.find("\\\\")==0): #if relative, convert to absolute path = bpy.path.abspath(path) 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 != "": - + 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"): path = os.path.join(path,group[self.idx].export_name) - else: + else: path = os.path.join(path,group[self.idx].export_name+".dae") - - hide_select = [] + + hide_select = [] for object in context.scene.objects: hide_select.append(object.hide_select) object.hide_select = False object.select = False context.scene.objects.active = None - + ### make particle duplicates, parent and select them nodes_to_be_added = [] if group[self.idx].use_include_particle_duplicates: @@ -341,79 +341,79 @@ class export_group(bpy.types.Operator): context.scene.objects.active = None for object in nodes_to_be_added: object.select = True - + ### select all other nodes from the group for i,object in enumerate(group[self.idx].nodes): if bpy.data.objects[object.name].type == "EMPTY": self.convert_group_to_node(bpy.data.objects[object.name]) - else: + else: 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.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." ) + 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." ) msg = "Export Group "+group[self.idx].name - + bpy.ops.ed.undo_push(message="") bpy.ops.ed.undo() bpy.ops.ed.undo_push(message=msg) - + else: - self.report({'INFO'}, "Define Export Name and Export Path." ) + self.report({'INFO'}, "Define Export Name and Export Path." ) return{'FINISHED'} class add_export_group(bpy.types.Operator): bl_idname = "scene.godot_add_export_group" bl_label = "Adds a new export Group" bl_description = "Creates a new Export Group with the selected Objects assigned to it." - + def execute(self,context): scene = context.scene - + item = scene.godot_export_groups.add() item.name = "New Group" for object in context.selected_objects: node = item.nodes.add() 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") return{'FINISHED'} - + class del_export_group(bpy.types.Operator): bl_idname = "scene.godot_delete_export_group" bl_label = "Delets the selected export Group" bl_description = "Delets the active Export Group." - + def invoke(self, context, event): - wm = context.window_manager + wm = context.window_manager return wm.invoke_confirm(self,event) - + def execute(self,context): scene = context.scene - + scene.godot_export_groups.remove(scene.godot_export_groups_index) if scene.godot_export_groups_index > 0: scene.godot_export_groups_index -= 1 bpy.ops.ed.undo_push(message="Delete Export Group") - return{'FINISHED'} + return{'FINISHED'} class godot_node_list(bpy.types.PropertyGroup): name = StringProperty() - + class godot_export_groups(bpy.types.PropertyGroup): name = StringProperty(name="Group Name") export_name = StringProperty(name="scene_name") nodes = CollectionProperty(type=godot_node_list) export_path = StringProperty(subtype="DIR_PATH") 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'}) - + 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_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_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) @@ -431,7 +431,7 @@ class godot_export_groups(bpy.types.PropertyGroup): use_metadata = BoolProperty(name="Use Metadata",default=True,options={'HIDDEN'}) 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_node_list) bpy.utils.register_class(godot_export_groups) @@ -465,7 +465,7 @@ def unregister(): @persistent def auto_export(dummy): bpy.ops.scene.godot_export_groups_autosave() - + bpy.app.handlers.save_post.append(auto_export) if __name__ == "__main__": diff --git a/tools/export/blender25/io_scene_dae/__init__.py b/tools/export/blender25/io_scene_dae/__init__.py index 182ec21e639..a1a0eabbbe4 100644 --- a/tools/export/blender25/io_scene_dae/__init__.py +++ b/tools/export/blender25/io_scene_dae/__init__.py @@ -59,7 +59,7 @@ class ExportDAE(bpy.types.Operator, ExportHelper): # List of operator properties, the attributes will be assigned # to the class instance from the operator settings before calling. - + object_types = EnumProperty( name="Object Types", options={'ENUM_FLAG'}, diff --git a/tools/export/blender25/io_scene_dae/export_dae.py b/tools/export/blender25/io_scene_dae/export_dae.py index 370dc359b5d..cdd845e3842 100644 --- a/tools/export/blender25/io_scene_dae/export_dae.py +++ b/tools/export/blender25/io_scene_dae/export_dae.py @@ -171,38 +171,38 @@ class DaeExporter: def export_image(self,image): if (image in self.image_cache): return self.image_cache[image] - + imgpath = image.filepath if (imgpath.find("//")==0 or imgpath.find("\\\\")==0): #if relative, convert to absolute imgpath = bpy.path.abspath(imgpath) #path is absolute, now do something! - + if (self.config["use_copy_images"]): #copy image basedir = os.path.dirname(self.path)+"/images" if (not os.path.isdir(basedir)): os.makedirs(basedir) - + if os.path.isfile(imgpath): dstfile=basedir+"/"+os.path.basename(imgpath) - + if (not os.path.isfile(dstfile)): shutil.copy(imgpath,dstfile) imgpath="images/"+os.path.basename(imgpath) else: ### 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")): image.filepath = basedir+"/"+os.path.basename(img_tmp_path) - else: + else: image.filepath = basedir+"/"+image.name+".png" - + dstfile=basedir+"/"+os.path.basename(image.filepath) - + if (not os.path.isfile(dstfile)): - + image.save() imgpath="images/"+os.path.basename(image.filepath) image.filepath = img_tmp_path @@ -211,15 +211,15 @@ class DaeExporter: #export relative, always, no one wants absolute paths. try: imgpath = os.path.relpath(imgpath,os.path.dirname(self.path)).replace("\\","/") # export unix compatible always - + except: pass #fails sometimes, not sure why - + imgid = self.new_id("image") print("FOR: "+imgpath) - + # if (not os.path.isfile(imgpath)): # print("NOT FILE?") # 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,'') close_controller=True elif (armature==None): - self.writel(S_NODES,il,'') + self.writel(S_NODES,il,'') if (len(meshdata["material_assign"])>0): @@ -1520,7 +1520,7 @@ class DaeExporter: tmp_bone_mat.append(Matrix(bone.matrix_basis)) bone.matrix_basis = Matrix() tmp_mat.append([Matrix(s.matrix_local),tmp_bone_mat]) - + self.writel(S_ANIM,0,'') @@ -1561,11 +1561,11 @@ class DaeExporter: if (not y in allowed_skeletons): allowed_skeletons.append(y) y.animation_data.action=x; - + y.matrix_local = tmp_mat[i][0] for j,bone in enumerate(s.pose.bones): bone.matrix_basis = Matrix() - + #print("allowed skeletons "+str(allowed_skeletons)) @@ -1600,9 +1600,9 @@ class DaeExporter: else: self.export_animation(self.scene.frame_start,self.scene.frame_end) - - - + + + self.writel(S_ANIM,0,'') def export(self): @@ -1684,7 +1684,7 @@ class DaeExporter: self.valid_nodes=[] self.armature_for_morph={} self.used_bones=[] - self.wrongvtx_report=False + self.wrongvtx_report=False diff --git a/tools/glwrapper/makewrapper.py b/tools/glwrapper/makewrapper.py index cde976d5f93..2e5f06be121 100644 --- a/tools/glwrapper/makewrapper.py +++ b/tools/glwrapper/makewrapper.py @@ -4,27 +4,27 @@ import sys if (len(sys.argv)<2): print("usage: makewrapper.py ") sys.exit(255) - + functions=[] types=[] constants=[] - + READ_FUNCTIONS=0 READ_TYPES=1 READ_CONSTANTS=2 - + read_what=READ_TYPES - + for x in (range(len(sys.argv)-1)): f=open(sys.argv[x+1],"r") - + while(True): - + line=f.readline() if (line==""): break - + line=line.replace("\n","").strip() """ if (line.find("[types]")!=-1): @@ -37,7 +37,7 @@ for x in (range(len(sys.argv)-1)): read_what=READ_FUNCTIONS continue """ - + if (line.find("#define")!=-1): if (line.find("0x")==-1 and line.find("GL_VERSION")==-1): 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): continue - line=line.replace("APIENTRY","") - line=line.replace("GLAPI","") - + line=line.replace("APIENTRY","") + line=line.replace("GLAPI","") + glpos=line.find(" gl") if (glpos==-1): - + glpos=line.find("\tgl") if (glpos==-1): continue - + ret=line[:glpos].strip(); - + line=line[glpos:].strip() namepos=line.find("(") - + if (namepos==-1): continue - + name=line[:namepos].strip() line=line[namepos:] - + argpos=line.rfind(")") if (argpos==-1): continue - + args=line[1:argpos] - + funcdata={} funcdata["ret"]=ret funcdata["name"]=name funcdata["args"]=args - + functions.append(funcdata) print(funcdata) - - - + + + #print(types) #print(constants) #print(functions) - - + + f=open("glwrapper.h","w") f.write("#ifndef GL_WRAPPER\n") @@ -109,10 +109,10 @@ header_code="""\ #error glATI.h included before glwrapper.h #endif -#define __gl_h_ -#define __GL_H__ -#define __glext_h_ -#define __GLEXT_H_ +#define __gl_h_ +#define __GL_H__ +#define __glext_h_ +#define __GLEXT_H_ #define __gl_ATI_h_ #define GL_TRUE 1 @@ -138,7 +138,7 @@ f.write("#define GLWRP_APIENTRY \n") f.write("#endif\n\n"); for x in types: f.write(x+"\n") - + f.write("\n\n") for x in constants: @@ -153,24 +153,24 @@ for x in functions: f.write("\n\n") f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n"); f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) );\n") - + f.write("#ifdef __cplusplus\n}\n#endif\n") f.write("#endif\n\n") - + f=open("glwrapper.c","w") f.write("\n\n") f.write("#include \"glwrapper.h\"\n") f.write("\n\n") - + for x in functions: f.write(x["ret"]+" GLWRP_APIENTRY (*__wrapper_"+x["name"]+")("+x["args"]+")=NULL;\n") - + f.write("\n\n") f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) ) {\n") f.write("\n") - + for x in functions: f.write("\t__wrapper_"+x["name"]+"=("+x["ret"]+" GLWRP_APIENTRY (*)("+x["args"]+"))wrapperFunc(\""+x["name"]+"\");\n") @@ -180,5 +180,4 @@ f.write("\n\n") - - \ No newline at end of file + diff --git a/tools/html_fs/godotfs.js b/tools/html_fs/godotfs.js index 93cc30556b3..2c59344cf5c 100644 --- a/tools/html_fs/godotfs.js +++ b/tools/html_fs/godotfs.js @@ -50,7 +50,7 @@ Module.expectedDataFileDownloads++; function handleError(error) { console.error('package error:', error); }; - + var fetched = null, fetchedCallback = null; fetchRemotePackage('data.pck', function(data) { if (fetchedCallback) { @@ -60,7 +60,7 @@ Module.expectedDataFileDownloads++; fetched = data; } }, handleError); - + function runWithFS() { function assert(check, msg) { @@ -113,13 +113,13 @@ function assert(check, msg) { var PACKAGE_NAME = 'data.pck'; var REMOTE_PACKAGE_NAME = 'data.pck'; var PACKAGE_UUID = 'b39761ce-0348-4959-9b16-302ed8e1592e'; - + function processPackageData(arrayBuffer) { Module.finishedDataFileDownloads++; assert(arrayBuffer, 'Loading data file failed.'); var byteArray = new Uint8Array(arrayBuffer); var curr; - + // Reuse the bytearray from the XHR as the source for file reads. DataRequest.prototype.byteArray = byteArray; DataRequest.prototype.requests["/data.pck"].onload(); @@ -127,9 +127,9 @@ function assert(check, msg) { }; Module['addRunDependency']('datafile_datapack'); - + if (!Module.preloadResults) Module.preloadResults = {}; - + Module.preloadResults[PACKAGE_NAME] = {fromCache: false}; if (fetched) { processPackageData(fetched); @@ -137,7 +137,7 @@ function assert(check, msg) { } else { fetchedCallback = processPackageData; } - + } if (Module['calledRun']) { runWithFS(); diff --git a/tools/memsort.py b/tools/memsort.py index 8ecccae8bd6..d2e4fe02264 100644 --- a/tools/memsort.py +++ b/tools/memsort.py @@ -33,4 +33,3 @@ while(l!=""): for x in sum: print(x.strip()+"("+str(cnt[x])+"):\n: "+str(sum[x])) - \ No newline at end of file diff --git a/tools/scripts/makeargs.py b/tools/scripts/makeargs.py index 6f7afa63285..8c5539c5fec 100644 --- a/tools/scripts/makeargs.py +++ b/tools/scripts/makeargs.py @@ -40,7 +40,7 @@ text=""" visual_server->m_func($argp);\\ }\\ } - + #define FUNC$num(m_func,$argt)\\ virtual void m_func($argtp) { \\ @@ -59,8 +59,8 @@ text=""" 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)) print(t) - +