-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix typed array export #67454
Fix typed array export #67454
Conversation
I'm closing this for now as this PR isn't really ready yet, there are still some issues on runtime. I'll reopen it once its ready |
2450d32
to
d865797
Compare
Some known issues to fix before undrafting this:
|
a87e484
to
5321015
Compare
@Paulb23 @YeldhamDev could I get a review for this one? |
I didn't know about this PR and tried to fix the problem myself, my code is below. Here I just cut off diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 451cb7cfee..606fc8239b 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -36,9 +36,10 @@
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/inspector_dock.h"
+#include "scene/resources/packed_scene.h"
bool EditorPropertyArrayObject::_set(const StringName &p_name, const Variant &p_value) {
- String name = p_name;
+ String name = String(p_name).replace(SceneState::get_meta_pointer_property(""), "");
if (name.begins_with("indices")) {
int index = name.get_slicec('/', 1).to_int();
@@ -50,7 +51,7 @@ bool EditorPropertyArrayObject::_set(const StringName &p_name, const Variant &p_
}
bool EditorPropertyArrayObject::_get(const StringName &p_name, Variant &r_ret) const {
- String name = p_name;
+ String name = String(p_name).replace(SceneState::get_meta_pointer_property(""), "");
if (name.begins_with("indices")) {
int index = name.get_slicec('/', 1).to_int();
@@ -159,8 +160,9 @@ EditorPropertyDictionaryObject::EditorPropertyDictionaryObject() {
///////////////////// ARRAY ///////////////////////////
void EditorPropertyArray::_property_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) {
- if (p_property.begins_with("indices")) {
- int index = p_property.get_slice("/", 1).to_int();
+ String name = p_property.replace(SceneState::get_meta_pointer_property(""), "");
+ if (name.begins_with("indices")) {
+ int index = name.get_slice("/", 1).to_int();
Variant array = object->get_array();
array.set(index, p_value);
emit_changed(get_edited_property(), array, "", true);
My changes and your changes for |
Hi, is there anything I can do to help move this along? I'd like to use this feature in a project. |
d1eefa3
to
31f42a0
Compare
Needs rebase. Also this doesn't seem to work anymore, probably after TypedArray changes.
|
@@ -404,7 +425,20 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { | |||
|
|||
for (const DeferredNodePathProperties &dnp : deferred_node_paths) { | |||
Node *other = dnp.base->get_node_or_null(dnp.path); | |||
dnp.base->set(dnp.property, other); | |||
if (String(dnp.property).contains("/indices/")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid converting StringName
to String
more than once. Do
String string_property = dnp.property;
@@ -238,16 +238,37 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { | |||
|
|||
if (nprops[j].name & FLAG_PATH_PROPERTY_IS_NODE) { | |||
uint32_t name_idx = nprops[j].name & (FLAG_PATH_PROPERTY_IS_NODE - 1); | |||
NodeData::Property nprop = nprops[j]; | |||
Variant prop_variant = props[nprop.value]; | |||
StringName prop_name = snames[name_idx]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringName prop_name = snames[name_idx]; | |
const StringName &prop_name = snames[name_idx]; |
(technically applies to other variables too)
Thanks @KoBeWi I'll check this out |
@GuilhermeGSousa are you still working on this? It's a pretty bad blocker for me and I'd like to see it merged sooner than later. |
Closing this in favor of #73256 |
Fixes #62916.
Also confirmed that this works nicely together with #67055 to get exported arrays of custom node types.