/// /// Material List のElement描画 /// static bool DrawMaterialUVBinding(Rect position, SerializedProperty property, string[] materialNames, int height) { bool changed = false; if (materialNames != null) { // Materialを選択する var y = position.y; var rect = new Rect(position.x, y, position.width, height); int materialIndex; if (ExpressionEditorHelper.StringPopup(rect, property.FindPropertyRelative(nameof(MaterialUVBinding.MaterialName)), materialNames, out materialIndex)) { changed = true; } // offset y += height; rect = new Rect(position.x, y, position.width, height); if (ExpressionEditorHelper.UVProp(rect, property.FindPropertyRelative(nameof(MaterialUVBinding.Offset)))) { changed = true; } // scale y += height; rect = new Rect(position.x, y, position.width, height); if (ExpressionEditorHelper.UVProp(rect, property.FindPropertyRelative(nameof(MaterialUVBinding.Scaling)))) { changed = true; } } return(changed); }
/// /// MorphTarget List のElement描画 /// static bool DrawMorphTargetBinding(Rect position, SerializedProperty property, PreviewSceneManager scene, int height) { bool changed = false; if (scene != null) { var y = position.y; var rect = new Rect(position.x, y, position.width, height); int pathIndex; if (ExpressionEditorHelper.StringPopup(rect, property.FindPropertyRelative(nameof(MorphTargetBinding.RelativePath)), scene.SkinnedMeshRendererPathList, out pathIndex)) { changed = true; } y += height; rect = new Rect(position.x, y, position.width, height); int morphTargetIndex; if (ExpressionEditorHelper.IntPopup(rect, property.FindPropertyRelative(nameof(MorphTargetBinding.Index)), scene.GetBlendShapeNames(pathIndex), out morphTargetIndex)) { changed = true; } y += height; rect = new Rect(position.x, y, position.width, height); if (ExpressionEditorHelper.FloatSlider(rect, property.FindPropertyRelative(nameof(MorphTargetBinding.Weight)), 100)) { changed = true; } } return(changed); }
/// /// Material List のElement描画 /// static bool DrawMaterialValueBinding(Rect position, SerializedProperty property, string[] materialNames, int height) { bool changed = false; if (materialNames != null) { // Material を選択する var y = position.y; var rect = new Rect(position.x, y, position.width, height); int materialIndex; if (ExpressionEditorHelper.StringPopup(rect, property.FindPropertyRelative(nameof(MaterialColorBinding.MaterialName)), materialNames, out materialIndex)) { changed = true; } y += height; rect = new Rect(position.x, y, position.width, height); // 対象のプロパティを enum から選択する var bindTypeProp = property.FindPropertyRelative("BindType"); var bindTypes = (UniGLTF.Extensions.VRMC_vrm.MaterialColorType[])Enum.GetValues(typeof(UniGLTF.Extensions.VRMC_vrm.MaterialColorType)); var bindType = bindTypes[bindTypeProp.enumValueIndex]; var newBindType = ExpressionEditorHelper.EnumPopup(rect, bindType); if (newBindType != bindType) { bindTypeProp.enumValueIndex = Array.IndexOf(bindTypes, newBindType); changed = true; } // 目標の色 y += height; rect = new Rect(position.x, y, position.width, height); if (ExpressionEditorHelper.ColorProp(rect, property.FindPropertyRelative(nameof(MaterialColorBinding.TargetValue)))) { changed = true; } } return(changed); }