Compare commits

..

No commits in common. "07565d42c4f70361f728808f97711741de2a2b9a" and "59703decc4dfce64daad534c03dca15dd9e08a47" have entirely different histories.

4 changed files with 13 additions and 14 deletions

View File

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

View File

@ -1,4 +1,4 @@
import { CADFiler, CADObject, Database, DuplicateRecordCloning, Factory, LayerNode, ObjectId, PhysicalMaterialRecord, TextureTableRecord } from "webcad_ue4_api";
import { CADFiler, CADObject, Database, DuplicateRecordCloning, Factory, LayerNode, ObjectId, PhysicalMaterialRecord } from "webcad_ue4_api";
// TODO: Danger: 注意入侵性代码
// 疑似是WebCAD中的漏洞当传入new Database()时,
@ -23,12 +23,7 @@ export function MaterialOut(material: PhysicalMaterialRecord): string
new Map(),
DuplicateRecordCloning.Ignore
);
let json = JSON.stringify(db.FileWrite().Data);
// // TODO: Danger: 因为WebCAD依赖库中的部分类的构造函数名异常所以在生成JSON时需要对类名进行替换
json = json.replace(LayerNode.name, "LayerNode")
.replace(TextureTableRecord.name, "TextureTableRecord")
.replace(PhysicalMaterialRecord.name, "PhysicalMaterialRecord");
return json;
return JSON.stringify(db.FileWrite().Data);
}
export function MaterialIn(fileData: Object[]): PhysicalMaterialRecord

View File

@ -108,13 +108,13 @@
</template>
<script setup lang='ts'>
import { ref, reactive, watch } from "vue"
import { ref, reactive, watch, onMounted, computed } from "vue"
import { useScene, type TextureAdjustment } from "../stores/sceneStore";
import CfFlex from "./CfFlex.vue";
import { DirectoryId } from "../api/Request";
import { IsNullOrWhitespace } from "../helpers/helper.string";
import { FromDeflateBase64, ToDeflatedBase64 } from "../helpers/helper.material";
import { storeToRefs } from "pinia";
import { AsyncDelay } from "../helpers/helper.async";
export interface MaterialRequest {
/** 材质名 */
@ -126,7 +126,6 @@ export interface MaterialRequest {
}
const scene = useScene();
const { Material, CurrGeometry, Geometries } = storeToRefs(scene);
const props = defineProps<{
name?: string;
@ -139,6 +138,10 @@ const emits = defineEmits<{
(e: 'submit', data: MaterialRequest[]): void;
}>();
const Material = computed(() => scene.Material);
const CurrGeometry = computed(() => scene.CurrGeometry);
const Geometries = computed(() => scene.Geometries);
const debugMode = ref(true);
const _textureSrc = ref(props.textureSrcList);
const debugTextureSrc = ref("");
@ -171,7 +174,7 @@ watch(() => props.textureSrcList, async (val) => {
watch(textureAdjustment, async (val) => {
UpdateTexture();
}, { deep: true });
});
//
watch(() => scene.CurrTexture, (val) => {
@ -202,6 +205,7 @@ async function UpdateMaterial() {
}
function UpdateTexture() {
console.log('UpdateTexture')
const texture = scene.CurrTexture;
const val = textureAdjustment.value;
texture.wrapS = val.wrapS;
@ -223,7 +227,6 @@ async function loadData() {
}
async function HandleUpload() {
console.log(scene.GetEditor().Viewer.Scene.children);
try {
if (IsNullOrWhitespace(materialInfo.materialName)) {
alert('材质名称不可为空');
@ -241,7 +244,7 @@ async function HandleUpload() {
file: ToDeflatedBase64(await scene.SerializeMaterialAsync())
};
result.push(mat);
}
}
else {
//
let idx = 0;

View File

@ -75,6 +75,7 @@ const sceneSetup = () => {
}
async function UpdateMaterialAsync() {
console.log(Material.value.Update);
// TODO: Danger: 如果等待下面这一行,会导致更新卡住(未知问题)
Material.value.Update();
// Material.value.Material.needsUpdate = true;