public static Vector2Property BindCustom(Animator animator, string name) { return(new Vector2Property { x = animator.BindCustomStreamProperty(name + ".x", CustomStreamPropertyType.Float), y = animator.BindCustomStreamProperty(name + ".y", CustomStreamPropertyType.Float) }); }
public static Vector3BoolProperty BindCustom(Animator animator, string name) { return(new Vector3BoolProperty { x = animator.BindCustomStreamProperty(name + ".x", CustomStreamPropertyType.Bool), y = animator.BindCustomStreamProperty(name + ".y", CustomStreamPropertyType.Bool), z = animator.BindCustomStreamProperty(name + ".z", CustomStreamPropertyType.Bool) }); }
public static FloatProperty BindCustom(Animator animator, string property) { return(new FloatProperty { value = animator.BindCustomStreamProperty(property, CustomStreamPropertyType.Float) }); }
public static BoolProperty BindCustom(Animator animator, string property) { return(new BoolProperty { value = animator.BindCustomStreamProperty(property, CustomStreamPropertyType.Bool) }); }
public override RigSyncSceneToStreamJob Create(Animator animator, ref T data, Component component) { var job = new RigSyncSceneToStreamJob(); var transforms = data.syncableTransforms; if (transforms != null) { job.transformSyncer = TransformSyncer.Create(transforms.Length); for (int i = 0; i < transforms.Length; ++i) { job.transformSyncer.BindAt(i, animator, transforms[i]); } } var properties = data.syncableProperties; if (properties != null) { int rigCount = properties.Length, constraintCount = 0, propertyCount = 0; for (int i = 0; i < properties.Length; ++i) { constraintCount += properties[i].constraints.Length; for (int j = 0; j < properties[i].constraints.Length; ++j) { for (int k = 0; k < properties[i].constraints[j].properties.Length; ++k) { propertyCount += properties[i].constraints[j].properties[k].descriptor.size; } } } job.propertySyncer = PropertySyncer.Create(propertyCount); job.rigWeightSyncer = PropertySyncer.Create(rigCount); job.constraintWeightSyncer = PropertySyncer.Create(constraintCount); job.rigStates = new NativeArray <float>(rigCount, Allocator.Persistent, NativeArrayOptions.UninitializedMemory); job.rigConstraintEndIdx = new NativeArray <int>(rigCount, Allocator.Persistent, NativeArrayOptions.UninitializedMemory); job.modulatedConstraintWeights = new NativeArray <PropertyStreamHandle>(constraintCount, Allocator.Persistent, NativeArrayOptions.UninitializedMemory); int constraintIdx = 0, propertyIdx = 0; for (int i = 0; i < properties.Length; ++i) { job.rigWeightSyncer.BindAt(i, animator, properties[i].rig.component, RigProperties.s_Weight); job.rigStates[i] = data.rigStates[i] ? 1f : 0f; var constraints = properties[i].constraints; for (int j = 0; j < constraints.Length; ++j) { ref var constraint = ref constraints[j]; job.constraintWeightSyncer.BindAt(constraintIdx, animator, constraint.component, ConstraintProperties.s_Weight); job.modulatedConstraintWeights[constraintIdx++] = animator.BindCustomStreamProperty( PropertyUtils.ConstructCustomPropertyName(constraint.component, ConstraintProperties.s_Weight), CustomStreamPropertyType.Float ); for (int k = 0; k < constraint.properties.Length; ++k) { ref var property = ref constraint.properties[k]; if (property.descriptor.size == 1) { job.propertySyncer.BindAt(propertyIdx++, animator, constraint.component, property.name); } else { Debug.Assert(property.descriptor.size <= 4); for (int l = 0; l < property.descriptor.size; ++l) { job.propertySyncer.BindAt(propertyIdx++, animator, constraint.component, property.name + s_PropertyElementNames[l]); } } } } job.rigConstraintEndIdx[i] = constraintIdx; }