Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
942c7f1cc7 | |||
10d5595fb6 |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "material-editor",
|
"name": "material-editor",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.17",
|
"version": "1.0.19",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
@@ -16,19 +16,24 @@ Database.prototype.AllocationObjectId = function (this: Database, object: CADObj
|
|||||||
|
|
||||||
export function MaterialOut(material: PhysicalMaterialRecord): string
|
export function MaterialOut(material: PhysicalMaterialRecord): string
|
||||||
{
|
{
|
||||||
let db = new Database();
|
try {
|
||||||
db.WblockCloneObejcts(
|
let db = new Database();
|
||||||
[material],
|
db.WblockCloneObejcts(
|
||||||
db.MaterialTable,
|
[material],
|
||||||
new Map(),
|
db.MaterialTable,
|
||||||
DuplicateRecordCloning.Ignore
|
new Map(),
|
||||||
);
|
DuplicateRecordCloning.Ignore
|
||||||
let json = JSON.stringify(db.FileWrite().Data);
|
);
|
||||||
// // TODO: Danger: 因为WebCAD依赖库中的部分类的构造函数名异常,所以在生成JSON时需要对类名进行替换
|
let json = JSON.stringify(db.FileWrite().Data);
|
||||||
json = json.replace(LayerNode.name, "LayerNode")
|
// // TODO: Danger: 因为WebCAD依赖库中的部分类的构造函数名异常,所以在生成JSON时需要对类名进行替换
|
||||||
.replace(TextureTableRecord.name, "TextureTableRecord")
|
json = json.replace(LayerNode.name, "LayerNode")
|
||||||
.replace(PhysicalMaterialRecord.name, "PhysicalMaterialRecord");
|
.replace(TextureTableRecord.name, "TextureTableRecord")
|
||||||
return json;
|
.replace(PhysicalMaterialRecord.name, "PhysicalMaterialRecord");
|
||||||
|
return json;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("error in MaterialOut:", error, material);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MaterialIn(fileData: Object[]): PhysicalMaterialRecord
|
export function MaterialIn(fileData: Object[]): PhysicalMaterialRecord
|
||||||
|
@@ -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 });
|
||||||
|
Reference in New Issue
Block a user