VOXEDIT: moved cvars

master
Martin Gerhardy 2022-04-20 17:33:21 +02:00
parent 3c00ef049f
commit 536c5822db
3 changed files with 13 additions and 6 deletions

View File

@ -88,6 +88,7 @@ app::AppState VoxEdit::onConstruct() {
core::Var::get(cfg::VoxEditGuizmoRotation, "0", "Activate rotations for the guizmo in scene mode", core::Var::boolValidator);
core::Var::get(cfg::VoxEditGuizmoAllowAxisFlip, "1", "Flip axis or stay along the positive world/local axis", core::Var::boolValidator);
core::Var::get(cfg::VoxEditGuizmoSnap, "1", "Use the grid size for snap", core::Var::boolValidator);
core::Var::get(cfg::VoxEditLastPalette, "nippon");
core::Var::get(cfg::VoxformatMergequads, "true", core::CV_NOPERSIST, "Merge similar quads to optimize the mesh");
core::Var::get(cfg::VoxformatReusevertices, "true", core::CV_NOPERSIST, "Reuse vertices or always create new ones");

View File

@ -27,6 +27,7 @@
#include "voxedit-ui/LayerPanel.h"
#include "voxedit-util/MementoHandler.h"
#include "voxel/Face.h"
#include "voxel/MaterialColor.h"
#include "voxel/RawVolume.h"
#include "voxel/RawVolumeMoveWrapper.h"
#include "voxel/RawVolumeWrapper.h"
@ -1081,9 +1082,6 @@ void SceneManager::construct() {
}).setHelp("Executes a lua script to modify the current active volume")
.setArgumentCompleter(voxelgenerator::scriptCompleter(io::filesystem()));
core::Var::get(cfg::VoxEditLastPalette, "nippon");
_showAabbVar = core::Var::getSafe(cfg::VoxEditShowaabb);
for (int i = 0; i < lengthof(DIRECTIONS); ++i) {
command::Command::registerActionButton(
core::string::format("movecursor%s", DIRECTIONS[i].postfix),
@ -1642,6 +1640,7 @@ void SceneManager::construct() {
}
}).setHelp("Duplicates the current node or the given node id");
_showAabbVar = core::Var::getSafe(cfg::VoxEditShowaabb);
_grayInactive = core::Var::getSafe(cfg::VoxEditGrayInactive);
_hideInactive = core::Var::getSafe(cfg::VoxEditHideInactive);
}
@ -1708,13 +1707,16 @@ bool SceneManager::init() {
return true;
}
const char *paletteName = core::Var::getSafe(cfg::VoxEditLastPalette)->strVal().c_str();
core::String paletteName = core::Var::getSafe(cfg::VoxEditLastPalette)->strVal();
if (paletteName.empty()) {
paletteName = voxel::Palette::getDefaultPaletteName();
}
voxel::Palette palette;
if (!palette.load(paletteName)) {
if (!palette.load(paletteName.c_str())) {
Log::warn("Failed to load the palette data");
}
if (!voxel::initPalette(palette)) {
Log::warn("Failed to initialize the palette data for %s, falling back to default", paletteName);
Log::warn("Failed to initialize the palette data for %s, falling back to default", paletteName.c_str());
if (!voxel::initDefaultPalette()) {
Log::error("Failed to initialize the palette data");
return false;

View File

@ -19,6 +19,10 @@ protected:
video::ShaderVarState state;
setShaderVars(state);
core::Var::get(cfg::VoxelMeshSize, "16", core::CV_READONLY);
core::Var::get(cfg::VoxEditShowaabb, "");
core::Var::get(cfg::VoxEditGrayInactive, "");
core::Var::get(cfg::VoxEditHideInactive, "");
core::Var::get(cfg::VoxEditLastPalette, "");
construct();
ASSERT_TRUE(init());