Repository navigation
Unity import: materials on placed models, and a Flat colour row - #238
Merged
Merged
Conversation
A model placed in a scene keeps its MeshRenderer inside the model, so a material dragged onto it is stored as an m_Materials.Array.data[N] modification on the PrefabInstance. meshOf read that override but then took the model's own material anyway whenever the object had no scene MeshRenderer, so the instance came in untextured. An override now beats the model's material. The unity-models fixture gains materials.unity (saved by Unity 6000.3) with such an instance.
A model's .meta can remap its materials to project materials (the Materials tab's On Demand Remap, or Search and Remap): externalObjects entries of type UnityEngine:Material, keyed by the material's name in the model file. The import never read them, so a model drawn in Unity with a textured project material came in with its own material. Imported models now keep each submesh's material name, and the Unity import swaps in the remapped .mat where the .meta names one.
With Lighting set to Flat every vertex of the mesh gets one colour, but the inspector showed no trace of it: an imported Unity Flat Color came in, yet could be neither seen nor changed. The row shows only in Flat mode, with the same colour well and picker as a material's Colour row; a pick is an undo step, a drag one step. The Lighting row is named obj.lighting, and scripted runs print "flatcolor: R,G,B". flatcolourcheck drives it on the Unity materials fixture. cliploopcheck now scrolls to the Agent section's last control rather than a fixed wheel, as its Flat mesh makes the inspector one row taller.
The Flat colour row makes a Flat skinned mesh's inspector one row taller, which pushes the Long clip card below the panel at 1600x960. Scroll to the card before checking that it lies inside the panel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #223. A placed model came in with no texture when its material was set in the scene (a
m_Materials.Array.data[0]override on the model's MeshRenderer, whichmeshOfignored for models) or remapped in the.fbx.meta(externalObjects, which nothing read). Both now apply.The exporter's flat colour was imported correctly. The inspector had no field for it, so a Flat colour row now shows under Lighting when Lighting is Flat (
obj.flatcolor, undoable).Tests:
testUnityPlacedMaterialon a fixture scene saved by Unity 6000.3 (both cases), andtests/flatcolourcheck.py.skininfocheckandcliploopchecknow scroll to their target, since the new row moves them.