Path: blob/master/modules/gltf/structures/gltf_mesh.cpp
10278 views
/**************************************************************************/1/* gltf_mesh.cpp */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#include "gltf_mesh.h"3132#include "scene/resources/3d/importer_mesh.h"3334void GLTFMesh::_bind_methods() {35ClassDB::bind_method(D_METHOD("get_original_name"), &GLTFMesh::get_original_name);36ClassDB::bind_method(D_METHOD("set_original_name", "original_name"), &GLTFMesh::set_original_name);37ClassDB::bind_method(D_METHOD("get_mesh"), &GLTFMesh::get_mesh);38ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &GLTFMesh::set_mesh);39ClassDB::bind_method(D_METHOD("get_blend_weights"), &GLTFMesh::get_blend_weights);40ClassDB::bind_method(D_METHOD("set_blend_weights", "blend_weights"), &GLTFMesh::set_blend_weights);41ClassDB::bind_method(D_METHOD("get_instance_materials"), &GLTFMesh::get_instance_materials);42ClassDB::bind_method(D_METHOD("set_instance_materials", "instance_materials"), &GLTFMesh::set_instance_materials);43ClassDB::bind_method(D_METHOD("get_additional_data", "extension_name"), &GLTFMesh::get_additional_data);44ClassDB::bind_method(D_METHOD("set_additional_data", "extension_name", "additional_data"), &GLTFMesh::set_additional_data);4546ADD_PROPERTY(PropertyInfo(Variant::STRING, "original_name"), "set_original_name", "get_original_name");47ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh"), "set_mesh", "get_mesh");48ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "blend_weights"), "set_blend_weights", "get_blend_weights"); // Vector<float>49ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "instance_materials"), "set_instance_materials", "get_instance_materials");50}5152String GLTFMesh::get_original_name() {53return original_name;54}5556void GLTFMesh::set_original_name(String p_name) {57original_name = p_name;58}5960Ref<ImporterMesh> GLTFMesh::get_mesh() {61return mesh;62}6364void GLTFMesh::set_mesh(Ref<ImporterMesh> p_mesh) {65mesh = p_mesh;66}6768TypedArray<Material> GLTFMesh::get_instance_materials() {69return instance_materials;70}7172void GLTFMesh::set_instance_materials(TypedArray<Material> p_instance_materials) {73instance_materials = p_instance_materials;74}7576Vector<float> GLTFMesh::get_blend_weights() {77return blend_weights;78}7980void GLTFMesh::set_blend_weights(Vector<float> p_blend_weights) {81blend_weights = p_blend_weights;82}8384Variant GLTFMesh::get_additional_data(const StringName &p_extension_name) {85return additional_data[p_extension_name];86}8788void GLTFMesh::set_additional_data(const StringName &p_extension_name, Variant p_additional_data) {89additional_data[p_extension_name] = p_additional_data;90}919293