Gets the current Material assigned to the CanvasRenderer.
static public int GetMaterial(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 1) { UnityEngine.CanvasRenderer self = (UnityEngine.CanvasRenderer)checkSelf(l); var ret = self.GetMaterial(); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 2) { UnityEngine.CanvasRenderer self = (UnityEngine.CanvasRenderer)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); var ret = self.GetMaterial(a1); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
static int GetMaterial(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { UnityEngine.CanvasRenderer obj = (UnityEngine.CanvasRenderer)ToLua.CheckObject(L, 1, typeof(UnityEngine.CanvasRenderer)); UnityEngine.Material o = obj.GetMaterial(); ToLua.Push(L, o); return(1); } else if (count == 2) { UnityEngine.CanvasRenderer obj = (UnityEngine.CanvasRenderer)ToLua.CheckObject(L, 1, typeof(UnityEngine.CanvasRenderer)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Material o = obj.GetMaterial(arg0); ToLua.Push(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.CanvasRenderer.GetMaterial")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void SetMaterial(Material material, UnityEngine.Color ac) { if (canvasRenderer.GetMaterial() != material) { canvasRenderer.SetMaterial(material, null); } additionalColor = ac; buffer.modified = true; }
public void OnEnable() { // Get the UI Skin and Styles for the various Editors TMP_UIStyleManager.GetUIStyles(); fontAsset_prop = serializedObject.FindProperty("m_fontAsset"); spriteAsset_prop = serializedObject.FindProperty("m_spriteAsset"); m_SubMeshComponent = target as TMP_SubMeshUI; //m_rectTransform = m_SubMeshComponent.rectTransform; m_canvasRenderer = m_SubMeshComponent.canvasRenderer; // Create new Material Editor if one does not exists if (m_canvasRenderer != null && m_canvasRenderer.GetMaterial() != null) { m_materialEditor = Editor.CreateEditor(m_canvasRenderer.GetMaterial()); m_targetMaterial = m_canvasRenderer.GetMaterial(); } }
static public int GetMaterial(IntPtr l) { try{ UnityEngine.CanvasRenderer self = (UnityEngine.CanvasRenderer)checkSelf(l); UnityEngine.Material ret = self.GetMaterial(); pushValue(l, ret); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int GetMaterial(IntPtr l) { try { UnityEngine.CanvasRenderer self = (UnityEngine.CanvasRenderer)checkSelf(l); var ret = self.GetMaterial(); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
//Drag-n-Drop related properties //private Rect m_inspectorStartRegion; //private Rect m_inspectorEndRegion; public void OnEnable() { // Get the UI Skin and Styles for the various Editors TMP_UIStyleManager.GetUIStyles(); //fontSharedMaterial_prop = serializedObject.FindProperty("m_sharedMaterial"); //raycastTarget_prop = serializedObject.FindProperty("m_RaycastTarget"); m_SubMeshComponent = target as TMP_SubMeshUI; //m_rectTransform = m_SubMeshComponent.rectTransform; m_canvasRenderer = m_SubMeshComponent.canvasRenderer; // Create new Material Editor if one does not exists if (m_canvasRenderer != null && m_canvasRenderer.GetMaterial() != null) { m_materialEditor = Editor.CreateEditor(m_canvasRenderer.GetMaterial()); m_targetMaterial = m_canvasRenderer.GetMaterial(); //UnityEditorInternal.InternalEditorUtility.SetIsInspectorExpanded(m_targetMaterial, true); //Debug.Log("Currently Assigned Material is " + m_targetMaterial + ". Font Material is " + m_textMeshProScript.fontSharedMaterial); } }
static public int GetMaterial__Int32(IntPtr l) { try { UnityEngine.CanvasRenderer self = (UnityEngine.CanvasRenderer)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); var ret = self.GetMaterial(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int GetMaterial(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif int argc = LuaDLL.lua_gettop(l); if (argc == 1) { UnityEngine.CanvasRenderer self = (UnityEngine.CanvasRenderer)checkSelf(l); var ret = self.GetMaterial(); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 2) { UnityEngine.CanvasRenderer self = (UnityEngine.CanvasRenderer)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); var ret = self.GetMaterial(a1); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function GetMaterial to call"); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
//private float prev_lineLenght; //private bool m_isUndoSet; public void OnEnable() { //Debug.Log("New Instance of TMPRO UGUI Editor with ID " + this.GetInstanceID()); // Initialize the Event Listener for Undo Events. Undo.undoRedoPerformed += OnUndoRedo; //Undo.postprocessModifications += OnUndoRedoEvent; text_prop = serializedObject.FindProperty("m_text"); fontAsset_prop = serializedObject.FindProperty("m_fontAsset"); fontSharedMaterial_prop = serializedObject.FindProperty("m_sharedMaterial"); //fontBaseMaterial_prop = serializedObject.FindProperty("m_baseMaterial"); isNewBaseMaterial_prop = serializedObject.FindProperty("m_isNewBaseMaterial"); fontStyle_prop = serializedObject.FindProperty("m_fontStyle"); fontSize_prop = serializedObject.FindProperty("m_fontSize"); fontSizeBase_prop = serializedObject.FindProperty("m_fontSizeBase"); autoSizing_prop = serializedObject.FindProperty("m_enableAutoSizing"); fontSizeMin_prop = serializedObject.FindProperty("m_fontSizeMin"); fontSizeMax_prop = serializedObject.FindProperty("m_fontSizeMax"); //charSpacingMax_prop = serializedObject.FindProperty("m_charSpacingMax"); lineSpacingMax_prop = serializedObject.FindProperty("m_lineSpacingMax"); charWidthMaxAdj_prop = serializedObject.FindProperty("m_charWidthMaxAdj"); // Colors & Gradient fontColor_prop = serializedObject.FindProperty("m_fontColor"); enableVertexGradient_prop = serializedObject.FindProperty ("m_enableVertexGradient"); fontColorGradient_prop = serializedObject.FindProperty ("m_fontColorGradient"); overrideHtmlColor_prop = serializedObject.FindProperty("m_overrideHtmlColors"); characterSpacing_prop = serializedObject.FindProperty("m_characterSpacing"); lineSpacing_prop = serializedObject.FindProperty("m_lineSpacing"); paragraphSpacing_prop = serializedObject.FindProperty("m_paragraphSpacing"); textAlignment_prop = serializedObject.FindProperty("m_textAlignment"); enableWordWrapping_prop = serializedObject.FindProperty("m_enableWordWrapping"); wordWrappingRatios_prop = serializedObject.FindProperty("m_wordWrappingRatios"); textOverflowMode_prop = serializedObject.FindProperty("m_overflowMode"); pageToDisplay_prop = serializedObject.FindProperty("m_pageToDisplay"); horizontalMapping_prop = serializedObject.FindProperty("m_horizontalMapping"); verticalMapping_prop = serializedObject.FindProperty("m_verticalMapping"); uvOffset_prop = serializedObject.FindProperty("m_uvOffset"); uvLineOffset_prop = serializedObject.FindProperty("m_uvLineOffset"); enableKerning_prop = serializedObject.FindProperty("m_enableKerning"); //isOrthographic_prop = serializedObject.FindProperty("m_isOrthographic"); havePropertiesChanged_prop = serializedObject.FindProperty("m_havePropertiesChanged"); inputSource_prop = serializedObject.FindProperty("m_inputSource"); isInputPasingRequired_prop = serializedObject.FindProperty("isInputParsingRequired"); //isCalculateSizeRequired_prop = serializedObject.FindProperty("m_isCalculateSizeRequired"); enableExtraPadding_prop = serializedObject.FindProperty("m_enableExtraPadding"); isRichText_prop = serializedObject.FindProperty("m_isRichText"); checkPaddingRequired_prop = serializedObject.FindProperty("checkPaddingRequired"); raycastTarget_prop = serializedObject.FindProperty("m_RaycastTarget"); margin_prop = serializedObject.FindProperty("m_margin"); //isMaskUpdateRequired_prop = serializedObject.FindProperty("isMaskUpdateRequired"); //mask_prop = serializedObject.FindProperty("m_mask"); //maskOffset_prop= serializedObject.FindProperty("m_maskOffset"); //maskOffsetMode_prop = serializedObject.FindProperty("m_maskOffsetMode"); //maskSoftness_prop = serializedObject.FindProperty("m_maskSoftness"); //vertexOffset_prop = serializedObject.FindProperty("m_vertexOffset"); //sortingLayerID_prop = serializedObject.FindProperty("m_sortingLayerID"); //sortingOrder_prop = serializedObject.FindProperty("m_sortingOrder"); hasFontAssetChanged_prop = serializedObject.FindProperty("hasFontAssetChanged"); // Get the UI Skin and Styles for the various Editors TMP_UIStyleManager.GetUIStyles(); m_textMeshProScript = (TextMeshProUGUI)target; m_rectTransform = Selection.activeGameObject.GetComponent<RectTransform>(); m_uiRenderer = Selection.activeGameObject.GetComponent<CanvasRenderer>(); // Add a Material Component if one does not exists /* m_materialComponent = Selection.activeGameObject.GetComponent<MaterialComponent> (); if (m_materialComponent == null) { m_materialComponent = Selection.activeGameObject.AddComponent<MaterialComponent> (); } */ // Create new Material Editor if one does not exists if (m_uiRenderer != null && m_uiRenderer.GetMaterial() != null) { m_materialEditor = Editor.CreateEditor(m_uiRenderer.GetMaterial()); m_targetMaterial = m_uiRenderer.GetMaterial(); //UnityEditorInternal.InternalEditorUtility.SetIsInspectorExpanded(m_targetMaterial, true); //Debug.Log("Currently Assigned Material is " + m_targetMaterial + ". Font Material is " + m_textMeshProScript.fontSharedMaterial); } //m_updateManager = Camera.main.gameObject.GetComponent<TMPro_UpdateManager>(); }
public void OnEnable() { //Debug.Log("New Instance of TMPRO UGUI Editor with ID " + this.GetInstanceID()); // Initialize the Event Listener for Undo Events. Undo.undoRedoPerformed += OnUndoRedo; //Undo.postprocessModifications += OnUndoRedoEvent; text_prop = serializedObject.FindProperty("m_text"); fontAsset_prop = serializedObject.FindProperty("m_fontAsset"); fontSharedMaterial_prop = serializedObject.FindProperty("m_sharedMaterial"); //fontBaseMaterial_prop = serializedObject.FindProperty("m_baseMaterial"); isNewBaseMaterial_prop = serializedObject.FindProperty("m_isNewBaseMaterial"); fontStyle_prop = serializedObject.FindProperty("m_fontStyle"); fontSize_prop = serializedObject.FindProperty("m_fontSize"); fontSizeBase_prop = serializedObject.FindProperty("m_fontSizeBase"); autoSizing_prop = serializedObject.FindProperty("m_enableAutoSizing"); fontSizeMin_prop = serializedObject.FindProperty("m_fontSizeMin"); fontSizeMax_prop = serializedObject.FindProperty("m_fontSizeMax"); charSpacingMax_prop = serializedObject.FindProperty("m_charSpacingMax"); lineSpacingMax_prop = serializedObject.FindProperty("m_lineSpacingMax"); // Colors & Gradient fontColor_prop = serializedObject.FindProperty("m_fontColor"); enableVertexGradient_prop = serializedObject.FindProperty ("m_enableVertexGradient"); fontColorGradient_prop = serializedObject.FindProperty ("m_fontColorGradient"); overrideHtmlColor_prop = serializedObject.FindProperty("m_overrideHtmlColors"); characterSpacing_prop = serializedObject.FindProperty("m_characterSpacing"); lineSpacing_prop = serializedObject.FindProperty("m_lineSpacing"); paragraphSpacing_prop = serializedObject.FindProperty("m_paragraphSpacing"); textAlignment_prop = serializedObject.FindProperty("m_textAlignment"); enableWordWrapping_prop = serializedObject.FindProperty("m_enableWordWrapping"); wordWrappingRatios_prop = serializedObject.FindProperty("m_wordWrappingRatios"); textOverflowMode_prop = serializedObject.FindProperty("m_overflowMode"); horizontalMapping_prop = serializedObject.FindProperty("m_horizontalMapping"); verticalMapping_prop = serializedObject.FindProperty("m_verticalMapping"); uvOffset_prop = serializedObject.FindProperty("m_uvOffset"); uvLineOffset_prop = serializedObject.FindProperty("m_uvLineOffset"); enableKerning_prop = serializedObject.FindProperty("m_enableKerning"); //isOrthographic_prop = serializedObject.FindProperty("m_isOrthographic"); havePropertiesChanged_prop = serializedObject.FindProperty("havePropertiesChanged"); inputSource_prop = serializedObject.FindProperty("m_inputSource"); isInputPasingRequired_prop = serializedObject.FindProperty("isInputParsingRequired"); //isAffectingWordWrapping_prop = serializedObject.FindProperty("isAffectingWordWrapping"); enableExtraPadding_prop = serializedObject.FindProperty("m_enableExtraPadding"); isRichText_prop = serializedObject.FindProperty("m_isRichText"); checkPaddingRequired_prop = serializedObject.FindProperty("checkPaddingRequired"); margin_prop = serializedObject.FindProperty("m_margin"); //isMaskUpdateRequired_prop = serializedObject.FindProperty("isMaskUpdateRequired"); //mask_prop = serializedObject.FindProperty("m_mask"); maskOffset_prop= serializedObject.FindProperty("m_maskOffset"); //maskOffsetMode_prop = serializedObject.FindProperty("m_maskOffsetMode"); //maskSoftness_prop = serializedObject.FindProperty("m_maskSoftness"); //vertexOffset_prop = serializedObject.FindProperty("m_vertexOffset"); //sortingLayerID_prop = serializedObject.FindProperty("m_sortingLayerID"); //sortingOrder_prop = serializedObject.FindProperty("m_sortingOrder"); hasFontAssetChanged_prop = serializedObject.FindProperty("hasFontAssetChanged"); // Find to location of the TextMesh Pro Asset Folder (as users may have moved it) string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation(); if (EditorGUIUtility.isProSkin) { mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_DarkSkin.guiskin", typeof(GUISkin)) as GUISkin; alignLeft = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignLeft.psd", typeof(Texture2D)) as Texture2D; alignCenter = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignCenter.psd", typeof(Texture2D)) as Texture2D; alignRight = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignRight.psd", typeof(Texture2D)) as Texture2D; alignJustified = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignJustified.psd", typeof(Texture2D)) as Texture2D; alignTop = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignTop.psd", typeof(Texture2D)) as Texture2D; alignMiddle = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignMiddle.psd", typeof(Texture2D)) as Texture2D; alignBottom = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignBottom.psd", typeof(Texture2D)) as Texture2D; } else { mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_LightSkin.guiskin", typeof(GUISkin)) as GUISkin; alignLeft = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignLeft_Light.psd", typeof(Texture2D)) as Texture2D; alignCenter = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignCenter_Light.psd", typeof(Texture2D)) as Texture2D; alignRight = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignRight_Light.psd", typeof(Texture2D)) as Texture2D; alignJustified = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignJustified_Light.psd", typeof(Texture2D)) as Texture2D; alignTop = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignTop_Light.psd", typeof(Texture2D)) as Texture2D; alignMiddle = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignMiddle_Light.psd", typeof(Texture2D)) as Texture2D; alignBottom = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignBottom_Light.psd", typeof(Texture2D)) as Texture2D; } if (mySkin != null) { Section_Label = mySkin.FindStyle("Section Label"); //Group_Label = mySkin.FindStyle("Group Label"); textAreaBox = mySkin.FindStyle("Text Area Box (Editor)"); alignContent_A = new GUIContent[] { new GUIContent(alignLeft, "Left"), new GUIContent(alignCenter, "Center"), new GUIContent(alignRight, "Right"), new GUIContent(alignJustified, "Justified") }; alignContent_B = new GUIContent[] { new GUIContent(alignTop, "Top"), new GUIContent(alignMiddle, "Middle"), new GUIContent(alignBottom, "Bottom") }; } m_textMeshProScript = (TextMeshProUGUI)target; m_rectTransform = Selection.activeGameObject.GetComponent<RectTransform>(); m_uiRenderer = Selection.activeGameObject.GetComponent<CanvasRenderer>(); // Add a Material Component if one does not exists /* m_materialComponent = Selection.activeGameObject.GetComponent<MaterialComponent> (); if (m_materialComponent == null) { m_materialComponent = Selection.activeGameObject.AddComponent<MaterialComponent> (); } */ // Create new Material Editor if one does not exists if (m_uiRenderer != null && m_uiRenderer.GetMaterial() != null) { m_materialEditor = Editor.CreateEditor(m_uiRenderer.GetMaterial()); m_targetMaterial = m_uiRenderer.GetMaterial(); //Debug.Log("Currently Assigned Material is " + m_targetMaterial + ". Font Material is " + m_textMeshProScript.fontSharedMaterial); } //m_updateManager = Camera.main.gameObject.GetComponent<TMPro_UpdateManager>(); }