Merge pull request #58972 from reduz/expose-more-gdextension
This commit is contained in:
commit
9b59736473
90 changed files with 1075 additions and 272 deletions
4
.github/workflows/linux_builds.yml
vendored
4
.github/workflows/linux_builds.yml
vendored
|
@ -36,7 +36,9 @@ jobs:
|
|||
tests: true
|
||||
sconsflags: float=64 use_asan=yes use_ubsan=yes
|
||||
proj-test: true
|
||||
godot-cpp-test: true
|
||||
# Can be turned off for PRs that intentionally break compat with godot-cpp,
|
||||
# until both the upstream PR and the matching godot-cpp changes are merged.
|
||||
godot-cpp-test: false
|
||||
bin: "./bin/godot.linuxbsd.double.tools.64.san"
|
||||
build-mono: false
|
||||
# Skip 2GiB artifact speeding up action.
|
||||
|
|
|
@ -194,6 +194,7 @@ typedef void *GDExtensionClassInstancePtr;
|
|||
|
||||
typedef GDNativeBool (*GDNativeExtensionClassSet)(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name, const GDNativeVariantPtr p_value);
|
||||
typedef GDNativeBool (*GDNativeExtensionClassGet)(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name, GDNativeVariantPtr r_ret);
|
||||
typedef uint64_t (*GDNativeExtensionClassGetRID)(GDExtensionClassInstancePtr p_instance);
|
||||
|
||||
typedef struct {
|
||||
uint32_t type;
|
||||
|
@ -228,6 +229,7 @@ typedef struct {
|
|||
GDNativeExtensionClassCreateInstance create_instance_func; /* this one is mandatory */
|
||||
GDNativeExtensionClassFreeInstance free_instance_func; /* this one is mandatory */
|
||||
GDNativeExtensionClassGetVirtual get_virtual_func;
|
||||
GDNativeExtensionClassGetRID get_rid_func;
|
||||
void *class_userdata;
|
||||
} GDNativeExtensionClassCreationInfo;
|
||||
|
||||
|
|
|
@ -158,6 +158,7 @@ void NativeExtension::_register_extension_class(const GDNativeExtensionClassLibr
|
|||
extension->native_extension.create_instance = p_extension_funcs->create_instance_func;
|
||||
extension->native_extension.free_instance = p_extension_funcs->free_instance_func;
|
||||
extension->native_extension.get_virtual = p_extension_funcs->get_virtual_func;
|
||||
extension->native_extension.get_rid = p_extension_funcs->get_rid_func;
|
||||
|
||||
ClassDB::register_extension_class(&extension->native_extension);
|
||||
}
|
||||
|
|
|
@ -290,6 +290,21 @@ void Resource::_take_over_path(const String &p_path) {
|
|||
}
|
||||
|
||||
RID Resource::get_rid() const {
|
||||
if (get_script_instance()) {
|
||||
Callable::CallError ce;
|
||||
RID ret = get_script_instance()->callp(SNAME("_get_rid"), nullptr, 0, ce);
|
||||
if (ce.error == Callable::CallError::CALL_OK && ret.is_valid()) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (_get_extension() && _get_extension()->get_rid) {
|
||||
RID ret;
|
||||
ret.from_uint64(_get_extension()->get_rid(_get_extension_instance()));
|
||||
if (ret.is_valid()) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return RID();
|
||||
}
|
||||
|
||||
|
@ -428,6 +443,11 @@ void Resource::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "resource_local_to_scene"), "set_local_to_scene", "is_local_to_scene");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "resource_path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_path", "get_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "resource_name"), "set_name", "get_name");
|
||||
|
||||
MethodInfo get_rid_bind("_get_rid");
|
||||
get_rid_bind.return_val.type = Variant::RID;
|
||||
|
||||
::ClassDB::add_virtual_method(get_class_static(), get_rid_bind, true, Vector<String>(), true);
|
||||
}
|
||||
|
||||
Resource::Resource() :
|
||||
|
|
|
@ -557,6 +557,19 @@ bool ClassDB::can_instantiate(const StringName &p_class) {
|
|||
return (!ti->disabled && ti->creation_func != nullptr && !(ti->native_extension && !ti->native_extension->create_instance));
|
||||
}
|
||||
|
||||
bool ClassDB::is_virtual(const StringName &p_class) {
|
||||
OBJTYPE_RLOCK;
|
||||
|
||||
ClassInfo *ti = classes.getptr(p_class);
|
||||
ERR_FAIL_COND_V_MSG(!ti, false, "Cannot get class '" + String(p_class) + "'.");
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (ti->api == API_EDITOR && !Engine::get_singleton()->is_editor_hint()) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return (!ti->disabled && ti->creation_func != nullptr && !(ti->native_extension && !ti->native_extension->create_instance) && ti->is_virtual);
|
||||
}
|
||||
|
||||
void ClassDB::_add_class2(const StringName &p_class, const StringName &p_inherits) {
|
||||
OBJTYPE_WLOCK;
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@ public:
|
|||
StringName name;
|
||||
bool disabled = false;
|
||||
bool exposed = false;
|
||||
bool is_virtual = false;
|
||||
Object *(*creation_func)() = nullptr;
|
||||
|
||||
ClassInfo() {}
|
||||
|
@ -156,20 +157,21 @@ public:
|
|||
}
|
||||
|
||||
template <class T>
|
||||
static void register_class() {
|
||||
static void register_class(bool p_virtual = false) {
|
||||
GLOBAL_LOCK_FUNCTION;
|
||||
T::initialize_class();
|
||||
ClassInfo *t = classes.getptr(T::get_class_static());
|
||||
ERR_FAIL_COND(!t);
|
||||
t->creation_func = &creator<T>;
|
||||
t->exposed = true;
|
||||
t->is_virtual = p_virtual;
|
||||
t->class_ptr = T::get_class_ptr_static();
|
||||
t->api = current_api;
|
||||
T::register_custom_data_to_otdb();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static void register_virtual_class() {
|
||||
static void register_abstract_class() {
|
||||
GLOBAL_LOCK_FUNCTION;
|
||||
T::initialize_class();
|
||||
ClassInfo *t = classes.getptr(T::get_class_static());
|
||||
|
@ -210,6 +212,7 @@ public:
|
|||
static bool class_exists(const StringName &p_class);
|
||||
static bool is_parent_class(const StringName &p_class, const StringName &p_inherits);
|
||||
static bool can_instantiate(const StringName &p_class);
|
||||
static bool is_virtual(const StringName &p_class);
|
||||
static Object *instantiate(const StringName &p_class);
|
||||
static void set_object_extension_instance(Object *p_object, const StringName &p_class, GDExtensionClassInstancePtr p_instance);
|
||||
|
||||
|
@ -436,9 +439,13 @@ _FORCE_INLINE_ Vector<Error> errarray(P... p_args) {
|
|||
if (!GD_IS_DEFINED(ClassDB_Disable_##m_class)) { \
|
||||
::ClassDB::register_class<m_class>(); \
|
||||
}
|
||||
#define GDREGISTER_VIRTUAL_CLASS(m_class) \
|
||||
if (!GD_IS_DEFINED(ClassDB_Disable_##m_class)) { \
|
||||
::ClassDB::register_virtual_class<m_class>(); \
|
||||
#define GDREGISTER_VIRTUAL_CLASS(m_class) \
|
||||
if (!GD_IS_DEFINED(ClassDB_Disable_##m_class)) { \
|
||||
::ClassDB::register_class<m_class>(true); \
|
||||
}
|
||||
#define GDREGISTER_ABSTRACT_CLASS(m_class) \
|
||||
if (!GD_IS_DEFINED(ClassDB_Disable_##m_class)) { \
|
||||
::ClassDB::register_abstract_class<m_class>(); \
|
||||
}
|
||||
|
||||
#include "core/disabled_classes.gen.h"
|
||||
|
|
|
@ -3,6 +3,7 @@ proto = """
|
|||
StringName _gdvirtual_##m_name##_sn = #m_name;\\
|
||||
mutable bool _gdvirtual_##m_name##_initialized = false;\\
|
||||
mutable GDNativeExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\\
|
||||
template<bool required>\\
|
||||
_FORCE_INLINE_ bool _gdvirtual_##m_name##_call($CALLARGS) $CONST { \\
|
||||
ScriptInstance *script_instance = ((Object*)(this))->get_script_instance();\\
|
||||
if (script_instance) {\\
|
||||
|
@ -25,6 +26,10 @@ _FORCE_INLINE_ bool _gdvirtual_##m_name##_call($CALLARGS) $CONST { \\
|
|||
$CALLPTRRET\\
|
||||
return true;\\
|
||||
}\\
|
||||
\\
|
||||
if (required) {\\
|
||||
WARN_PRINT_ONCE("Required virtual method: "+get_class()+"::" + #m_name + " must be overriden before calling.");\\
|
||||
}\\
|
||||
\\
|
||||
return false;\\
|
||||
}\\
|
||||
|
|
|
@ -255,6 +255,7 @@ struct ObjectNativeExtension {
|
|||
GDNativeExtensionClassToString to_string;
|
||||
GDNativeExtensionClassReference reference;
|
||||
GDNativeExtensionClassReference unreference;
|
||||
GDNativeExtensionClassGetRID get_rid;
|
||||
|
||||
_FORCE_INLINE_ bool is_class(const String &p_class) const {
|
||||
const ObjectNativeExtension *e = this;
|
||||
|
@ -273,8 +274,12 @@ struct ObjectNativeExtension {
|
|||
GDNativeExtensionClassGetVirtual get_virtual;
|
||||
};
|
||||
|
||||
#define GDVIRTUAL_CALL(m_name, ...) _gdvirtual_##m_name##_call(__VA_ARGS__)
|
||||
#define GDVIRTUAL_CALL_PTR(m_obj, m_name, ...) m_obj->_gdvirtual_##m_name##_call(__VA_ARGS__)
|
||||
#define GDVIRTUAL_CALL(m_name, ...) _gdvirtual_##m_name##_call<false>(__VA_ARGS__)
|
||||
#define GDVIRTUAL_CALL_PTR(m_obj, m_name, ...) m_obj->_gdvirtual_##m_name##_call<false>(__VA_ARGS__)
|
||||
|
||||
#define GDVIRTUAL_REQUIRED_CALL(m_name, ...) _gdvirtual_##m_name##_call<true>(__VA_ARGS__)
|
||||
#define GDVIRTUAL_REQUIRED_CALL_PTR(m_obj, m_name, ...) m_obj->_gdvirtual_##m_name##_call<true>(__VA_ARGS__)
|
||||
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
#define GDVIRTUAL_BIND(m_name, ...) ::ClassDB::add_virtual_method(get_class_static(), _gdvirtual_##m_name##_get_method_info(), true, sarray(__VA_ARGS__));
|
||||
#else
|
||||
|
|
|
@ -141,7 +141,7 @@ void register_core_types() {
|
|||
|
||||
GDREGISTER_CLASS(Object);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(Script);
|
||||
GDREGISTER_ABSTRACT_CLASS(Script);
|
||||
|
||||
GDREGISTER_CLASS(RefCounted);
|
||||
GDREGISTER_CLASS(WeakRef);
|
||||
|
@ -149,12 +149,12 @@ void register_core_types() {
|
|||
GDREGISTER_CLASS(Image);
|
||||
|
||||
GDREGISTER_CLASS(Shortcut);
|
||||
GDREGISTER_VIRTUAL_CLASS(InputEvent);
|
||||
GDREGISTER_VIRTUAL_CLASS(InputEventWithModifiers);
|
||||
GDREGISTER_VIRTUAL_CLASS(InputEventFromWindow);
|
||||
GDREGISTER_ABSTRACT_CLASS(InputEvent);
|
||||
GDREGISTER_ABSTRACT_CLASS(InputEventWithModifiers);
|
||||
GDREGISTER_ABSTRACT_CLASS(InputEventFromWindow);
|
||||
GDREGISTER_CLASS(InputEventKey);
|
||||
GDREGISTER_CLASS(InputEventShortcut);
|
||||
GDREGISTER_VIRTUAL_CLASS(InputEventMouse);
|
||||
GDREGISTER_ABSTRACT_CLASS(InputEventMouse);
|
||||
GDREGISTER_CLASS(InputEventMouseButton);
|
||||
GDREGISTER_CLASS(InputEventMouseMotion);
|
||||
GDREGISTER_CLASS(InputEventJoypadButton);
|
||||
|
@ -162,21 +162,21 @@ void register_core_types() {
|
|||
GDREGISTER_CLASS(InputEventScreenDrag);
|
||||
GDREGISTER_CLASS(InputEventScreenTouch);
|
||||
GDREGISTER_CLASS(InputEventAction);
|
||||
GDREGISTER_VIRTUAL_CLASS(InputEventGesture);
|
||||
GDREGISTER_ABSTRACT_CLASS(InputEventGesture);
|
||||
GDREGISTER_CLASS(InputEventMagnifyGesture);
|
||||
GDREGISTER_CLASS(InputEventPanGesture);
|
||||
GDREGISTER_CLASS(InputEventMIDI);
|
||||
|
||||
// Network
|
||||
GDREGISTER_VIRTUAL_CLASS(IP);
|
||||
GDREGISTER_ABSTRACT_CLASS(IP);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(StreamPeer);
|
||||
GDREGISTER_ABSTRACT_CLASS(StreamPeer);
|
||||
GDREGISTER_CLASS(StreamPeerExtension);
|
||||
GDREGISTER_CLASS(StreamPeerBuffer);
|
||||
GDREGISTER_CLASS(StreamPeerTCP);
|
||||
GDREGISTER_CLASS(TCPServer);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(PacketPeer);
|
||||
GDREGISTER_ABSTRACT_CLASS(PacketPeer);
|
||||
GDREGISTER_CLASS(PacketPeerExtension);
|
||||
GDREGISTER_CLASS(PacketPeerStream);
|
||||
GDREGISTER_CLASS(PacketPeerUDP);
|
||||
|
@ -200,7 +200,7 @@ void register_core_types() {
|
|||
resource_format_loader_crypto.instantiate();
|
||||
ResourceLoader::add_resource_format_loader(resource_format_loader_crypto);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(MultiplayerPeer);
|
||||
GDREGISTER_ABSTRACT_CLASS(MultiplayerPeer);
|
||||
GDREGISTER_CLASS(MultiplayerPeerExtension);
|
||||
GDREGISTER_CLASS(MultiplayerAPI);
|
||||
GDREGISTER_CLASS(MainLoop);
|
||||
|
@ -226,19 +226,19 @@ void register_core_types() {
|
|||
GDREGISTER_CLASS(PCKPacker);
|
||||
|
||||
GDREGISTER_CLASS(PackedDataContainer);
|
||||
GDREGISTER_VIRTUAL_CLASS(PackedDataContainerRef);
|
||||
GDREGISTER_ABSTRACT_CLASS(PackedDataContainerRef);
|
||||
GDREGISTER_CLASS(AStar);
|
||||
GDREGISTER_CLASS(AStar2D);
|
||||
GDREGISTER_CLASS(EncodedObjectAsID);
|
||||
GDREGISTER_CLASS(RandomNumberGenerator);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(ResourceImporter);
|
||||
GDREGISTER_ABSTRACT_CLASS(ResourceImporter);
|
||||
|
||||
GDREGISTER_CLASS(NativeExtension);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(NativeExtensionManager);
|
||||
GDREGISTER_ABSTRACT_CLASS(NativeExtensionManager);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(ResourceUID);
|
||||
GDREGISTER_ABSTRACT_CLASS(ResourceUID);
|
||||
|
||||
GDREGISTER_CLASS(EngineProfiler);
|
||||
|
||||
|
@ -276,7 +276,7 @@ void register_core_settings() {
|
|||
|
||||
void register_core_singletons() {
|
||||
GDREGISTER_CLASS(ProjectSettings);
|
||||
GDREGISTER_VIRTUAL_CLASS(IP);
|
||||
GDREGISTER_ABSTRACT_CLASS(IP);
|
||||
GDREGISTER_CLASS(core_bind::Geometry2D);
|
||||
GDREGISTER_CLASS(core_bind::Geometry3D);
|
||||
GDREGISTER_CLASS(core_bind::ResourceLoader);
|
||||
|
@ -286,7 +286,7 @@ void register_core_singletons() {
|
|||
GDREGISTER_CLASS(core_bind::special::ClassDB);
|
||||
GDREGISTER_CLASS(core_bind::Marshalls);
|
||||
GDREGISTER_CLASS(TranslationServer);
|
||||
GDREGISTER_VIRTUAL_CLASS(Input);
|
||||
GDREGISTER_ABSTRACT_CLASS(Input);
|
||||
GDREGISTER_CLASS(InputMap);
|
||||
GDREGISTER_CLASS(Expression);
|
||||
GDREGISTER_CLASS(core_bind::EngineDebugger);
|
||||
|
|
|
@ -9,4 +9,11 @@
|
|||
<tutorials>
|
||||
<link title="Audio Mic Record Demo">https://godotengine.org/asset-library/asset/527</link>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_instantiate" qualifiers="virtual">
|
||||
<return type="AudioEffectInstance" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
</class>
|
||||
|
|
|
@ -6,4 +6,19 @@
|
|||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_process" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<argument index="0" name="src_buffer" type="const void*" />
|
||||
<argument index="1" name="dst_buffer" type="AudioFrame*" />
|
||||
<argument index="2" name="frame_count" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_process_silence" qualifiers="virtual const">
|
||||
<return type="bool" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
</class>
|
||||
|
|
|
@ -6,4 +6,23 @@
|
|||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_get_stream_sampling_rate" qualifiers="virtual const">
|
||||
<return type="float" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_mix_resampled" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<argument index="0" name="dst_buffer" type="AudioFrame*" />
|
||||
<argument index="1" name="frame_count" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="begin_resample">
|
||||
<return type="void" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
</class>
|
||||
|
|
|
@ -11,6 +11,26 @@
|
|||
<link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_can_do_next_pass" qualifiers="virtual const">
|
||||
<return type="bool" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_can_use_render_priority" qualifiers="virtual const">
|
||||
<return type="bool" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_shader_mode" qualifiers="virtual const">
|
||||
<return type="int" enum="Shader.Mode" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_shader_rid" qualifiers="virtual const">
|
||||
<return type="RID" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="inspect_native_shader_code">
|
||||
<return type="void" />
|
||||
<description>
|
||||
|
@ -22,7 +42,7 @@
|
|||
Sets the [Material] to be used for the next pass. This renders the object again using a different material.
|
||||
[b]Note:[/b] This only applies to [StandardMaterial3D]s and [ShaderMaterial]s with type "Spatial".
|
||||
</member>
|
||||
<member name="render_priority" type="int" setter="set_render_priority" getter="get_render_priority" default="0">
|
||||
<member name="render_priority" type="int" setter="set_render_priority" getter="get_render_priority">
|
||||
Sets the render priority for transparent objects in 3D scenes. Higher priority objects will be sorted in front of lower priority objects.
|
||||
[b]Note:[/b] This only applies to [StandardMaterial3D]s and [ShaderMaterial]s with type "Spatial".
|
||||
[b]Note:[/b] This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
|
||||
|
|
|
@ -13,6 +13,89 @@
|
|||
<link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_get_aabb" qualifiers="virtual const">
|
||||
<return type="AABB" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_blend_shape_count" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_blend_shape_name" qualifiers="virtual const">
|
||||
<return type="StringName" />
|
||||
<argument index="0" name="index" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_surface_count" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_blend_shape_name" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<argument index="0" name="index" type="int" />
|
||||
<argument index="1" name="name" type="StringName" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_surface_get_array_index_len" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<argument index="0" name="index" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_surface_get_array_len" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<argument index="0" name="index" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_surface_get_arrays" qualifiers="virtual const">
|
||||
<return type="Array" />
|
||||
<argument index="0" name="index" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_surface_get_blend_shape_arrays" qualifiers="virtual const">
|
||||
<return type="Array" />
|
||||
<argument index="0" name="index" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_surface_get_format" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<argument index="0" name="index" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_surface_get_lods" qualifiers="virtual const">
|
||||
<return type="Dictionary" />
|
||||
<argument index="0" name="index" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_surface_get_material" qualifiers="virtual const">
|
||||
<return type="Material" />
|
||||
<argument index="0" name="index" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_surface_get_primitive_type" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<argument index="0" name="index" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_surface_set_material" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<argument index="0" name="index" type="int" />
|
||||
<argument index="1" name="material" type="Material" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="create_convex_shape" qualifiers="const">
|
||||
<return type="Shape3D" />
|
||||
<argument index="0" name="clean" type="bool" default="true" />
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_create_mesh_array" qualifiers="virtual const">
|
||||
<return type="Array" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_mesh_arrays" qualifiers="const">
|
||||
<return type="Array" />
|
||||
<description>
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_value_changed" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<argument index="0" name="" type="float" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="share">
|
||||
<return type="void" />
|
||||
<argument index="0" name="with" type="Node" />
|
||||
|
|
|
@ -12,6 +12,11 @@
|
|||
<link title="When and how to avoid using nodes for everything">$DOCS_URL/tutorials/best_practices/node_alternatives.html</link>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_get_rid" qualifiers="virtual">
|
||||
<return type="RID" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="duplicate" qualifiers="const">
|
||||
<return type="Resource" />
|
||||
<argument index="0" name="subresources" type="bool" default="false" />
|
||||
|
|
|
@ -10,6 +10,37 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_draw" qualifiers="virtual const">
|
||||
<return type="void" />
|
||||
<argument index="0" name="to_canvas_item" type="RID" />
|
||||
<argument index="1" name="rect" type="Rect2" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_center_size" qualifiers="virtual const">
|
||||
<return type="Vector2" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_draw_rect" qualifiers="virtual const">
|
||||
<return type="Rect2" />
|
||||
<argument index="0" name="rect" type="Rect2" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_style_margin" qualifiers="virtual const">
|
||||
<return type="float" />
|
||||
<argument index="0" name="side" type="int" enum="Side" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_test_mask" qualifiers="virtual const">
|
||||
<return type="bool" />
|
||||
<argument index="0" name="point" type="Vector2" />
|
||||
<argument index="1" name="rect" type="Rect2" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="draw" qualifiers="const">
|
||||
<return type="void" />
|
||||
<argument index="0" name="canvas_item" type="RID" />
|
||||
|
|
|
@ -12,6 +12,58 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_draw" qualifiers="virtual const">
|
||||
<return type="void" />
|
||||
<argument index="0" name="to_canvas_item" type="RID" />
|
||||
<argument index="1" name="pos" type="Vector2" />
|
||||
<argument index="2" name="modulate" type="Color" />
|
||||
<argument index="3" name="transpose" type="bool" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_draw_rect" qualifiers="virtual const">
|
||||
<return type="void" />
|
||||
<argument index="0" name="to_canvas_item" type="RID" />
|
||||
<argument index="1" name="rect" type="Rect2" />
|
||||
<argument index="2" name="tile" type="bool" />
|
||||
<argument index="3" name="modulate" type="Color" />
|
||||
<argument index="4" name="transpose" type="bool" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_draw_rect_region" qualifiers="virtual const">
|
||||
<return type="void" />
|
||||
<argument index="0" name="tp_canvas_item" type="RID" />
|
||||
<argument index="1" name="rect" type="Rect2" />
|
||||
<argument index="2" name="src_rect" type="Rect2" />
|
||||
<argument index="3" name="modulate" type="Color" />
|
||||
<argument index="4" name="transpose" type="bool" />
|
||||
<argument index="5" name="clip_uv" type="bool" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_height" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_width" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_has_alpha" qualifiers="virtual const">
|
||||
<return type="bool" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_is_pixel_opaque" qualifiers="virtual const">
|
||||
<return type="bool" />
|
||||
<argument index="0" name="x" type="int" />
|
||||
<argument index="1" name="y" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="draw" qualifiers="const">
|
||||
<return type="void" />
|
||||
<argument index="0" name="canvas_item" type="RID" />
|
||||
|
|
|
@ -7,6 +7,36 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_get_data" qualifiers="virtual const">
|
||||
<return type="Image[]" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_depth" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_format" qualifiers="virtual const">
|
||||
<return type="int" enum="Image.Format" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_height" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_width" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_has_mipmaps" qualifiers="virtual const">
|
||||
<return type="bool" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_data" qualifiers="const">
|
||||
<return type="Image[]" />
|
||||
<description>
|
||||
|
|
|
@ -9,6 +9,42 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_get_format" qualifiers="virtual const">
|
||||
<return type="int" enum="Image.Format" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_height" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_layer_data" qualifiers="virtual const">
|
||||
<return type="Image" />
|
||||
<argument index="0" name="layer_index" type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_layered_type" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_layers" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_width" qualifiers="virtual const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="_has_mipmaps" qualifiers="virtual const">
|
||||
<return type="bool" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_format" qualifiers="const">
|
||||
<return type="int" enum="Image.Format" />
|
||||
<description>
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_get_aabb" qualifiers="virtual const">
|
||||
<return type="AABB" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_aabb" qualifiers="const">
|
||||
<return type="AABB" />
|
||||
<description>
|
||||
|
|
|
@ -130,8 +130,8 @@ bool CreateDialog::_should_hide_type(const String &p_type) const {
|
|||
}
|
||||
|
||||
if (ClassDB::class_exists(p_type)) {
|
||||
if (!ClassDB::can_instantiate(p_type)) {
|
||||
return true; // Can't create abstract class.
|
||||
if (!ClassDB::can_instantiate(p_type) || ClassDB::is_virtual(p_type)) {
|
||||
return true; // Can't create abstract or virtual class.
|
||||
}
|
||||
|
||||
if (!ClassDB::is_parent_class(p_type, base_type)) {
|
||||
|
|
|
@ -919,7 +919,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
|
|||
ClassDB::get_inheriters_from_class("AudioEffect", &effects);
|
||||
effects.sort_custom<StringName::AlphCompare>();
|
||||
for (const StringName &E : effects) {
|
||||
if (!ClassDB::can_instantiate(E)) {
|
||||
if (!ClassDB::can_instantiate(E) || ClassDB::is_virtual(E)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -3858,18 +3858,18 @@ void EditorNode::register_editor_types() {
|
|||
GDREGISTER_CLASS(EditorScript);
|
||||
GDREGISTER_CLASS(EditorSelection);
|
||||
GDREGISTER_CLASS(EditorFileDialog);
|
||||
GDREGISTER_VIRTUAL_CLASS(EditorSettings);
|
||||
GDREGISTER_ABSTRACT_CLASS(EditorSettings);
|
||||
GDREGISTER_CLASS(EditorNode3DGizmo);
|
||||
GDREGISTER_CLASS(EditorNode3DGizmoPlugin);
|
||||
GDREGISTER_VIRTUAL_CLASS(EditorResourcePreview);
|
||||
GDREGISTER_ABSTRACT_CLASS(EditorResourcePreview);
|
||||
GDREGISTER_CLASS(EditorResourcePreviewGenerator);
|
||||
GDREGISTER_VIRTUAL_CLASS(EditorFileSystem);
|
||||
GDREGISTER_ABSTRACT_CLASS(EditorFileSystem);
|
||||
GDREGISTER_CLASS(EditorFileSystemDirectory);
|
||||
GDREGISTER_CLASS(EditorVCSInterface);
|
||||
GDREGISTER_VIRTUAL_CLASS(ScriptEditor);
|
||||
GDREGISTER_VIRTUAL_CLASS(ScriptEditorBase);
|
||||
GDREGISTER_ABSTRACT_CLASS(ScriptEditor);
|
||||
GDREGISTER_ABSTRACT_CLASS(ScriptEditorBase);
|
||||
GDREGISTER_CLASS(EditorSyntaxHighlighter);
|
||||
GDREGISTER_VIRTUAL_CLASS(EditorInterface);
|
||||
GDREGISTER_ABSTRACT_CLASS(EditorInterface);
|
||||
GDREGISTER_CLASS(EditorExportPlugin);
|
||||
GDREGISTER_CLASS(EditorResourceConversionPlugin);
|
||||
GDREGISTER_CLASS(EditorSceneFormatImporter);
|
||||
|
@ -3884,7 +3884,7 @@ void EditorNode::register_editor_types() {
|
|||
GDREGISTER_CLASS(EditorResourcePicker);
|
||||
GDREGISTER_CLASS(EditorScriptPicker);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(FileSystemDock);
|
||||
GDREGISTER_ABSTRACT_CLASS(FileSystemDock);
|
||||
|
||||
// FIXME: Is this stuff obsolete, or should it be ported to new APIs?
|
||||
GDREGISTER_CLASS(EditorScenePostImport);
|
||||
|
|
|
@ -166,20 +166,20 @@ void GPUParticles3DEditorBase::_node_selected(const NodePath &p_path) {
|
|||
return;
|
||||
}
|
||||
|
||||
VisualInstance3D *vi = Object::cast_to<VisualInstance3D>(sel);
|
||||
if (!vi) {
|
||||
MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(sel);
|
||||
if (!mi || mi->get_mesh().is_null()) {
|
||||
EditorNode::get_singleton()->show_warning(vformat(TTR("\"%s\" doesn't contain geometry."), sel->get_name()));
|
||||
return;
|
||||
}
|
||||
|
||||
geometry = vi->get_faces(VisualInstance3D::FACES_SOLID);
|
||||
geometry = mi->get_mesh()->get_faces();
|
||||
|
||||
if (geometry.size() == 0) {
|
||||
EditorNode::get_singleton()->show_warning(vformat(TTR("\"%s\" doesn't contain face geometry."), sel->get_name()));
|
||||
return;
|
||||
}
|
||||
|
||||
Transform3D geom_xform = base_node->get_global_transform().affine_inverse() * vi->get_global_transform();
|
||||
Transform3D geom_xform = base_node->get_global_transform().affine_inverse() * mi->get_global_transform();
|
||||
|
||||
int gc = geometry.size();
|
||||
Face3 *w = geometry.ptrw();
|
||||
|
|
|
@ -105,9 +105,9 @@ void MultiMeshEditor::_populate() {
|
|||
return;
|
||||
}
|
||||
|
||||
GeometryInstance3D *ss_instance = Object::cast_to<MeshInstance3D>(ss_node);
|
||||
MeshInstance3D *ss_instance = Object::cast_to<MeshInstance3D>(ss_node);
|
||||
|
||||
if (!ss_instance) {
|
||||
if (!ss_instance || !ss_instance->get_mesh().is_valid()) {
|
||||
err_dialog->set_text(TTR("Surface source is invalid (no geometry)."));
|
||||
err_dialog->popup_centered();
|
||||
return;
|
||||
|
@ -115,7 +115,7 @@ void MultiMeshEditor::_populate() {
|
|||
|
||||
Transform3D geom_xform = node->get_global_transform().affine_inverse() * ss_instance->get_global_transform();
|
||||
|
||||
Vector<Face3> geometry = ss_instance->get_faces(VisualInstance3D::FACES_SOLID);
|
||||
Vector<Face3> geometry = ss_instance->get_mesh()->get_faces();
|
||||
|
||||
if (geometry.size() == 0) {
|
||||
err_dialog->set_text(TTR("Surface source is invalid (no faces)."));
|
||||
|
|
|
@ -907,7 +907,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
|
|||
}
|
||||
}
|
||||
|
||||
if (!is_custom_resource && !ClassDB::can_instantiate(t)) {
|
||||
if (!is_custom_resource && (!ClassDB::can_instantiate(t) || ClassDB::is_virtual(t))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -491,10 +491,6 @@ Vector<Vector3> CSGShape3D::get_brush_faces() {
|
|||
return faces;
|
||||
}
|
||||
|
||||
Vector<Face3> CSGShape3D::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
void CSGShape3D::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_PARENTED: {
|
||||
|
|
|
@ -128,7 +128,6 @@ public:
|
|||
virtual Vector<Vector3> get_brush_faces();
|
||||
|
||||
virtual AABB get_aabb() const override;
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
void set_use_collision(bool p_enable);
|
||||
bool is_using_collision() const;
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
void register_csg_types() {
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(CSGShape3D);
|
||||
GDREGISTER_VIRTUAL_CLASS(CSGPrimitive3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(CSGShape3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(CSGPrimitive3D);
|
||||
GDREGISTER_CLASS(CSGMesh3D);
|
||||
GDREGISTER_CLASS(CSGSphere3D);
|
||||
GDREGISTER_CLASS(CSGBox3D);
|
||||
|
|
|
@ -44,7 +44,7 @@ void register_enet_types() {
|
|||
}
|
||||
|
||||
GDREGISTER_CLASS(ENetMultiplayerPeer);
|
||||
GDREGISTER_VIRTUAL_CLASS(ENetPacketPeer);
|
||||
GDREGISTER_ABSTRACT_CLASS(ENetPacketPeer);
|
||||
GDREGISTER_CLASS(ENetConnection);
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ void AudioStreamPlaybackMP3::start(float p_from_pos) {
|
|||
active = true;
|
||||
seek(p_from_pos);
|
||||
loops = 0;
|
||||
_begin_resample();
|
||||
begin_resample();
|
||||
}
|
||||
|
||||
void AudioStreamPlaybackMP3::stop() {
|
||||
|
|
|
@ -53,10 +53,10 @@ void register_visual_script_types() {
|
|||
ScriptServer::register_language(visual_script_language);
|
||||
|
||||
GDREGISTER_CLASS(VisualScript);
|
||||
GDREGISTER_VIRTUAL_CLASS(VisualScriptNode);
|
||||
GDREGISTER_ABSTRACT_CLASS(VisualScriptNode);
|
||||
GDREGISTER_CLASS(VisualScriptFunctionState);
|
||||
GDREGISTER_CLASS(VisualScriptFunction);
|
||||
GDREGISTER_VIRTUAL_CLASS(VisualScriptLists);
|
||||
GDREGISTER_ABSTRACT_CLASS(VisualScriptLists);
|
||||
GDREGISTER_CLASS(VisualScriptComposeArray);
|
||||
GDREGISTER_CLASS(VisualScriptOperator);
|
||||
GDREGISTER_CLASS(VisualScriptVariableSet);
|
||||
|
|
|
@ -166,7 +166,7 @@ void AudioStreamPlaybackOGGVorbis::start(float p_from_pos) {
|
|||
active = true;
|
||||
seek(p_from_pos);
|
||||
loops = 0;
|
||||
_begin_resample();
|
||||
begin_resample();
|
||||
}
|
||||
|
||||
void AudioStreamPlaybackOGGVorbis::stop() {
|
||||
|
|
|
@ -47,7 +47,7 @@ void register_webrtc_types() {
|
|||
ClassDB::register_custom_instance_class<WebRTCPeerConnection>();
|
||||
GDREGISTER_CLASS(WebRTCPeerConnectionExtension);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(WebRTCDataChannel);
|
||||
GDREGISTER_ABSTRACT_CLASS(WebRTCDataChannel);
|
||||
GDREGISTER_CLASS(WebRTCDataChannelExtension);
|
||||
|
||||
GDREGISTER_CLASS(WebRTCMultiplayerPeer);
|
||||
|
|
|
@ -63,7 +63,7 @@ void register_websocket_types() {
|
|||
WSLServer::make_default();
|
||||
#endif
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(WebSocketMultiplayerPeer);
|
||||
GDREGISTER_ABSTRACT_CLASS(WebSocketMultiplayerPeer);
|
||||
ClassDB::register_custom_instance_class<WebSocketServer>();
|
||||
ClassDB::register_custom_instance_class<WebSocketClient>();
|
||||
ClassDB::register_custom_instance_class<WebSocketPeer>();
|
||||
|
|
|
@ -38,7 +38,7 @@ Ref<WebXRInterfaceJS> webxr;
|
|||
#endif
|
||||
|
||||
void register_webxr_types() {
|
||||
GDREGISTER_VIRTUAL_CLASS(WebXRInterface);
|
||||
GDREGISTER_ABSTRACT_CLASS(WebXRInterface);
|
||||
|
||||
#ifdef JAVASCRIPT_ENABLED
|
||||
webxr.instantiate();
|
||||
|
|
|
@ -37,8 +37,8 @@ static JavaScript *javascript_eval;
|
|||
|
||||
void register_javascript_api() {
|
||||
JavaScriptToolsEditorPlugin::initialize();
|
||||
GDREGISTER_VIRTUAL_CLASS(JavaScriptObject);
|
||||
GDREGISTER_VIRTUAL_CLASS(JavaScript);
|
||||
GDREGISTER_ABSTRACT_CLASS(JavaScriptObject);
|
||||
GDREGISTER_ABSTRACT_CLASS(JavaScript);
|
||||
javascript_eval = memnew(JavaScript);
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("JavaScript", javascript_eval));
|
||||
}
|
||||
|
|
|
@ -39,10 +39,6 @@ AABB CPUParticles3D::get_aabb() const {
|
|||
return AABB();
|
||||
}
|
||||
|
||||
Vector<Face3> CPUParticles3D::get_faces(uint32_t p_usage_particle_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
void CPUParticles3D::set_emitting(bool p_emitting) {
|
||||
if (emitting == p_emitting) {
|
||||
return;
|
||||
|
|
|
@ -201,7 +201,6 @@ protected:
|
|||
|
||||
public:
|
||||
AABB get_aabb() const override;
|
||||
Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
void set_emitting(bool p_emitting);
|
||||
void set_amount(int p_amount);
|
||||
|
|
|
@ -152,10 +152,6 @@ AABB Decal::get_aabb() const {
|
|||
return aabb;
|
||||
}
|
||||
|
||||
Vector<Face3> Decal::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
void Decal::_validate_property(PropertyInfo &property) const {
|
||||
if (!distance_fade_enabled && (property.name == "distance_fade_begin" || property.name == "distance_fade_length")) {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
|
|
|
@ -104,7 +104,6 @@ public:
|
|||
uint32_t get_cull_mask() const;
|
||||
|
||||
virtual AABB get_aabb() const override;
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
Decal();
|
||||
~Decal();
|
||||
|
|
|
@ -62,7 +62,6 @@ public:
|
|||
Ref<Material> get_material() const;
|
||||
|
||||
virtual AABB get_aabb() const override;
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override { return Vector<Face3>(); }
|
||||
TypedArray<String> get_configuration_warnings() const override;
|
||||
|
||||
FogVolume();
|
||||
|
|
|
@ -36,10 +36,6 @@ AABB GPUParticles3D::get_aabb() const {
|
|||
return AABB();
|
||||
}
|
||||
|
||||
Vector<Face3> GPUParticles3D::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
void GPUParticles3D::set_emitting(bool p_emitting) {
|
||||
RS::get_singleton()->particles_set_emitting(particles, p_emitting);
|
||||
|
||||
|
|
|
@ -98,7 +98,6 @@ protected:
|
|||
|
||||
public:
|
||||
AABB get_aabb() const override;
|
||||
Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
void set_emitting(bool p_emitting);
|
||||
void set_amount(int p_amount);
|
||||
|
|
|
@ -50,8 +50,6 @@ public:
|
|||
void set_cull_mask(uint32_t p_cull_mask);
|
||||
uint32_t get_cull_mask() const;
|
||||
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override { return Vector<Face3>(); }
|
||||
|
||||
~GPUParticlesCollision3D();
|
||||
};
|
||||
|
||||
|
@ -274,8 +272,6 @@ public:
|
|||
void set_directionality(real_t p_directionality);
|
||||
real_t get_directionality() const;
|
||||
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override { return Vector<Face3>(); }
|
||||
|
||||
~GPUParticlesAttractor3D();
|
||||
};
|
||||
|
||||
|
|
|
@ -156,10 +156,6 @@ AABB Light3D::get_aabb() const {
|
|||
return AABB();
|
||||
}
|
||||
|
||||
Vector<Face3> Light3D::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
void Light3D::set_bake_mode(BakeMode p_mode) {
|
||||
bake_mode = p_mode;
|
||||
RS::get_singleton()->light_set_bake_mode(light, RS::LightBakeMode(p_mode));
|
||||
|
|
|
@ -138,7 +138,6 @@ public:
|
|||
Ref<Texture2D> get_projector() const;
|
||||
|
||||
virtual AABB get_aabb() const override;
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
Light3D();
|
||||
~Light3D();
|
||||
|
|
|
@ -1263,10 +1263,6 @@ AABB LightmapGI::get_aabb() const {
|
|||
return AABB();
|
||||
}
|
||||
|
||||
Vector<Face3> LightmapGI::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
void LightmapGI::set_use_denoiser(bool p_enable) {
|
||||
use_denoiser = p_enable;
|
||||
}
|
||||
|
|
|
@ -267,7 +267,6 @@ public:
|
|||
GenerateProbes get_generate_probes() const;
|
||||
|
||||
AABB get_aabb() const override;
|
||||
Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
BakeError bake(Node *p_from_node, String p_image_data_path = "", Lightmapper::BakeStepFunc p_bake_step = nullptr, void *p_bake_userdata = nullptr);
|
||||
LightmapGI();
|
||||
|
|
|
@ -219,18 +219,6 @@ AABB MeshInstance3D::get_aabb() const {
|
|||
return AABB();
|
||||
}
|
||||
|
||||
Vector<Face3> MeshInstance3D::get_faces(uint32_t p_usage_flags) const {
|
||||
if (!(p_usage_flags & (FACES_SOLID | FACES_ENCLOSING))) {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
if (mesh.is_null()) {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
return mesh->get_faces();
|
||||
}
|
||||
|
||||
Node *MeshInstance3D::create_trimesh_collision_node() {
|
||||
if (mesh.is_null()) {
|
||||
return nullptr;
|
||||
|
|
|
@ -93,7 +93,6 @@ public:
|
|||
void create_debug_tangents();
|
||||
|
||||
virtual AABB get_aabb() const override;
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
MeshInstance3D();
|
||||
~MeshInstance3D();
|
||||
|
|
|
@ -49,10 +49,6 @@ Ref<MultiMesh> MultiMeshInstance3D::get_multimesh() const {
|
|||
return multimesh;
|
||||
}
|
||||
|
||||
Vector<Face3> MultiMeshInstance3D::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
AABB MultiMeshInstance3D::get_aabb() const {
|
||||
if (multimesh.is_null()) {
|
||||
return AABB();
|
||||
|
|
|
@ -44,8 +44,6 @@ protected:
|
|||
// bind helpers
|
||||
|
||||
public:
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
void set_multimesh(const Ref<MultiMesh> &p_multimesh);
|
||||
Ref<MultiMesh> get_multimesh() const;
|
||||
|
||||
|
|
|
@ -433,10 +433,6 @@ AABB OccluderInstance3D::get_aabb() const {
|
|||
return AABB();
|
||||
}
|
||||
|
||||
Vector<Face3> OccluderInstance3D::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
void OccluderInstance3D::set_occluder(const Ref<Occluder3D> &p_occluder) {
|
||||
if (occluder == p_occluder) {
|
||||
return;
|
||||
|
|
|
@ -194,7 +194,6 @@ public:
|
|||
Ref<Occluder3D> get_occluder() const;
|
||||
|
||||
virtual AABB get_aabb() const override;
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
void set_bake_mask(uint32_t p_mask);
|
||||
uint32_t get_bake_mask() const;
|
||||
|
|
|
@ -178,10 +178,6 @@ AABB ReflectionProbe::get_aabb() const {
|
|||
return aabb;
|
||||
}
|
||||
|
||||
Vector<Face3> ReflectionProbe::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
void ReflectionProbe::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "interior/ambient_color" || property.name == "interior/ambient_color_energy") {
|
||||
if (ambient_mode != AMBIENT_COLOR) {
|
||||
|
|
|
@ -113,7 +113,6 @@ public:
|
|||
UpdateMode get_update_mode() const;
|
||||
|
||||
virtual AABB get_aabb() const override;
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
ReflectionProbe();
|
||||
~ReflectionProbe();
|
||||
|
|
|
@ -177,10 +177,6 @@ AABB SpriteBase3D::get_aabb() const {
|
|||
return aabb;
|
||||
}
|
||||
|
||||
Vector<Face3> SpriteBase3D::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
Ref<TriangleMesh> SpriteBase3D::generate_triangle_mesh() const {
|
||||
if (triangle_mesh.is_valid()) {
|
||||
return triangle_mesh;
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
virtual Rect2 get_item_rect() const = 0;
|
||||
|
||||
virtual AABB get_aabb() const override;
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
Ref<TriangleMesh> generate_triangle_mesh() const;
|
||||
|
||||
SpriteBase3D();
|
||||
|
|
|
@ -89,10 +89,6 @@ void VisibleOnScreenNotifier3D::_bind_methods() {
|
|||
ADD_SIGNAL(MethodInfo("screen_exited"));
|
||||
}
|
||||
|
||||
Vector<Face3> VisibleOnScreenNotifier3D::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
VisibleOnScreenNotifier3D::VisibleOnScreenNotifier3D() {
|
||||
RID notifier = RS::get_singleton()->visibility_notifier_create();
|
||||
RS::get_singleton()->visibility_notifier_set_aabb(notifier, aabb);
|
||||
|
|
|
@ -57,8 +57,6 @@ public:
|
|||
virtual AABB get_aabb() const override;
|
||||
bool is_on_screen() const;
|
||||
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
VisibleOnScreenNotifier3D();
|
||||
~VisibleOnScreenNotifier3D();
|
||||
};
|
||||
|
|
|
@ -32,6 +32,14 @@
|
|||
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
AABB VisualInstance3D::get_aabb() const {
|
||||
AABB ret;
|
||||
if (GDVIRTUAL_CALL(_get_aabb, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return AABB();
|
||||
}
|
||||
|
||||
AABB VisualInstance3D::get_transformed_aabb() const {
|
||||
return get_global_transform().xform(get_aabb());
|
||||
}
|
||||
|
@ -115,6 +123,7 @@ void VisualInstance3D::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("get_transformed_aabb"), &VisualInstance3D::get_transformed_aabb);
|
||||
|
||||
GDVIRTUAL_BIND(_get_aabb);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "layers", PROPERTY_HINT_LAYERS_3D_RENDER), "set_layer_mask", "get_layer_mask");
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ protected:
|
|||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
||||
GDVIRTUAL0RC(AABB, _get_aabb)
|
||||
public:
|
||||
enum GetFacesFlags {
|
||||
FACES_SOLID = 1, // solid geometry
|
||||
|
@ -58,8 +59,7 @@ public:
|
|||
};
|
||||
|
||||
RID get_instance() const;
|
||||
virtual AABB get_aabb() const = 0;
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const = 0;
|
||||
virtual AABB get_aabb() const;
|
||||
|
||||
virtual AABB get_transformed_aabb() const; // helper
|
||||
|
||||
|
|
|
@ -450,10 +450,6 @@ AABB VoxelGI::get_aabb() const {
|
|||
return AABB(-extents, extents * 2);
|
||||
}
|
||||
|
||||
Vector<Face3> VoxelGI::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
TypedArray<String> VoxelGI::get_configuration_warnings() const {
|
||||
TypedArray<String> warnings = Node::get_configuration_warnings();
|
||||
|
||||
|
|
|
@ -149,7 +149,6 @@ public:
|
|||
void bake(Node *p_from_node = nullptr, bool p_create_visual_debug = false);
|
||||
|
||||
virtual AABB get_aabb() const override;
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
TypedArray<String> get_configuration_warnings() const override;
|
||||
|
||||
|
|
|
@ -166,10 +166,6 @@ AABB RootMotionView::get_aabb() const {
|
|||
return AABB(Vector3(-radius, 0, -radius), Vector3(radius * 2, 0.001, radius * 2));
|
||||
}
|
||||
|
||||
Vector<Face3> RootMotionView::get_faces(uint32_t p_usage_flags) const {
|
||||
return Vector<Face3>();
|
||||
}
|
||||
|
||||
void RootMotionView::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_animation_path", "path"), &RootMotionView::set_animation_path);
|
||||
ClassDB::bind_method(D_METHOD("get_animation_path"), &RootMotionView::get_animation_path);
|
||||
|
|
|
@ -71,7 +71,6 @@ public:
|
|||
bool get_zero_y() const;
|
||||
|
||||
virtual AABB get_aabb() const override;
|
||||
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override;
|
||||
|
||||
RootMotionView();
|
||||
~RootMotionView();
|
||||
|
|
|
@ -40,6 +40,9 @@ TypedArray<String> Range::get_configuration_warnings() const {
|
|||
return warnings;
|
||||
}
|
||||
|
||||
void Range::_value_changed(double p_value) {
|
||||
GDVIRTUAL_CALL(_value_changed, p_value);
|
||||
}
|
||||
void Range::_value_changed_notify() {
|
||||
_value_changed(shared->val);
|
||||
emit_signal(SNAME("value_changed"), shared->val);
|
||||
|
@ -279,6 +282,8 @@ void Range::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_greater"), "set_allow_greater", "is_greater_allowed");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_lesser"), "set_allow_lesser", "is_lesser_allowed");
|
||||
|
||||
GDVIRTUAL_BIND(_value_changed);
|
||||
|
||||
ADD_LINKED_PROPERTY("min_value", "value");
|
||||
ADD_LINKED_PROPERTY("min_value", "max_value");
|
||||
ADD_LINKED_PROPERTY("min_value", "page");
|
||||
|
|
|
@ -62,12 +62,14 @@ class Range : public Control {
|
|||
void _validate_values();
|
||||
|
||||
protected:
|
||||
virtual void _value_changed(double) {}
|
||||
virtual void _value_changed(double p_value);
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
bool _rounded_values = false;
|
||||
|
||||
GDVIRTUAL1(_value_changed, double)
|
||||
|
||||
public:
|
||||
void set_value(double p_val);
|
||||
void set_min(double p_min);
|
||||
|
|
|
@ -39,7 +39,7 @@ Size2 SpinBox::get_minimum_size() const {
|
|||
return ms;
|
||||
}
|
||||
|
||||
void SpinBox::_value_changed(double) {
|
||||
void SpinBox::_value_changed(double p_value) {
|
||||
String value = TS->format_number(String::num(get_value(), Math::range_step_decimals(get_step())));
|
||||
if (!prefix.is_empty()) {
|
||||
value = prefix + " " + value;
|
||||
|
@ -48,6 +48,7 @@ void SpinBox::_value_changed(double) {
|
|||
value += " " + suffix;
|
||||
}
|
||||
line_edit->set_text(value);
|
||||
Range::_value_changed(p_value);
|
||||
}
|
||||
|
||||
void SpinBox::_text_submitted(const String &p_string) {
|
||||
|
|
|
@ -47,7 +47,7 @@ class SpinBox : public Range {
|
|||
void _release_mouse();
|
||||
|
||||
void _text_submitted(const String &p_string);
|
||||
virtual void _value_changed(double) override;
|
||||
virtual void _value_changed(double p_value) override;
|
||||
void _text_changed(const String &p_string);
|
||||
|
||||
String prefix;
|
||||
|
|
|
@ -300,9 +300,9 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(Object);
|
||||
|
||||
GDREGISTER_CLASS(Node);
|
||||
GDREGISTER_VIRTUAL_CLASS(InstancePlaceholder);
|
||||
GDREGISTER_ABSTRACT_CLASS(InstancePlaceholder);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(Viewport);
|
||||
GDREGISTER_ABSTRACT_CLASS(Viewport);
|
||||
GDREGISTER_CLASS(SubViewport);
|
||||
GDREGISTER_CLASS(ViewportTexture);
|
||||
GDREGISTER_CLASS(HTTPRequest);
|
||||
|
@ -324,11 +324,11 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(Control);
|
||||
GDREGISTER_CLASS(Button);
|
||||
GDREGISTER_CLASS(Label);
|
||||
GDREGISTER_VIRTUAL_CLASS(ScrollBar);
|
||||
GDREGISTER_ABSTRACT_CLASS(ScrollBar);
|
||||
GDREGISTER_CLASS(HScrollBar);
|
||||
GDREGISTER_CLASS(VScrollBar);
|
||||
GDREGISTER_CLASS(ProgressBar);
|
||||
GDREGISTER_VIRTUAL_CLASS(Slider);
|
||||
GDREGISTER_ABSTRACT_CLASS(Slider);
|
||||
GDREGISTER_CLASS(HSlider);
|
||||
GDREGISTER_CLASS(VSlider);
|
||||
GDREGISTER_CLASS(Popup);
|
||||
|
@ -349,19 +349,19 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(AspectRatioContainer);
|
||||
GDREGISTER_CLASS(TabContainer);
|
||||
GDREGISTER_CLASS(TabBar);
|
||||
GDREGISTER_VIRTUAL_CLASS(Separator);
|
||||
GDREGISTER_ABSTRACT_CLASS(Separator);
|
||||
GDREGISTER_CLASS(HSeparator);
|
||||
GDREGISTER_CLASS(VSeparator);
|
||||
GDREGISTER_CLASS(TextureButton);
|
||||
GDREGISTER_CLASS(Container);
|
||||
GDREGISTER_VIRTUAL_CLASS(BoxContainer);
|
||||
GDREGISTER_ABSTRACT_CLASS(BoxContainer);
|
||||
GDREGISTER_CLASS(HBoxContainer);
|
||||
GDREGISTER_CLASS(VBoxContainer);
|
||||
GDREGISTER_CLASS(GridContainer);
|
||||
GDREGISTER_CLASS(CenterContainer);
|
||||
GDREGISTER_CLASS(ScrollContainer);
|
||||
GDREGISTER_CLASS(PanelContainer);
|
||||
GDREGISTER_VIRTUAL_CLASS(FlowContainer);
|
||||
GDREGISTER_ABSTRACT_CLASS(FlowContainer);
|
||||
GDREGISTER_CLASS(HFlowContainer);
|
||||
GDREGISTER_CLASS(VFlowContainer);
|
||||
|
||||
|
@ -384,7 +384,7 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(SyntaxHighlighter);
|
||||
GDREGISTER_CLASS(CodeHighlighter);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(TreeItem);
|
||||
GDREGISTER_ABSTRACT_CLASS(TreeItem);
|
||||
GDREGISTER_CLASS(OptionButton);
|
||||
GDREGISTER_CLASS(SpinBox);
|
||||
GDREGISTER_CLASS(ColorPicker);
|
||||
|
@ -398,7 +398,7 @@ void register_scene_types() {
|
|||
|
||||
GDREGISTER_CLASS(MarginContainer);
|
||||
GDREGISTER_CLASS(SubViewportContainer);
|
||||
GDREGISTER_VIRTUAL_CLASS(SplitContainer);
|
||||
GDREGISTER_ABSTRACT_CLASS(SplitContainer);
|
||||
GDREGISTER_CLASS(HSplitContainer);
|
||||
GDREGISTER_CLASS(VSplitContainer);
|
||||
|
||||
|
@ -418,7 +418,7 @@ void register_scene_types() {
|
|||
|
||||
GDREGISTER_CLASS(AnimationPlayer);
|
||||
GDREGISTER_CLASS(Tween);
|
||||
GDREGISTER_VIRTUAL_CLASS(Tweener);
|
||||
GDREGISTER_ABSTRACT_CLASS(Tweener);
|
||||
GDREGISTER_CLASS(PropertyTweener);
|
||||
GDREGISTER_CLASS(IntervalTweener);
|
||||
GDREGISTER_CLASS(CallbackTweener);
|
||||
|
@ -453,9 +453,9 @@ void register_scene_types() {
|
|||
|
||||
#ifndef _3D_DISABLED
|
||||
GDREGISTER_CLASS(Node3D);
|
||||
GDREGISTER_VIRTUAL_CLASS(Node3DGizmo);
|
||||
GDREGISTER_ABSTRACT_CLASS(Node3DGizmo);
|
||||
GDREGISTER_CLASS(Skin);
|
||||
GDREGISTER_VIRTUAL_CLASS(SkinReference);
|
||||
GDREGISTER_ABSTRACT_CLASS(SkinReference);
|
||||
GDREGISTER_CLASS(Skeleton3D);
|
||||
GDREGISTER_CLASS(ImporterMesh);
|
||||
GDREGISTER_CLASS(ImporterMeshInstance3D);
|
||||
|
@ -464,22 +464,22 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(Camera3D);
|
||||
GDREGISTER_CLASS(AudioListener3D);
|
||||
GDREGISTER_CLASS(XRCamera3D);
|
||||
GDREGISTER_VIRTUAL_CLASS(XRNode3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(XRNode3D);
|
||||
GDREGISTER_CLASS(XRController3D);
|
||||
GDREGISTER_CLASS(XRAnchor3D);
|
||||
GDREGISTER_CLASS(XROrigin3D);
|
||||
GDREGISTER_CLASS(MeshInstance3D);
|
||||
GDREGISTER_CLASS(OccluderInstance3D);
|
||||
GDREGISTER_VIRTUAL_CLASS(Occluder3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(Occluder3D);
|
||||
GDREGISTER_CLASS(ArrayOccluder3D);
|
||||
GDREGISTER_CLASS(QuadOccluder3D);
|
||||
GDREGISTER_CLASS(BoxOccluder3D);
|
||||
GDREGISTER_CLASS(SphereOccluder3D);
|
||||
GDREGISTER_CLASS(PolygonOccluder3D);
|
||||
GDREGISTER_VIRTUAL_CLASS(SpriteBase3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(SpriteBase3D);
|
||||
GDREGISTER_CLASS(Sprite3D);
|
||||
GDREGISTER_CLASS(AnimatedSprite3D);
|
||||
GDREGISTER_VIRTUAL_CLASS(Light3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(Light3D);
|
||||
GDREGISTER_CLASS(DirectionalLight3D);
|
||||
GDREGISTER_CLASS(OmniLight3D);
|
||||
GDREGISTER_CLASS(SpotLight3D);
|
||||
|
@ -490,14 +490,14 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(LightmapGI);
|
||||
GDREGISTER_CLASS(LightmapGIData);
|
||||
GDREGISTER_CLASS(LightmapProbe);
|
||||
GDREGISTER_VIRTUAL_CLASS(Lightmapper);
|
||||
GDREGISTER_ABSTRACT_CLASS(Lightmapper);
|
||||
GDREGISTER_CLASS(GPUParticles3D);
|
||||
GDREGISTER_VIRTUAL_CLASS(GPUParticlesCollision3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(GPUParticlesCollision3D);
|
||||
GDREGISTER_CLASS(GPUParticlesCollisionBox3D);
|
||||
GDREGISTER_CLASS(GPUParticlesCollisionSphere3D);
|
||||
GDREGISTER_CLASS(GPUParticlesCollisionSDF3D);
|
||||
GDREGISTER_CLASS(GPUParticlesCollisionHeightField3D);
|
||||
GDREGISTER_VIRTUAL_CLASS(GPUParticlesAttractor3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(GPUParticlesAttractor3D);
|
||||
GDREGISTER_CLASS(GPUParticlesAttractorBox3D);
|
||||
GDREGISTER_CLASS(GPUParticlesAttractorSphere3D);
|
||||
GDREGISTER_CLASS(GPUParticlesAttractorVectorField3D);
|
||||
|
@ -509,8 +509,8 @@ void register_scene_types() {
|
|||
|
||||
OS::get_singleton()->yield(); // may take time to init
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(CollisionObject3D);
|
||||
GDREGISTER_VIRTUAL_CLASS(PhysicsBody3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(CollisionObject3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(PhysicsBody3D);
|
||||
GDREGISTER_CLASS(StaticBody3D);
|
||||
GDREGISTER_CLASS(AnimatableBody3D);
|
||||
GDREGISTER_CLASS(RigidDynamicBody3D);
|
||||
|
@ -542,7 +542,7 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(FogMaterial);
|
||||
GDREGISTER_CLASS(RemoteTransform3D);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(Joint3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(Joint3D);
|
||||
GDREGISTER_CLASS(PinJoint3D);
|
||||
GDREGISTER_CLASS(HingeJoint3D);
|
||||
GDREGISTER_CLASS(SliderJoint3D);
|
||||
|
@ -560,14 +560,14 @@ void register_scene_types() {
|
|||
|
||||
GDREGISTER_CLASS(Shader);
|
||||
GDREGISTER_CLASS(VisualShader);
|
||||
GDREGISTER_VIRTUAL_CLASS(VisualShaderNode);
|
||||
GDREGISTER_ABSTRACT_CLASS(VisualShaderNode);
|
||||
GDREGISTER_CLASS(VisualShaderNodeCustom);
|
||||
GDREGISTER_CLASS(VisualShaderNodeInput);
|
||||
GDREGISTER_VIRTUAL_CLASS(VisualShaderNodeOutput);
|
||||
GDREGISTER_VIRTUAL_CLASS(VisualShaderNodeResizableBase);
|
||||
GDREGISTER_VIRTUAL_CLASS(VisualShaderNodeGroupBase);
|
||||
GDREGISTER_VIRTUAL_CLASS(VisualShaderNodeConstant);
|
||||
GDREGISTER_VIRTUAL_CLASS(VisualShaderNodeVectorBase);
|
||||
GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeOutput);
|
||||
GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeResizableBase);
|
||||
GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeGroupBase);
|
||||
GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeConstant);
|
||||
GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeVectorBase);
|
||||
GDREGISTER_CLASS(VisualShaderNodeComment);
|
||||
GDREGISTER_CLASS(VisualShaderNodeFloatConstant);
|
||||
GDREGISTER_CLASS(VisualShaderNodeIntConstant);
|
||||
|
@ -607,11 +607,11 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(VisualShaderNodeTexture);
|
||||
GDREGISTER_CLASS(VisualShaderNodeCurveTexture);
|
||||
GDREGISTER_CLASS(VisualShaderNodeCurveXYZTexture);
|
||||
GDREGISTER_VIRTUAL_CLASS(VisualShaderNodeSample3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeSample3D);
|
||||
GDREGISTER_CLASS(VisualShaderNodeTexture2DArray);
|
||||
GDREGISTER_CLASS(VisualShaderNodeTexture3D);
|
||||
GDREGISTER_CLASS(VisualShaderNodeCubemap);
|
||||
GDREGISTER_VIRTUAL_CLASS(VisualShaderNodeUniform);
|
||||
GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeUniform);
|
||||
GDREGISTER_CLASS(VisualShaderNodeUniformRef);
|
||||
GDREGISTER_CLASS(VisualShaderNodeFloatUniform);
|
||||
GDREGISTER_CLASS(VisualShaderNodeIntUniform);
|
||||
|
@ -634,7 +634,7 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(VisualShaderNodeCompare);
|
||||
GDREGISTER_CLASS(VisualShaderNodeMultiplyAdd);
|
||||
GDREGISTER_CLASS(VisualShaderNodeBillboard);
|
||||
GDREGISTER_VIRTUAL_CLASS(VisualShaderNodeVarying);
|
||||
GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeVarying);
|
||||
GDREGISTER_CLASS(VisualShaderNodeVaryingSetter);
|
||||
GDREGISTER_CLASS(VisualShaderNodeVaryingGetter);
|
||||
|
||||
|
@ -645,7 +645,7 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(VisualShaderNodeSDFRaymarch);
|
||||
|
||||
GDREGISTER_CLASS(VisualShaderNodeParticleOutput);
|
||||
GDREGISTER_VIRTUAL_CLASS(VisualShaderNodeParticleEmitter);
|
||||
GDREGISTER_ABSTRACT_CLASS(VisualShaderNodeParticleEmitter);
|
||||
GDREGISTER_CLASS(VisualShaderNodeParticleSphereEmitter);
|
||||
GDREGISTER_CLASS(VisualShaderNodeParticleBoxEmitter);
|
||||
GDREGISTER_CLASS(VisualShaderNodeParticleRingEmitter);
|
||||
|
@ -657,7 +657,7 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(VisualShaderNodeParticleEmit);
|
||||
|
||||
GDREGISTER_CLASS(ShaderMaterial);
|
||||
GDREGISTER_VIRTUAL_CLASS(CanvasItem);
|
||||
GDREGISTER_ABSTRACT_CLASS(CanvasItem);
|
||||
GDREGISTER_CLASS(CanvasTexture);
|
||||
GDREGISTER_CLASS(CanvasItemMaterial);
|
||||
SceneTree::add_idle_callback(CanvasItemMaterial::flush_changes);
|
||||
|
@ -676,8 +676,8 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(Line2D);
|
||||
GDREGISTER_CLASS(MeshInstance2D);
|
||||
GDREGISTER_CLASS(MultiMeshInstance2D);
|
||||
GDREGISTER_VIRTUAL_CLASS(CollisionObject2D);
|
||||
GDREGISTER_VIRTUAL_CLASS(PhysicsBody2D);
|
||||
GDREGISTER_ABSTRACT_CLASS(CollisionObject2D);
|
||||
GDREGISTER_ABSTRACT_CLASS(PhysicsBody2D);
|
||||
GDREGISTER_CLASS(StaticBody2D);
|
||||
GDREGISTER_CLASS(AnimatableBody2D);
|
||||
GDREGISTER_CLASS(RigidDynamicBody2D);
|
||||
|
@ -693,7 +693,7 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(Polygon2D);
|
||||
GDREGISTER_CLASS(Skeleton2D);
|
||||
GDREGISTER_CLASS(Bone2D);
|
||||
GDREGISTER_VIRTUAL_CLASS(Light2D);
|
||||
GDREGISTER_ABSTRACT_CLASS(Light2D);
|
||||
GDREGISTER_CLASS(PointLight2D);
|
||||
GDREGISTER_CLASS(DirectionalLight2D);
|
||||
GDREGISTER_CLASS(LightOccluder2D);
|
||||
|
@ -704,12 +704,12 @@ void register_scene_types() {
|
|||
|
||||
GDREGISTER_CLASS(Camera2D);
|
||||
GDREGISTER_CLASS(AudioListener2D);
|
||||
GDREGISTER_VIRTUAL_CLASS(Joint2D);
|
||||
GDREGISTER_ABSTRACT_CLASS(Joint2D);
|
||||
GDREGISTER_CLASS(PinJoint2D);
|
||||
GDREGISTER_CLASS(GrooveJoint2D);
|
||||
GDREGISTER_CLASS(DampedSpringJoint2D);
|
||||
GDREGISTER_CLASS(TileSet);
|
||||
GDREGISTER_VIRTUAL_CLASS(TileSetSource);
|
||||
GDREGISTER_ABSTRACT_CLASS(TileSetSource);
|
||||
GDREGISTER_CLASS(TileSetAtlasSource);
|
||||
GDREGISTER_CLASS(TileSetScenesCollectionSource);
|
||||
GDREGISTER_CLASS(TileMapPattern);
|
||||
|
@ -736,7 +736,7 @@ void register_scene_types() {
|
|||
|
||||
/* REGISTER RESOURCES */
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(Shader);
|
||||
GDREGISTER_ABSTRACT_CLASS(Shader);
|
||||
GDREGISTER_CLASS(ParticlesMaterial);
|
||||
SceneTree::add_idle_callback(ParticlesMaterial::flush_changes);
|
||||
ParticlesMaterial::init_shaders();
|
||||
|
@ -765,7 +765,7 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(RibbonTrailMesh);
|
||||
GDREGISTER_CLASS(PointMesh);
|
||||
GDREGISTER_VIRTUAL_CLASS(Material);
|
||||
GDREGISTER_VIRTUAL_CLASS(BaseMaterial3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(BaseMaterial3D);
|
||||
GDREGISTER_CLASS(StandardMaterial3D);
|
||||
GDREGISTER_CLASS(ORMMaterial3D);
|
||||
SceneTree::add_idle_callback(BaseMaterial3D::flush_changes);
|
||||
|
@ -775,7 +775,7 @@ void register_scene_types() {
|
|||
|
||||
OS::get_singleton()->yield(); // may take time to init
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(Shape3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(Shape3D);
|
||||
GDREGISTER_CLASS(SeparationRayShape3D);
|
||||
GDREGISTER_CLASS(SphereShape3D);
|
||||
GDREGISTER_CLASS(BoxShape3D);
|
||||
|
@ -820,14 +820,14 @@ void register_scene_types() {
|
|||
GDREGISTER_CLASS(AnimatedTexture);
|
||||
GDREGISTER_CLASS(CameraTexture);
|
||||
GDREGISTER_VIRTUAL_CLASS(TextureLayered);
|
||||
GDREGISTER_VIRTUAL_CLASS(ImageTextureLayered);
|
||||
GDREGISTER_ABSTRACT_CLASS(ImageTextureLayered);
|
||||
GDREGISTER_VIRTUAL_CLASS(Texture3D);
|
||||
GDREGISTER_CLASS(ImageTexture3D);
|
||||
GDREGISTER_CLASS(CompressedTexture3D);
|
||||
GDREGISTER_CLASS(Cubemap);
|
||||
GDREGISTER_CLASS(CubemapArray);
|
||||
GDREGISTER_CLASS(Texture2DArray);
|
||||
GDREGISTER_VIRTUAL_CLASS(CompressedTextureLayered);
|
||||
GDREGISTER_ABSTRACT_CLASS(CompressedTextureLayered);
|
||||
GDREGISTER_CLASS(CompressedCubemap);
|
||||
GDREGISTER_CLASS(CompressedCubemapArray);
|
||||
GDREGISTER_CLASS(CompressedTexture2DArray);
|
||||
|
@ -860,12 +860,12 @@ void register_scene_types() {
|
|||
#ifndef _3D_DISABLED
|
||||
GDREGISTER_CLASS(AudioStreamPlayer3D);
|
||||
#endif
|
||||
GDREGISTER_VIRTUAL_CLASS(VideoStream);
|
||||
GDREGISTER_ABSTRACT_CLASS(VideoStream);
|
||||
GDREGISTER_CLASS(AudioStreamSample);
|
||||
|
||||
OS::get_singleton()->yield(); // may take time to init
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(Shape2D);
|
||||
GDREGISTER_ABSTRACT_CLASS(Shape2D);
|
||||
GDREGISTER_CLASS(WorldBoundaryShape2D);
|
||||
GDREGISTER_CLASS(SegmentShape2D);
|
||||
GDREGISTER_CLASS(SeparationRayShape2D);
|
||||
|
@ -886,11 +886,11 @@ void register_scene_types() {
|
|||
|
||||
OS::get_singleton()->yield(); // may take time to init
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(SceneState);
|
||||
GDREGISTER_ABSTRACT_CLASS(SceneState);
|
||||
GDREGISTER_CLASS(PackedScene);
|
||||
|
||||
GDREGISTER_CLASS(SceneTree);
|
||||
GDREGISTER_VIRTUAL_CLASS(SceneTreeTimer); // sorry, you can't create it
|
||||
GDREGISTER_ABSTRACT_CLASS(SceneTreeTimer); // sorry, you can't create it
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
// Dropped in 4.0, near approximation.
|
||||
|
|
|
@ -88,6 +88,37 @@ void Material::inspect_native_shader_code() {
|
|||
}
|
||||
}
|
||||
|
||||
RID Material::get_shader_rid() const {
|
||||
RID ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_shader_rid, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return RID();
|
||||
}
|
||||
Shader::Mode Material::get_shader_mode() const {
|
||||
Shader::Mode ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_shader_mode, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return Shader::MODE_MAX;
|
||||
}
|
||||
|
||||
bool Material::_can_do_next_pass() const {
|
||||
bool ret;
|
||||
if (GDVIRTUAL_CALL(_can_do_next_pass, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool Material::_can_use_render_priority() const {
|
||||
bool ret;
|
||||
if (GDVIRTUAL_CALL(_can_use_render_priority, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Material::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_next_pass", "next_pass"), &Material::set_next_pass);
|
||||
ClassDB::bind_method(D_METHOD("get_next_pass"), &Material::get_next_pass);
|
||||
|
@ -103,6 +134,11 @@ void Material::_bind_methods() {
|
|||
|
||||
BIND_CONSTANT(RENDER_PRIORITY_MAX);
|
||||
BIND_CONSTANT(RENDER_PRIORITY_MIN);
|
||||
|
||||
GDVIRTUAL_BIND(_get_shader_rid)
|
||||
GDVIRTUAL_BIND(_get_shader_mode)
|
||||
GDVIRTUAL_BIND(_can_do_next_pass)
|
||||
GDVIRTUAL_BIND(_can_use_render_priority)
|
||||
}
|
||||
|
||||
Material::Material() {
|
||||
|
|
|
@ -51,11 +51,15 @@ class Material : public Resource {
|
|||
protected:
|
||||
_FORCE_INLINE_ RID _get_material() const { return material; }
|
||||
static void _bind_methods();
|
||||
virtual bool _can_do_next_pass() const { return false; }
|
||||
virtual bool _can_use_render_priority() const { return false; }
|
||||
virtual bool _can_do_next_pass() const;
|
||||
virtual bool _can_use_render_priority() const;
|
||||
|
||||
void _validate_property(PropertyInfo &property) const override;
|
||||
|
||||
GDVIRTUAL0RC(RID, _get_shader_rid)
|
||||
GDVIRTUAL0RC(Shader::Mode, _get_shader_mode)
|
||||
GDVIRTUAL0RC(bool, _can_do_next_pass)
|
||||
GDVIRTUAL0RC(bool, _can_use_render_priority)
|
||||
public:
|
||||
enum {
|
||||
RENDER_PRIORITY_MAX = RS::MATERIAL_RENDER_PRIORITY_MAX,
|
||||
|
@ -68,9 +72,8 @@ public:
|
|||
int get_render_priority() const;
|
||||
|
||||
virtual RID get_rid() const override;
|
||||
virtual RID get_shader_rid() const = 0;
|
||||
|
||||
virtual Shader::Mode get_shader_mode() const = 0;
|
||||
virtual RID get_shader_rid() const;
|
||||
virtual Shader::Mode get_shader_mode() const;
|
||||
Material();
|
||||
virtual ~Material();
|
||||
};
|
||||
|
|
|
@ -40,6 +40,122 @@
|
|||
|
||||
Mesh::ConvexDecompositionFunc Mesh::convex_decomposition_function = nullptr;
|
||||
|
||||
int Mesh::get_surface_count() const {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_surface_count, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Mesh::surface_get_array_len(int p_idx) const {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_surface_get_array_len, p_idx, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Mesh::surface_get_array_index_len(int p_idx) const {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_surface_get_array_index_len, p_idx, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Array Mesh::surface_get_arrays(int p_surface) const {
|
||||
Array ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_surface_get_arrays, p_surface, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return Array();
|
||||
}
|
||||
|
||||
Array Mesh::surface_get_blend_shape_arrays(int p_surface) const {
|
||||
Array ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_surface_get_blend_shape_arrays, p_surface, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return Array();
|
||||
}
|
||||
|
||||
Dictionary Mesh::surface_get_lods(int p_surface) const {
|
||||
Dictionary ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_surface_get_lods, p_surface, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return Dictionary();
|
||||
}
|
||||
|
||||
uint32_t Mesh::surface_get_format(int p_idx) const {
|
||||
uint32_t ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_surface_get_format, p_idx, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Mesh::PrimitiveType Mesh::surface_get_primitive_type(int p_idx) const {
|
||||
uint32_t ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_surface_get_primitive_type, p_idx, ret)) {
|
||||
return (Mesh::PrimitiveType)ret;
|
||||
}
|
||||
|
||||
return PRIMITIVE_MAX;
|
||||
}
|
||||
|
||||
void Mesh::surface_set_material(int p_idx, const Ref<Material> &p_material) {
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_surface_set_material, p_idx, p_material)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Material> Mesh::surface_get_material(int p_idx) const {
|
||||
Ref<Material> ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_surface_get_material, p_idx, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return Ref<Material>();
|
||||
}
|
||||
|
||||
int Mesh::get_blend_shape_count() const {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_blend_shape_count, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
StringName Mesh::get_blend_shape_name(int p_index) const {
|
||||
StringName ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_blend_shape_name, p_index, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return StringName();
|
||||
}
|
||||
|
||||
void Mesh::set_blend_shape_name(int p_index, const StringName &p_name) {
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_set_blend_shape_name, p_index, p_name)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AABB Mesh::get_aabb() const {
|
||||
AABB ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_aabb, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return AABB();
|
||||
}
|
||||
|
||||
Ref<TriangleMesh> Mesh::generate_triangle_mesh() const {
|
||||
if (triangle_mesh.is_valid()) {
|
||||
return triangle_mesh;
|
||||
|
@ -502,6 +618,21 @@ void Mesh::_bind_methods() {
|
|||
|
||||
BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_NORMALIZED);
|
||||
BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_RELATIVE);
|
||||
|
||||
GDVIRTUAL_BIND(_get_surface_count)
|
||||
GDVIRTUAL_BIND(_surface_get_array_len, "index")
|
||||
GDVIRTUAL_BIND(_surface_get_array_index_len, "index")
|
||||
GDVIRTUAL_BIND(_surface_get_arrays, "index")
|
||||
GDVIRTUAL_BIND(_surface_get_blend_shape_arrays, "index")
|
||||
GDVIRTUAL_BIND(_surface_get_lods, "index")
|
||||
GDVIRTUAL_BIND(_surface_get_format, "index")
|
||||
GDVIRTUAL_BIND(_surface_get_primitive_type, "index")
|
||||
GDVIRTUAL_BIND(_surface_set_material, "index", "material")
|
||||
GDVIRTUAL_BIND(_surface_get_material, "index")
|
||||
GDVIRTUAL_BIND(_get_blend_shape_count)
|
||||
GDVIRTUAL_BIND(_get_blend_shape_name, "index")
|
||||
GDVIRTUAL_BIND(_set_blend_shape_name, "index", "name")
|
||||
GDVIRTUAL_BIND(_get_aabb)
|
||||
}
|
||||
|
||||
void Mesh::clear_cache() const {
|
||||
|
|
|
@ -45,9 +45,34 @@ class Mesh : public Resource {
|
|||
mutable Vector<Vector3> debug_lines;
|
||||
Size2i lightmap_size_hint;
|
||||
|
||||
public:
|
||||
enum PrimitiveType {
|
||||
PRIMITIVE_POINTS = RenderingServer::PRIMITIVE_POINTS,
|
||||
PRIMITIVE_LINES = RenderingServer::PRIMITIVE_LINES,
|
||||
PRIMITIVE_LINE_STRIP = RenderingServer::PRIMITIVE_LINE_STRIP,
|
||||
PRIMITIVE_TRIANGLES = RenderingServer::PRIMITIVE_TRIANGLES,
|
||||
PRIMITIVE_TRIANGLE_STRIP = RenderingServer::PRIMITIVE_TRIANGLE_STRIP,
|
||||
PRIMITIVE_MAX = RenderingServer::PRIMITIVE_MAX,
|
||||
};
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
GDVIRTUAL0RC(int, _get_surface_count)
|
||||
GDVIRTUAL1RC(int, _surface_get_array_len, int)
|
||||
GDVIRTUAL1RC(int, _surface_get_array_index_len, int)
|
||||
GDVIRTUAL1RC(Array, _surface_get_arrays, int)
|
||||
GDVIRTUAL1RC(Array, _surface_get_blend_shape_arrays, int)
|
||||
GDVIRTUAL1RC(Dictionary, _surface_get_lods, int)
|
||||
GDVIRTUAL1RC(uint32_t, _surface_get_format, int)
|
||||
GDVIRTUAL1RC(uint32_t, _surface_get_primitive_type, int)
|
||||
GDVIRTUAL2(_surface_set_material, int, Ref<Material>)
|
||||
GDVIRTUAL1RC(Ref<Material>, _surface_get_material, int)
|
||||
GDVIRTUAL0RC(int, _get_blend_shape_count)
|
||||
GDVIRTUAL1RC(StringName, _get_blend_shape_name, int)
|
||||
GDVIRTUAL2(_set_blend_shape_name, int, StringName)
|
||||
GDVIRTUAL0RC(AABB, _get_aabb)
|
||||
|
||||
public:
|
||||
enum {
|
||||
NO_INDEX_ARRAY = RenderingServer::NO_INDEX_ARRAY,
|
||||
|
@ -120,28 +145,20 @@ public:
|
|||
|
||||
};
|
||||
|
||||
enum PrimitiveType {
|
||||
PRIMITIVE_POINTS = RenderingServer::PRIMITIVE_POINTS,
|
||||
PRIMITIVE_LINES = RenderingServer::PRIMITIVE_LINES,
|
||||
PRIMITIVE_LINE_STRIP = RenderingServer::PRIMITIVE_LINE_STRIP,
|
||||
PRIMITIVE_TRIANGLES = RenderingServer::PRIMITIVE_TRIANGLES,
|
||||
PRIMITIVE_TRIANGLE_STRIP = RenderingServer::PRIMITIVE_TRIANGLE_STRIP,
|
||||
PRIMITIVE_MAX = RenderingServer::PRIMITIVE_MAX,
|
||||
};
|
||||
|
||||
virtual int get_surface_count() const = 0;
|
||||
virtual int surface_get_array_len(int p_idx) const = 0;
|
||||
virtual int surface_get_array_index_len(int p_idx) const = 0;
|
||||
virtual Array surface_get_arrays(int p_surface) const = 0;
|
||||
virtual Array surface_get_blend_shape_arrays(int p_surface) const = 0;
|
||||
virtual Dictionary surface_get_lods(int p_surface) const = 0;
|
||||
virtual uint32_t surface_get_format(int p_idx) const = 0;
|
||||
virtual PrimitiveType surface_get_primitive_type(int p_idx) const = 0;
|
||||
virtual void surface_set_material(int p_idx, const Ref<Material> &p_material) = 0;
|
||||
virtual Ref<Material> surface_get_material(int p_idx) const = 0;
|
||||
virtual int get_blend_shape_count() const = 0;
|
||||
virtual StringName get_blend_shape_name(int p_index) const = 0;
|
||||
virtual void set_blend_shape_name(int p_index, const StringName &p_name) = 0;
|
||||
virtual int get_surface_count() const;
|
||||
virtual int surface_get_array_len(int p_idx) const;
|
||||
virtual int surface_get_array_index_len(int p_idx) const;
|
||||
virtual Array surface_get_arrays(int p_surface) const;
|
||||
virtual Array surface_get_blend_shape_arrays(int p_surface) const;
|
||||
virtual Dictionary surface_get_lods(int p_surface) const;
|
||||
virtual uint32_t surface_get_format(int p_idx) const;
|
||||
virtual PrimitiveType surface_get_primitive_type(int p_idx) const;
|
||||
virtual void surface_set_material(int p_idx, const Ref<Material> &p_material);
|
||||
virtual Ref<Material> surface_get_material(int p_idx) const;
|
||||
virtual int get_blend_shape_count() const;
|
||||
virtual StringName get_blend_shape_name(int p_index) const;
|
||||
virtual void set_blend_shape_name(int p_index, const StringName &p_name);
|
||||
virtual AABB get_aabb() const;
|
||||
|
||||
Vector<Face3> get_faces() const;
|
||||
Ref<TriangleMesh> generate_triangle_mesh() const;
|
||||
|
@ -153,8 +170,6 @@ public:
|
|||
|
||||
Ref<Mesh> create_outline(float p_margin) const;
|
||||
|
||||
virtual AABB get_aabb() const = 0;
|
||||
|
||||
void set_lightmap_size_hint(const Size2i &p_size);
|
||||
Size2i get_lightmap_size_hint() const;
|
||||
void clear_cache() const;
|
||||
|
|
|
@ -36,11 +36,17 @@
|
|||
*/
|
||||
void PrimitiveMesh::_update() const {
|
||||
Array arr;
|
||||
arr.resize(RS::ARRAY_MAX);
|
||||
_create_mesh_array(arr);
|
||||
if (GDVIRTUAL_CALL(_create_mesh_array, arr)) {
|
||||
ERR_FAIL_COND_MSG(arr.size() != RS::ARRAY_MAX, "_create_mesh_array must return an array of Mesh.ARRAY_MAX elements.");
|
||||
} else {
|
||||
arr.resize(RS::ARRAY_MAX);
|
||||
_create_mesh_array(arr);
|
||||
}
|
||||
|
||||
Vector<Vector3> points = arr[RS::ARRAY_VERTEX];
|
||||
|
||||
ERR_FAIL_COND_MSG(points.size() == 0, "_create_mesh_array must return at least a vertex array.");
|
||||
|
||||
aabb = AABB();
|
||||
|
||||
int pc = points.size();
|
||||
|
@ -210,6 +216,8 @@ void PrimitiveMesh::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "BaseMaterial3D,ShaderMaterial"), "set_material", "get_material");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::AABB, "custom_aabb", PROPERTY_HINT_NONE, ""), "set_custom_aabb", "get_custom_aabb");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flip_faces"), "set_flip_faces", "get_flip_faces");
|
||||
|
||||
GDVIRTUAL_BIND(_create_mesh_array);
|
||||
}
|
||||
|
||||
void PrimitiveMesh::set_material(const Ref<Material> &p_material) {
|
||||
|
|
|
@ -64,8 +64,9 @@ protected:
|
|||
|
||||
static void _bind_methods();
|
||||
|
||||
virtual void _create_mesh_array(Array &p_arr) const = 0;
|
||||
virtual void _create_mesh_array(Array &p_arr) const {}
|
||||
void _request_update();
|
||||
GDVIRTUAL0RC(Array, _create_mesh_array)
|
||||
|
||||
public:
|
||||
virtual int get_surface_count() const override;
|
||||
|
|
|
@ -34,10 +34,28 @@
|
|||
|
||||
#include <limits.h>
|
||||
|
||||
float StyleBox::get_style_margin(Side p_side) const {
|
||||
float ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_style_margin, p_side, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
bool StyleBox::test_mask(const Point2 &p_point, const Rect2 &p_rect) const {
|
||||
bool ret;
|
||||
if (GDVIRTUAL_CALL(_test_mask, p_point, p_rect, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void StyleBox::draw(RID p_canvas_item, const Rect2 &p_rect) const {
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_draw, p_canvas_item, p_rect)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void StyleBox::set_default_margin(Side p_side, float p_value) {
|
||||
ERR_FAIL_INDEX((int)p_side, 4);
|
||||
|
||||
|
@ -74,10 +92,19 @@ Point2 StyleBox::get_offset() const {
|
|||
}
|
||||
|
||||
Size2 StyleBox::get_center_size() const {
|
||||
Size2 ret;
|
||||
if (GDVIRTUAL_CALL(_get_center_size, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return Size2();
|
||||
}
|
||||
|
||||
Rect2 StyleBox::get_draw_rect(const Rect2 &p_rect) const {
|
||||
Rect2 ret;
|
||||
if (GDVIRTUAL_CALL(_get_draw_rect, p_rect, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return p_rect;
|
||||
}
|
||||
|
||||
|
@ -100,6 +127,12 @@ void StyleBox::_bind_methods() {
|
|||
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_right", PROPERTY_HINT_RANGE, "-1,2048,1"), "set_default_margin", "get_default_margin", SIDE_RIGHT);
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_top", PROPERTY_HINT_RANGE, "-1,2048,1"), "set_default_margin", "get_default_margin", SIDE_TOP);
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "content_margin_bottom", PROPERTY_HINT_RANGE, "-1,2048,1"), "set_default_margin", "get_default_margin", SIDE_BOTTOM);
|
||||
|
||||
GDVIRTUAL_BIND(_get_style_margin, "side")
|
||||
GDVIRTUAL_BIND(_test_mask, "point", "rect")
|
||||
GDVIRTUAL_BIND(_get_center_size)
|
||||
GDVIRTUAL_BIND(_get_draw_rect, "rect")
|
||||
GDVIRTUAL_BIND(_draw, "to_canvas_item", "rect")
|
||||
}
|
||||
|
||||
StyleBox::StyleBox() {
|
||||
|
|
|
@ -44,9 +44,15 @@ class StyleBox : public Resource {
|
|||
float margin[4];
|
||||
|
||||
protected:
|
||||
virtual float get_style_margin(Side p_side) const = 0;
|
||||
virtual float get_style_margin(Side p_side) const;
|
||||
static void _bind_methods();
|
||||
|
||||
GDVIRTUAL1RC(float, _get_style_margin, Side)
|
||||
GDVIRTUAL2RC(bool, _test_mask, Point2, Rect2)
|
||||
GDVIRTUAL0RC(Size2, _get_center_size)
|
||||
GDVIRTUAL1RC(Rect2, _get_draw_rect, Rect2)
|
||||
GDVIRTUAL2C(_draw, RID, Rect2)
|
||||
|
||||
public:
|
||||
virtual bool test_mask(const Point2 &p_point, const Rect2 &p_rect) const;
|
||||
|
||||
|
@ -56,7 +62,7 @@ public:
|
|||
virtual Size2 get_center_size() const;
|
||||
|
||||
virtual Rect2 get_draw_rect(const Rect2 &p_rect) const;
|
||||
virtual void draw(RID p_canvas_item, const Rect2 &p_rect) const = 0;
|
||||
virtual void draw(RID p_canvas_item, const Rect2 &p_rect) const;
|
||||
|
||||
CanvasItem *get_current_item_drawn() const;
|
||||
|
||||
|
|
|
@ -38,23 +38,61 @@
|
|||
#include "scene/resources/bit_map.h"
|
||||
#include "servers/camera/camera_feed.h"
|
||||
|
||||
int Texture2D::get_width() const {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_width, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Texture2D::get_height() const {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_height, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Size2 Texture2D::get_size() const {
|
||||
return Size2(get_width(), get_height());
|
||||
}
|
||||
|
||||
bool Texture2D::is_pixel_opaque(int p_x, int p_y) const {
|
||||
bool ret;
|
||||
if (GDVIRTUAL_CALL(_is_pixel_opaque, p_x, p_y, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool Texture2D::has_alpha() const {
|
||||
bool ret;
|
||||
if (GDVIRTUAL_CALL(_has_alpha, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Texture2D::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose) const {
|
||||
if (GDVIRTUAL_CALL(_draw, p_canvas_item, p_pos, p_modulate, p_transpose)) {
|
||||
return;
|
||||
}
|
||||
RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, get_size()), get_rid(), false, p_modulate, p_transpose);
|
||||
}
|
||||
|
||||
void Texture2D::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose) const {
|
||||
if (GDVIRTUAL_CALL(_draw_rect, p_canvas_item, p_rect, p_tile, p_modulate, p_transpose)) {
|
||||
return;
|
||||
}
|
||||
RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, get_rid(), p_tile, p_modulate, p_transpose);
|
||||
}
|
||||
|
||||
void Texture2D::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, bool p_clip_uv) const {
|
||||
if (GDVIRTUAL_CALL(_draw_rect_region, p_canvas_item, p_rect, p_src_rect, p_modulate, p_transpose, p_clip_uv)) {
|
||||
return;
|
||||
}
|
||||
RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, get_rid(), p_src_rect, p_modulate, p_transpose, p_clip_uv);
|
||||
}
|
||||
|
||||
|
@ -75,6 +113,15 @@ void Texture2D::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_image"), &Texture2D::get_image);
|
||||
|
||||
ADD_GROUP("", "");
|
||||
|
||||
GDVIRTUAL_BIND(_get_width);
|
||||
GDVIRTUAL_BIND(_get_height);
|
||||
GDVIRTUAL_BIND(_is_pixel_opaque, "x", "y");
|
||||
GDVIRTUAL_BIND(_has_alpha);
|
||||
|
||||
GDVIRTUAL_BIND(_draw, "to_canvas_item", "pos", "modulate", "transpose")
|
||||
GDVIRTUAL_BIND(_draw_rect, "to_canvas_item", "rect", "tile", "modulate", "transpose")
|
||||
GDVIRTUAL_BIND(_draw_rect_region, "tp_canvas_item", "rect", "src_rect", "modulate", "transpose", "clip_uv");
|
||||
}
|
||||
|
||||
Texture2D::Texture2D() {
|
||||
|
@ -740,7 +787,7 @@ String ResourceFormatLoaderCompressedTexture2D::get_resource_type(const String &
|
|||
|
||||
////////////////////////////////////
|
||||
|
||||
TypedArray<Image> Texture3D::_get_data() const {
|
||||
TypedArray<Image> Texture3D::_get_datai() const {
|
||||
Vector<Ref<Image>> data = get_data();
|
||||
|
||||
TypedArray<Image> ret;
|
||||
|
@ -751,13 +798,73 @@ TypedArray<Image> Texture3D::_get_data() const {
|
|||
return ret;
|
||||
}
|
||||
|
||||
Image::Format Texture3D::get_format() const {
|
||||
Image::Format ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_format, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return Image::FORMAT_MAX;
|
||||
}
|
||||
|
||||
int Texture3D::get_width() const {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_width, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Texture3D::get_height() const {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_height, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Texture3D::get_depth() const {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_depth, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Texture3D::has_mipmaps() const {
|
||||
bool ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_has_mipmaps, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Vector<Ref<Image>> Texture3D::get_data() const {
|
||||
TypedArray<Image> ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_data, ret)) {
|
||||
Vector<Ref<Image>> data;
|
||||
data.resize(ret.size());
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
data.write[i] = ret[i];
|
||||
}
|
||||
return data;
|
||||
}
|
||||
return Vector<Ref<Image>>();
|
||||
}
|
||||
void Texture3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_format"), &Texture3D::get_format);
|
||||
ClassDB::bind_method(D_METHOD("get_width"), &Texture3D::get_width);
|
||||
ClassDB::bind_method(D_METHOD("get_height"), &Texture3D::get_height);
|
||||
ClassDB::bind_method(D_METHOD("get_depth"), &Texture3D::get_depth);
|
||||
ClassDB::bind_method(D_METHOD("has_mipmaps"), &Texture3D::has_mipmaps);
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &Texture3D::_get_data);
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &Texture3D::_get_datai);
|
||||
|
||||
GDVIRTUAL_BIND(_get_format);
|
||||
GDVIRTUAL_BIND(_get_width);
|
||||
GDVIRTUAL_BIND(_get_height);
|
||||
GDVIRTUAL_BIND(_get_depth);
|
||||
GDVIRTUAL_BIND(_has_mipmaps);
|
||||
GDVIRTUAL_BIND(_get_data);
|
||||
}
|
||||
//////////////////////////////////////////
|
||||
|
||||
|
@ -2446,6 +2553,63 @@ AnimatedTexture::~AnimatedTexture() {
|
|||
|
||||
///////////////////////////////
|
||||
|
||||
Image::Format TextureLayered::get_format() const {
|
||||
Image::Format ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_format, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return Image::FORMAT_MAX;
|
||||
}
|
||||
|
||||
TextureLayered::LayeredType TextureLayered::get_layered_type() const {
|
||||
uint32_t ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_layered_type, ret)) {
|
||||
return (LayeredType)ret;
|
||||
}
|
||||
return LAYERED_TYPE_2D_ARRAY;
|
||||
}
|
||||
|
||||
int TextureLayered::get_width() const {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_width, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TextureLayered::get_height() const {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_height, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TextureLayered::get_layers() const {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_layers, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool TextureLayered::has_mipmaps() const {
|
||||
bool ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_has_mipmaps, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Ref<Image> TextureLayered::get_layer_data(int p_layer) const {
|
||||
Ref<Image> ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_layer_data, p_layer, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return Ref<Image>();
|
||||
}
|
||||
|
||||
void TextureLayered::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_format"), &TextureLayered::get_format);
|
||||
ClassDB::bind_method(D_METHOD("get_layered_type"), &TextureLayered::get_layered_type);
|
||||
|
@ -2458,6 +2622,14 @@ void TextureLayered::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(LAYERED_TYPE_2D_ARRAY);
|
||||
BIND_ENUM_CONSTANT(LAYERED_TYPE_CUBEMAP);
|
||||
BIND_ENUM_CONSTANT(LAYERED_TYPE_CUBEMAP_ARRAY);
|
||||
|
||||
GDVIRTUAL_BIND(_get_format);
|
||||
GDVIRTUAL_BIND(_get_layered_type);
|
||||
GDVIRTUAL_BIND(_get_width);
|
||||
GDVIRTUAL_BIND(_get_height);
|
||||
GDVIRTUAL_BIND(_get_layers);
|
||||
GDVIRTUAL_BIND(_has_mipmaps);
|
||||
GDVIRTUAL_BIND(_get_layer_data, "layer_index");
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
|
|
|
@ -57,14 +57,23 @@ class Texture2D : public Texture {
|
|||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
GDVIRTUAL0RC(int, _get_width)
|
||||
GDVIRTUAL0RC(int, _get_height)
|
||||
GDVIRTUAL2RC(bool, _is_pixel_opaque, int, int)
|
||||
GDVIRTUAL0RC(bool, _has_alpha)
|
||||
|
||||
GDVIRTUAL4C(_draw, RID, Point2, Color, bool)
|
||||
GDVIRTUAL5C(_draw_rect, RID, Rect2, bool, Color, bool)
|
||||
GDVIRTUAL6C(_draw_rect_region, RID, Rect2, Rect2, Color, bool, bool)
|
||||
|
||||
public:
|
||||
virtual int get_width() const = 0;
|
||||
virtual int get_height() const = 0;
|
||||
virtual int get_width() const;
|
||||
virtual int get_height() const;
|
||||
virtual Size2 get_size() const;
|
||||
|
||||
virtual bool is_pixel_opaque(int p_x, int p_y) const;
|
||||
|
||||
virtual bool has_alpha() const = 0;
|
||||
virtual bool has_alpha() const;
|
||||
|
||||
virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const;
|
||||
virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) const;
|
||||
|
@ -300,6 +309,13 @@ class TextureLayered : public Texture {
|
|||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
GDVIRTUAL0RC(Image::Format, _get_format)
|
||||
GDVIRTUAL0RC(uint32_t, _get_layered_type)
|
||||
GDVIRTUAL0RC(int, _get_width)
|
||||
GDVIRTUAL0RC(int, _get_height)
|
||||
GDVIRTUAL0RC(int, _get_layers)
|
||||
GDVIRTUAL0RC(bool, _has_mipmaps)
|
||||
GDVIRTUAL1RC(Ref<Image>, _get_layer_data, int)
|
||||
public:
|
||||
enum LayeredType {
|
||||
LAYERED_TYPE_2D_ARRAY,
|
||||
|
@ -307,13 +323,15 @@ public:
|
|||
LAYERED_TYPE_CUBEMAP_ARRAY
|
||||
};
|
||||
|
||||
virtual Image::Format get_format() const = 0;
|
||||
virtual LayeredType get_layered_type() const = 0;
|
||||
virtual int get_width() const = 0;
|
||||
virtual int get_height() const = 0;
|
||||
virtual int get_layers() const = 0;
|
||||
virtual bool has_mipmaps() const = 0;
|
||||
virtual Ref<Image> get_layer_data(int p_layer) const = 0;
|
||||
virtual Image::Format get_format() const;
|
||||
virtual LayeredType get_layered_type() const;
|
||||
virtual int get_width() const;
|
||||
virtual int get_height() const;
|
||||
virtual int get_layers() const;
|
||||
virtual bool has_mipmaps() const;
|
||||
virtual Ref<Image> get_layer_data(int p_layer) const;
|
||||
|
||||
TextureLayered() {}
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(TextureLayered::LayeredType)
|
||||
|
@ -474,15 +492,21 @@ class Texture3D : public Texture {
|
|||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
TypedArray<Image> _get_data() const;
|
||||
TypedArray<Image> _get_datai() const;
|
||||
|
||||
GDVIRTUAL0RC(Image::Format, _get_format)
|
||||
GDVIRTUAL0RC(int, _get_width)
|
||||
GDVIRTUAL0RC(int, _get_height)
|
||||
GDVIRTUAL0RC(int, _get_depth)
|
||||
GDVIRTUAL0RC(bool, _has_mipmaps)
|
||||
GDVIRTUAL0RC(TypedArray<Image>, _get_data)
|
||||
public:
|
||||
virtual Image::Format get_format() const = 0;
|
||||
virtual int get_width() const = 0;
|
||||
virtual int get_height() const = 0;
|
||||
virtual int get_depth() const = 0;
|
||||
virtual bool has_mipmaps() const = 0;
|
||||
virtual Vector<Ref<Image>> get_data() const = 0;
|
||||
virtual Image::Format get_format() const;
|
||||
virtual int get_width() const;
|
||||
virtual int get_height() const;
|
||||
virtual int get_depth() const;
|
||||
virtual bool has_mipmaps() const;
|
||||
virtual Vector<Ref<Image>> get_data() const;
|
||||
};
|
||||
|
||||
class ImageTexture3D : public Texture3D {
|
||||
|
|
|
@ -30,5 +30,36 @@
|
|||
|
||||
#include "audio_effect.h"
|
||||
|
||||
void AudioEffectInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_process, p_src_frames, p_dst_frames, p_frame_count)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
bool AudioEffectInstance::process_silence() const {
|
||||
bool ret;
|
||||
if (GDVIRTUAL_CALL(_process_silence, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void AudioEffectInstance::_bind_methods() {
|
||||
GDVIRTUAL_BIND(_process, "src_buffer", "dst_buffer", "frame_count");
|
||||
GDVIRTUAL_BIND(_process_silence);
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
Ref<AudioEffectInstance> AudioEffect::instantiate() {
|
||||
Ref<AudioEffectInstance> ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_instantiate, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return Ref<AudioEffectInstance>();
|
||||
}
|
||||
void AudioEffect::_bind_methods() {
|
||||
GDVIRTUAL_BIND(_instantiate);
|
||||
}
|
||||
|
||||
AudioEffect::AudioEffect() {
|
||||
}
|
||||
|
|
|
@ -33,20 +33,32 @@
|
|||
|
||||
#include "core/io/resource.h"
|
||||
#include "core/math/audio_frame.h"
|
||||
#include "core/object/gdvirtual.gen.inc"
|
||||
#include "core/object/script_language.h"
|
||||
#include "core/variant/native_ptr.h"
|
||||
|
||||
class AudioEffectInstance : public RefCounted {
|
||||
GDCLASS(AudioEffectInstance, RefCounted);
|
||||
|
||||
protected:
|
||||
GDVIRTUAL3(_process, GDNativeConstPtr<AudioFrame>, GDNativePtr<AudioFrame>, int)
|
||||
GDVIRTUAL0RC(bool, _process_silence)
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) = 0;
|
||||
virtual bool process_silence() const { return false; }
|
||||
virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count);
|
||||
virtual bool process_silence() const;
|
||||
};
|
||||
|
||||
class AudioEffect : public Resource {
|
||||
GDCLASS(AudioEffect, Resource);
|
||||
|
||||
protected:
|
||||
GDVIRTUAL0R(Ref<AudioEffectInstance>, _instantiate)
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual Ref<AudioEffectInstance> instantiate() = 0;
|
||||
virtual Ref<AudioEffectInstance> instantiate();
|
||||
AudioEffect();
|
||||
};
|
||||
|
||||
|
|
|
@ -76,10 +76,10 @@ void AudioStreamPlayback::seek(float p_time) {
|
|||
|
||||
int AudioStreamPlayback::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) {
|
||||
int ret;
|
||||
if (GDVIRTUAL_CALL(_mix, p_buffer, p_rate_scale, p_frames, ret)) {
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_mix, p_buffer, p_rate_scale, p_frames, ret)) {
|
||||
return ret;
|
||||
}
|
||||
WARN_PRINT_ONCE("AudioStreamPlayback::mix unimplemented!");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ void AudioStreamPlayback::_bind_methods() {
|
|||
}
|
||||
//////////////////////////////
|
||||
|
||||
void AudioStreamPlaybackResampled::_begin_resample() {
|
||||
void AudioStreamPlaybackResampled::begin_resample() {
|
||||
//clear cubic interpolation history
|
||||
internal_buffer[0] = AudioFrame(0.0, 0.0);
|
||||
internal_buffer[1] = AudioFrame(0.0, 0.0);
|
||||
|
@ -105,6 +105,30 @@ void AudioStreamPlaybackResampled::_begin_resample() {
|
|||
mix_offset = 0;
|
||||
}
|
||||
|
||||
int AudioStreamPlaybackResampled::_mix_internal(AudioFrame *p_buffer, int p_frames) {
|
||||
int ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_mix_resampled, p_buffer, p_frames, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
float AudioStreamPlaybackResampled::get_stream_sampling_rate() {
|
||||
float ret;
|
||||
if (GDVIRTUAL_REQUIRED_CALL(_get_stream_sampling_rate, ret)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AudioStreamPlaybackResampled::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("begin_resample"), &AudioStreamPlaybackResampled::begin_resample);
|
||||
|
||||
GDVIRTUAL_BIND(_mix_resampled, "dst_buffer", "frame_count");
|
||||
GDVIRTUAL_BIND(_get_stream_sampling_rate);
|
||||
}
|
||||
|
||||
int AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) {
|
||||
float target_rate = AudioServer::get_singleton()->get_mix_rate();
|
||||
float playback_speed_scale = AudioServer::get_singleton()->get_playback_speed_scale();
|
||||
|
@ -315,7 +339,7 @@ void AudioStreamPlaybackMicrophone::start(float p_from_pos) {
|
|||
|
||||
if (AudioDriver::get_singleton()->capture_start() == OK) {
|
||||
active = true;
|
||||
_begin_resample();
|
||||
begin_resample();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,10 +81,15 @@ class AudioStreamPlaybackResampled : public AudioStreamPlayback {
|
|||
uint64_t mix_offset;
|
||||
|
||||
protected:
|
||||
void _begin_resample();
|
||||
void begin_resample();
|
||||
// Returns the number of frames that were mixed.
|
||||
virtual int _mix_internal(AudioFrame *p_buffer, int p_frames) = 0;
|
||||
virtual float get_stream_sampling_rate() = 0;
|
||||
virtual int _mix_internal(AudioFrame *p_buffer, int p_frames);
|
||||
virtual float get_stream_sampling_rate();
|
||||
|
||||
GDVIRTUAL2R(int, _mix_resampled, GDNativePtr<AudioFrame>, int)
|
||||
GDVIRTUAL0RC(float, _get_stream_sampling_rate)
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual int mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) override;
|
||||
|
|
|
@ -169,7 +169,7 @@ float AudioStreamGeneratorPlayback::get_stream_sampling_rate() {
|
|||
|
||||
void AudioStreamGeneratorPlayback::start(float p_from_pos) {
|
||||
if (mixed == 0.0) {
|
||||
_begin_resample();
|
||||
begin_resample();
|
||||
}
|
||||
skips = 0;
|
||||
active = true;
|
||||
|
|
|
@ -110,7 +110,7 @@ void preregister_server_types() {
|
|||
shader_types = memnew(ShaderTypes);
|
||||
|
||||
GDREGISTER_CLASS(TextServerManager);
|
||||
GDREGISTER_VIRTUAL_CLASS(TextServer);
|
||||
GDREGISTER_ABSTRACT_CLASS(TextServer);
|
||||
GDREGISTER_CLASS(TextServerExtension);
|
||||
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("TextServerManager", TextServerManager::get_singleton(), "TextServerManager"));
|
||||
|
@ -119,20 +119,20 @@ void preregister_server_types() {
|
|||
void register_server_types() {
|
||||
OS::get_singleton()->set_has_server_feature_callback(has_server_feature_callback);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(DisplayServer);
|
||||
GDREGISTER_VIRTUAL_CLASS(RenderingServer);
|
||||
GDREGISTER_ABSTRACT_CLASS(DisplayServer);
|
||||
GDREGISTER_ABSTRACT_CLASS(RenderingServer);
|
||||
GDREGISTER_CLASS(AudioServer);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(PhysicsServer2D);
|
||||
GDREGISTER_VIRTUAL_CLASS(PhysicsServer3D);
|
||||
GDREGISTER_VIRTUAL_CLASS(NavigationServer2D);
|
||||
GDREGISTER_VIRTUAL_CLASS(NavigationServer3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(PhysicsServer2D);
|
||||
GDREGISTER_ABSTRACT_CLASS(PhysicsServer3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(NavigationServer2D);
|
||||
GDREGISTER_ABSTRACT_CLASS(NavigationServer3D);
|
||||
GDREGISTER_CLASS(XRServer);
|
||||
GDREGISTER_CLASS(CameraServer);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(RenderingDevice);
|
||||
GDREGISTER_ABSTRACT_CLASS(RenderingDevice);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(XRInterface);
|
||||
GDREGISTER_ABSTRACT_CLASS(XRInterface);
|
||||
GDREGISTER_CLASS(XRInterfaceExtension); // can't register this as virtual because we need a creation function for our extensions.
|
||||
GDREGISTER_CLASS(XRPose);
|
||||
GDREGISTER_CLASS(XRPositionalTracker);
|
||||
|
@ -149,7 +149,7 @@ void register_server_types() {
|
|||
GDREGISTER_CLASS(AudioBusLayout);
|
||||
|
||||
GDREGISTER_CLASS(AudioStreamGenerator);
|
||||
GDREGISTER_VIRTUAL_CLASS(AudioStreamGeneratorPlayback);
|
||||
GDREGISTER_ABSTRACT_CLASS(AudioStreamGeneratorPlayback);
|
||||
|
||||
{
|
||||
//audio effects
|
||||
|
@ -183,12 +183,12 @@ void register_server_types() {
|
|||
|
||||
GDREGISTER_CLASS(AudioEffectRecord);
|
||||
GDREGISTER_CLASS(AudioEffectSpectrumAnalyzer);
|
||||
GDREGISTER_VIRTUAL_CLASS(AudioEffectSpectrumAnalyzerInstance);
|
||||
GDREGISTER_ABSTRACT_CLASS(AudioEffectSpectrumAnalyzerInstance);
|
||||
|
||||
GDREGISTER_CLASS(AudioEffectCapture);
|
||||
}
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(RenderingDevice);
|
||||
GDREGISTER_ABSTRACT_CLASS(RenderingDevice);
|
||||
GDREGISTER_CLASS(RDTextureFormat);
|
||||
GDREGISTER_CLASS(RDTextureView);
|
||||
GDREGISTER_CLASS(RDAttachmentFormat);
|
||||
|
@ -208,16 +208,16 @@ void register_server_types() {
|
|||
|
||||
GDREGISTER_CLASS(CameraFeed);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(PhysicsDirectBodyState2D);
|
||||
GDREGISTER_VIRTUAL_CLASS(PhysicsDirectSpaceState2D);
|
||||
GDREGISTER_ABSTRACT_CLASS(PhysicsDirectBodyState2D);
|
||||
GDREGISTER_ABSTRACT_CLASS(PhysicsDirectSpaceState2D);
|
||||
GDREGISTER_CLASS(PhysicsRayQueryParameters2D);
|
||||
GDREGISTER_CLASS(PhysicsPointQueryParameters2D);
|
||||
GDREGISTER_CLASS(PhysicsShapeQueryParameters2D);
|
||||
GDREGISTER_CLASS(PhysicsTestMotionParameters2D);
|
||||
GDREGISTER_CLASS(PhysicsTestMotionResult2D);
|
||||
|
||||
GDREGISTER_VIRTUAL_CLASS(PhysicsDirectBodyState3D);
|
||||
GDREGISTER_VIRTUAL_CLASS(PhysicsDirectSpaceState3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(PhysicsDirectBodyState3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(PhysicsDirectSpaceState3D);
|
||||
GDREGISTER_CLASS(PhysicsRayQueryParameters3D);
|
||||
GDREGISTER_CLASS(PhysicsPointQueryParameters3D);
|
||||
GDREGISTER_CLASS(PhysicsShapeQueryParameters3D);
|
||||
|
|
Loading…
Reference in a new issue