Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
bd1a8aac
Unverified
Commit
bd1a8aac
authored
Jan 16, 2020
by
Rémi Verschelde
Committed by
GitHub
Jan 16, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #35187 from aaronfranke/editor-property-int
Use int64_t for EditorPropertyInteger and warn when out of double range
parents
dd3779c1
5e1dad3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
editor_properties.cpp
editor/editor_properties.cpp
+9
-4
editor_properties.h
editor/editor_properties.h
+2
-2
No files found.
editor/editor_properties.cpp
View file @
bd1a8aac
...
...
@@ -805,10 +805,10 @@ EditorPropertyLayers::EditorPropertyLayers() {
///////////////////// INT /////////////////////////
void
EditorPropertyInteger
::
_value_changed
(
double
val
)
{
void
EditorPropertyInteger
::
_value_changed
(
int64_t
val
)
{
if
(
setting
)
return
;
emit_changed
(
get_edited_property
(),
(
int64_t
)
val
);
emit_changed
(
get_edited_property
(),
val
);
}
void
EditorPropertyInteger
::
update_property
()
{
...
...
@@ -816,14 +816,19 @@ void EditorPropertyInteger::update_property() {
setting
=
true
;
spin
->
set_value
(
val
);
setting
=
false
;
#ifdef DEBUG_ENABLED
// If spin (currently EditorSplinSlider : Range) is changed so that it can use int64_t, then the below warning wouldn't be a problem.
if
(
val
!=
(
int64_t
)(
double
)(
val
))
{
WARN_PRINT
(
"Cannot reliably represent '"
+
itos
(
val
)
+
"' in the inspector, value is too large."
);
}
#endif
}
void
EditorPropertyInteger
::
_bind_methods
()
{
ClassDB
::
bind_method
(
D_METHOD
(
"_value_changed"
),
&
EditorPropertyInteger
::
_value_changed
);
}
void
EditorPropertyInteger
::
setup
(
int
p_min
,
int
p_max
,
in
t
p_step
,
bool
p_allow_greater
,
bool
p_allow_lesser
)
{
void
EditorPropertyInteger
::
setup
(
int
64_t
p_min
,
int64_t
p_max
,
int64_
t
p_step
,
bool
p_allow_greater
,
bool
p_allow_lesser
)
{
spin
->
set_min
(
p_min
);
spin
->
set_max
(
p_max
);
spin
->
set_step
(
p_step
);
...
...
editor/editor_properties.h
View file @
bd1a8aac
...
...
@@ -263,14 +263,14 @@ class EditorPropertyInteger : public EditorProperty {
GDCLASS
(
EditorPropertyInteger
,
EditorProperty
);
EditorSpinSlider
*
spin
;
bool
setting
;
void
_value_changed
(
double
p_val
);
void
_value_changed
(
int64_t
p_val
);
protected
:
static
void
_bind_methods
();
public
:
virtual
void
update_property
();
void
setup
(
int
p_min
,
int
p_max
,
in
t
p_step
,
bool
p_allow_greater
,
bool
p_allow_lesser
);
void
setup
(
int
64_t
p_min
,
int64_t
p_max
,
int64_
t
p_step
,
bool
p_allow_greater
,
bool
p_allow_lesser
);
EditorPropertyInteger
();
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment