private static Control GetEditor(this CFloat @this) { var editor = new TextBox { Margin = new Padding(3, 3, 3, 0) }; editor.DataBindings.Add("Text", @this, "val"); return(editor); }
public SFoliageInstance(CR2WFile cr2w) : base(cr2w) { position = new CVector3D(cr2w) { Name = "Position" }; Yaw = new CFloat(cr2w); Yaw.Name = "Yaw"; Pitch = new CFloat(cr2w); Pitch.Name = "Pitch"; Roll = new CFloat(cr2w); Roll.Name = "Roll"; }
public CTree(CR2WFile cr2w) : base(cr2w) { x = new CFloat(cr2w); x.Name = "X"; y = new CFloat(cr2w); y.Name = "Y"; z = new CFloat(cr2w); z.Name = "Z"; Yaw = new CFloat(cr2w); Yaw.Name = "Yaw"; Pitch = new CFloat(cr2w); Pitch.Name = "Pitch"; Roll = new CFloat(cr2w); Roll.Name = "Roll"; }
/// <summary> /// Try to apply animation to rig. /// </summary> public void Apply(Rig rig) { bones.Clear(); Vector3Df current; for (int i = 0; i < orientations.Count; i++) { Bone bone = new Bone(); bones.Add(bone); var animBone = currentBones[i]; var positionVar = animBone.Position; CFloat dtPos = positionVar.Dt; CUInt32 dataAddrPos = positionVar.DataAddr; CUInt32 dataAddrFallbackPos = positionVar.DataAddrFallback; CUInt16 numframesPos = positionVar.NumFrames; if (dtPos != null) bone.position_dt = dtPos.val; if (dataAddrPos != null) bone.position_dataAddr = dataAddrPos.val; if (dataAddrFallbackPos != null) bone.position_dataAddrFallback = dataAddrFallbackPos.val; if (numframesPos != null) bone.position_numFrames = numframesPos.val; var orientationVar = animBone.Orientation; CFloat dtRot = orientationVar.Dt; CUInt32 dataAddrRot = orientationVar.DataAddr; CUInt32 dataAddrFallbackRot = orientationVar.DataAddrFallback; CUInt16 numframesRot = orientationVar.NumFrames; if (dtRot != null) bone.rotation_dt = dtRot.val; if (dataAddrRot != null) bone.rotation_dataAddr = dataAddrRot.val; if (dataAddrFallbackRot != null) bone.rotation_dataAddrFallback = dataAddrFallbackRot.val; if (numframesRot != null) bone.rotation_numFrames = numframesRot.val; var scaleVar = animBone.Scale; CFloat dtScale = scaleVar.Dt; CUInt32 dataAddrScale = scaleVar.DataAddr; CUInt32 dataAddrFallbackScale = scaleVar.DataAddrFallback; CUInt16 numframesScale = scaleVar.NumFrames; if (dtScale != null) bone.scale_dt = dtScale.val; if (dataAddrScale != null) bone.scale_dataAddr = dataAddrScale.val; if (dataAddrFallbackScale != null) bone.scale_dataAddrFallback = dataAddrFallbackScale.val; if (numframesScale != null) bone.scale_numFrames = numframesScale.val; bone.BoneName = rig.meshSkeleton.names[i]; for (int j = 0; j < positions[i].Count; j++) { bone.positionFrames.Add(new Vector(positions[i][j].X, positions[i][j].Y, positions[i][j].Z)); } for (int j = 0; j < orientations[i].Count; j++) { current = orientationsEuler[i][j]; bone.rotationFrames.Add(orientations[i][j]); } for (int j = 0; j < scales[i].Count; j++) { bone.scaleFrames.Add(new Vector(scales[i][j].X, scales[i][j].Y, scales[i][j].Z)); } } exportData.bones = bones; }
private void ReadBytes(int bytestart, BinaryReader reader) { reader.BaseStream.Seek(bytestart, SeekOrigin.Begin); try { var obj = new CVector(File); obj.Read(reader, (uint)(bytes.Length - bytestart)); var v = CreatePropertyLayout(obj); v.Endpos = (int)reader.BaseStream.Position; v.HexValue = bytes[bytestart].ToString("X2"); v.Method = "CVector"; } catch { } reader.BaseStream.Seek(bytestart, SeekOrigin.Begin); try { var obj = new CUInt64(File); obj.Read(reader, (uint)(bytes.Length - bytestart)); var v = CreatePropertyLayout(obj); v.Endpos = (int)reader.BaseStream.Position; v.HexValue = bytes[bytestart].ToString("X2"); v.Method = "CUInt64"; } catch { } reader.BaseStream.Seek(bytestart, SeekOrigin.Begin); try { var obj = new CUInt32(File); obj.Read(reader, (uint)(bytes.Length - bytestart)); var v = CreatePropertyLayout(obj); v.Endpos = (int)reader.BaseStream.Position; v.HexValue = bytes[bytestart].ToString("X2"); v.Method = "CUInt32"; } catch { } reader.BaseStream.Seek(bytestart, SeekOrigin.Begin); try { var obj = new CUInt16(File); obj.Read(reader, (uint)(bytes.Length - bytestart)); var v = CreatePropertyLayout(obj); v.Endpos = (int)reader.BaseStream.Position; v.HexValue = bytes[bytestart].ToString("X2"); v.Method = "CUInt16"; } catch { } reader.BaseStream.Seek(bytestart, SeekOrigin.Begin); try { var obj = new CUInt8(File); obj.Read(reader, (uint)(bytes.Length - bytestart)); var v = CreatePropertyLayout(obj); v.Endpos = (int)reader.BaseStream.Position; v.HexValue = bytes[bytestart].ToString("X2"); v.Method = "CUInt8"; } catch { } reader.BaseStream.Seek(bytestart, SeekOrigin.Begin); try { var obj = new CDynamicInt(File); obj.Read(reader, (uint)(bytes.Length - bytestart)); var v = CreatePropertyLayout(obj); v.Endpos = (int)reader.BaseStream.Position; v.HexValue = bytes[bytestart].ToString("X2"); v.Method = "CDynamicInt"; } catch { } reader.BaseStream.Seek(bytestart, SeekOrigin.Begin); try { var obj = new CFloat(File); obj.Read(reader, (uint)(bytes.Length - bytestart)); var v = CreatePropertyLayout(obj); v.Endpos = (int)reader.BaseStream.Position; v.HexValue = bytes[bytestart].ToString("X2"); v.Method = "CFloat"; } catch { } reader.BaseStream.Seek(bytestart, SeekOrigin.Begin); try { var obj = new CName(File); obj.Read(reader, (uint)(bytes.Length - bytestart)); var v = CreatePropertyLayout(obj); v.Endpos = (int)reader.BaseStream.Position; v.HexValue = bytes[bytestart].ToString("X2"); v.Method = "CName"; var valueTest = v.Value; } catch { } reader.BaseStream.Seek(bytestart, SeekOrigin.Begin); try { var obj = new CHandle(File); obj.Read(reader, (uint)(bytes.Length - bytestart)); var v = CreatePropertyLayout(obj); v.Endpos = (int)reader.BaseStream.Position; v.HexValue = bytes[bytestart].ToString("X2"); v.Method = "CHandle"; var valueTest = v.Value; } catch { } reader.BaseStream.Seek(bytestart, SeekOrigin.Begin); try { var obj = new CSoft(File); obj.Read(reader, (uint)(bytes.Length - bytestart)); var v = CreatePropertyLayout(obj); v.Endpos = (int)reader.BaseStream.Position; v.HexValue = bytes[bytestart].ToString("X2"); v.Method = "CSoft"; var valueTest = v.Value; } catch { } reader.BaseStream.Seek(bytestart, SeekOrigin.Begin); try { var obj = File.ReadVariable(reader); obj.Read(reader, (uint)(bytes.Length - bytestart)); var v = CreatePropertyLayout(obj); v.Endpos = (int)reader.BaseStream.Position; v.HexValue = bytes[bytestart].ToString("X2"); v.Method = "ReadVariable"; } catch { } }
public override void Read(BinaryReader file, uint size) { base.Read(file, size); var cnt = file.ReadVLQInt32(); for (int i = 0; i < cnt; i++) { //This is actually a byte-byte pair but no idea why or how anyone would edit this var mapping = new CUInt16(cr2w); mapping.Read(file, size); unicodemapping.AddVariable(mapping); } linedist.Read(file, size); maxglyphheight.Read(file, size); kerning.Read(file, size); var num = file.ReadVLQInt32(); for (int i = 0; i < num; i++) { CArray glyph = new CArray(cr2w) { Name = "Glyph - " + i }; // UVs CFloat uv00 = new CFloat(cr2w) { Name = "UV[0][0]" }; uv00.Read(file, size); glyph.AddVariable(uv00); CFloat uv01 = new CFloat(cr2w) { Name = "UV[0][1]" }; uv01.Read(file, size); glyph.AddVariable(uv01); CFloat uv10 = new CFloat(cr2w) { Name = "UV[1][0]" }; uv10.Read(file, size); glyph.AddVariable(uv10); CFloat uv11 = new CFloat(cr2w) { Name = "UV[1][1]" }; uv11.Read(file, size); glyph.AddVariable(uv11); CInt32 textureindex = new CInt32(cr2w) { Name = "Texture index" }; textureindex.Read(file, size); glyph.AddVariable(textureindex); CInt32 width = new CInt32(cr2w) { Name = "Width" }; width.Read(file, size); glyph.AddVariable(width); CInt32 height = new CInt32(cr2w) { Name = "Height" }; height.Read(file, size); glyph.AddVariable(height); CInt32 advance_x = new CInt32(cr2w) { Name = "Advance X" }; advance_x.Read(file, size); glyph.AddVariable(advance_x); CInt32 bearing_x = new CInt32(cr2w) { Name = "Bearing X" }; bearing_x.Read(file, size); glyph.AddVariable(bearing_x); CInt32 bearing_y = new CInt32(cr2w) { Name = "Bearing Y" }; bearing_y.Read(file, size); glyph.AddVariable(bearing_y); glyphs.AddVariable(glyph); } }
/// <summary> /// Try to apply animation to rig. /// </summary> public void Apply(Rig rig) { bones.Clear(); Vector3Df current; for (int i = 0; i < orientations.Count; i++) { Bone bone = new Bone(); bones.Add(bone); CVector animBone = currentBones[i]; CVector positionVar = animBone.GetVariableByName("position") as CVector; CFloat dtPos = positionVar.GetVariableByName("dt") as CFloat; CUInt32 dataAddrPos = positionVar.GetVariableByName("dataAddr") as CUInt32; CUInt32 dataAddrFallbackPos = positionVar.GetVariableByName("dataAddrFallback") as CUInt32; CUInt16 numframesPos = positionVar.GetVariableByName("numFrames") as CUInt16; if (dtPos != null) { bone.position_dt = dtPos.val; } if (dataAddrPos != null) { bone.position_dataAddr = dataAddrPos.val; } if (dataAddrFallbackPos != null) { bone.position_dataAddrFallback = dataAddrFallbackPos.val; } if (numframesPos != null) { bone.position_numFrames = numframesPos.val; } CVector orientationVar = animBone.GetVariableByName("orientation") as CVector; CFloat dtRot = orientationVar.GetVariableByName("dt") as CFloat; CUInt32 dataAddrRot = orientationVar.GetVariableByName("dataAddr") as CUInt32; CUInt32 dataAddrFallbackRot = orientationVar.GetVariableByName("dataAddrFallback") as CUInt32; CUInt16 numframesRot = orientationVar.GetVariableByName("numFrames") as CUInt16; if (dtRot != null) { bone.rotation_dt = dtRot.val; } if (dataAddrRot != null) { bone.rotation_dataAddr = dataAddrRot.val; } if (dataAddrFallbackRot != null) { bone.rotation_dataAddrFallback = dataAddrFallbackRot.val; } if (numframesRot != null) { bone.rotation_numFrames = numframesRot.val; } CVector scaleVar = animBone.GetVariableByName("scale") as CVector; CFloat dtScale = scaleVar.GetVariableByName("dt") as CFloat; CUInt32 dataAddrScale = scaleVar.GetVariableByName("dataAddr") as CUInt32; CUInt32 dataAddrFallbackScale = scaleVar.GetVariableByName("dataAddrFallback") as CUInt32; CUInt16 numframesScale = scaleVar.GetVariableByName("numFrames") as CUInt16; if (dtScale != null) { bone.scale_dt = dtScale.val; } if (dataAddrScale != null) { bone.scale_dataAddr = dataAddrScale.val; } if (dataAddrFallbackScale != null) { bone.scale_dataAddrFallback = dataAddrFallbackScale.val; } if (numframesScale != null) { bone.scale_numFrames = numframesScale.val; } bone.BoneName = rig.meshSkeleton.names[i]; for (int j = 0; j < positions[i].Count; j++) { bone.positionFrames.Add(new Vector(positions[i][j].X, positions[i][j].Y, positions[i][j].Z)); } for (int j = 0; j < orientations[i].Count; j++) { current = orientationsEuler[i][j]; bone.rotationFrames.Add(orientations[i][j]); } for (int j = 0; j < scales[i].Count; j++) { bone.scaleFrames.Add(new Vector(scales[i][j].X, scales[i][j].Y, scales[i][j].Z)); } } exportData.bones = bones; }
public CameraPosition(Vector2 position, float rotation, float zoom) { Position = position; Rotation = rotation; ZoomLevel = new CFloat(zoom, 0.01f, 3f); }