3 Commits

3 changed files with 11 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "material-editor", "name": "material-editor",
"private": true, "private": true,
"version": "1.0.17", "version": "1.0.20",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -1,4 +1,4 @@
import { CADFiler, CADObject, Database, DuplicateRecordCloning, Factory, LayerNode, ObjectId, PhysicalMaterialRecord, TextureTableRecord } from "webcad_ue4_api"; import { CADFactory, CADFiler, CADObject, Database, DuplicateRecordCloning, Factory, LayerNode, ObjectId, PhysicalMaterialRecord, TextureTableRecord } from "webcad_ue4_api";
// TODO: Danger: 注意入侵性代码 // TODO: Danger: 注意入侵性代码
// 疑似是WebCAD中的漏洞当传入new Database()时, // 疑似是WebCAD中的漏洞当传入new Database()时,
@@ -14,8 +14,7 @@ Database.prototype.AllocationObjectId = function (this: Database, object: CADObj
this.idMap.set(object.Id.Index, object.Id); this.idMap.set(object.Id.Index, object.Id);
} }
export function MaterialOut(material: PhysicalMaterialRecord): string export function MaterialOut(material: PhysicalMaterialRecord): string {
{
let db = new Database(); let db = new Database();
db.WblockCloneObejcts( db.WblockCloneObejcts(
[material], [material],
@@ -28,6 +27,8 @@ export function MaterialOut(material: PhysicalMaterialRecord): string
json = json.replace(LayerNode.name, "LayerNode") json = json.replace(LayerNode.name, "LayerNode")
.replace(TextureTableRecord.name, "TextureTableRecord") .replace(TextureTableRecord.name, "TextureTableRecord")
.replace(PhysicalMaterialRecord.name, "PhysicalMaterialRecord"); .replace(PhysicalMaterialRecord.name, "PhysicalMaterialRecord");
console.debug("DEBUG CAD Object Name", CADFactory['factory'].objectNameMap);
console.debug("CURRENT PROTOTYPE NAME\n", "LAYERNODE:", LayerNode.name, "TEXTURETABLERECORD:", TextureTableRecord.name, "PHYSICALMATERIALRECORD:", PhysicalMaterialRecord.name);
return json; return json;
} }

View File

@@ -108,7 +108,7 @@
</template> </template>
<script setup lang='ts'> <script setup lang='ts'>
import { ref, reactive, watch } from "vue" import { ref, reactive, watch, computed } from "vue"
import { useScene, type TextureAdjustment } from "../stores/sceneStore"; import { useScene, type TextureAdjustment } from "../stores/sceneStore";
import CfFlex from "./CfFlex.vue"; import CfFlex from "./CfFlex.vue";
import { DirectoryId } from "../api/Request"; import { DirectoryId } from "../api/Request";
@@ -139,7 +139,7 @@ const emits = defineEmits<{
(e: 'submit', data: MaterialRequest[]): void; (e: 'submit', data: MaterialRequest[]): void;
}>(); }>();
const debugMode = ref(true); const debugMode = ref(false);
const _textureSrc = ref(props.textureSrcList); const _textureSrc = ref(props.textureSrcList);
const debugTextureSrc = ref(""); const debugTextureSrc = ref("");
const textureAdjustment = ref<TextureAdjustment>({ const textureAdjustment = ref<TextureAdjustment>({
@@ -169,6 +169,10 @@ watch(() => props.textureSrcList, async (val) => {
await scene.ChangeTextureFromUrlAsync(_textureSrc.value[0]); await scene.ChangeTextureFromUrlAsync(_textureSrc.value[0]);
}); });
watch(() => props.name, () => {
materialInfo.materialName = props.name || '材质';
});
watch(textureAdjustment, async (val) => { watch(textureAdjustment, async (val) => {
UpdateTexture(); UpdateTexture();
}, { deep: true }); }, { deep: true });