diff options
author | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2018-09-19 18:35:22 -0300 |
---|---|---|
committer | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2018-09-19 20:23:09 -0300 |
commit | c0c567add7c2d9aad27814f56a480c0d73bc28a3 (patch) | |
tree | 3233f9f41bf9ff5fdf3e9e0abf2c2289bf5badad /editor | |
parent | e20a28a7db090dbf39bc8c90487c3d7beb84cbb8 (diff) |
Properly setup EditorProperties in arrays and dictionaries
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_properties_array_dict.cpp | 179 |
1 files changed, 97 insertions, 82 deletions
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 9982a31b7b..808a8ac2f8 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -336,16 +336,16 @@ void EditorPropertyArray::update_property() { } break; case Variant::INT: { - EditorPropertyInteger *ed = memnew(EditorPropertyInteger); - ed->setup(-100000, 100000, true, true); - prop = ed; + EditorPropertyInteger *editor = memnew(EditorPropertyInteger); + editor->setup(-100000, 100000, true, true); + prop = editor; } break; case Variant::REAL: { - EditorPropertyFloat *ed = memnew(EditorPropertyFloat); - ed->setup(-100000, 100000, 0.001, true, false, true, true); - prop = ed; + EditorPropertyFloat *editor = memnew(EditorPropertyFloat); + editor->setup(-100000, 100000, 0.001, true, false, true, true); + prop = editor; } break; case Variant::STRING: { @@ -357,63 +357,63 @@ void EditorPropertyArray::update_property() { case Variant::VECTOR2: { - EditorPropertyVector2 *ed = memnew(EditorPropertyVector2); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyVector2 *editor = memnew(EditorPropertyVector2); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::RECT2: { - EditorPropertyRect2 *ed = memnew(EditorPropertyRect2); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyRect2 *editor = memnew(EditorPropertyRect2); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::VECTOR3: { - EditorPropertyVector3 *ed = memnew(EditorPropertyVector3); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyVector3 *editor = memnew(EditorPropertyVector3); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::TRANSFORM2D: { - EditorPropertyTransform2D *ed = memnew(EditorPropertyTransform2D); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::PLANE: { - EditorPropertyPlane *ed = memnew(EditorPropertyPlane); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyPlane *editor = memnew(EditorPropertyPlane); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::QUAT: { - EditorPropertyQuat *ed = memnew(EditorPropertyQuat); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyQuat *editor = memnew(EditorPropertyQuat); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::AABB: { - EditorPropertyAABB *ed = memnew(EditorPropertyAABB); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyAABB *editor = memnew(EditorPropertyAABB); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::BASIS: { - EditorPropertyBasis *ed = memnew(EditorPropertyBasis); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyBasis *editor = memnew(EditorPropertyBasis); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::TRANSFORM: { - EditorPropertyTransform *ed = memnew(EditorPropertyTransform); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyTransform *editor = memnew(EditorPropertyTransform); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; @@ -431,8 +431,9 @@ void EditorPropertyArray::update_property() { } break; case Variant::OBJECT: { - - prop = memnew(EditorPropertyResource); + EditorPropertyResource *editor = memnew(EditorPropertyResource); + editor->setup("Resource"); + prop = editor; } break; case Variant::DICTIONARY: { @@ -798,16 +799,16 @@ void EditorPropertyDictionary::update_property() { } break; case Variant::INT: { - EditorPropertyInteger *ed = memnew(EditorPropertyInteger); - ed->setup(-100000, 100000, true, true); - prop = ed; + EditorPropertyInteger *editor = memnew(EditorPropertyInteger); + editor->setup(-100000, 100000, true, true); + prop = editor; } break; case Variant::REAL: { - EditorPropertyFloat *ed = memnew(EditorPropertyFloat); - ed->setup(-100000, 100000, 0.001, true, false, true, true); - prop = ed; + EditorPropertyFloat *editor = memnew(EditorPropertyFloat); + editor->setup(-100000, 100000, 0.001, true, false, true, true); + prop = editor; } break; case Variant::STRING: { @@ -815,67 +816,66 @@ void EditorPropertyDictionary::update_property() { } break; - // math types - + // math types case Variant::VECTOR2: { - EditorPropertyVector2 *ed = memnew(EditorPropertyVector2); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyVector2 *editor = memnew(EditorPropertyVector2); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::RECT2: { - EditorPropertyRect2 *ed = memnew(EditorPropertyRect2); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyRect2 *editor = memnew(EditorPropertyRect2); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::VECTOR3: { - EditorPropertyVector3 *ed = memnew(EditorPropertyVector3); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyVector3 *editor = memnew(EditorPropertyVector3); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::TRANSFORM2D: { - EditorPropertyTransform2D *ed = memnew(EditorPropertyTransform2D); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::PLANE: { - EditorPropertyPlane *ed = memnew(EditorPropertyPlane); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyPlane *editor = memnew(EditorPropertyPlane); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::QUAT: { - EditorPropertyQuat *ed = memnew(EditorPropertyQuat); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyQuat *editor = memnew(EditorPropertyQuat); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::AABB: { - EditorPropertyAABB *ed = memnew(EditorPropertyAABB); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyAABB *editor = memnew(EditorPropertyAABB); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::BASIS: { - EditorPropertyBasis *ed = memnew(EditorPropertyBasis); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyBasis *editor = memnew(EditorPropertyBasis); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; case Variant::TRANSFORM: { - EditorPropertyTransform *ed = memnew(EditorPropertyTransform); - ed->setup(-100000, 100000, 0.001, true); - prop = ed; + EditorPropertyTransform *editor = memnew(EditorPropertyTransform); + editor->setup(-100000, 100000, 0.001, true); + prop = editor; } break; @@ -893,8 +893,9 @@ void EditorPropertyDictionary::update_property() { } break; case Variant::OBJECT: { - - prop = memnew(EditorPropertyResource); + EditorPropertyResource *editor = memnew(EditorPropertyResource); + editor->setup("Resource"); + prop = editor; } break; case Variant::DICTIONARY: { @@ -902,39 +903,53 @@ void EditorPropertyDictionary::update_property() { } break; case Variant::ARRAY: { - - prop = memnew(EditorPropertyArray); - + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::ARRAY); + prop = editor; } break; // arrays case Variant::POOL_BYTE_ARRAY: { - prop = memnew(EditorPropertyArray); + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::POOL_BYTE_ARRAY); + prop = editor; } break; case Variant::POOL_INT_ARRAY: { - prop = memnew(EditorPropertyArray); + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::POOL_INT_ARRAY); + prop = editor; } break; case Variant::POOL_REAL_ARRAY: { - prop = memnew(EditorPropertyArray); + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::POOL_REAL_ARRAY); + prop = editor; } break; case Variant::POOL_STRING_ARRAY: { - prop = memnew(EditorPropertyArray); + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::POOL_STRING_ARRAY); + prop = editor; } break; case Variant::POOL_VECTOR2_ARRAY: { - prop = memnew(EditorPropertyArray); + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::POOL_VECTOR2_ARRAY); + prop = editor; } break; case Variant::POOL_VECTOR3_ARRAY: { - prop = memnew(EditorPropertyArray); + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::POOL_VECTOR3_ARRAY); + prop = editor; } break; case Variant::POOL_COLOR_ARRAY: { - prop = memnew(EditorPropertyArray); + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::POOL_COLOR_ARRAY); + prop = editor; } break; default: {} } |