Path: blob/master/editor/inspector/editor_properties_vector.h
9896 views
/**************************************************************************/1/* editor_properties_vector.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "editor/inspector/editor_inspector.h"3334class EditorSpinSlider;35class TextureButton;3637class EditorPropertyVectorN : public EditorProperty {38GDCLASS(EditorPropertyVectorN, EditorProperty);3940static const String COMPONENT_LABELS[4];4142int component_count = 0;43Variant::Type vector_type;4445Vector<EditorSpinSlider *> spin_sliders;46TextureButton *linked = nullptr;47Vector<double> ratio;48bool is_grabbed = false;4950bool radians_as_degrees = false;5152void _update_ratio();53void _store_link(bool p_linked);54void _grab_changed(bool p_grab);55void _value_changed(double p_val, const String &p_name);5657protected:58virtual void _set_read_only(bool p_read_only) override;59void _notification(int p_what);6061public:62virtual void update_property() override;63void setup(double p_min, double p_max, double p_step = 1.0, bool p_hide_slider = true, bool p_link = false, const String &p_suffix = String(), bool p_radians_as_degrees = false, bool p_is_int = false);64EditorPropertyVectorN(Variant::Type p_type, bool p_force_wide, bool p_horizontal);65};6667class EditorPropertyVector2 : public EditorPropertyVectorN {68GDCLASS(EditorPropertyVector2, EditorPropertyVectorN);6970public:71EditorPropertyVector2(bool p_force_wide = false);72};7374class EditorPropertyVector2i : public EditorPropertyVectorN {75GDCLASS(EditorPropertyVector2i, EditorPropertyVectorN);7677public:78EditorPropertyVector2i(bool p_force_wide = false);79};8081class EditorPropertyVector3 : public EditorPropertyVectorN {82GDCLASS(EditorPropertyVector3, EditorPropertyVectorN);8384public:85EditorPropertyVector3(bool p_force_wide = false);86};8788class EditorPropertyVector3i : public EditorPropertyVectorN {89GDCLASS(EditorPropertyVector3i, EditorPropertyVectorN);9091public:92EditorPropertyVector3i(bool p_force_wide = false);93};9495class EditorPropertyVector4 : public EditorPropertyVectorN {96GDCLASS(EditorPropertyVector4, EditorPropertyVectorN);9798public:99EditorPropertyVector4(bool p_force_wide = false);100};101102class EditorPropertyVector4i : public EditorPropertyVectorN {103GDCLASS(EditorPropertyVector4i, EditorPropertyVectorN);104105public:106EditorPropertyVector4i(bool p_force_wide = false);107};108109110