static public void Initialize(Decal d) { DecalUVEditorWindow window = (DecalUVEditorWindow)EditorWindow.GetWindow(typeof(DecalUVEditorWindow), false, "Decal UV"); window.currentDecal = d; window.scale = false; window.move = false; window.texture = d.decalMaterial.mainTexture; window.textureSize = new Vector2(window.texture.width, window.texture.height); window.boxRect = new Rect(d.offset.x * window.textureSize.x, (1.0f - d.offset.y - d.tiling.y) * window.textureSize.y, d.tiling.x * window.textureSize.x, d.tiling.y * window.textureSize.y); window.startPos = new Vector2(window.boxRect.x, window.boxRect.y); window.delta = new Vector2(window.boxRect.width, window.boxRect.height); }
//Draw custom Inspector. public override void OnInspectorGUI() { Decal decal = (Decal)target; /* * GUILayout.BeginVertical(); * decal.showAffectedObjectsOptions = EditorGUILayout.Foldout(decal.showAffectedObjectsOptions, "Affected Objects"); * if(decal.showAffectedObjectsOptions) * { * DrawAffectedObjects(decal); * } * * decal.pushDistance = EditorGUILayout.FloatField(decal.pushDistance); * * GUILayout.FlexibleSpace(); * GUILayout.EndVertical();*/ base.OnInspectorGUI(); if (decal.decalMaterial != null) { if (decal.decalMaterial.mainTexture != null) { if (GUILayout.Button("Edit UV")) { DecalUVEditorWindow.Initialize(decal); } } } //if(decal.decalMaterial == null) return; //GUILayout.BeginVertical(); //GUILayout.FlexibleSpace(); //GUILayout.Label(decal.decalMaterial.mainTexture); //GUILayout.FlexibleSpace(); //GUILayout.EndVertical(); //GUILayout.BeginArea(new Rect(0, 400, 512, 1024)); //GUILayout.EndArea(); //Graphics.DrawTexture(new Rect(10, 10, 100, 100), decal.decalMaterial.mainTexture); }