Browse Source

renamed Properties class

Vicente Penades 6 years ago
parent
commit
38dee07b2d

+ 11 - 11
build/SharpGLTF.CodeGen/Program.cs

@@ -41,8 +41,8 @@ namespace SharpGLTF
             // load and process schema
             var ctx1 = LoadSchemaContext(Constants.MainSchemaFile);
 
-            // we remove "glTF Property" because it is hand coded.
-            ctx1.Remove(ctx1.Classes.FirstOrDefault(item => item.PersistentName == "glTF Property"));            
+            // we remove "glTF Property" because it is completely hand coded.
+            ctx1.IgnoredByCodeEmitter("glTF Property");
 
             // mimeType "anyof" is basically the string to use.
             ctx1.Remove(ctx1.Enumerations.FirstOrDefault(item => item.PersistentName == "image/jpeg-image/png"));
@@ -101,8 +101,8 @@ namespace SharpGLTF
             var ctx = LoadSchemaContext(Constants.KhronosPbrSpecGlossSchemaFile);
 
             // remove already defined classes
-            ctx.Remove("glTF Property");
-            ctx.Remove("Texture Info");
+            ctx.IgnoredByCodeEmitter("glTF Property");
+            ctx.IgnoredByCodeEmitter("Texture Info");
 
             ctx.Classes
                 .ToArray()
@@ -126,7 +126,7 @@ namespace SharpGLTF
         private static void _ProcessKhronosUnlitExtension()
         {
             var ctx = LoadSchemaContext(Constants.KhronosUnlitSchemaFile);
-            ctx.Remove("glTF Property");
+            ctx.IgnoredByCodeEmitter("glTF Property");
 
             ProcessSchema("ext.Unlit.g", ctx);
         }
@@ -134,8 +134,8 @@ namespace SharpGLTF
         private static void _ProcessKhronosModelLightsPunctualExtension()
         {
             var ctx = LoadSchemaContext(Constants.KhronosModelLightsPunctualSchemaFile);            
-            ctx.Remove("glTF Property");
-            ctx.Classes.FirstOrDefault(item => item.PersistentName == "glTF Child of Root Property").IgnoredByEmitter = true;
+            ctx.IgnoredByCodeEmitter("glTF Property");
+            ctx.IgnoredByCodeEmitter("glTF Child of Root Property");
 
             var light = ctx.Classes
                 .ToArray()
@@ -152,7 +152,7 @@ namespace SharpGLTF
         private static void _ProcessKhronosNodeLightsPunctualExtension()
         {
             var ctx = LoadSchemaContext(Constants.KhronosNodeLightsPunctualSchemaFile);
-            ctx.Remove("glTF Property");            
+            ctx.IgnoredByCodeEmitter("glTF Property");            
 
             ProcessSchema("ext.NodeLightsPunctual.g", ctx);
         }
@@ -160,7 +160,7 @@ namespace SharpGLTF
         private static void _ProcessKhronosTextureTransformExtension()
         {
             var ctx = LoadSchemaContext(Constants.KhronosTextureTransformSchemaFile);
-            ctx.Remove("glTF Property");
+            ctx.IgnoredByCodeEmitter("glTF Property");
 
             var tex = ctx.Classes
                 .ToArray()
@@ -204,10 +204,10 @@ namespace SharpGLTF
             newEmitter.DeclareContext(ctx);
             newEmitter.SetCollectionContainer("List<TItem>");
 
-            const string rootName = "ModelRoot";            
+            const string rootName = "ModelRoot";
 
             newEmitter.SetRuntimeName("glTF", rootName);
-            newEmitter.SetRuntimeName("glTF Property", "ExtensionsProperty");
+            newEmitter.SetRuntimeName("glTF Property", "ExtraProperties");
             newEmitter.SetRuntimeName("glTF Child of Root Property", "LogicalChildOfRoot");
 
             // newEmitter.SetRuntimeName("Sampler", "TextureSampler");

+ 5 - 0
build/SharpGLTF.CodeGen/SchemaReflection/SchemaTypesContext.cs

@@ -85,6 +85,11 @@ namespace SharpGLTF.SchemaReflection
 
             public void Remove(string persistentName) { _Types.Remove(persistentName); }
 
+            public void IgnoredByCodeEmitter(string persistentName)
+            {
+                Classes.FirstOrDefault(item => item.PersistentName == persistentName).IgnoredByEmitter = true;
+            }
+
             #endregion
         }
     }

+ 2 - 2
src/SharpGLTF/Schema2/Generated/ext.ModelLightsPunctual.g.cs

@@ -25,7 +25,7 @@ namespace SharpGLTF.Schema2
 {
 	using Collections;
 
-	partial class PunctualLightSpot : glTFProperty
+	partial class PunctualLightSpot : ExtraProperties
 	{
 	
 		private const Double _innerConeAngleDefault = 0;
@@ -108,7 +108,7 @@ namespace SharpGLTF.Schema2
 	
 	}
 
-	partial class KHR_lights_punctualglTFextension : glTFProperty
+	partial class KHR_lights_punctualglTFextension : ExtraProperties
 	{
 	
 		private const int _lightsMinItems = 1;

+ 1 - 1
src/SharpGLTF/Schema2/Generated/ext.NodeLightsPunctual.g.cs

@@ -25,7 +25,7 @@ namespace SharpGLTF.Schema2
 {
 	using Collections;
 
-	partial class KHR_lights_punctualnodeextension : glTFProperty
+	partial class KHR_lights_punctualnodeextension : ExtraProperties
 	{
 	
 		private Int32 _light;

+ 1 - 1
src/SharpGLTF/Schema2/Generated/ext.TextureTransform.g.cs

@@ -28,7 +28,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// glTF extension that enables shifting and scaling UV coordinates on a per-texture basis
 	/// </summary>
-	partial class TextureTransform : glTFProperty
+	partial class TextureTransform : ExtraProperties
 	{
 	
 		private static readonly Vector2 _offsetDefault = Vector2.One;

+ 1 - 1
src/SharpGLTF/Schema2/Generated/ext.Unlit.g.cs

@@ -28,7 +28,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// glTF extension that defines the unlit material model.
 	/// </summary>
-	partial class MaterialUnlit : glTFProperty
+	partial class MaterialUnlit : ExtraProperties
 	{
 	
 	

+ 1 - 1
src/SharpGLTF/Schema2/Generated/ext.pbrSpecularGlossiness.g.cs

@@ -28,7 +28,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// glTF extension that defines the specular-glossiness material model from Physically-Based Rendering (PBR) methodology.
 	/// </summary>
-	partial class MaterialPBRSpecularGlossiness : glTFProperty
+	partial class MaterialPBRSpecularGlossiness : ExtraProperties
 	{
 	
 		private static readonly Vector4 _diffuseFactorDefault = Vector4.One;

+ 14 - 14
src/SharpGLTF/Schema2/Generated/gltf.g.cs

@@ -169,7 +169,7 @@ namespace SharpGLTF.Schema2
 	}
 
 
-	partial class LogicalChildOfRoot : glTFProperty
+	partial class LogicalChildOfRoot : ExtraProperties
 	{
 	
 		private String _name;
@@ -197,7 +197,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// Indices of those attributes that deviate from their initialization value.
 	/// </summary>
-	partial class AccessorSparseIndices : glTFProperty
+	partial class AccessorSparseIndices : ExtraProperties
 	{
 	
 		private Int32 _bufferView;
@@ -235,7 +235,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// Array of size `accessor.sparse.count` times number of components storing the displaced accessor attributes pointed by `accessor.sparse.indices`.
 	/// </summary>
-	partial class AccessorSparseValues : glTFProperty
+	partial class AccessorSparseValues : ExtraProperties
 	{
 	
 		private Int32 _bufferView;
@@ -269,7 +269,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// Sparse storage of attributes that deviate from their initialization value.
 	/// </summary>
-	partial class AccessorSparse : glTFProperty
+	partial class AccessorSparse : ExtraProperties
 	{
 	
 		private const Int32 _countMinimum = 1;
@@ -376,7 +376,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// The index of the node and TRS property that an animation channel targets.
 	/// </summary>
-	partial class AnimationChannelTarget : glTFProperty
+	partial class AnimationChannelTarget : ExtraProperties
 	{
 	
 		private Int32? _node;
@@ -408,7 +408,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// Targets an animation's sampler at a node's property.
 	/// </summary>
-	partial class AnimationChannel : glTFProperty
+	partial class AnimationChannel : ExtraProperties
 	{
 	
 		private Int32 _sampler;
@@ -440,7 +440,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// Combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target).
 	/// </summary>
-	partial class AnimationSampler : glTFProperty
+	partial class AnimationSampler : ExtraProperties
 	{
 	
 		private Int32 _input;
@@ -511,7 +511,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// Metadata about the glTF asset.
 	/// </summary>
-	partial class Asset : glTFProperty
+	partial class Asset : ExtraProperties
 	{
 	
 		private String _copyright;
@@ -633,7 +633,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// An orthographic camera containing properties to create an orthographic projection matrix.
 	/// </summary>
-	partial class CameraOrthographic : glTFProperty
+	partial class CameraOrthographic : ExtraProperties
 	{
 	
 		private Double _xmag;
@@ -675,7 +675,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// A perspective camera containing properties to create a perspective projection matrix.
 	/// </summary>
-	partial class CameraPerspective : glTFProperty
+	partial class CameraPerspective : ExtraProperties
 	{
 	
 		private const Double _aspectRatioMinimum = 0;
@@ -756,7 +756,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// Reference to a texture.
 	/// </summary>
-	partial class TextureInfo : glTFProperty
+	partial class TextureInfo : ExtraProperties
 	{
 	
 		private Int32 _index;
@@ -790,7 +790,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology.
 	/// </summary>
-	partial class MaterialPBRMetallicRoughness : glTFProperty
+	partial class MaterialPBRMetallicRoughness : ExtraProperties
 	{
 	
 		private static readonly Vector4 _baseColorFactorDefault = Vector4.One;
@@ -956,7 +956,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// Geometry to be rendered with the given material.
 	/// </summary>
-	partial class MeshPrimitive : glTFProperty
+	partial class MeshPrimitive : ExtraProperties
 	{
 	
 		private Dictionary<String,Int32> _attributes;
@@ -1242,7 +1242,7 @@ namespace SharpGLTF.Schema2
 	/// <summary>
 	/// The root object for a glTF asset.
 	/// </summary>
-	partial class ModelRoot : glTFProperty
+	partial class ModelRoot : ExtraProperties
 	{
 	
 		private Asset _asset;

+ 1 - 1
src/SharpGLTF/Schema2/gltf.AccessorSparse.cs

@@ -24,7 +24,7 @@ namespace SharpGLTF.Schema2
         internal AccessorSparse() { }
 
         /// <inheritdoc />
-        protected override IEnumerable<glTFProperty> GetLogicalChildren()
+        protected override IEnumerable<ExtraProperties> GetLogicalChildren()
         {
             return base.GetLogicalChildren().Concat(_indices, _values);
         }

+ 1 - 1
src/SharpGLTF/Schema2/gltf.Accessors.cs

@@ -331,7 +331,7 @@ namespace SharpGLTF.Schema2
 
         #region API
 
-        protected override IEnumerable<glTFProperty> GetLogicalChildren()
+        protected override IEnumerable<ExtraProperties> GetLogicalChildren()
         {
             return base.GetLogicalChildren().Concat(_sparse);
         }

+ 1 - 1
src/SharpGLTF/Schema2/gltf.Animations.cs

@@ -37,7 +37,7 @@ namespace SharpGLTF.Schema2
         #region API
 
         /// <inheritdoc />
-        protected override IEnumerable<glTFProperty> GetLogicalChildren()
+        protected override IEnumerable<ExtraProperties> GetLogicalChildren()
         {
             return base.GetLogicalChildren().Concat(_samplers).Concat(_channels);
         }

+ 1 - 1
src/SharpGLTF/Schema2/gltf.Camera.cs

@@ -31,7 +31,7 @@ namespace SharpGLTF.Schema2
         #region API
 
         /// <inheritdoc />
-        protected override IEnumerable<glTFProperty> GetLogicalChildren()
+        protected override IEnumerable<ExtraProperties> GetLogicalChildren()
         {
             return base.GetLogicalChildren().Concat(_orthographic, _perspective);
         }

+ 1 - 1
src/SharpGLTF/Schema2/gltf.ExtensionsFactory.cs

@@ -94,7 +94,7 @@ namespace SharpGLTF.Schema2
             // retrieve ALL the property based objects of the whole model.
 
             var allObjects = GetLogicalChildren()
-                .SelectMany(item => glTFProperty.Flatten(item)
+                .SelectMany(item => ExtraProperties.Flatten(item)
                 .ToList());
 
             // check all the extensions used by each object

+ 6 - 6
src/SharpGLTF/Schema2/gltf.Property.cs → src/SharpGLTF/Schema2/gltf.ExtraProperties.cs

@@ -8,7 +8,7 @@ namespace SharpGLTF.Schema2
 {
     using IO;
 
-    public abstract class glTFProperty : JsonSerializable
+    public abstract class ExtraProperties : JsonSerializable
     {
         #region data
 
@@ -72,15 +72,15 @@ namespace SharpGLTF.Schema2
         }
 
         /// <summary>
-        /// Gets a collection of <see cref="glTFProperty"/> instances stored by this object.
+        /// Gets a collection of <see cref="ExtraProperties"/> instances stored by this object.
         /// </summary>
-        /// <returns>A collection of <see cref="glTFProperty"/> instances.</returns>
-        protected virtual IEnumerable<glTFProperty> GetLogicalChildren()
+        /// <returns>A collection of <see cref="ExtraProperties"/> instances.</returns>
+        protected virtual IEnumerable<ExtraProperties> GetLogicalChildren()
         {
-            return _extensions.OfType<glTFProperty>();
+            return _extensions.OfType<ExtraProperties>();
         }
 
-        protected static IEnumerable<glTFProperty> Flatten(glTFProperty container)
+        protected static IEnumerable<ExtraProperties> Flatten(ExtraProperties container)
         {
             yield return container;
 

+ 1 - 1
src/SharpGLTF/Schema2/gltf.Materials.cs

@@ -64,7 +64,7 @@ namespace SharpGLTF.Schema2
         #region API
 
         /// <inheritdoc />
-        protected override IEnumerable<glTFProperty> GetLogicalChildren()
+        protected override IEnumerable<ExtraProperties> GetLogicalChildren()
         {
             return base.GetLogicalChildren().Concat(_normalTexture, _emissiveTexture, _occlusionTexture, _pbrMetallicRoughness);
         }

+ 2 - 2
src/SharpGLTF/Schema2/gltf.MaterialsFactory.cs

@@ -138,7 +138,7 @@ namespace SharpGLTF.Schema2
     internal sealed partial class MaterialPBRMetallicRoughness
     {
         /// <inheritdoc />
-        protected override IEnumerable<glTFProperty> GetLogicalChildren()
+        protected override IEnumerable<ExtraProperties> GetLogicalChildren()
         {
             return base.GetLogicalChildren().Concat(_baseColorTexture, _metallicRoughnessTexture);
         }
@@ -191,7 +191,7 @@ namespace SharpGLTF.Schema2
         internal MaterialPBRSpecularGlossiness(Material material) { }
 
         /// <inheritdoc />
-        protected override IEnumerable<glTFProperty> GetLogicalChildren()
+        protected override IEnumerable<ExtraProperties> GetLogicalChildren()
         {
             return base.GetLogicalChildren().Concat(_diffuseTexture, _specularGlossinessTexture);
         }

+ 1 - 1
src/SharpGLTF/Schema2/gltf.Mesh.cs

@@ -41,7 +41,7 @@ namespace SharpGLTF.Schema2
         #region API
 
         /// <inheritdoc />
-        protected override IEnumerable<glTFProperty> GetLogicalChildren()
+        protected override IEnumerable<ExtraProperties> GetLogicalChildren()
         {
             return base.GetLogicalChildren().Concat(_primitives);
         }

+ 1 - 1
src/SharpGLTF/Schema2/gltf.Root.cs

@@ -91,7 +91,7 @@ namespace SharpGLTF.Schema2
         public IReadOnlyList<Animation>     LogicalAnimations   => _animations;
 
         /// <inheritdoc />
-        protected override IEnumerable<glTFProperty> GetLogicalChildren()
+        protected override IEnumerable<ExtraProperties> GetLogicalChildren()
         {
             var containers = base.GetLogicalChildren();
 

+ 1 - 1
src/SharpGLTF/Schema2/khr.lights.cs

@@ -16,7 +16,7 @@ namespace SharpGLTF.Schema2
         }
 
         /// <inheritdoc />
-        protected override IEnumerable<glTFProperty> GetLogicalChildren()
+        protected override IEnumerable<ExtraProperties> GetLogicalChildren()
         {
             return base.GetLogicalChildren().Concat(_lights);
         }