Path: blob/master/modules/gltf/structures/gltf_object_model_property.h
21409 views
/**************************************************************************/1/* gltf_object_model_property.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "core/math/expression.h"33#include "core/variant/typed_array.h"34#include "gltf_accessor.h"3536// Object model: https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/ObjectModel.adoc37// KHR_animation_pointer: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_animation_pointer3839class GLTFObjectModelProperty : public RefCounted {40GDCLASS(GLTFObjectModelProperty, RefCounted);4142public:43enum GLTFObjectModelType {44GLTF_OBJECT_MODEL_TYPE_UNKNOWN,45GLTF_OBJECT_MODEL_TYPE_BOOL,46GLTF_OBJECT_MODEL_TYPE_FLOAT,47GLTF_OBJECT_MODEL_TYPE_FLOAT_ARRAY,48GLTF_OBJECT_MODEL_TYPE_FLOAT2,49GLTF_OBJECT_MODEL_TYPE_FLOAT3,50GLTF_OBJECT_MODEL_TYPE_FLOAT4,51GLTF_OBJECT_MODEL_TYPE_FLOAT2X2,52GLTF_OBJECT_MODEL_TYPE_FLOAT3X3,53GLTF_OBJECT_MODEL_TYPE_FLOAT4X4,54GLTF_OBJECT_MODEL_TYPE_INT,55};5657private:58Ref<Expression> gltf_to_godot_expr;59Ref<Expression> godot_to_gltf_expr;60TypedArray<NodePath> node_paths;61GLTFObjectModelType object_model_type = GLTF_OBJECT_MODEL_TYPE_UNKNOWN;62Vector<PackedStringArray> json_pointers;63Variant::Type variant_type = Variant::NIL;6465protected:66static void _bind_methods();6768public:69void append_node_path(const NodePath &p_node_path);70void append_path_to_property(const NodePath &p_node_path, const StringName &p_prop_name);7172GLTFAccessor::GLTFAccessorType get_accessor_type() const;73GLTFAccessor::GLTFComponentType get_component_type(const Vector<Variant> &p_values) const;7475Ref<Expression> get_gltf_to_godot_expression() const;76void set_gltf_to_godot_expression(const Ref<Expression> &p_gltf_to_godot_expr);7778Ref<Expression> get_godot_to_gltf_expression() const;79void set_godot_to_gltf_expression(const Ref<Expression> &p_godot_to_gltf_expr);8081TypedArray<NodePath> get_node_paths() const;82bool has_node_paths() const;83void set_node_paths(const TypedArray<NodePath> &p_node_paths);8485GLTFObjectModelType get_object_model_type() const;86void set_object_model_type(GLTFObjectModelType p_type);8788Vector<PackedStringArray> get_json_pointers() const;89bool has_json_pointers() const;90void set_json_pointers(const Vector<PackedStringArray> &p_json_pointers);9192TypedArray<PackedStringArray> get_json_pointers_bind() const;93void set_json_pointers_bind(const TypedArray<PackedStringArray> &p_json_pointers);9495Variant::Type get_variant_type() const;96void set_variant_type(Variant::Type p_variant_type);9798void set_types(Variant::Type p_variant_type, GLTFObjectModelType p_obj_model_type);99};100101VARIANT_ENUM_CAST(GLTFObjectModelProperty::GLTFObjectModelType);102103104