diff --git a/Metasequoia.Sharp/Classes/Classes.Generated.cs b/Metasequoia.Sharp/Classes/Classes.Generated.cs index dd8586e..d902e34 100644 --- a/Metasequoia.Sharp/Classes/Classes.Generated.cs +++ b/Metasequoia.Sharp/Classes/Classes.Generated.cs @@ -61,6 +61,16 @@ public Object GetObject(int index) partial void BeforeGetObject(int index); /// + /// MQObject GetObjectFromUniqueID(int id) + /// + public Object GetObjectFromUniqueId(int id) + { + BeforeGetObjectFromUniqueId(id); + return NativeMethods.MQDoc_GetObjectFromUniqueID(this, id); + } + + partial void BeforeGetObjectFromUniqueId(int id); + /// /// int GetCurrentObjectIndex() /// public int CurrentObjectIndex @@ -107,6 +117,26 @@ public int GetObjectIndex(Object obj) partial void BeforeGetObjectIndex(Object obj); /// + /// void GetUnusedObjectName(char *buffer, int buffer_size) + /// + public void GetUnusedObjectName(StringBuilder buffer, int buffer_size) + { + BeforeGetUnusedObjectName(buffer, buffer_size); + NativeMethods.MQDoc_GetUnusedObjectName(this, buffer, buffer_size, null); + } + + partial void BeforeGetUnusedObjectName(StringBuilder buffer, int buffer_size); + /// + /// void GetUnusedObjectName(char *buffer, int buffer_size, const char *base_name) + /// + public void GetUnusedObjectName(StringBuilder buffer, int buffer_size, string base_name) + { + BeforeGetUnusedObjectName(buffer, buffer_size, base_name); + NativeMethods.MQDoc_GetUnusedObjectName(this, buffer, buffer_size, base_name); + } + + partial void BeforeGetUnusedObjectName(StringBuilder buffer, int buffer_size, string base_name); + /// /// int GetMaterialCount() /// public int MaterialCount @@ -128,6 +158,16 @@ public Material GetMaterial(int material) partial void BeforeGetMaterial(int material); /// + /// MQMaterial GetMaterialFromUniqueID(int id) + /// + public Material GetMaterialFromUniqueId(int id) + { + BeforeGetMaterialFromUniqueId(id); + return NativeMethods.MQDoc_GetMaterialFromUniqueID(this, id); + } + + partial void BeforeGetMaterialFromUniqueId(int id); + /// /// int GetCurrentMaterialIndex() /// public int CurrentMaterialIndex @@ -164,6 +204,26 @@ public void DeleteMaterial(int index) partial void BeforeDeleteMaterial(int index); /// + /// void GetUnusedMaterialName(char *buffer, int buffer_size) + /// + public void GetUnusedMaterialName(StringBuilder buffer, int buffer_size) + { + BeforeGetUnusedMaterialName(buffer, buffer_size); + NativeMethods.MQDoc_GetUnusedMaterialName(this, buffer, buffer_size, null); + } + + partial void BeforeGetUnusedMaterialName(StringBuilder buffer, int buffer_size); + /// + /// void GetUnusedMaterialName(char *buffer, int buffer_size, const char *base_name) + /// + public void GetUnusedMaterialName(StringBuilder buffer, int buffer_size, string base_name) + { + BeforeGetUnusedMaterialName(buffer, buffer_size, base_name); + NativeMethods.MQDoc_GetUnusedMaterialName(this, buffer, buffer_size, base_name); + } + + partial void BeforeGetUnusedMaterialName(StringBuilder buffer, int buffer_size, string base_name); + /// /// void Compact() /// public void Compact() @@ -471,6 +531,126 @@ public int InsertObject(Object obj, Object before) } partial void BeforeInsertObject(Object obj, Object before); + /// + /// int CreateObjectUserData(DWORD productID, DWORD pluginID, const char *identifier, int bytes_per_object) + /// + public int CreateObjectUserData(uint productID, uint pluginID, string identifier, int bytes_per_object) + { + BeforeCreateObjectUserData(productID, pluginID, identifier, bytes_per_object); + return CreateUserData(productID, pluginID, identifier, (int)Userdata.Object, bytes_per_object); + } + + partial void BeforeCreateObjectUserData(uint productID, uint pluginID, string identifier, int bytes_per_object); + /// + /// void DeleteObjectUserData(int userdata_id) + /// + public void DeleteObjectUserData(int userdata_id) + { + BeforeDeleteObjectUserData(userdata_id); + NativeMethods.MQDoc_DeleteUserData(this, (int)Userdata.Object, userdata_id); + } + + partial void BeforeDeleteObjectUserData(int userdata_id); + /// + /// int FindObjectUserData(DWORD productID, DWORD pluginID, const char *identifier) + /// + public int FindObjectUserData(uint productID, uint pluginID, string identifier) + { + BeforeFindObjectUserData(productID, pluginID, identifier); + return FindUserData(productID, pluginID, identifier, (int)Userdata.Object); + } + + partial void BeforeFindObjectUserData(uint productID, uint pluginID, string identifier); + /// + /// int CreateVertexUserData(DWORD productID, DWORD pluginID, const char *identifier, int bytes_per_vertex) + /// + public int CreateVertexUserData(uint productID, uint pluginID, string identifier, int bytes_per_vertex) + { + BeforeCreateVertexUserData(productID, pluginID, identifier, bytes_per_vertex); + return CreateUserData(productID, pluginID, identifier, (int)Userdata.Vertex, bytes_per_vertex); + } + + partial void BeforeCreateVertexUserData(uint productID, uint pluginID, string identifier, int bytes_per_vertex); + /// + /// void DeleteVertexUserData(int userdata_id) + /// + public void DeleteVertexUserData(int userdata_id) + { + BeforeDeleteVertexUserData(userdata_id); + NativeMethods.MQDoc_DeleteUserData(this, (int)Userdata.Vertex, userdata_id); + } + + partial void BeforeDeleteVertexUserData(int userdata_id); + /// + /// int FindVertexUserData(DWORD productID, DWORD pluginID, const char *identifier) + /// + public int FindVertexUserData(uint productID, uint pluginID, string identifier) + { + BeforeFindVertexUserData(productID, pluginID, identifier); + return FindUserData(productID, pluginID, identifier, (int)Userdata.Vertex); + } + + partial void BeforeFindVertexUserData(uint productID, uint pluginID, string identifier); + /// + /// int CreateFaceUserData(DWORD productID, DWORD pluginID, const char *identifier, int bytes_per_face) + /// + public int CreateFaceUserData(uint productID, uint pluginID, string identifier, int bytes_per_face) + { + BeforeCreateFaceUserData(productID, pluginID, identifier, bytes_per_face); + return CreateUserData(productID, pluginID, identifier, (int)Userdata.Face, bytes_per_face); + } + + partial void BeforeCreateFaceUserData(uint productID, uint pluginID, string identifier, int bytes_per_face); + /// + /// void DeleteFaceUserData(int userdata_id) + /// + public void DeleteFaceUserData(int userdata_id) + { + BeforeDeleteFaceUserData(userdata_id); + NativeMethods.MQDoc_DeleteUserData(this, (int)Userdata.Face, userdata_id); + } + + partial void BeforeDeleteFaceUserData(int userdata_id); + /// + /// int FindFaceUserData(DWORD productID, DWORD pluginID, const char *identifier) + /// + public int FindFaceUserData(uint productID, uint pluginID, string identifier) + { + BeforeFindFaceUserData(productID, pluginID, identifier); + return FindUserData(productID, pluginID, identifier, (int)Userdata.Face); + } + + partial void BeforeFindFaceUserData(uint productID, uint pluginID, string identifier); + /// + /// int CreateMaterialUserData(DWORD productID, DWORD pluginID, const char *identifier, int bytes_per_material) + /// + public int CreateMaterialUserData(uint productID, uint pluginID, string identifier, int bytes_per_material) + { + BeforeCreateMaterialUserData(productID, pluginID, identifier, bytes_per_material); + return CreateUserData(productID, pluginID, identifier, (int)Userdata.Material, bytes_per_material); + } + + partial void BeforeCreateMaterialUserData(uint productID, uint pluginID, string identifier, int bytes_per_material); + /// + /// void DeleteMaterialUserData(int userdata_id) + /// + public void DeleteMaterialUserData(int userdata_id) + { + BeforeDeleteMaterialUserData(userdata_id); + NativeMethods.MQDoc_DeleteUserData(this, (int)Userdata.Material, userdata_id); + } + + partial void BeforeDeleteMaterialUserData(int userdata_id); + /// + /// int FindMaterialUserData(DWORD productID, DWORD pluginID, const char *identifier) + /// + public int FindMaterialUserData(uint productID, uint pluginID, string identifier) + { + BeforeFindMaterialUserData(productID, pluginID, identifier); + return FindUserData(productID, pluginID, identifier, (int)Userdata.Material); + } + + partial void BeforeFindMaterialUserData(uint productID, uint pluginID, string identifier); } /// @@ -644,28 +824,6 @@ public float FOV } } - /// - /// MQPoint GetGlobalDirectionalLight() - /// - public Point GlobalDirectionalLight - { - get - { - var val = new float[3]; - NativeMethods.MQScene_FloatValue(this,(int)MQScene.GetDirectionalLight,val); - return new Point(val[0],val[1],val[2]); - } - set - { - var vec = value; - var val = new float[3]; - val[0]=vec.X; - val[1]=vec.Y; - val[2]=vec.Z; - NativeMethods.MQScene_FloatValue(this,(int)MQScene.SetDirectionalLight,val); - } - } - /// /// MQColor GetGlobalAmbientColor() /// @@ -725,6 +883,96 @@ public bool GetVisibleFace(Object obj, [MarshalAs(UnmanagedType.LPArray, ArraySu } partial void BeforeGetVisibleFace(Object obj, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Bool)] bool[] visible); + /// + /// int AddGlobalDirectionalLight() + /// + public int AddGlobalDirectionalLight() + { + BeforeAddGlobalDirectionalLight(); + var val = new int[1]; + NativeMethods.MQScene_IntValue(this,(int)MQScene.AddMultilight,val); + return val[0]; + } + + partial void BeforeAddGlobalDirectionalLight(); + /// + /// BOOL DeleteGlobalDirectionalLight(int index) + /// + public bool DeleteGlobalDirectionalLight(int index) + { + BeforeDeleteGlobalDirectionalLight(index); + var val = new int[2]; + val[0]=index; + NativeMethods.MQScene_IntValue(this,(int)MQScene.DeleteMultilight,val); + return val[1] != 0; + } + + partial void BeforeDeleteGlobalDirectionalLight(int index); + /// + /// int GetGlobalDirectionalLightNum() + /// + public int GlobalDirectionalLightNum + { + get + { + var val = new int[1]; + NativeMethods.MQScene_IntValue(this,(int)MQScene.GetMultilightNumber,val); + return val[0]; + } + } + + /// + /// MQPoint GetGlobalDirectionalLightDirection(int index) + /// + public Point GetGlobalDirectionalLightDirection(int index) + { + BeforeGetGlobalDirectionalLightDirection(index); + var val = new float[3]; + NativeMethods.MQScene_IntValue(this,(int)MQScene.SetMultilightIndex,new[]{index}); + NativeMethods.MQScene_FloatValue(this,(int)MQScene.GetMultilightDir,val); + return new Point(val[0],val[1],val[2]); + } + + partial void BeforeGetGlobalDirectionalLightDirection(int index); + /// + /// MQColor GetGlobalDirectionalLightColor(int index) + /// + public Color GetGlobalDirectionalLightColor(int index) + { + BeforeGetGlobalDirectionalLightColor(index); + var val = new float[3]; + NativeMethods.MQScene_IntValue(this,(int)MQScene.SetMultilightIndex,new[]{index}); + NativeMethods.MQScene_FloatValue(this,(int)MQScene.GetMultilightColor,val); + return new Color(val[0],val[1],val[2]); + } + + partial void BeforeGetGlobalDirectionalLightColor(int index); + /// + /// void SetGlobalDirectionalLightDirection(int index, const MQPoint& dir) + /// + public void SetGlobalDirectionalLightDirection(int index, ref Point dir) + { + var val = new float[3]; + NativeMethods.MQScene_IntValue(this,(int)MQScene.SetMultilightIndex,new[]{index}); + val[0]=dir.X; + val[1]=dir.Y; + val[2]=dir.Z; + NativeMethods.MQScene_FloatValue(this,(int)MQScene.SetMultilightDir,val); + } + + /// + /// void SetGlobalDirectionalLightColor(int index, const MQColor& col) + /// + public void SetGlobalDirectionalLightColor(int index, ref Color col) + { + var val = new float[3]; + NativeMethods.MQScene_IntValue(this,(int)MQScene.SetMultilightIndex,new[]{index}); + val[0]=col.R; + val[1]=col.G; + val[2]=col.B; + NativeMethods.MQScene_FloatValue(this,(int)MQScene.SetMultilightColor,val); + } + } /// @@ -894,6 +1142,16 @@ public int GetVertexIndexFromUniqueId(uint unique_id) partial void BeforeGetVertexIndexFromUniqueId(uint unique_id); /// + /// int GetVertexRelatedFaces(int vertex, int *faces) + /// + public int GetVertexRelatedFaces(int vertex, int[] faces) + { + BeforeGetVertexRelatedFaces(vertex, faces); + return NativeMethods.MQObj_GetVertexRelatedFaces(this, vertex, faces); + } + + partial void BeforeGetVertexRelatedFaces(int vertex, int[] faces); + /// /// float GetVertexWeight(int index) /// public float GetVertexWeight(int index) @@ -1077,6 +1335,46 @@ public void SetFaceVertexColor(int face, int vertex, uint color) partial void BeforeSetFaceVertexColor(int face, int vertex, uint color); /// + /// float GetFaceEdgeCrease(int face, int line) + /// + public float GetFaceEdgeCrease(int face, int line) + { + BeforeGetFaceEdgeCrease(face, line); + return NativeMethods.MQObj_GetFaceEdgeCrease(this, face, line ); + } + + partial void BeforeGetFaceEdgeCrease(int face, int line); + /// + /// void SetFaceEdgeCrease(int face, int line, float crease) + /// + public void SetFaceEdgeCrease(int face, int line, float crease) + { + BeforeSetFaceEdgeCrease(face, line, crease); + NativeMethods.MQObj_SetFaceEdgeCrease(this, face, line, crease); + } + + partial void BeforeSetFaceEdgeCrease(int face, int line, float crease); + /// + /// BOOL GetFaceVisible(int face) + /// + public bool GetFaceVisible(int face) + { + BeforeGetFaceVisible(face); + return NativeMethods.MQObj_GetFaceVisible(this, face); + } + + partial void BeforeGetFaceVisible(int face); + /// + /// void SetFaceVisible(int face, BOOL flag) + /// + public void SetFaceVisible(int face, bool flag) + { + BeforeSetFaceVisible(face, flag); + NativeMethods.MQObj_SetFaceVisible(this, face, flag); + } + + partial void BeforeSetFaceVisible(int face, bool flag); + /// /// void OptimizeVertex(float distance, MQBool *apply) /// public void OptimizeVertex(float distance, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.I1)] bool[] apply) @@ -1144,6 +1442,22 @@ public int PatchSegment } } + /// + /// BOOL GetPatchTriangle() + /// + public bool PatchTriangle + { + get + { + return NativeMethods.MQObj_GetIntValue(this, (int)ObjId.PatchTriangle) != 0; + } + set + { + var flag = value; + NativeMethods.MQObj_SetIntValue(this, (int)ObjId.PatchTriangle, flag ? 1 : 0); + } + } + /// /// int GetShading() /// @@ -1470,6 +1784,292 @@ public Matrix LocalInverseMatrix } } + /// + /// int GetType() + /// + public ObjectType Type + { + get + { + return (ObjectType)NativeMethods.MQObj_GetIntValue(this, (int)ObjId.Type); + } + set + { + var type = value; + NativeMethods.MQObj_SetIntValue(this, (int)ObjId.Type, (int)type); + } + } + + /// + /// float GetLightValue() + /// + public float LightValue + { + get + { + var val = new float[1]; + NativeMethods.MQObj_GetFloatArray(this, (int)ObjId.LightValue, val); + return val[0]; + } + set + { + var val = new float[1]; + val[0]=value; + NativeMethods.MQObj_SetFloatArray(this, (int)ObjId.LightValue, val); + } + } + + /// + /// int GetLightAttenuation() + /// + public int LightAttenuation + { + get + { + return NativeMethods.MQObj_GetIntValue(this, (int)ObjId.LightAttenuation); + } + set + { + NativeMethods.MQObj_SetIntValue(this, (int)ObjId.LightAttenuation, value); + } + } + + /// + /// float GetLightFallOffEnd() + /// + public float LightFallOffEnd + { + get + { + var val = new float[1]; + NativeMethods.MQObj_GetFloatArray(this, (int)ObjId.LightFalloffEnd, val); + return val[0]; + } + set + { + var distance = value; + var val = new float[1]; + val[0]=distance; + NativeMethods.MQObj_SetFloatArray(this, (int)ObjId.LightFalloffEnd, val); + } + } + + /// + /// float GetLightFallOffHalf() + /// + public float LightFallOffHalf + { + get + { + var val = new float[1]; + NativeMethods.MQObj_GetFloatArray(this, (int)ObjId.LightFalloffHalf, val); + return val[0]; + } + set + { + var distance = value; + var val = new float[1]; + val[0]=distance; + NativeMethods.MQObj_SetFloatArray(this, (int)ObjId.LightFalloffHalf, val); + } + } + + /// + /// BOOL GetSelected() + /// + public bool Selected + { + get + { + return NativeMethods.MQObj_GetIntValue(this, (int)ObjId.Selected) != 0; + } + set + { + var flag = value; + NativeMethods.MQObj_SetIntValue(this, (int)ObjId.Selected, flag ? 1 : 0); + } + } + + /// + /// BOOL AllocUserData(int userdata_id) + /// + public bool AllocUserData(int userdata_id) + { + BeforeAllocUserData(userdata_id); + return NativeMethods.MQObj_AllocUserData(this, userdata_id); + } + + partial void BeforeAllocUserData(int userdata_id); + /// + /// void FreeUserData(int userdata_id) + /// + public void FreeUserData(int userdata_id) + { + BeforeFreeUserData(userdata_id); + NativeMethods.MQObj_FreeUserData(this, userdata_id); + } + + partial void BeforeFreeUserData(int userdata_id); + /// + /// BOOL GetUserData(int userdata_id, void *buffer) + /// + public bool GetUserData(int userdata_id, byte[] buffer) + { + BeforeGetUserData(userdata_id, buffer); + return NativeMethods.MQObj_GetUserData(this, userdata_id, 0, 0, buffer); + } + + partial void BeforeGetUserData(int userdata_id, byte[] buffer); + /// + /// BOOL GetUserDataPart(int userdata_id, int offset, int copy_bytes, void *buffer) + /// + public bool GetUserDataPart(int userdata_id, int offset, int copy_bytes, byte[] buffer) + { + BeforeGetUserDataPart(userdata_id, offset, copy_bytes, buffer); + return NativeMethods.MQObj_GetUserData(this, userdata_id, offset, copy_bytes, buffer); + } + + partial void BeforeGetUserDataPart(int userdata_id, int offset, int copy_bytes, byte[] buffer); + /// + /// BOOL SetUserData(int userdata_id, const void *buffer) + /// + public bool SetUserData(int userdata_id, byte[] buffer) + { + BeforeSetUserData(userdata_id, buffer); + return NativeMethods.MQObj_SetUserData(this, userdata_id, 0, 0, buffer); + } + + partial void BeforeSetUserData(int userdata_id, byte[] buffer); + /// + /// BOOL SetUserDataPart(int userdata_id, int offset, int copy_bytes, const void *buffer) + /// + public bool SetUserDataPart(int userdata_id, int offset, int copy_bytes, byte[] buffer) + { + BeforeSetUserDataPart(userdata_id, offset, copy_bytes, buffer); + return NativeMethods.MQObj_SetUserData(this, userdata_id, offset, copy_bytes, buffer); + } + + partial void BeforeSetUserDataPart(int userdata_id, int offset, int copy_bytes, byte[] buffer); + /// + /// BOOL AllocVertexUserData(int userdata_id) + /// + public bool AllocVertexUserData(int userdata_id) + { + BeforeAllocVertexUserData(userdata_id); + return NativeMethods.MQObj_AllocVertexUserData(this, userdata_id); + } + + partial void BeforeAllocVertexUserData(int userdata_id); + /// + /// void FreeVertexUserData(int userdata_id) + /// + public void FreeVertexUserData(int userdata_id) + { + BeforeFreeVertexUserData(userdata_id); + NativeMethods.MQObj_FreeVertexUserData(this, userdata_id); + } + + partial void BeforeFreeVertexUserData(int userdata_id); + /// + /// BOOL GetVertexUserData(int userdata_id, int vertex_index, void *buffer) + /// + public bool GetVertexUserData(int userdata_id, int vertex_index, byte[] buffer) + { + BeforeGetVertexUserData(userdata_id, vertex_index, buffer); + return NativeMethods.MQObj_GetVertexUserData(this, userdata_id, vertex_index, 1, 0, 0, buffer); + } + + partial void BeforeGetVertexUserData(int userdata_id, int vertex_index, byte[] buffer); + /// + /// BOOL GetVertexUserDataPart(int userdata_id, int vertex_start_index, int copy_vertex_num, int offset, int copy_bytes, void *buffer) + /// + public bool GetVertexUserDataPart(int userdata_id, int vertex_start_index, int copy_vertex_num, int offset, int copy_bytes, byte[] buffer) + { + BeforeGetVertexUserDataPart(userdata_id, vertex_start_index, copy_vertex_num, offset, copy_bytes, buffer); + return NativeMethods.MQObj_GetVertexUserData(this, userdata_id, vertex_start_index, copy_vertex_num, offset, copy_bytes, buffer); + } + + partial void BeforeGetVertexUserDataPart(int userdata_id, int vertex_start_index, int copy_vertex_num, int offset, int copy_bytes, byte[] buffer); + /// + /// BOOL SetVertexUserData(int userdata_id, int vertex_index, const void *buffer) + /// + public bool SetVertexUserData(int userdata_id, int vertex_index, byte[] buffer) + { + BeforeSetVertexUserData(userdata_id, vertex_index, buffer); + return NativeMethods.MQObj_SetVertexUserData(this, userdata_id, vertex_index, 1, 0, 0, buffer); + } + + partial void BeforeSetVertexUserData(int userdata_id, int vertex_index, byte[] buffer); + /// + /// BOOL SetVertexUserDataPart(int userdata_id, int vertex_start_index, int copy_vertex_num, int offset, int copy_bytes, const void *buffer) + /// + public bool SetVertexUserDataPart(int userdata_id, int vertex_start_index, int copy_vertex_num, int offset, int copy_bytes, byte[] buffer) + { + BeforeSetVertexUserDataPart(userdata_id, vertex_start_index, copy_vertex_num, offset, copy_bytes, buffer); + return NativeMethods.MQObj_SetVertexUserData(this, userdata_id, vertex_start_index, copy_vertex_num, offset, copy_bytes, buffer); + } + + partial void BeforeSetVertexUserDataPart(int userdata_id, int vertex_start_index, int copy_vertex_num, int offset, int copy_bytes, byte[] buffer); + /// + /// BOOL AllocFaceUserData(int userdata_id) + /// + public bool AllocFaceUserData(int userdata_id) + { + BeforeAllocFaceUserData(userdata_id); + return NativeMethods.MQObj_AllocFaceUserData(this, userdata_id); + } + + partial void BeforeAllocFaceUserData(int userdata_id); + /// + /// void FreeFaceUserData(int userdata_id) + /// + public void FreeFaceUserData(int userdata_id) + { + BeforeFreeFaceUserData(userdata_id); + NativeMethods.MQObj_FreeFaceUserData(this, userdata_id); + } + + partial void BeforeFreeFaceUserData(int userdata_id); + /// + /// BOOL GetFaceUserData(int userdata_id, int face_index, void *buffer) + /// + public bool GetFaceUserData(int userdata_id, int face_index, byte[] buffer) + { + BeforeGetFaceUserData(userdata_id, face_index, buffer); + return NativeMethods.MQObj_GetFaceUserData(this, userdata_id, face_index, 1, 0, 0, buffer); + } + + partial void BeforeGetFaceUserData(int userdata_id, int face_index, byte[] buffer); + /// + /// BOOL GetFaceUserDataPart(int userdata_id, int face_start_index, int copy_face_num, int offset, int copy_bytes, void *buffer) + /// + public bool GetFaceUserDataPart(int userdata_id, int face_start_index, int copy_face_num, int offset, int copy_bytes, byte[] buffer) + { + BeforeGetFaceUserDataPart(userdata_id, face_start_index, copy_face_num, offset, copy_bytes, buffer); + return NativeMethods.MQObj_GetFaceUserData(this, userdata_id, face_start_index, copy_face_num, offset, copy_bytes, buffer); + } + + partial void BeforeGetFaceUserDataPart(int userdata_id, int face_start_index, int copy_face_num, int offset, int copy_bytes, byte[] buffer); + /// + /// BOOL SetFaceUserData(int userdata_id, int face_index, const void *buffer) + /// + public bool SetFaceUserData(int userdata_id, int face_index, byte[] buffer) + { + BeforeSetFaceUserData(userdata_id, face_index, buffer); + return NativeMethods.MQObj_SetFaceUserData(this, userdata_id, face_index, 1, 0, 0, buffer); + } + + partial void BeforeSetFaceUserData(int userdata_id, int face_index, byte[] buffer); + /// + /// BOOL SetFaceUserDataPart(int userdata_id, int face_start_index, int copy_face_num, int offset, int copy_bytes, const void *buffer) + /// + public bool SetFaceUserDataPart(int userdata_id, int face_start_index, int copy_face_num, int offset, int copy_bytes, byte[] buffer) + { + BeforeSetFaceUserDataPart(userdata_id, face_start_index, copy_face_num, offset, copy_bytes, buffer); + return NativeMethods.MQObj_SetFaceUserData(this, userdata_id, face_start_index, copy_face_num, offset, copy_bytes, buffer); + } + + partial void BeforeSetFaceUserDataPart(int userdata_id, int face_start_index, int copy_face_num, int offset, int copy_bytes, byte[] buffer); } /// @@ -1556,6 +2156,37 @@ public MaterialVertexcolor VertexColor } } + /// + /// BOOL GetSelected() + /// + public bool Selected + { + get + { + return NativeMethods.MQMat_GetIntValue(this, (int)MatId.Selected) != 0; + } + set + { + var flag = value; + NativeMethods.MQMat_SetIntValue(this, (int)MatId.Selected, flag ? 1 : 0); + } + } + + /// + /// BOOL GetDoubleSided() + /// + public bool DoubleSided + { + get + { + return NativeMethods.MQMat_GetIntValue(this, (int)MatId.Doublesided) != 0; + } + set + { + NativeMethods.MQMat_SetIntValue(this, (int)MatId.Doublesided, value ? 1: 0); + } + } + /// /// MQColor GetColor() /// @@ -1816,6 +2447,66 @@ public void SetBumpName(string name) } partial void BeforeSetBumpName(string name); + /// + /// BOOL AllocUserData(int userdata_id) + /// + public bool AllocUserData(int userdata_id) + { + BeforeAllocUserData(userdata_id); + return NativeMethods.MQMat_AllocUserData(this, userdata_id); + } + + partial void BeforeAllocUserData(int userdata_id); + /// + /// void FreeUserData(int userdata_id) + /// + public void FreeUserData(int userdata_id) + { + BeforeFreeUserData(userdata_id); + NativeMethods.MQMat_FreeUserData(this, userdata_id); + } + + partial void BeforeFreeUserData(int userdata_id); + /// + /// BOOL GetUserData(int userdata_id, void *buffer) + /// + public bool GetUserData(int userdata_id, byte[] buffer) + { + BeforeGetUserData(userdata_id, buffer); + return NativeMethods.MQMat_GetUserData(this, userdata_id, 0, 0, buffer); + } + + partial void BeforeGetUserData(int userdata_id, byte[] buffer); + /// + /// BOOL GetUserDataPart(int userdata_id, int offset, int copy_bytes, void *buffer) + /// + public bool GetUserDataPart(int userdata_id, int offset, int copy_bytes, byte[] buffer) + { + BeforeGetUserDataPart(userdata_id, offset, copy_bytes, buffer); + return NativeMethods.MQMat_GetUserData(this, userdata_id, offset, copy_bytes, buffer); + } + + partial void BeforeGetUserDataPart(int userdata_id, int offset, int copy_bytes, byte[] buffer); + /// + /// BOOL SetUserData(int userdata_id, const void *buffer) + /// + public bool SetUserData(int userdata_id, byte[] buffer) + { + BeforeSetUserData(userdata_id, buffer); + return NativeMethods.MQMat_SetUserData(this, userdata_id, 0, 0, buffer); + } + + partial void BeforeSetUserData(int userdata_id, byte[] buffer); + /// + /// BOOL SetUserDataPart(int userdata_id, int offset, int copy_bytes, const void *buffer) + /// + public bool SetUserDataPart(int userdata_id, int offset, int copy_bytes, byte[] buffer) + { + BeforeSetUserDataPart(userdata_id, offset, copy_bytes, buffer); + return NativeMethods.MQMat_SetUserData(this, userdata_id, offset, copy_bytes, buffer); + } + + partial void BeforeSetUserDataPart(int userdata_id, int offset, int copy_bytes, byte[] buffer); } } diff --git a/Metasequoia.Sharp/Classes/Classes.tt b/Metasequoia.Sharp/Classes/Classes.tt index 37ec7de..6803a7b 100644 --- a/Metasequoia.Sharp/Classes/Classes.tt +++ b/Metasequoia.Sharp/Classes/Classes.tt @@ -18,7 +18,13 @@ namespace Metasequoia <# var path = Path.Combine(Path.GetDirectoryName(this.Host.TemplateFile), "..", "..", "mqsdk", "MQPlugin.h"); var enc = Encoding.GetEncoding(932); -var regex = new Regex(@"^inline (?\w+)\s+MQC(?\w+)\:\:(?\w+)\((?.*?)\)\s*\{(?(.|\n)+?)\}", RegexOptions.Compiled | RegexOptions.Multiline); +var regex = new Regex(@"^inline (?\w+)\s+MQC(?\w+)\:\:(?\w+)\((?.*?)\)\s*\{(?(\{(.|\n)*?\}|.|\n)+?)\}", RegexOptions.Compiled | RegexOptions.Multiline); +var ignore = new[] +{ + "Document.GetMappingImageSize", + "Document.CreateUserData", + "Document.FindUserData", +}; var defs = regex.Matches(File.ReadAllText(path, enc).Replace("\r\n", "\n")) .Cast() .Select(_ => @@ -34,7 +40,8 @@ var defs = regex.Matches(File.ReadAllText(path, enc).Replace("\r\n", "\n")) Content = _.Groups["content"].Value, Handled = new[] { false }, }; - }); + }) + .Where(_ => !ignore.Contains(_.ClassName + "." + _.MethodName)); var map = new Dictionary { { "MQMatrix&", "ref Matrix" }, @@ -54,7 +61,9 @@ var map = new Dictionary { "uint map_type", "Mapping map_type" }, { "float *", "float[] " }, { "int *", "int[] " }, + { "int&", "out int" }, { "UINT", "uint" }, + { "void *", "byte[] " }, { "MQ", "" }, }; var flagMap = new Dictionary @@ -67,6 +76,7 @@ var flagMap = new Dictionary { "Object.GetMirrorAxis", new[] { "ObjectMirrorAxis", "axis" } }, { "Object.GetLatheType", new[] { "ObjectLathe", "type", "int" } }, { "Object.GetLatheAxis", new[] { "ObjectLatheAxis", "axis" } }, + { "Object.GetType", new[] { "ObjectType", "type", "int" } }, { "Material.GetShader", new[] { "MaterialShader", "shader", "int" } }, { "Material.GetVertexColor", new[] { "MaterialVertexcolor", "value", "int" } }, { "Material.GetMappingType", new[] { "MaterialProjection", "type", "int" } }, @@ -184,6 +194,13 @@ foreach (var k in defs.GroupBy(_ => _.ClassName)) .Replace("MQObj_GetFaceCoordinateArray(this, face, uvarray);", "unsafe { fixed (void* ptr = uvarray) MQObj_GetFaceCoordinateArray(this, face, (IntPtr)ptr); }") .Replace("MQObj_SetFaceCoordinateArray(this, face, uvarray);", "unsafe { fixed (void* ptr = uvarray) MQObj_SetFaceCoordinateArray(this, face, (IntPtr)ptr); }") + .Replace("return MQDoc_GetUnusedObjectName", "MQDoc_GetUnusedObjectName") + .Replace("return MQDoc_GetUnusedMaterialName", "MQDoc_GetUnusedMaterialName") + .Replace("MQObj_GetIntValue(this, MQOBJ_ID_SELECTED)", "MQObj_GetIntValue(this, MQOBJ_ID_SELECTED) != 0") + .Replace("MQObj_SetIntValue(this, MQOBJ_ID_SELECTED, flag)", "MQObj_SetIntValue(this, MQOBJ_ID_SELECTED, flag ? 1 : 0)") + .Replace("MQMat_GetIntValue(this, MQMAT_ID_SELECTED)", "MQMat_GetIntValue(this, MQMAT_ID_SELECTED) != 0") + .Replace("MQMat_SetIntValue(this, MQMAT_ID_SELECTED, flag)", "MQMat_SetIntValue(this, MQMAT_ID_SELECTED, flag ? 1 : 0)") + .Replace("if (w != NULL) *w", "w") .Replace("; ", ";\r\n\t\t\t") @@ -217,9 +234,23 @@ foreach (var k in defs.GroupBy(_ => _.ClassName)) .Replace("MQPoint(", "new Point(") .Replace("MQAngle(", "new Angle(") .Replace("VALID, flag)", "VALID, flag ? 1 : 0)") + .Replace("!= 0 ? TRUE : FALSE", "!= 0") .Replace("? TRUE : FALSE", "!= 0") + .Replace("MQUSERDATA_OBJECT", "(int)Userdata.Object") + .Replace("MQUSERDATA_VERTEX", "(int)Userdata.Vertex") + .Replace("MQUSERDATA_FACE", "(int)Userdata.Face") + .Replace("MQUSERDATA_MATERIAL", "(int)Userdata.Material") + .Replace("MQUserDataInfo", "UserDataInfo") + + .Replace("int val[1];", "var val = new int[1];") + .Replace("int val[2];", "var val = new int[2];") + .Replace("int val[3];", "var val = new int[3];") + .Replace("MQSCENE_SET_MULTILIGHT_INDEX,&index", "MQSCENE_SET_MULTILIGHT_INDEX,new[]{index}") + .Replace("TRUE", "true") + .Replace("FALSE", "false") + .Replace("NULL", "null") .Replace("MQ", "NativeMethods.MQ") .Replace("\n", "\r\n") .Replace("\r\r\n", "\r\n"); diff --git a/Metasequoia.Sharp/Classes/Document.cs b/Metasequoia.Sharp/Classes/Document.cs index cb7fd76..03138aa 100644 --- a/Metasequoia.Sharp/Classes/Document.cs +++ b/Metasequoia.Sharp/Classes/Document.cs @@ -1,4 +1,7 @@ -using System.Text; +using System; +using System.Runtime.InteropServices; +using System.Linq; +using System.Text; namespace Metasequoia { @@ -29,6 +32,34 @@ public ReadOnlyIndexer Materials private set; } + public string GetUnusedObjectName() + { + return GetUnusedObjectName(null); + } + + public string GetUnusedObjectName(string basename) + { + var sb = new StringBuilder(Object.NameBufferLength); + + this.GetUnusedObjectName(sb, sb.Capacity, basename); + + return sb.ToString(); + } + + public string GetUnusedMaterialName() + { + return GetUnusedMaterialName(null); + } + + public string GetUnusedMaterialName(string basename) + { + var sb = new StringBuilder(Material.NameBufferLength); + + this.GetUnusedMaterialName(sb, sb.Capacity, basename); + + return sb.ToString(); + } + public string FindMappingFile(string filename, Mapping mapType) { var sb = new StringBuilder(Material.TextureNameBufferLength); @@ -52,5 +83,80 @@ partial void BeforeAddMaterial(Material mat) { mat.deletable = false; } + + #region Interop + + /// + /// BOOL GetMappingImageSize(const char *filename, DWORD map_type, int& width, int& height) + /// + public unsafe bool GetMappingImageSize(string filename, Mapping mapType, out int width, out int height) + { + var array = new IntPtr[5]; + int bpp; + IntPtr buffer; + + fixed (int* widthp = &width) + fixed (int* heightp = &height) + { + array[0] = (IntPtr)widthp; + array[1] = (IntPtr)heightp; + array[2] = (IntPtr)(&bpp); + array[3] = IntPtr.Zero; + array[4] = (IntPtr)(&buffer); + + if (!NativeMethods.MQDoc_GetMappingImage(this, filename, (uint)mapType, array)) + { + width = height = 0; + return false; + } + } + + return true; + } + + /// + /// int CreateUserData(DWORD productID, DWORD pluginID, const char *identifier, int userdata_type, int bytes_per_object) + /// + public int CreateUserData(uint productID, uint pluginID, string identifier, int userdata_type, int bytes_per_object) + { + BeforeCreateUserData(productID, pluginID, identifier, userdata_type, bytes_per_object); + + var info = new UserDataInfo + { + dwSize = (uint)Marshal.SizeOf(typeof(UserDataInfo)), + ProductID = productID, + PluginID = pluginID, + Identifier = Plugin.Get932(identifier).Take(15).Concat(new byte[] { 0 }).ToArray(), + UserdataType = userdata_type, + BytesPerElement = bytes_per_object, + Create = true, + }; + + return NativeMethods.MQDoc_CreateUserData(this, ref info); + } + + partial void BeforeCreateUserData(uint productID, uint pluginID, string identifier, int userdata_type, int bytes_per_object); + /// + /// int FindUserData(DWORD productID, DWORD pluginID, const char *identifier, int userdata_type) + /// + public int FindUserData(uint productID, uint pluginID, string identifier, int userdata_type) + { + BeforeFindUserData(productID, pluginID, identifier, userdata_type); + + var info = new UserDataInfo + { + dwSize = (uint)Marshal.SizeOf(typeof(UserDataInfo)), + ProductID = productID, + PluginID = pluginID, + Identifier = Plugin.Get932(identifier).Take(15).Concat(new byte[] { 0 }).ToArray(), + UserdataType = userdata_type, + BytesPerElement = 0, + }; + + return NativeMethods.MQDoc_CreateUserData(this, ref info); + } + partial void BeforeFindUserData(uint productID, uint pluginID, string identifier, int userdata_type); + + #endregion } } diff --git a/Metasequoia.Sharp/Enums/Enums.Generated.cs b/Metasequoia.Sharp/Enums/Enums.Generated.cs index 7ef7e54..9711375 100644 --- a/Metasequoia.Sharp/Enums/Enums.Generated.cs +++ b/Metasequoia.Sharp/Enums/Enums.Generated.cs @@ -12,7 +12,7 @@ partial class Plugin /// /// MQPLUGIN_VERSION /// - public const int Version = 0x0249; + public const int Version = 0x0311; } public enum PluginType @@ -339,6 +339,26 @@ public enum Mapping Bump = 3, } + public enum Userdata + { + /// + /// MQUSERDATA_OBJECT + /// + Object = 1, + /// + /// MQUSERDATA_MATERIAL + /// + Material = 2, + /// + /// MQUSERDATA_VERTEX + /// + Vertex = 3, + /// + /// MQUSERDATA_FACE + /// + Face = 4, + } + public enum MQScene { /// @@ -405,6 +425,54 @@ public enum MQScene /// MQSCENE_CONVERT_SCREEN_TO_3D /// ConvertScreenTo3d = 0x301, + /// + /// MQSCENE_ADD_MULTILIGHT + /// + AddMultilight = 0x400, + /// + /// MQSCENE_DELETE_MULTILIGHT + /// + DeleteMultilight = 0x401, + /// + /// MQSCENE_GET_MULTILIGHT_NUMBER + /// + GetMultilightNumber = 0x402, + /// + /// MQSCENE_SET_MULTILIGHT_INDEX + /// + SetMultilightIndex = 0x403, + /// + /// MQSCENE_GET_MULTILIGHT_DIR + /// + GetMultilightDir = 0x404, + /// + /// MQSCENE_SET_MULTILIGHT_DIR + /// + SetMultilightDir = 0x405, + /// + /// MQSCENE_GET_MULTILIGHT_COLOR + /// + GetMultilightColor = 0x406, + /// + /// MQSCENE_SET_MULTILIGHT_COLOR + /// + SetMultilightColor = 0x407, + } + + public enum ObjectType + { + /// + /// MQOBJECT_TYPE_NORMAL + /// + Normal = 0, + /// + /// MQOBJECT_TYPE_POINT_LIGHT + /// + PointLight = 1, + /// + /// MQOBJECT_TYPE_DIRECTIONAL_LIGHT + /// + DirectionalLight = 2, } [Flags] @@ -621,6 +689,18 @@ public enum ObjId /// UniqueId = 0x104, /// + /// MQOBJ_ID_TYPE + /// + Type = 0x105, + /// + /// MQOBJ_ID_SELECTED + /// + Selected = 0x106, + /// + /// MQOBJ_ID_PATCH_TRIANGLE + /// + PatchTriangle = 0x107, + /// /// MQOBJ_ID_COLOR /// Color = 0x201, @@ -648,6 +728,22 @@ public enum ObjId /// MQOBJ_ID_LOCAL_INVERSE_MATRIX /// LocalInverseMatrix = 0x305, + /// + /// MQOBJ_ID_LIGHT_VALUE + /// + LightValue = 0x401, + /// + /// MQOBJ_ID_LIGHT_ATTENUATION + /// + LightAttenuation = 0x402, + /// + /// MQOBJ_ID_LIGHT_FALLOFF_END + /// + LightFalloffEnd = 0x403, + /// + /// MQOBJ_ID_LIGHT_FALLOFF_HALF + /// + LightFalloffHalf = 0x404, } public enum MatId @@ -665,6 +761,14 @@ public enum MatId /// UniqueId = 0x103, /// + /// MQMAT_ID_DOUBLESIDED + /// + Doublesided = 0x104, + /// + /// MQMAT_ID_SELECTED + /// + Selected = 0x106, + /// /// MQMAT_ID_MAPPROJ /// Mapproj = 0x301, diff --git a/Metasequoia.Sharp/Enums/Enums.tt b/Metasequoia.Sharp/Enums/Enums.tt index d156d0d..e7cd448 100644 --- a/Metasequoia.Sharp/Enums/Enums.tt +++ b/Metasequoia.Sharp/Enums/Enums.tt @@ -30,7 +30,9 @@ var enums = regex.Matches(File.ReadAllText(path, enc).Replace("\r\n", "\n")) .Replace("file_type", "fileType") .Replace("object_lathe_x", "object_lathe_axis_x") .Replace("object_lathe_y", "object_lathe_axis_y") - .Replace("object_lathe_z", "object_lathe_axis_z"); + .Replace("object_lathe_z", "object_lathe_axis_z") + .Replace("point_light", "pointLight") + .Replace("directional_light", "directionalLight"); var idx = name.StartsWith("plugin_type") || name.StartsWith("object_") || name.StartsWith("material_") ? name.LastIndexOf('_') : name.IndexOf('_'); diff --git a/Metasequoia.Sharp/NativeMethods.Generated.cs b/Metasequoia.Sharp/NativeMethods.Generated.cs index 134c465..512ea21 100644 --- a/Metasequoia.Sharp/NativeMethods.Generated.cs +++ b/Metasequoia.Sharp/NativeMethods.Generated.cs @@ -45,18 +45,23 @@ internal static bool Initialize() MQ_SendMessage = GetDelegate(hModule, "MQ_SendMessage"); MQDoc_GetObjectCount = GetDelegate(hModule, "MQDoc_GetObjectCount"); MQDoc_GetObject = GetDelegate(hModule, "MQDoc_GetObject"); + MQDoc_GetObjectFromUniqueID = GetDelegate(hModule, "MQDoc_GetObjectFromUniqueID"); MQDoc_GetCurrentObjectIndex = GetDelegate(hModule, "MQDoc_GetCurrentObjectIndex"); MQDoc_SetCurrentObjectIndex = GetDelegate(hModule, "MQDoc_SetCurrentObjectIndex"); MQDoc_AddObject = GetDelegate(hModule, "MQDoc_AddObject"); MQDoc_DeleteObject = GetDelegate(hModule, "MQDoc_DeleteObject"); MQDoc_GetObjectIndex = GetDelegate(hModule, "MQDoc_GetObjectIndex"); + MQDoc_GetUnusedObjectName = GetDelegate(hModule, "MQDoc_GetUnusedObjectName"); MQDoc_GetMaterialCount = GetDelegate(hModule, "MQDoc_GetMaterialCount"); MQDoc_GetMaterial = GetDelegate(hModule, "MQDoc_GetMaterial"); + MQDoc_GetMaterialFromUniqueID = GetDelegate(hModule, "MQDoc_GetMaterialFromUniqueID"); MQDoc_GetCurrentMaterialIndex = GetDelegate(hModule, "MQDoc_GetCurrentMaterialIndex"); MQDoc_SetCurrentMaterialIndex = GetDelegate(hModule, "MQDoc_SetCurrentMaterialIndex"); MQDoc_AddMaterial = GetDelegate(hModule, "MQDoc_AddMaterial"); MQDoc_DeleteMaterial = GetDelegate(hModule, "MQDoc_DeleteMaterial"); + MQDoc_GetUnusedMaterialName = GetDelegate(hModule, "MQDoc_GetUnusedMaterialName"); MQDoc_FindMappingFile = GetDelegate(hModule, "MQDoc_FindMappingFile"); + MQDoc_GetMappingImage = GetDelegate(hModule, "MQDoc_GetMappingImage"); MQDoc_Compact = GetDelegate(hModule, "MQDoc_Compact"); MQDoc_ClearSelect = GetDelegate(hModule, "MQDoc_ClearSelect"); MQDoc_AddSelectVertex = GetDelegate(hModule, "MQDoc_AddSelectVertex"); @@ -78,11 +83,14 @@ internal static bool Initialize() MQDoc_GetGlobalMatrix = GetDelegate(hModule, "MQDoc_GetGlobalMatrix"); MQDoc_GetGlobalInverseMatrix = GetDelegate(hModule, "MQDoc_GetGlobalInverseMatrix"); MQDoc_InsertObject = GetDelegate(hModule, "MQDoc_InsertObject"); + MQDoc_CreateUserData = GetDelegate(hModule, "MQDoc_CreateUserData"); + MQDoc_DeleteUserData = GetDelegate(hModule, "MQDoc_DeleteUserData"); MQScene_InitSize = GetDelegate(hModule, "MQScene_InitSize"); MQScene_GetProjMatrix = GetDelegate(hModule, "MQScene_GetProjMatrix"); MQScene_GetViewMatrix = GetDelegate(hModule, "MQScene_GetViewMatrix"); MQScene_FloatValue = GetDelegate(hModule, "MQScene_FloatValue"); MQScene_GetVisibleFace = GetDelegate(hModule, "MQScene_GetVisibleFace"); + MQScene_IntValue = GetDelegate(hModule, "MQScene_IntValue"); MQObj_Delete = GetDelegate(hModule, "MQObj_Delete"); MQObj_Clone = GetDelegate(hModule, "MQObj_Clone"); MQObj_Merge = GetDelegate(hModule, "MQObj_Merge"); @@ -105,6 +113,7 @@ internal static bool Initialize() MQObj_GetVertexRefCount = GetDelegate(hModule, "MQObj_GetVertexRefCount"); MQObj_GetVertexUniqueID = GetDelegate(hModule, "MQObj_GetVertexUniqueID"); MQObj_GetVertexIndexFromUniqueID = GetDelegate(hModule, "MQObj_GetVertexIndexFromUniqueID"); + MQObj_GetVertexRelatedFaces = GetDelegate(hModule, "MQObj_GetVertexRelatedFaces"); MQObj_GetVertexWeight = GetDelegate(hModule, "MQObj_GetVertexWeight"); MQObj_SetVertexWeight = GetDelegate(hModule, "MQObj_SetVertexWeight"); MQObj_CopyVertexAttribute = GetDelegate(hModule, "MQObj_CopyVertexAttribute"); @@ -115,6 +124,10 @@ internal static bool Initialize() MQObj_SetFaceCoordinateArray = GetDelegate(hModule, "MQObj_SetFaceCoordinateArray"); MQObj_GetFaceVertexColor = GetDelegate(hModule, "MQObj_GetFaceVertexColor"); MQObj_SetFaceVertexColor = GetDelegate(hModule, "MQObj_SetFaceVertexColor"); + MQObj_GetFaceEdgeCrease = GetDelegate(hModule, "MQObj_GetFaceEdgeCrease"); + MQObj_SetFaceEdgeCrease = GetDelegate(hModule, "MQObj_SetFaceEdgeCrease"); + MQObj_GetFaceVisible = GetDelegate(hModule, "MQObj_GetFaceVisible"); + MQObj_SetFaceVisible = GetDelegate(hModule, "MQObj_SetFaceVisible"); MQObj_OptimizeVertex = GetDelegate(hModule, "MQObj_OptimizeVertex"); MQObj_Compact = GetDelegate(hModule, "MQObj_Compact"); MQObj_GetVisible = GetDelegate(hModule, "MQObj_GetVisible"); @@ -143,6 +156,18 @@ internal static bool Initialize() MQObj_GetFloatArray = GetDelegate(hModule, "MQObj_GetFloatArray"); MQObj_SetIntValue = GetDelegate(hModule, "MQObj_SetIntValue"); MQObj_SetFloatArray = GetDelegate(hModule, "MQObj_SetFloatArray"); + MQObj_AllocUserData = GetDelegate(hModule, "MQObj_AllocUserData"); + MQObj_FreeUserData = GetDelegate(hModule, "MQObj_FreeUserData"); + MQObj_GetUserData = GetDelegate(hModule, "MQObj_GetUserData"); + MQObj_SetUserData = GetDelegate(hModule, "MQObj_SetUserData"); + MQObj_AllocVertexUserData = GetDelegate(hModule, "MQObj_AllocVertexUserData"); + MQObj_FreeVertexUserData = GetDelegate(hModule, "MQObj_FreeVertexUserData"); + MQObj_GetVertexUserData = GetDelegate(hModule, "MQObj_GetVertexUserData"); + MQObj_SetVertexUserData = GetDelegate(hModule, "MQObj_SetVertexUserData"); + MQObj_AllocFaceUserData = GetDelegate(hModule, "MQObj_AllocFaceUserData"); + MQObj_FreeFaceUserData = GetDelegate(hModule, "MQObj_FreeFaceUserData"); + MQObj_GetFaceUserData = GetDelegate(hModule, "MQObj_GetFaceUserData"); + MQObj_SetFaceUserData = GetDelegate(hModule, "MQObj_SetFaceUserData"); MQMat_Delete = GetDelegate(hModule, "MQMat_Delete"); MQMat_GetIntValue = GetDelegate(hModule, "MQMat_GetIntValue"); MQMat_GetFloatArray = GetDelegate(hModule, "MQMat_GetFloatArray"); @@ -170,6 +195,10 @@ internal static bool Initialize() MQMat_SetTextureName = GetDelegate(hModule, "MQMat_SetTextureName"); MQMat_SetAlphaName = GetDelegate(hModule, "MQMat_SetAlphaName"); MQMat_SetBumpName = GetDelegate(hModule, "MQMat_SetBumpName"); + MQMat_AllocUserData = GetDelegate(hModule, "MQMat_AllocUserData"); + MQMat_FreeUserData = GetDelegate(hModule, "MQMat_FreeUserData"); + MQMat_GetUserData = GetDelegate(hModule, "MQMat_GetUserData"); + MQMat_SetUserData = GetDelegate(hModule, "MQMat_SetUserData"); MQMatrix_FloatValue = GetDelegate(hModule, "MQMatrix_FloatValue"); MQXmlElem_Value = GetDelegate(hModule, "MQXmlElem_Value"); @@ -235,6 +264,10 @@ internal static bool Initialize() public delegate /* Object */ IntPtr MQDoc_GetObjectDelegate(/* Document */ IntPtr doc, int index); public static MQDoc_GetObjectDelegate MQDoc_GetObject; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate /* Object */ IntPtr MQDoc_GetObjectFromUniqueIDDelegate(/* Document */ IntPtr doc, int id); + public static MQDoc_GetObjectFromUniqueIDDelegate MQDoc_GetObjectFromUniqueID; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] public delegate int MQDoc_GetCurrentObjectIndexDelegate(/* Document */ IntPtr doc); public static MQDoc_GetCurrentObjectIndexDelegate MQDoc_GetCurrentObjectIndex; @@ -255,14 +288,22 @@ internal static bool Initialize() public delegate int MQDoc_GetObjectIndexDelegate(/* Document */ IntPtr doc, /* Object */ IntPtr obj); public static MQDoc_GetObjectIndexDelegate MQDoc_GetObjectIndex; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate void MQDoc_GetUnusedObjectNameDelegate(/* Document */ IntPtr doc, [MarshalAs(UnmanagedType.LPStr)] StringBuilder buffer, int buffer_size, [MarshalAs(UnmanagedType.LPStr)] string base_name); + public static MQDoc_GetUnusedObjectNameDelegate MQDoc_GetUnusedObjectName; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] public delegate int MQDoc_GetMaterialCountDelegate(/* Document */ IntPtr doc); public static MQDoc_GetMaterialCountDelegate MQDoc_GetMaterialCount; [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] - public delegate /* Material */ IntPtr MQDoc_GetMaterialDelegate(/* Document */ IntPtr doc, int material); + public delegate /* Material */ IntPtr MQDoc_GetMaterialDelegate(/* Document */ IntPtr doc, int index); public static MQDoc_GetMaterialDelegate MQDoc_GetMaterial; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate /* Material */ IntPtr MQDoc_GetMaterialFromUniqueIDDelegate(/* Document */ IntPtr doc, int id); + public static MQDoc_GetMaterialFromUniqueIDDelegate MQDoc_GetMaterialFromUniqueID; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] public delegate int MQDoc_GetCurrentMaterialIndexDelegate(/* Document */ IntPtr doc); public static MQDoc_GetCurrentMaterialIndexDelegate MQDoc_GetCurrentMaterialIndex; @@ -279,11 +320,20 @@ internal static bool Initialize() public delegate void MQDoc_DeleteMaterialDelegate(/* Document */ IntPtr doc, int index); public static MQDoc_DeleteMaterialDelegate MQDoc_DeleteMaterial; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate void MQDoc_GetUnusedMaterialNameDelegate(/* Document */ IntPtr doc, [MarshalAs(UnmanagedType.LPStr)] StringBuilder buffer, int buffer_size, [MarshalAs(UnmanagedType.LPStr)] string base_name); + public static MQDoc_GetUnusedMaterialNameDelegate MQDoc_GetUnusedMaterialName; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool MQDoc_FindMappingFileDelegate(/* Document */ IntPtr doc, [MarshalAs(UnmanagedType.LPStr)] StringBuilder out_path, [MarshalAs(UnmanagedType.LPStr)] string filename, uint map_type); public static MQDoc_FindMappingFileDelegate MQDoc_FindMappingFile; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQDoc_GetMappingImageDelegate(/* Document */ IntPtr doc, [MarshalAs(UnmanagedType.LPStr)] string filename, uint map_type, /* void** */ IntPtr[] array); + public static MQDoc_GetMappingImageDelegate MQDoc_GetMappingImage; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] public delegate void MQDoc_CompactDelegate(/* Document */ IntPtr doc); public static MQDoc_CompactDelegate MQDoc_Compact; @@ -380,6 +430,14 @@ internal static bool Initialize() public delegate int MQDoc_InsertObjectDelegate(/* Document */ IntPtr doc, /* Object */ IntPtr obj, /* Object */ IntPtr before); public static MQDoc_InsertObjectDelegate MQDoc_InsertObject; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate int MQDoc_CreateUserDataDelegate(/* Document */ IntPtr doc, ref UserDataInfo info); + public static MQDoc_CreateUserDataDelegate MQDoc_CreateUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate void MQDoc_DeleteUserDataDelegate(/* Document */ IntPtr doc, int userdata_type, int userdata_id); + public static MQDoc_DeleteUserDataDelegate MQDoc_DeleteUserData; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] public delegate void MQScene_InitSizeDelegate(/* Scene */ IntPtr scene, int width, int height); public static MQScene_InitSizeDelegate MQScene_InitSize; @@ -401,6 +459,10 @@ internal static bool Initialize() public delegate bool MQScene_GetVisibleFaceDelegate(/* Scene */ IntPtr scene, /* Object */ IntPtr obj, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.Bool)] bool[] visible); public static MQScene_GetVisibleFaceDelegate MQScene_GetVisibleFace; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate void MQScene_IntValueDelegate(/* Scene */ IntPtr scene, int type_id, int[] values); + public static MQScene_IntValueDelegate MQScene_IntValue; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] public delegate void MQObj_DeleteDelegate(/* Object */ IntPtr obj); public static MQObj_DeleteDelegate MQObj_Delete; @@ -490,6 +552,10 @@ internal static bool Initialize() public delegate int MQObj_GetVertexIndexFromUniqueIDDelegate(/* Object */ IntPtr obj, uint unique_id); public static MQObj_GetVertexIndexFromUniqueIDDelegate MQObj_GetVertexIndexFromUniqueID; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate int MQObj_GetVertexRelatedFacesDelegate(/* Object */ IntPtr obj, int vertex, int[] faces); + public static MQObj_GetVertexRelatedFacesDelegate MQObj_GetVertexRelatedFaces; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] public delegate float MQObj_GetVertexWeightDelegate(/* Object */ IntPtr obj, int index); public static MQObj_GetVertexWeightDelegate MQObj_GetVertexWeight; @@ -532,6 +598,23 @@ internal static bool Initialize() public delegate void MQObj_SetFaceVertexColorDelegate(/* Object */ IntPtr obj, int face, int vertex, uint color); public static MQObj_SetFaceVertexColorDelegate MQObj_SetFaceVertexColor; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate float MQObj_GetFaceEdgeCreaseDelegate(/* Object */ IntPtr obj, int face, int line); + public static MQObj_GetFaceEdgeCreaseDelegate MQObj_GetFaceEdgeCrease; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate void MQObj_SetFaceEdgeCreaseDelegate(/* Object */ IntPtr obj, int face, int line, float crease); + public static MQObj_SetFaceEdgeCreaseDelegate MQObj_SetFaceEdgeCrease; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQObj_GetFaceVisibleDelegate(/* Object */ IntPtr obj, int face); + public static MQObj_GetFaceVisibleDelegate MQObj_GetFaceVisible; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate void MQObj_SetFaceVisibleDelegate(/* Object */ IntPtr obj, int face, [MarshalAs(UnmanagedType.Bool)] bool flag); + public static MQObj_SetFaceVisibleDelegate MQObj_SetFaceVisible; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] public delegate void MQObj_OptimizeVertexDelegate(/* Object */ IntPtr obj, float distance, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.I1)] bool[] apply); public static MQObj_OptimizeVertexDelegate MQObj_OptimizeVertex; @@ -644,6 +727,63 @@ internal static bool Initialize() public delegate void MQObj_SetFloatArrayDelegate(/* Object */ IntPtr obj, int type_id, float[] array); public static MQObj_SetFloatArrayDelegate MQObj_SetFloatArray; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQObj_AllocUserDataDelegate(/* Object */ IntPtr obj, int userdata_id); + public static MQObj_AllocUserDataDelegate MQObj_AllocUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate void MQObj_FreeUserDataDelegate(/* Object */ IntPtr obj, int userdata_id); + public static MQObj_FreeUserDataDelegate MQObj_FreeUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQObj_GetUserDataDelegate(/* Object */ IntPtr obj, int userdata_id, int offset, int copy_bytes, byte[] buffer); + public static MQObj_GetUserDataDelegate MQObj_GetUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQObj_SetUserDataDelegate(/* Object */ IntPtr obj, int userdata_id, int offset, int copy_bytes, byte[] buffer); + public static MQObj_SetUserDataDelegate MQObj_SetUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQObj_AllocVertexUserDataDelegate(/* Object */ IntPtr obj, int userdata_id); + public static MQObj_AllocVertexUserDataDelegate MQObj_AllocVertexUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate void MQObj_FreeVertexUserDataDelegate(/* Object */ IntPtr obj, int userdata_id); + public static MQObj_FreeVertexUserDataDelegate MQObj_FreeVertexUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQObj_GetVertexUserDataDelegate(/* Object */ IntPtr obj, int userdata_id, int vertex_start_index, int copy_vertex_num, int offset, int copy_bytes, byte[] buffer); + public static MQObj_GetVertexUserDataDelegate MQObj_GetVertexUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQObj_SetVertexUserDataDelegate(/* Object */ IntPtr obj, int userdata_id, int vertex_start_index, int copy_vertex_num, int offset, int copy_bytes, byte[] buffer); + public static MQObj_SetVertexUserDataDelegate MQObj_SetVertexUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQObj_AllocFaceUserDataDelegate(/* Object */ IntPtr obj, int userdata_id); + public static MQObj_AllocFaceUserDataDelegate MQObj_AllocFaceUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate void MQObj_FreeFaceUserDataDelegate(/* Object */ IntPtr obj, int userdata_id); + public static MQObj_FreeFaceUserDataDelegate MQObj_FreeFaceUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQObj_GetFaceUserDataDelegate(/* Object */ IntPtr obj, int userdata_id, int face_start_index, int copy_face_num, int offset, int copy_bytes, byte[] buffer); + public static MQObj_GetFaceUserDataDelegate MQObj_GetFaceUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQObj_SetFaceUserDataDelegate(/* Object */ IntPtr obj, int userdata_id, int face_start_index, int copy_face_num, int offset, int copy_bytes, byte[] buffer); + public static MQObj_SetFaceUserDataDelegate MQObj_SetFaceUserData; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] public delegate void MQMat_DeleteDelegate(/* Material */ IntPtr mat); public static MQMat_DeleteDelegate MQMat_Delete; @@ -752,6 +892,25 @@ internal static bool Initialize() public delegate void MQMat_SetBumpNameDelegate(/* Material */ IntPtr mat, [MarshalAs(UnmanagedType.LPStr)] string name); public static MQMat_SetBumpNameDelegate MQMat_SetBumpName; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQMat_AllocUserDataDelegate(/* Material */ IntPtr mat, int userdata_id); + public static MQMat_AllocUserDataDelegate MQMat_AllocUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + public delegate void MQMat_FreeUserDataDelegate(/* Material */ IntPtr mat, int userdata_id); + public static MQMat_FreeUserDataDelegate MQMat_FreeUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQMat_GetUserDataDelegate(/* Material */ IntPtr mat, int userdata_id, int offset, int copy_bytes, byte[] buffer); + public static MQMat_GetUserDataDelegate MQMat_GetUserData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool MQMat_SetUserDataDelegate(/* Material */ IntPtr mat, int userdata_id, int offset, int copy_bytes, byte[] buffer); + public static MQMat_SetUserDataDelegate MQMat_SetUserData; + [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] public delegate void MQMatrix_FloatValueDelegate(float[] mtx, int type_id, float[] values); public static MQMatrix_FloatValueDelegate MQMatrix_FloatValue; diff --git a/Metasequoia.Sharp/NativeMethods.tt b/Metasequoia.Sharp/NativeMethods.tt index 60ac9b1..aaf6fb6 100644 --- a/Metasequoia.Sharp/NativeMethods.tt +++ b/Metasequoia.Sharp/NativeMethods.tt @@ -50,6 +50,7 @@ var map = new Dictionary { "MQPoint *ptsarray", "IntPtr ptsarray" }, { "MQPoint *pts", "ref Point pts" }, { "MQPoint *p", "ref Point p" }, + { "MQUserDataInfo *", "ref UserDataInfo " }, { "MQCoordinate *", "IntPtr " }, { "MQColor *", "out Color " }, { "MQBool *", "[MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.I1)] bool[] " }, @@ -64,6 +65,7 @@ var map = new Dictionary { "BOOL", "[MarshalAs(UnmanagedType.Bool)] bool" }, { "UINT", "uint" }, { "HWND", "IntPtr" }, + { "void **", "/* void** */ IntPtr[] " }, { "void *", "/* void* */ IntPtr " }, { "MQ", "" }, }; @@ -94,6 +96,7 @@ var functions = File.ReadLines(path, enc) parameters = ""; else parameters = string.Join(", ", parameters.Split(',') + .Select(_ => name.Contains("UserData") ? _.Replace("const void *", "byte[] ").Replace("void *", "byte[] ") : _) .Select(_ => map.Aggregate(_.Trim(), (x, y) => x.Replace(y.Key, y.Value)))); switch (name) diff --git a/Metasequoia.Sharp/Plugin.cs b/Metasequoia.Sharp/Plugin.cs index 96e88fd..f7dc58b 100644 --- a/Metasequoia.Sharp/Plugin.cs +++ b/Metasequoia.Sharp/Plugin.cs @@ -88,7 +88,7 @@ static byte[] GetASCII(string value) return Encoding.ASCII.GetBytes(value); } - static byte[] Get932(string value) + internal static byte[] Get932(string value) { return Encoding.GetEncoding(932).GetBytes(value); } diff --git a/Metasequoia.Sharp/Properties/AssemblyInfo.cs b/Metasequoia.Sharp/Properties/AssemblyInfo.cs index 719d841..b5c4f8c 100644 --- a/Metasequoia.Sharp/Properties/AssemblyInfo.cs +++ b/Metasequoia.Sharp/Properties/AssemblyInfo.cs @@ -7,4 +7,4 @@ [assembly: AssemblyCopyright("Copyright © mfakane 2012")] [assembly: ComVisible(false)] [assembly: Guid("AB86CB1E-3944-49BD-A1DA-F377E1F6D181")] -[assembly: AssemblyVersion("0.1.2.49")] +[assembly: AssemblyVersion("0.2.3.11")] diff --git a/Metasequoia.Sharp/Structs/Structures.Generated.cs b/Metasequoia.Sharp/Structs/Structures.Generated.cs index 8222b07..f568b60 100644 --- a/Metasequoia.Sharp/Structs/Structures.Generated.cs +++ b/Metasequoia.Sharp/Structs/Structures.Generated.cs @@ -114,6 +114,41 @@ public partial struct FileDialogInfo public int AxisZ; } + /// + /// MQUserDataInfo + /// + public partial struct UserDataInfo + { + /// + /// DWORD dwSize + /// + public uint dwSize; + /// + /// DWORD productID + /// + public uint ProductID; + /// + /// DWORD pluginID + /// + public uint PluginID; + /// + /// char identifier + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] Identifier; + /// + /// int userdata_type + /// + public int UserdataType; + /// + /// int bytes_per_element + /// + public int BytesPerElement; + /// + /// bool create + /// + public bool Create; + } + /// /// MQSendMessageInfo /// diff --git a/Metasequoia.Sharp/Structs/Structures.tt b/Metasequoia.Sharp/Structs/Structures.tt index 72b1e00..d6eaa46 100644 --- a/Metasequoia.Sharp/Structs/Structures.tt +++ b/Metasequoia.Sharp/Structs/Structures.tt @@ -19,11 +19,12 @@ namespace Metasequoia var path = Path.Combine(Path.GetDirectoryName(this.Host.TemplateFile), "..", "..", "mqsdk", "MQPlugin.h"); var enc = Encoding.GetEncoding(932); var regex = new Regex(@"typedef struct (?.+?)\n{\n(?(?:.|\n)+?)\n} \1;|typedef struct {\n(?(?:.|\n)+?)\n} (?.+?);|struct (?.+?){\n(?(?:.|\n)+?)\n};", RegexOptions.Compiled); -var fieldRegex = new Regex(@"^\s*(?(const )?[a-zA-Z0-9_]+ \*?)(?[a-zA-Z0-9_,]+);", RegexOptions.Compiled | RegexOptions.Multiline); +var fieldRegex = new Regex(@"^\s*(?(const )?[a-zA-Z0-9_]+ \*?)(?[a-zA-Z0-9_,]+)(?\[[0-9]+\])?;", RegexOptions.Compiled | RegexOptions.Multiline); var map = new Dictionary { { "DWORD", "uint" }, { "const char*", "[MarshalAs(UnmanagedType.LPStr)] string" }, + { "char", "byte" }, { "void*", "/* void* */ IntPtr" }, }; @@ -54,6 +55,12 @@ foreach (Match i in regex.Matches(File.ReadAllText(path, enc).Replace("\r\n", "\ type = sl[1].Trim(); } + if (j.Groups["size"].Success) + { + attr = "[MarshalAs(UnmanagedType.ByValArray, SizeConst = " + j.Groups["size"].Value.Trim('[', ']') + ")] "; + type += "[]"; + } + foreach (var k in j.Groups["names"].Value.Split(',')) { var n = k; diff --git a/readme.txt b/readme.txt index c105f86..eaa8ab9 100644 --- a/readme.txt +++ b/readme.txt @@ -12,8 +12,8 @@ Metasequoia.Sharp 名前空間には、C# で使用するうえで便利なク * Microsoft Visual Studio 2010 以降 * .NET Framework 4.0 以降 -* Metasequoia Ver2.4.9 以降 -* Metasequoia Plugin SDK Rev2.49b 以降 +* Metasequoia Ver3.1.1 以降 +* Metasequoia Plugin SDK Rev3.11 以降 * ILMerge 事前準備 @@ -69,6 +69,10 @@ mfakane 更新履歴 ======= +Version 0.2, Sun, 14 Jul 2013 + + mqsdk 3.11 ベースへ更新 + Version 0.1, Thu, 05 Apr 2012 Station/Command プラグイン関係の機能を追加 @@ -90,15 +94,6 @@ Do What The Fuck You Want To Public License, Version 2 (WTFPL) および自ら 以下の条文を参照してください。http://sam.zoy.org/wtfpl/ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - - Copyright (C) 2012 mfakane - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO.