コード例 #1
0
 static int LoadIcon(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         IconManager          obj  = (IconManager)ToLua.CheckObject <IconManager>(L, 1);
         string               arg0 = ToLua.CheckString(L, 2);
         LoadCompleteCallback arg1 = (LoadCompleteCallback)ToLua.CheckDelegate <LoadCompleteCallback>(L, 3);
         LoadErrorCallback    arg2 = (LoadErrorCallback)ToLua.CheckDelegate <LoadErrorCallback>(L, 4);
         obj.LoadIcon(arg0, arg1, arg2);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #2
0
        public static void Render(FMAT material, UVViewport UVViewport, bool onLoad)
        {
            float width = ImGui.GetWindowWidth();

            if (ImGui.BeginChild("TEXTURE_MAP_LIST", new System.Numerics.Vector2(width, 100)))
            {
                int index = 0;
                foreach (var texMap in material.TextureMaps)
                {
                    var tex = SearchTextureInstance(texMap.Name);
                    if (tex != null)
                    {
                        if (tex.RenderableTex == null)
                        {
                            tex.LoadRenderableTexture();
                        }

                        if (tex.RenderableTex != null)
                        {
                            IconManager.LoadTexture(tex.Name, tex);
                        }
                        else
                        {
                            IconManager.LoadIcon("TEXTURE");
                        }
                    }
                    else
                    {
                        IconManager.LoadIcon("TEXTURE");
                    }
                    ImGui.SameLine();

                    if (dialogOpened && SelectedIndices.Contains(index))
                    {
                        if (TextureSelectionDialog.Render(texMap.Name, ref dialogOpened))
                        {
                            var input = TextureSelectionDialog.OutputName;
                            //Only undo matching textures, not typed names
                            if (tex != null)
                            {
                                UndoStack.Add(new UndoStringOperation($"Texture Map",
                                                                      texMap, "Name", input));
                            }

                            texMap.Name = input;
                        }
                    }
                    else
                    {
                        if (ImGui.Selectable(texMap.Name, SelectedIndices.Contains(index)))
                        {
                            SelectedIndices.Clear();
                            SelectedIndices.Add(index);
                        }
                        if (ImGui.IsItemClicked() && ImGui.IsMouseDoubleClicked(0))
                        {
                            dialogOpened = true;
                        }
                    }

                    index++;
                }
            }
            ImGui.EndChild();

            if (material.TextureMaps.Count == 0)
            {
                return;
            }

            //Make sure there is atleast 1 selection used
            if (SelectedIndices.Count == 0)
            {
                SelectedIndices.Add(0);
            }

            if (ImGui.BeginChild("SAMPLER_DATA"))
            {
                SelectSampler(material, UVViewport, SelectedIndices.FirstOrDefault(), onLoad);
            }
            ImGui.EndChild();
        }