From 35b404ba085819e5cd5f432b7c00ef3167523bb7 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 12 Jan 2017 08:34:00 -0300 Subject: [PATCH] Unify naming of blendshape / morphtarget into just "Blend Shape" --- drivers/gles3/rasterizer_scene_gles3.cpp | 4 +- drivers/gles3/rasterizer_storage_gles3.cpp | 42 ++++---- drivers/gles3/rasterizer_storage_gles3.h | 20 ++-- scene/3d/mesh_instance.cpp | 16 +-- scene/3d/mesh_instance.h | 6 +- scene/resources/mesh.cpp | 100 +++++++++--------- scene/resources/mesh.h | 26 ++--- servers/visual/rasterizer.h | 10 +- servers/visual/visual_server_raster.h | 10 +- servers/visual/visual_server_scene.cpp | 18 ++-- servers/visual/visual_server_scene.h | 2 +- servers/visual_server.h | 16 +-- .../io_plugins/editor_import_collada.cpp | 6 +- 13 files changed, 138 insertions(+), 138 deletions(-) diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 5611b4b63a6..5e0f439e3e3 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1251,9 +1251,9 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e) { RasterizerStorageGLES3::Surface *s = static_cast(e->geometry); - if (s->morph_targets.size() && e->instance->morph_values.size()) { + if (s->blend_shapes.size() && e->instance->blend_values.size()) { //blend shapes, use transform feedback - storage->mesh_render_blend_shapes(s,e->instance->morph_values.ptr()); + storage->mesh_render_blend_shapes(s,e->instance->blend_values.ptr()); //rebind shader state.scene_shader.bind(); } else { diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index a4fea29b47e..f0967199882 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2480,7 +2480,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P } - bool has_morph = p_blend_shapes.size(); + //bool has_morph = p_blend_shapes.size(); Surface::Attrib attribs[VS::ARRAY_MAX]; @@ -2702,7 +2702,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P ERR_FAIL_COND(p_index_array.size()!=index_array_size); - ERR_FAIL_COND(p_blend_shapes.size()!=mesh->morph_target_count); + ERR_FAIL_COND(p_blend_shapes.size()!=mesh->blend_shape_count); for(int i=0;i::Read vr = p_blend_shapes[i].read(); @@ -2837,7 +2837,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P glBindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER,0); //unbind - surface->morph_targets.push_back(mt); + surface->blend_shapes.push_back(mt); } } @@ -2846,7 +2846,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P mesh->instance_change_notify(); } -void RasterizerStorageGLES3::mesh_set_morph_target_count(RID p_mesh,int p_amount){ +void RasterizerStorageGLES3::mesh_set_blend_shape_count(RID p_mesh,int p_amount){ Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); @@ -2855,32 +2855,32 @@ void RasterizerStorageGLES3::mesh_set_morph_target_count(RID p_mesh,int p_amount ERR_FAIL_COND(mesh->surfaces.size()!=0); ERR_FAIL_COND(p_amount<0); - mesh->morph_target_count=p_amount; + mesh->blend_shape_count=p_amount; } -int RasterizerStorageGLES3::mesh_get_morph_target_count(RID p_mesh) const{ +int RasterizerStorageGLES3::mesh_get_blend_shape_count(RID p_mesh) const{ const Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND_V(!mesh,0); - return mesh->morph_target_count; + return mesh->blend_shape_count; } -void RasterizerStorageGLES3::mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode){ +void RasterizerStorageGLES3::mesh_set_blend_shape_mode(RID p_mesh,VS::BlendShapeMode p_mode){ Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); - mesh->morph_target_mode=p_mode; + mesh->blend_shape_mode=p_mode; } -VS::MorphTargetMode RasterizerStorageGLES3::mesh_get_morph_target_mode(RID p_mesh) const{ +VS::BlendShapeMode RasterizerStorageGLES3::mesh_get_blend_shape_mode(RID p_mesh) const{ const Mesh *mesh = mesh_owner.getornull(p_mesh); - ERR_FAIL_COND_V(!mesh,VS::MORPH_MODE_NORMALIZED); + ERR_FAIL_COND_V(!mesh,VS::BLEND_SHAPE_MODE_NORMALIZED); - return mesh->morph_target_mode; + return mesh->blend_shape_mode; } void RasterizerStorageGLES3::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material){ @@ -3027,9 +3027,9 @@ Vector > RasterizerStorageGLES3::mesh_surface_get_blend_shap Vector > bsarr; - for(int i=0;isurfaces[p_surface]->morph_targets.size();i++) { + for(int i=0;isurfaces[p_surface]->blend_shapes.size();i++) { - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,mesh->surfaces[p_surface]->morph_targets[i].vertex_id); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,mesh->surfaces[p_surface]->blend_shapes[i].vertex_id); void * data = glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER,0,mesh->surfaces[p_surface]->array_byte_size,GL_MAP_READ_BIT); ERR_FAIL_COND_V(!data,Vector >()); @@ -3081,10 +3081,10 @@ void RasterizerStorageGLES3::mesh_remove_surface(RID p_mesh, int p_surface){ glDeleteVertexArrays(1,&surface->array_id); - for(int i=0;imorph_targets.size();i++) { + for(int i=0;iblend_shapes.size();i++) { - glDeleteBuffers(1,&surface->morph_targets[i].vertex_id); - glDeleteVertexArrays(1,&surface->morph_targets[i].array_id); + glDeleteBuffers(1,&surface->blend_shapes[i].vertex_id); + glDeleteVertexArrays(1,&surface->blend_shapes[i].array_id); } mesh->instance_material_change_notify(); @@ -3290,9 +3290,9 @@ void RasterizerStorageGLES3::mesh_render_blend_shapes(Surface *s, float *p_weigh //copy all first float base_weight=1.0; - int mtc = s->morph_targets.size(); + int mtc = s->blend_shapes.size(); - if (s->mesh->morph_target_mode==VS::MORPH_MODE_NORMALIZED) { + if (s->mesh->blend_shape_mode==VS::BLEND_SHAPE_MODE_NORMALIZED) { for(int i=0;imorph_targets[ti].array_id); + glBindVertexArray(s->blend_shapes[ti].array_id); glBindBuffer(GL_ARRAY_BUFFER, resources.transform_feedback_buffers[0]); glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, resources.transform_feedback_buffers[1]); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 66593b202fb..f9e440288fa 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -531,12 +531,12 @@ public: //bool packed; - struct MorphTarget { + struct BlendShape { GLuint vertex_id; GLuint array_id; }; - Vector morph_targets; + Vector blend_shapes; Rect3 aabb; @@ -583,13 +583,13 @@ public: bool active; Vector surfaces; - int morph_target_count; - VS::MorphTargetMode morph_target_mode; + int blend_shape_count; + VS::BlendShapeMode blend_shape_mode; Rect3 custom_aabb; mutable uint64_t last_pass; Mesh() { - morph_target_mode=VS::MORPH_MODE_NORMALIZED; - morph_target_count=0; + blend_shape_mode=VS::BLEND_SHAPE_MODE_NORMALIZED; + blend_shape_count=0; last_pass=0; active=false; } @@ -601,12 +601,12 @@ public: virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const PoolVector& p_array,int p_vertex_count,const PoolVector& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector >& p_blend_shapes=Vector >(),const Vector& p_bone_aabbs=Vector()); - virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount); - virtual int mesh_get_morph_target_count(RID p_mesh) const; + virtual void mesh_set_blend_shape_count(RID p_mesh,int p_amount); + virtual int mesh_get_blend_shape_count(RID p_mesh) const; - virtual void mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode); - virtual VS::MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const; + virtual void mesh_set_blend_shape_mode(RID p_mesh,VS::BlendShapeMode p_mode); + virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const; virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material); virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const; diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index c4712ecc7a3..66bad45c455 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -42,10 +42,10 @@ bool MeshInstance::_set(const StringName& p_name, const Variant& p_value) { return false; - Map::Element *E = morph_tracks.find(p_name); + Map::Element *E = blend_shape_tracks.find(p_name); if (E) { E->get().value=p_value; - VisualServer::get_singleton()->instance_set_morph_target_weight(get_instance(),E->get().idx,E->get().value); + VisualServer::get_singleton()->instance_set_blend_shape_weight(get_instance(),E->get().idx,E->get().value); return true; } @@ -67,7 +67,7 @@ bool MeshInstance::_get(const StringName& p_name,Variant &r_ret) const { if (!get_instance().is_valid()) return false; - const Map::Element *E = morph_tracks.find(p_name); + const Map::Element *E = blend_shape_tracks.find(p_name); if (E) { r_ret = E->get().value; return true; @@ -86,7 +86,7 @@ bool MeshInstance::_get(const StringName& p_name,Variant &r_ret) const { void MeshInstance::_get_property_list( List *p_list) const { List ls; - for(const Map::Element *E=morph_tracks.front();E;E=E->next()) { + for(const Map::Element *E=blend_shape_tracks.front();E;E=E->next()) { ls.push_back(E->key()); } @@ -119,16 +119,16 @@ void MeshInstance::set_mesh(const Ref& p_mesh) { mesh=p_mesh; - morph_tracks.clear(); + blend_shape_tracks.clear(); if (mesh.is_valid()) { - for(int i=0;iget_morph_target_count();i++) { + for(int i=0;iget_blend_shape_count();i++) { - MorphTrack mt; + BlendShapeTrack mt; mt.idx=i; mt.value=0; - morph_tracks["morph/"+String(mesh->get_morph_target_name(i))]=mt; + blend_shape_tracks["blend_shapes/"+String(mesh->get_blend_shape_name(i))]=mt; } mesh->connect(CoreStringNames::get_singleton()->changed,this,SceneStringNames::get_singleton()->_mesh_changed); diff --git a/scene/3d/mesh_instance.h b/scene/3d/mesh_instance.h index 4d28cc29421..2d1af469801 100644 --- a/scene/3d/mesh_instance.h +++ b/scene/3d/mesh_instance.h @@ -42,14 +42,14 @@ class MeshInstance : public GeometryInstance { Ref mesh; NodePath skeleton_path; - struct MorphTrack { + struct BlendShapeTrack { int idx; float value; - MorphTrack() { idx=0; value=0; } + BlendShapeTrack() { idx=0; value=0; } }; - Map morph_tracks; + Map blend_shape_tracks; Vector > materials; void _mesh_changed(); diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 74f4e8f5f79..99911eddebf 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -77,19 +77,19 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { String sname=p_name; - if (p_name=="morph_target/names") { + if (p_name=="blend_shape/names") { PoolVector sk=p_value; int sz = sk.size(); PoolVector::Read r = sk.read(); for(int i=0;i > morphs; + Vector< PoolVector > blend_shapes; - if (d.has("morph_data")) { - Array morph_data=d["morph_data"]; - for(int i=0;i morph = morph_data[i]; - morphs.push_back(morph_data[i]); + if (d.has("blend_shape_data")) { + Array blend_shape_data=d["blend_shape_data"]; + for(int i=0;i shape = blend_shape_data[i]; + blend_shapes.push_back(shape); } } @@ -174,7 +174,7 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { } } - add_surface(format,PrimitiveType(primitive),array_data,vertex_count,array_index_data,index_count,aabb,morphs,bone_aabb); + add_surface(format,PrimitiveType(primitive),array_data,vertex_count,array_index_data,index_count,aabb,blend_shapes,bone_aabb); } else { ERR_FAIL_V(false); } @@ -199,16 +199,16 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { String sname=p_name; - if (p_name=="morph_target/names") { + if (p_name=="blend_shape/names") { PoolVector sk; - for(int i=0;i > morph_data = VS::get_singleton()->mesh_surface_get_blend_shapes(mesh,idx); + Vector< PoolVector > blend_shape_data = VS::get_singleton()->mesh_surface_get_blend_shapes(mesh,idx); Array md; - for(int i=0;i m = surface_get_material(idx); if (m.is_valid()) @@ -274,9 +274,9 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { void Mesh::_get_property_list( List *p_list) const { - if (morph_targets.size()) { - p_list->push_back(PropertyInfo(Variant::POOL_STRING_ARRAY,"morph_target/names",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::INT,"morph_target/mode",PROPERTY_HINT_ENUM,"Normalized,Relative")); + if (blend_shapes.size()) { + p_list->push_back(PropertyInfo(Variant::POOL_STRING_ARRAY,"blend_shape/names",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::INT,"blend_shape/mode",PROPERTY_HINT_ENUM,"Normalized,Relative")); } for (int i=0;imesh_surface_get_arrays(mesh,p_surface); } -Array Mesh::surface_get_morph_arrays(int p_surface) const { +Array Mesh::surface_get_blend_shape_arrays(int p_surface) const { ERR_FAIL_INDEX_V(p_surface,surfaces.size(),Array()); return Array(); @@ -379,7 +379,7 @@ int Mesh::get_surface_count() const { return surfaces.size(); } -void Mesh::add_morph_target(const StringName& p_name) { +void Mesh::add_blend_shape(const StringName& p_name) { if (surfaces.size()) { ERR_EXPLAIN("Can't add a shape key count if surfaces are already created."); @@ -388,49 +388,49 @@ void Mesh::add_morph_target(const StringName& p_name) { StringName name=p_name; - if (morph_targets.find(name)!=-1 ) { + if (blend_shapes.find(name)!=-1 ) { int count=2; do { name = String(p_name) + " " + itos(count); count++; - } while(morph_targets.find(name)!=-1); + } while(blend_shapes.find(name)!=-1); } - morph_targets.push_back(name); - VS::get_singleton()->mesh_set_morph_target_count(mesh,morph_targets.size()); + blend_shapes.push_back(name); + VS::get_singleton()->mesh_set_blend_shape_count(mesh,blend_shapes.size()); } -int Mesh::get_morph_target_count() const { +int Mesh::get_blend_shape_count() const { - return morph_targets.size(); + return blend_shapes.size(); } -StringName Mesh::get_morph_target_name(int p_index) const { - ERR_FAIL_INDEX_V( p_index, morph_targets.size(),StringName() ); - return morph_targets[p_index]; +StringName Mesh::get_blend_shape_name(int p_index) const { + ERR_FAIL_INDEX_V( p_index, blend_shapes.size(),StringName() ); + return blend_shapes[p_index]; } -void Mesh::clear_morph_targets() { +void Mesh::clear_blend_shapes() { if (surfaces.size()) { ERR_EXPLAIN("Can't set shape key count if surfaces are already created."); ERR_FAIL_COND(surfaces.size()); } - morph_targets.clear(); + blend_shapes.clear(); } -void Mesh::set_morph_target_mode(MorphTargetMode p_mode) { +void Mesh::set_blend_shape_mode(BlendShapeMode p_mode) { - morph_target_mode=p_mode; - VS::get_singleton()->mesh_set_morph_target_mode(mesh,(VS::MorphTargetMode)p_mode); + blend_shape_mode=p_mode; + VS::get_singleton()->mesh_set_blend_shape_mode(mesh,(VS::BlendShapeMode)p_mode); } -Mesh::MorphTargetMode Mesh::get_morph_target_mode() const { +Mesh::BlendShapeMode Mesh::get_blend_shape_mode() const { - return morph_target_mode; + return blend_shape_mode; } @@ -1019,12 +1019,12 @@ Ref Mesh::create_outline(float p_margin) const { void Mesh::_bind_methods() { - ClassDB::bind_method(_MD("add_morph_target","name"),&Mesh::add_morph_target); - ClassDB::bind_method(_MD("get_morph_target_count"),&Mesh::get_morph_target_count); - ClassDB::bind_method(_MD("get_morph_target_name","index"),&Mesh::get_morph_target_name); - ClassDB::bind_method(_MD("clear_morph_targets"),&Mesh::clear_morph_targets); - ClassDB::bind_method(_MD("set_morph_target_mode","mode"),&Mesh::set_morph_target_mode); - ClassDB::bind_method(_MD("get_morph_target_mode"),&Mesh::get_morph_target_mode); + ClassDB::bind_method(_MD("add_blend_shape","name"),&Mesh::add_blend_shape); + ClassDB::bind_method(_MD("get_blend_shape_count"),&Mesh::get_blend_shape_count); + ClassDB::bind_method(_MD("get_blend_shape_name","index"),&Mesh::get_blend_shape_name); + ClassDB::bind_method(_MD("clear_blend_shapes"),&Mesh::clear_blend_shapes); + ClassDB::bind_method(_MD("set_blend_shape_mode","mode"),&Mesh::set_blend_shape_mode); + ClassDB::bind_method(_MD("get_blend_shape_mode"),&Mesh::get_blend_shape_mode); ClassDB::bind_method(_MD("add_surface_from_arrays","primitive","arrays","blend_shapes","compress_flags"),&Mesh::add_surface_from_arrays,DEFVAL(Array()),DEFVAL(ARRAY_COMPRESS_DEFAULT)); ClassDB::bind_method(_MD("get_surface_count"),&Mesh::get_surface_count); @@ -1084,7 +1084,7 @@ void Mesh::_bind_methods() { Mesh::Mesh() { mesh=VisualServer::get_singleton()->mesh_create(); - morph_target_mode=MORPH_MODE_RELATIVE; + blend_shape_mode=BLEND_SHAPE_MODE_RELATIVE; } diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index 8e0b4d4e25c..1af33ad8369 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -105,10 +105,10 @@ public: PRIMITIVE_TRIANGLE_FAN=VisualServer::PRIMITIVE_TRIANGLE_FAN, }; - enum MorphTargetMode { + enum BlendShapeMode { - MORPH_MODE_NORMALIZED=VS::MORPH_MODE_NORMALIZED, - MORPH_MODE_RELATIVE=VS::MORPH_MODE_RELATIVE, + BLEND_SHAPE_MODE_NORMALIZED=VS::BLEND_SHAPE_MODE_NORMALIZED, + BLEND_SHAPE_MODE_RELATIVE=VS::BLEND_SHAPE_MODE_RELATIVE, }; private: @@ -120,8 +120,8 @@ private: Vector surfaces; RID mesh; Rect3 aabb; - MorphTargetMode morph_target_mode; - Vector morph_targets; + BlendShapeMode blend_shape_mode; + Vector blend_shapes; Rect3 custom_aabb; mutable Ref triangle_mesh; @@ -142,15 +142,15 @@ public: void add_surface(uint32_t p_format,PrimitiveType p_primitive,const PoolVector& p_array,int p_vertex_count,const PoolVector& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector >& p_blend_shapes=Vector >(),const Vector& p_bone_aabbs=Vector()); Array surface_get_arrays(int p_surface) const; - virtual Array surface_get_morph_arrays(int p_surface) const; + virtual Array surface_get_blend_shape_arrays(int p_surface) const; - void add_morph_target(const StringName& p_name); - int get_morph_target_count() const; - StringName get_morph_target_name(int p_index) const; - void clear_morph_targets(); + void add_blend_shape(const StringName& p_name); + int get_blend_shape_count() const; + StringName get_blend_shape_name(int p_index) const; + void clear_blend_shapes(); - void set_morph_target_mode(MorphTargetMode p_mode); - MorphTargetMode get_morph_target_mode() const; + void set_blend_shape_mode(BlendShapeMode p_mode); + BlendShapeMode get_blend_shape_mode() const; int get_surface_count() const; void surface_remove(int p_idx); @@ -196,6 +196,6 @@ public: VARIANT_ENUM_CAST( Mesh::ArrayType ); VARIANT_ENUM_CAST( Mesh::PrimitiveType ); -VARIANT_ENUM_CAST( Mesh::MorphTargetMode ); +VARIANT_ENUM_CAST( Mesh::BlendShapeMode ); #endif diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 887fc5ac5f6..94a514e7c1d 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -93,7 +93,7 @@ public: Vector reflection_probe_instances; Vector gi_probe_instances; - Vector morph_values; + Vector blend_values; //BakedLightData *baked_light; VS::ShadowCastingSetting cast_shadows; @@ -244,12 +244,12 @@ public: virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const PoolVector& p_array,int p_vertex_count,const PoolVector& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector >& p_blend_shapes=Vector >(),const Vector& p_bone_aabbs=Vector())=0; - virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0; - virtual int mesh_get_morph_target_count(RID p_mesh) const=0; + virtual void mesh_set_blend_shape_count(RID p_mesh,int p_amount)=0; + virtual int mesh_get_blend_shape_count(RID p_mesh) const=0; - virtual void mesh_set_morph_target_mode(RID p_mesh,VS::MorphTargetMode p_mode)=0; - virtual VS::MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const=0; + virtual void mesh_set_blend_shape_mode(RID p_mesh,VS::BlendShapeMode p_mode)=0; + virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const=0; virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material)=0; virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const=0; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index d9b650d5694..5c8105681a8 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -673,12 +673,12 @@ public: BIND10(mesh_add_surface,RID,uint32_t,PrimitiveType,const PoolVector&,int ,const PoolVector& ,int ,const Rect3&,const Vector >&,const Vector& ) - BIND2(mesh_set_morph_target_count,RID,int) - BIND1RC(int,mesh_get_morph_target_count,RID) + BIND2(mesh_set_blend_shape_count,RID,int) + BIND1RC(int,mesh_get_blend_shape_count,RID) - BIND2(mesh_set_morph_target_mode,RID,MorphTargetMode) - BIND1RC(MorphTargetMode, mesh_get_morph_target_mode,RID ) + BIND2(mesh_set_blend_shape_mode,RID,BlendShapeMode) + BIND1RC(BlendShapeMode, mesh_get_blend_shape_mode,RID ) BIND3(mesh_surface_set_material,RID, int , RID ) BIND2RC(RID,mesh_surface_get_material,RID, int ) @@ -976,7 +976,7 @@ public: BIND2(instance_set_layer_mask,RID, uint32_t ) BIND2(instance_set_transform,RID, const Transform& ) BIND2(instance_attach_object_instance_ID,RID,ObjectID ) - BIND3(instance_set_morph_target_weight,RID,int , float ) + BIND3(instance_set_blend_shape_weight,RID,int , float ) BIND3(instance_set_surface_material,RID,int , RID ) BIND2(instance_set_visible,RID ,bool) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 4635b0fcfea..030796a22d0 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -470,7 +470,7 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base){ instance->base_data=NULL; } - instance->morph_values.clear(); + instance->blend_values.clear(); for(int i=0;imaterials.size();i++) { if (instance->materials[i].is_valid()) { @@ -829,7 +829,7 @@ void VisualServerScene::instance_attach_object_instance_ID(RID p_instance,Object instance->object_ID=p_ID; } -void VisualServerScene::instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight){ +void VisualServerScene::instance_set_blend_shape_weight(RID p_instance,int p_shape, float p_weight){ Instance *instance = instance_owner.get( p_instance ); ERR_FAIL_COND( !instance ); @@ -838,8 +838,8 @@ void VisualServerScene::instance_set_morph_target_weight(RID p_instance,int p_sh _update_dirty_instance(instance); } - ERR_FAIL_INDEX(p_shape,instance->morph_values.size()); - instance->morph_values[p_shape]=p_weight; + ERR_FAIL_INDEX(p_shape,instance->blend_values.size()); + instance->blend_values[p_shape]=p_weight; } void VisualServerScene::instance_set_surface_material(RID p_instance,int p_surface, RID p_material){ @@ -3409,11 +3409,11 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) { } p_instance->materials.resize(new_mat_count); - int new_morph_count = VSG::storage->mesh_get_morph_target_count(p_instance->base); - if (new_morph_count!=p_instance->morph_values.size()) { - p_instance->morph_values.resize(new_morph_count); - for(int i=0;imorph_values[i]=0; + int new_blend_shape_count = VSG::storage->mesh_get_blend_shape_count(p_instance->base); + if (new_blend_shape_count!=p_instance->blend_values.size()) { + p_instance->blend_values.resize(new_blend_shape_count); + for(int i=0;iblend_values[i]=0; } } } diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index fc3ea29b005..1f7de3d0059 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -491,7 +491,7 @@ public: virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask); virtual void instance_set_transform(RID p_instance, const Transform& p_transform); virtual void instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID); - virtual void instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight); + virtual void instance_set_blend_shape_weight(RID p_instance,int p_shape, float p_weight); virtual void instance_set_surface_material(RID p_instance,int p_surface, RID p_material); virtual void instance_set_visible(RID p_instance,bool p_visible); diff --git a/servers/visual_server.h b/servers/visual_server.h index 3e7240af6fd..cb4d87ce8ad 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -246,16 +246,16 @@ public: virtual void mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes=Array(),uint32_t p_compress_format=ARRAY_COMPRESS_DEFAULT); virtual void mesh_add_surface(RID p_mesh,uint32_t p_format,PrimitiveType p_primitive,const PoolVector& p_array,int p_vertex_count,const PoolVector& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector >& p_blend_shapes=Vector >(),const Vector& p_bone_aabbs=Vector())=0; - virtual void mesh_set_morph_target_count(RID p_mesh,int p_amount)=0; - virtual int mesh_get_morph_target_count(RID p_mesh) const=0; + virtual void mesh_set_blend_shape_count(RID p_mesh,int p_amount)=0; + virtual int mesh_get_blend_shape_count(RID p_mesh) const=0; - enum MorphTargetMode { - MORPH_MODE_NORMALIZED, - MORPH_MODE_RELATIVE, + enum BlendShapeMode { + BLEND_SHAPE_MODE_NORMALIZED, + BLEND_SHAPE_MODE_RELATIVE, }; - virtual void mesh_set_morph_target_mode(RID p_mesh,MorphTargetMode p_mode)=0; - virtual MorphTargetMode mesh_get_morph_target_mode(RID p_mesh) const=0; + virtual void mesh_set_blend_shape_mode(RID p_mesh,BlendShapeMode p_mode)=0; + virtual BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const=0; virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material)=0; virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const=0; @@ -714,7 +714,7 @@ public: virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask)=0; virtual void instance_set_transform(RID p_instance, const Transform& p_transform)=0; virtual void instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID)=0; - virtual void instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight)=0; + virtual void instance_set_blend_shape_weight(RID p_instance,int p_shape, float p_weight)=0; virtual void instance_set_surface_material(RID p_instance,int p_surface, RID p_material)=0; virtual void instance_set_visible(RID p_instance,bool p_visible)=0; diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 5720e15caa6..846a551121b 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -624,12 +624,12 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref& p_mesh,con ERR_FAIL_COND_V( !collada.state.mesh_data_map.has(target), ERR_INVALID_DATA ); String name = collada.state.mesh_data_map[target].name; - p_mesh->add_morph_target(name); + p_mesh->add_blend_shape(name); } if (p_morph_data->mode=="RELATIVE") - p_mesh->set_morph_target_mode(Mesh::MORPH_MODE_RELATIVE); + p_mesh->set_blend_shape_mode(Mesh::BLEND_SHAPE_MODE_RELATIVE); else if (p_morph_data->mode=="NORMALIZED") - p_mesh->set_morph_target_mode(Mesh::MORPH_MODE_NORMALIZED); + p_mesh->set_blend_shape_mode(Mesh::BLEND_SHAPE_MODE_NORMALIZED); }