Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

Ir 2543 create prefab #10384

Merged
merged 24 commits into from
Jun 21, 2024
Merged

Ir 2543 create prefab #10384

merged 24 commits into from
Jun 21, 2024

Conversation

JT00y
Copy link
Contributor

@JT00y JT00y commented Jun 13, 2024

Summary

Subtasks Checklist

Breaking Changes

References

closes #insert number here

QA Steps

@JT00y JT00y requested a review from dinomut1 June 13, 2024 18:36
@@ -80,7 +80,8 @@ export const ModelComponent = defineComponent({
convertToVRM: false,
scene: null as Group | null,
asset: null as VRM | GLTF | null,
dereference: false
dereference: false,
save: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't add this "save" attribute, this should be handled through just calling "exportModelGLTF" explicitly

@@ -120,6 +140,13 @@ export const ModelNodeEditor: EditorComponentType = (props) => {
)
}, [modelComponent.asset])

useEffect(() => {
if (modelComponent.save.value) {
onExportPrefabModel()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's just call this function rather than using a reactor to set it off

try {
exportRelativeGLTF(entity, srcProject, fileName)
//pass static resource
const resources = await Engine.instance.api.service(staticResourcePath).find({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will always fail because the file doesn't exist yet

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should remove this call, and construct a static resource object to pass for upload

throw new Error('User not found')
}
const resource = resources.data[0]
await Engine.instance.api.service(staticResourcePath).patch(resource.id, { tags: prefabTag })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be a "create" call instead of "patch"

const entity = node?.entity as Entity
const [defaultPrefabFolder, setDefaultPrefabFolder] = useState<string>('/assets/custom-prefabs')
const [prefabName, setPrefabName] = useState<string>('prefab')
const [prefabTag, setPrefabTag] = useState<string[]>([])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change these to Hookstate objects instead of normal react state

Copy link
Contributor

@dinomut1 dinomut1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting close. We need to fix the export of .bin + texture files in .gltf export mode. I tried making a prefab out of the portal frame in the default project and ran into this issue:
Screencast from 06-17-2024 03:06:49 PM.webm
The 'model-resources' folder is getting saved into the wrong location. When saving the .gtlf into the assets/custom-prefabs folder, the model resources are getting saved into assets/assets/custom-prefabs/model-resources/...:
Screencast from 06-17-2024 03:09:12 PM.webm

Copy link
Contributor

@dinomut1 dinomut1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@dinomut1 dinomut1 added this pull request to the merge queue Jun 21, 2024
Merged via the queue into dev with commit 00a5df0 Jun 21, 2024
8 checks passed
@dinomut1 dinomut1 deleted the ir-2543-create-prefab branch June 21, 2024 04:48
MbfloydIR added a commit that referenced this pull request Jun 24, 2024
* dev: (34 commits)
  ir 2253 fix project zip archiver (#10437)
  IR-2721: Zendesk integration (#10416)
  clearer delete scene argument id (#10440)
  fix editor tests (#10439)
  fix material removal errors due to missing source component (#10433)
  studio: ui feedback for loading a scene (#10404)
  fix material ParameterInput (#10429)
  update visibility to authoring layer (#10428)
  IR-2711: update default scene (#10399)
  clean up console log
  fix resources.json sorting not happening when it is regenerated
  fix styling for key value project settings (#10432)
  Added VITE_FEATHERS_STORE_KEY to Docker builds (#10426)
  IR 2148 Material Entities for All Meshes, Improved hashing logic, Plugin Components (#10209)
  Ir 2543 create prefab (#10384)
  feat(tooltip): make title from string to ReactNode to accept custom title (#10424)
  Update branch-build.yml (#10430)
  fix frustum culling calculation (#10418)
  show no results for unmatching query in hierarchy tree (#10415)
  Remove react-is hackfix install (#10425)
  ...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants