diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-06-27 16:10:09 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-07-04 14:08:16 +0200 |
commit | 542489a86696cba222711a20e31704a62d4b8fed (patch) | |
tree | 33cad996a760b77b4538850a9614fa1fc3451548 /editor/doc | |
parent | 7b569e91c0c6b84965cad416b8e86dcfdacbcfc4 (diff) |
DocData: Re-expose parametric setters and getters
Setters and getters have been hidden from the documentation when the matching
properties have been exposed, but some of them are parametric and require the
name or index of a given parameter to be used. So they need to be properly
documented with the type and name of the arguments they take.
For example, CPUParticles' `set_param(Parameter param, float value)`.
Diffstat (limited to 'editor/doc')
-rw-r--r-- | editor/doc/doc_data.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index 6ee07d3661..a8ba54d4f8 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -323,8 +323,14 @@ void DocData::generate(bool p_basic_types) { if (E->get().name == "" || (E->get().name[0] == '_' && !(E->get().flags & METHOD_FLAG_VIRTUAL))) continue; //hidden, don't count - if (skip_setter_getter_methods && setters_getters.has(E->get().name) && E->get().name.find("/") == -1) - continue; + if (skip_setter_getter_methods && setters_getters.has(E->get().name)) { + // Don't skip parametric setters and getters, i.e. method which require + // one or more parameters to define what property should be set or retrieved. + // E.g. CPUParticles::set_param(Parameter param, float value). + if (E->get().arguments.size() == 0 /* getter */ || (E->get().arguments.size() == 1 && E->get().return_val.type == Variant::NIL /* setter */)) { + continue; + } + } MethodDoc method; @@ -366,21 +372,6 @@ void DocData::generate(bool p_basic_types) { method.arguments.push_back(argument); } - - /* - String hint; - switch(arginfo.hint) { - case PROPERTY_HINT_DIR: hint="A directory."; break; - case PROPERTY_HINT_RANGE: hint="Range - min: "+arginfo.hint_string.get_slice(",",0)+" max: "+arginfo.hint_string.get_slice(",",1)+" step: "+arginfo.hint_string.get_slice(",",2); break; - case PROPERTY_HINT_ENUM: hint="Values: "; for(int j=0;j<arginfo.hint_string.get_slice_count(",");j++) { if (j>0) hint+=", "; hint+=arginfo.hint_string.get_slice(",",j)+"="+itos(j); } break; - case PROPERTY_HINT_LENGTH: hint="Length: "+arginfo.hint_string; break; - case PROPERTY_HINT_FLAGS: hint="Values: "; for(int j=0;j<arginfo.hint_string.get_slice_count(",");j++) { if (j>0) hint+=", "; hint+=arginfo.hint_string.get_slice(",",j)+"="+itos(1<<j); } break; - case PROPERTY_HINT_FILE: hint="A file:"; break; - //case PROPERTY_HINT_RESOURCE_TYPE: hint="Type: "+arginfo.hint_string; break; - }; - if (hint!="") - _write_string(f,4,hint); -*/ } c.methods.push_back(method); |