Skip to content

Commit 751f87f

Browse files
committed
Add section for script exported properties
1 parent 9546650 commit 751f87f

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

src/jvm_wrapper/registration/kt_property.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ PropertyInfo KtPropertyInfo::toPropertyInfo() const {
3030
info.class_name = class_name;
3131
info.hint = hint;
3232
info.hint_string = hint_string;
33-
info.usage = usage;
33+
info.usage = usage | PropertyUsageFlags::PROPERTY_USAGE_SCRIPT_VARIABLE;
3434
return info;
3535
}
3636

src/script/jvm_script.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ void JvmScript::get_script_exported_property_list(List<PropertyInfo>* p_list) co
177177
List<PropertyInfo> all_properties;
178178
get_script_property_list(&all_properties);
179179

180+
p_list->push_back(get_class_category());
180181
for (const PropertyInfo& property_info : all_properties) {
181182
if (property_info.usage & PropertyUsageFlags::PROPERTY_USAGE_EDITOR) { p_list->push_back(property_info); }
182183
}
@@ -208,30 +209,27 @@ Vector<DocData::ClassDoc> JvmScript::get_documentation() const {
208209
return {};
209210
}
210211

211-
PropertyInfo JvmScript::get_class_category() const {
212-
// TODO: Investigate what it's supposed to do.
213-
return {};
214-
}
215-
216212
String JvmScript::get_class_icon_path() const {
217213
// TODO: Add ability to register an icon to Godot
218214
return {};
219215
}
220216

221217
StringName JvmScript::get_doc_class_name() const {
222-
// TODO: Add ability to register documentation to Godot
223-
return {};
218+
String class_name = get_global_name();
219+
if (class_name.is_empty()) {
220+
return get_path().get_file();
221+
}
222+
return class_name;
224223
}
225224

226225
PlaceHolderScriptInstance* JvmScript::placeholder_instance_create(Object* p_this) {
227226
PlaceHolderScriptInstance* placeholder {memnew(JvmPlaceHolderInstance(GdjLanguage::get_instance(), Ref<Script>(this), p_this))};
228227

228+
update_script_exports();// Update in case this method is called between the (re)loading and the delayed update_script_exports().
229+
229230
List<PropertyInfo> exported_properties;
230231
get_script_exported_property_list(&exported_properties);
231-
232-
update_script_exports();// Update in case this method is called between the (re)loading and the delayed update_script_exports().
233232
placeholder->update(exported_properties, exported_members_default_value_cache);
234-
235233
placeholders.insert(placeholder);
236234
return placeholder;
237235
}

src/script/jvm_script.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ class JvmScript : public Script {
7272
void set_last_time_source_modified(uint64_t p_time);
7373

7474
Vector<DocData::ClassDoc> get_documentation() const override;
75-
PropertyInfo get_class_category() const override;
7675
String get_class_icon_path() const override;
7776
StringName get_doc_class_name() const override;
7877

0 commit comments

Comments
 (0)