Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-05-19 20:24:21 +0300
committerbubnikv <bubnikv@gmail.com>2017-05-19 20:24:21 +0300
commit70db88dd90f741b89ad8b1ded7f4448864580e09 (patch)
treea3b57a077da3fc572910b103e6fb25d0e4ac0d7a /xs/src/perlglue.cpp
parent8bd3dec331b32a3a403a891e0bfd9fcf5745e5db (diff)
Improved retract handling on bowden extruders:
Separated deretract speed from a retract speed, allowed a partial retract before wipe.
Diffstat (limited to 'xs/src/perlglue.cpp')
-rw-r--r--xs/src/perlglue.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/xs/src/perlglue.cpp b/xs/src/perlglue.cpp
index f814b3de3..59fb0f390 100644
--- a/xs/src/perlglue.cpp
+++ b/xs/src/perlglue.cpp
@@ -95,6 +95,13 @@ ConfigOption_to_SV(const ConfigOption &opt, const ConfigOptionDef &def) {
} else if (def.type == coPercent) {
const ConfigOptionPercent* optv = dynamic_cast<const ConfigOptionPercent*>(&opt);
return newSVnv(optv->value);
+ } else if (def.type == coPercents) {
+ const ConfigOptionPercents* optv = dynamic_cast<const ConfigOptionPercents*>(&opt);
+ AV* av = newAV();
+ av_fill(av, optv->values.size()-1);
+ for (const double &v : optv->values)
+ av_store(av, &v - &optv->values.front(), newSVnv(v));
+ return newRV_noinc((SV*)av);
} else if (def.type == coInt) {
const ConfigOptionInt* optv = dynamic_cast<const ConfigOptionInt*>(&opt);
return newSViv(optv->value);
@@ -148,7 +155,7 @@ ConfigBase__get_at(ConfigBase* THIS, const t_config_option_key &opt_key, size_t
if (opt == NULL) return &PL_sv_undef;
const ConfigOptionDef* def = THIS->def->get(opt_key);
- if (def->type == coFloats) {
+ if (def->type == coFloats || def->type == coPercents) {
ConfigOptionFloats* optv = dynamic_cast<ConfigOptionFloats*>(opt);
return newSVnv(optv->get_at(i));
} else if (def->type == coInts) {
@@ -191,6 +198,17 @@ ConfigBase__set(ConfigBase* THIS, const t_config_option_key &opt_key, SV* value)
values.push_back(SvNV(*elem));
}
optv->values = values;
+ } else if (def->type == coPercents) {
+ ConfigOptionPercents* optv = dynamic_cast<ConfigOptionPercents*>(opt);
+ std::vector<double> values;
+ AV* av = (AV*)SvRV(value);
+ const size_t len = av_len(av)+1;
+ for (size_t i = 0; i < len; i++) {
+ SV** elem = av_fetch(av, i, 0);
+ if (elem == NULL || !looks_like_number(*elem)) return false;
+ values.push_back(SvNV(*elem));
+ }
+ optv->values = values;
} else if (def->type == coInt) {
if (!looks_like_number(value)) return false;
ConfigOptionInt* optv = dynamic_cast<ConfigOptionInt*>(opt);