Explorar o código

Added visibility field to shader parameters so internal parameters can be hidden in the inspector
Resource/GameObject fields will no longer trigger value changed events if the change was initiated externally
Various visual improvements to Material inspector
Fixed a size issue with composite GUI field elements
Fixed a crash with drop down menus
Managed localized strings no longer implicitly convert to normal strings in order to avoid errors
Reimporting builtin assets will now persist their GUIDs

BearishSun %!s(int64=10) %!d(string=hai) anos
pai
achega
6c5fee53e3

+ 5 - 0
BansheeCore/Include/BsImporter.h

@@ -96,4 +96,9 @@ namespace BansheeEngine
 
 		SpecificImporter* getImporterForFile(const Path& inputFilePath) const;
 	};
+
+	/**
+	 * @brief	Provides global access to the importer.
+	 */
+	BS_CORE_EXPORT Importer& gImporter();
 }

+ 5 - 0
BansheeCore/Source/BsImporter.cpp

@@ -152,4 +152,9 @@ namespace BansheeEngine
 
 		return nullptr;
 	}
+
+	BS_CORE_EXPORT Importer& gImporter()
+	{
+		return Importer::instance();
+	}
 }

+ 1 - 1
BansheeCore/Source/BsResources.cpp

@@ -115,7 +115,7 @@ namespace BansheeEngine
 
 		if(!FileSystem::isFile(filePath))
 		{
-			gDebug().logWarning("Specified file: " + filePath.toString() + " doesn't exist.");
+			LOGWRN("Specified file: " + filePath.toString() + " doesn't exist.");
 
 			loadComplete(outputResource);
 			return outputResource;

+ 5 - 9
BansheeEditor/Source/BsBuiltinEditorResources.cpp

@@ -357,10 +357,6 @@ namespace BansheeEngine
 
 	void BuiltinEditorResources::preprocess()
 	{
-		FileSystem::remove(EditorShaderIncludeFolder);
-		FileSystem::remove(EditorShaderFolder);
-		FileSystem::remove(EditorSkinFolder);
-
 		BuiltinResourcesHelper::importAssets(EditorRawShaderIncludeFolder, EditorShaderIncludeFolder, mResourceManifest); // Hidden dependency: Includes must be imported before shaders
 		BuiltinResourcesHelper::importAssets(EditorRawShaderFolder, EditorShaderFolder, mResourceManifest);
 		BuiltinResourcesHelper::importAssets(EditorRawSkinFolder, EditorSkinFolder, mResourceManifest);
@@ -1358,7 +1354,7 @@ namespace BansheeEngine
 
 		GUIElementStyle editorVector2FieldStyle;
 		editorVector2FieldStyle.fixedHeight = true;
-		editorVector2FieldStyle.height = 21;
+		editorVector2FieldStyle.height = 35;
 		editorVector2FieldStyle.minWidth = 30;
 		editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
 		editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
@@ -1367,7 +1363,7 @@ namespace BansheeEngine
 
 		GUIElementStyle editorVector3FieldStyle;
 		editorVector3FieldStyle.fixedHeight = true;
-		editorVector3FieldStyle.height = 21;
+		editorVector3FieldStyle.height = 35;
 		editorVector3FieldStyle.minWidth = 30;
 		editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
 		editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
@@ -1376,7 +1372,7 @@ namespace BansheeEngine
 
 		GUIElementStyle editorVector4FieldStyle;
 		editorVector4FieldStyle.fixedHeight = true;
-		editorVector4FieldStyle.height = 21;
+		editorVector4FieldStyle.height = 35;
 		editorVector4FieldStyle.minWidth = 30;
 		editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
 		editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
@@ -1385,7 +1381,7 @@ namespace BansheeEngine
 
 		GUIElementStyle editorListBoxFieldStyle;
 		editorListBoxFieldStyle.fixedHeight = true;
-		editorListBoxFieldStyle.height = 21;
+		editorListBoxFieldStyle.height = 35;
 		editorListBoxFieldStyle.minWidth = 30;
 		editorListBoxFieldStyle.subStyles[GUIListBoxField::getLabelStyleType()] = GUIListBoxField::getLabelStyleType();
 		editorListBoxFieldStyle.subStyles[GUIListBoxField::getListBoxStyleType()] = GUIListBox::getGUITypeName();
@@ -1394,7 +1390,7 @@ namespace BansheeEngine
 
 		GUIElementStyle editorSliderFieldStyle;
 		editorSliderFieldStyle.fixedHeight = true;
-		editorSliderFieldStyle.height = 21;
+		editorSliderFieldStyle.height = 35;
 		editorSliderFieldStyle.minWidth = 30;
 		editorSliderFieldStyle.subStyles[GUISliderField::getLabelStyleType()] = GUISliderField::getLabelStyleType();
 		editorSliderFieldStyle.subStyles[GUISliderField::getInputStyleType()] = GUIInputBox::getGUITypeName();

+ 30 - 9
BansheeEngine/Source/BsBuiltinResources.cpp

@@ -278,12 +278,6 @@ namespace BansheeEngine
 
 	void BuiltinResources::preprocess()
 	{
-		FileSystem::remove(EngineCursorFolder);
-		FileSystem::remove(EngineShaderIncludeFolder);
-		FileSystem::remove(EngineShaderFolder);
-		FileSystem::remove(EngineSkinFolder);
-		FileSystem::remove(EngineMeshFolder);
-
 		BuiltinResourcesHelper::importAssets(EngineRawCursorFolder, EngineCursorFolder, mResourceManifest);
 		BuiltinResourcesHelper::importAssets(EngineRawShaderIncludeFolder, EngineShaderIncludeFolder, mResourceManifest); // Hidden dependency: Includes must be imported before shaders
 		BuiltinResourcesHelper::importAssets(EngineRawShaderFolder, EngineShaderFolder, mResourceManifest);
@@ -950,23 +944,50 @@ namespace BansheeEngine
 		if (!FileSystem::exists(inputFolder))
 			return;
 
+		UnorderedSet<Path> outputAssets;
 		auto importResource = [&](const Path& filePath)
 		{
 			Path relativePath = filePath.getRelative(inputFolder);
-			Path outputPath = FileSystem::getWorkingDirectoryPath() + outputFolder + relativePath;
-			outputPath.setFilename(outputPath.getWFilename() + L".asset");
+			relativePath = outputFolder + relativePath;;
+			relativePath.setFilename(relativePath.getWFilename() + L".asset");
+
+			Path outputPath = FileSystem::getWorkingDirectoryPath() + relativePath;
+
+			HResource resource;
+			if (FileSystem::exists(outputPath))
+				resource = gResources().load(outputPath);
+
+			if (resource != nullptr)
+				gImporter().reimport(resource, filePath);
+			else
+				resource = Importer::instance().import(filePath);
 
-			HResource resource = Importer::instance().import(filePath);
 			if (resource != nullptr)
 			{
 				Resources::instance().save(resource, outputPath, true);
 				manifest->registerResource(resource.getUUID(), outputPath);
+
+				outputAssets.insert(relativePath);
 			}
 
 			return true;
 		};
 
+		Vector<Path> obsoleteAssets;
+		auto gatherObsolete = [&](const Path& filePath)
+		{
+			auto iterFind = outputAssets.find(filePath);
+			if (iterFind == outputAssets.end())
+				obsoleteAssets.push_back(filePath);
+
+			return true;
+		};
+
 		FileSystem::iterate(inputFolder, importResource);
+		FileSystem::iterate(outputFolder, gatherObsolete);
+
+		for (auto& obsoleteAssetPath : obsoleteAssets)
+			FileSystem::remove(obsoleteAssetPath);
 	}
 
 	void BuiltinResourcesHelper::importFont(const Path& inputFile, const Path& outputFolder, 

+ 4 - 1
BansheeEngine/Source/BsGUIDropDownContent.cpp

@@ -87,7 +87,10 @@ namespace BansheeEngine
 			[&](UINT32 idx, UINT32 visIdx)
 		{ 
 			setSelected(visIdx);
-			mStates[idx] = !mStates[idx];
+
+			if (mIsToggle)
+				mStates[idx] = !mStates[idx];
+
 			mParent->elementActivated(idx, mVisibleElements[visIdx].button->_getLayoutData().area);
 		};
 

+ 2 - 2
BansheeEngine/Source/BsGUIRenderTexture.cpp

@@ -27,12 +27,12 @@ namespace BansheeEngine
 
 	GUIRenderTexture* GUIRenderTexture::create(const RenderTexturePtr& texture, const String& styleName)
 	{
-		return new (bs_alloc<GUIRenderTexture>()) GUIRenderTexture(getStyleName<GUIRenderTexture>(styleName), texture, GUIDimensions::create());
+		return new (bs_alloc<GUIRenderTexture>()) GUIRenderTexture(styleName, texture, GUIDimensions::create());
 	}
 
 	GUIRenderTexture* GUIRenderTexture::create(const RenderTexturePtr& texture, const GUIOptions& options, const String& styleName)
 	{
-		return new (bs_alloc<GUIRenderTexture>()) GUIRenderTexture(getStyleName<GUIRenderTexture>(styleName), texture, GUIDimensions::create(options));
+		return new (bs_alloc<GUIRenderTexture>()) GUIRenderTexture(styleName, texture, GUIDimensions::create(options));
 	}
 
 	void GUIRenderTexture::setRenderTexture(const RenderTexturePtr& texture)

+ 3 - 3
BansheeSL/Include/BsSLImporter.h

@@ -16,12 +16,12 @@ namespace BansheeEngine
 		virtual ~SLImporter();
 
 		/** @copydoc SpecificImporter::isExtensionSupported */
-		virtual bool isExtensionSupported(const WString& ext) const;
+		virtual bool isExtensionSupported(const WString& ext) const override;
 
 		/** @copydoc SpecificImporter::isMagicNumberSupported */
-		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const;
+		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const override;
 
 		/** @copydoc SpecificImporter::import */
-		virtual ResourcePtr import(const Path& filePath, ConstImportOptionsPtr importOptions);
+		virtual ResourcePtr import(const Path& filePath, ConstImportOptionsPtr importOptions) override;
 	};
 }

+ 63 - 57
MBansheeEditor/Inspectors/MaterialInspector.cs

@@ -20,6 +20,7 @@ namespace BansheeEditor
                 return;
 
             shaderField = new GUIResourceField(typeof(Shader), new LocEdString("Shader"));
+            shaderField.Value = material.Shader;
             shaderField.OnChanged += (x) =>
             {
                 material.Shader = x as Shader;
@@ -87,32 +88,43 @@ namespace BansheeEditor
 
             foreach (var param in shaderParams)
             {
-                switch (param.type)
+                if (param.Internal)
+                    continue;
+
+                switch (param.Type)
                 {
                     case ShaderParameterType.Float:
+                        layout.AddSpace(5);
                         guiParams.Add(new MaterialParamFloatGUI(param, mat, layout));
                         break;
                     case ShaderParameterType.Vector2:
+                        layout.AddSpace(5);
                         guiParams.Add(new MaterialParamVec2GUI(param, mat, layout));
                         break;
                     case ShaderParameterType.Vector3:
+                        layout.AddSpace(5);
                         guiParams.Add(new MaterialParamVec3GUI(param, mat, layout));
                         break;
                     case ShaderParameterType.Vector4:
+                        layout.AddSpace(5);
                         guiParams.Add(new MaterialParamVec4GUI(param, mat, layout));
                         break;
                     case ShaderParameterType.Matrix3:
+                        layout.AddSpace(5);
                         guiParams.Add(new MaterialParamMat3GUI(param, mat, layout));
                         break;
                     case ShaderParameterType.Matrix4:
+                        layout.AddSpace(5);
                         guiParams.Add(new MaterialParamMat4GUI(param, mat, layout));
                         break;
                     case ShaderParameterType.Color:
+                        layout.AddSpace(5);
                         guiParams.Add(new MaterialParamColorGUI(param, mat, layout));
                         break;
                     case ShaderParameterType.Texture2D:
                     case ShaderParameterType.Texture3D:
                     case ShaderParameterType.TextureCube:
+                        layout.AddSpace(5);
                         guiParams.Add(new MaterialParamTextureGUI(param, mat, layout));
                         break;
                 }
@@ -166,11 +178,11 @@ namespace BansheeEditor
         internal MaterialParamFloatGUI(ShaderParameter shaderParam, Material material, GUILayout layout)
             : base(shaderParam)
         {
-            LocString title = new LocEdString(shaderParam.name);
+            LocString title = new LocEdString(shaderParam.Name);
             guiElem = new GUIFloatField(title);
             guiElem.OnChanged += (x) =>
             {
-                material.SetFloat(shaderParam.name, x);
+                material.SetFloat(shaderParam.Name, x);
                 EditorApplication.SetDirty(material);
             };
 
@@ -180,7 +192,7 @@ namespace BansheeEditor
         /// <inheritdoc/>
         internal override void Refresh(Material material)
         {
-            guiElem.Value = material.GetFloat(shaderParam.name);
+            guiElem.Value = material.GetFloat(shaderParam.Name);
         }
 
         /// <inheritdoc/>
@@ -206,11 +218,11 @@ namespace BansheeEditor
         internal MaterialParamVec2GUI(ShaderParameter shaderParam, Material material, GUILayout layout)
             : base(shaderParam)
         {
-            LocString title = new LocEdString(shaderParam.name);
+            LocString title = new LocEdString(shaderParam.Name);
             guiElem = new GUIVector2Field(title);
             guiElem.OnChanged += (x) =>
             {
-                material.SetVector2(shaderParam.name, x);
+                material.SetVector2(shaderParam.Name, x);
                 EditorApplication.SetDirty(material);
             };
 
@@ -220,7 +232,7 @@ namespace BansheeEditor
         /// <inheritdoc/>
         internal override void Refresh(Material material)
         {
-            guiElem.Value = material.GetVector2(shaderParam.name);
+            guiElem.Value = material.GetVector2(shaderParam.Name);
         }
 
         /// <inheritdoc/>
@@ -246,11 +258,11 @@ namespace BansheeEditor
         internal MaterialParamVec3GUI(ShaderParameter shaderParam, Material material, GUILayout layout)
             : base(shaderParam)
         {
-            LocString title = new LocEdString(shaderParam.name);
+            LocString title = new LocEdString(shaderParam.Name);
             guiElem = new GUIVector3Field(title);
             guiElem.OnChanged += (x) =>
             {
-                material.SetVector3(shaderParam.name, x);
+                material.SetVector3(shaderParam.Name, x);
                 EditorApplication.SetDirty(material);
             };
 
@@ -260,7 +272,7 @@ namespace BansheeEditor
         /// <inheritdoc/>
         internal override void Refresh(Material material)
         {
-            guiElem.Value = material.GetVector3(shaderParam.name);
+            guiElem.Value = material.GetVector3(shaderParam.Name);
         }
 
         /// <inheritdoc/>
@@ -286,11 +298,11 @@ namespace BansheeEditor
         internal MaterialParamVec4GUI(ShaderParameter shaderParam, Material material, GUILayout layout)
             : base(shaderParam)
         {
-            LocString title = new LocEdString(shaderParam.name);
+            LocString title = new LocEdString(shaderParam.Name);
             guiElem = new GUIVector4Field(title);
             guiElem.OnChanged += (x) =>
             {
-                material.SetVector4(shaderParam.name, x);
+                material.SetVector4(shaderParam.Name, x);
                 EditorApplication.SetDirty(material);
             };
 
@@ -300,7 +312,7 @@ namespace BansheeEditor
         /// <inheritdoc/>
         internal override void Refresh(Material material)
         {
-            guiElem.Value = material.GetVector4(shaderParam.name);
+            guiElem.Value = material.GetVector4(shaderParam.Name);
         }
 
         /// <inheritdoc/>
@@ -317,6 +329,7 @@ namespace BansheeEditor
     {
         private const int MAT_SIZE = 3;
 
+        private GUILayout mainLayout;
         private GUIFloatField[] guiMatFields = new GUIFloatField[MAT_SIZE * MAT_SIZE];
 
         /// <summary>
@@ -328,16 +341,18 @@ namespace BansheeEditor
         internal MaterialParamMat3GUI(ShaderParameter shaderParam, Material material, GUILayout layout)
             : base(shaderParam)
         {
-            LocString title = new LocEdString(shaderParam.name);
+            LocString title = new LocEdString(shaderParam.Name);
             GUILabel guiTitle = new GUILabel(title, GUIOption.FixedWidth(100));
 
-            GUILayout mainLayout = layout.AddLayoutX();
-            mainLayout.AddElement(guiTitle);
+            mainLayout = layout.AddLayoutY();
+            GUILayoutX titleLayout = mainLayout.AddLayoutX();
+            titleLayout.AddElement(guiTitle);
+            titleLayout.AddFlexibleSpace();
 
             GUILayoutY contentLayout = mainLayout.AddLayoutY();
 
             GUILayoutX[] rows = new GUILayoutX[MAT_SIZE];
-            for (int i = 0; i < MAT_SIZE; i++)
+            for (int i = 0; i < rows.Length; i++)
                 rows[i] = contentLayout.AddLayoutX();
 
             for (int row = 0; row < MAT_SIZE; row++)
@@ -345,18 +360,19 @@ namespace BansheeEditor
                 for (int col = 0; col < MAT_SIZE; col++)
                 {
                     int index = row * MAT_SIZE + col;
-                    guiMatFields[index] = new GUIFloatField(row + ", " + col, 30);
+                    guiMatFields[index] = new GUIFloatField(row + "," + col, 20, "", GUIOption.FixedWidth(80));
 
                     GUIFloatField field = guiMatFields[index];
                     rows[row].AddElement(field);
+                    rows[row].AddSpace(5);
 
                     int hoistedRow = row;
                     int hoistedCol = col;
                     field.OnChanged += (x) =>
                     {
-                        Matrix3 value = material.GetMatrix3(shaderParam.name);
+                        Matrix3 value = material.GetMatrix3(shaderParam.Name);
                         value[hoistedRow, hoistedCol] = x;
-                        material.SetMatrix3(shaderParam.name, value);
+                        material.SetMatrix3(shaderParam.Name, value);
                         EditorApplication.SetDirty(material);
                     };
                 }
@@ -366,7 +382,7 @@ namespace BansheeEditor
         /// <inheritdoc/>
         internal override void Refresh(Material material)
         {
-            Matrix3 value = material.GetMatrix3(shaderParam.name);
+            Matrix3 value = material.GetMatrix3(shaderParam.Name);
 
             for (int row = 0; row < MAT_SIZE; row++)
             {
@@ -381,14 +397,7 @@ namespace BansheeEditor
         /// <inheritdoc/>
         internal override void Destroy()
         {
-            for (int row = 0; row < MAT_SIZE; row++)
-            {
-                for (int col = 0; col < MAT_SIZE; col++)
-                {
-                    int index = row*MAT_SIZE + col;
-                    guiMatFields[index].Destroy();
-                }
-            }
+            mainLayout.Destroy();
         }
     }
 
@@ -399,6 +408,7 @@ namespace BansheeEditor
     {
         private const int MAT_SIZE = 4;
 
+        private GUILayout mainLayout;
         private GUIFloatField[] guiMatFields = new GUIFloatField[MAT_SIZE * MAT_SIZE];
 
         /// <summary>
@@ -410,16 +420,18 @@ namespace BansheeEditor
         internal MaterialParamMat4GUI(ShaderParameter shaderParam, Material material, GUILayout layout)
             : base(shaderParam)
         {
-            LocString title = new LocEdString(shaderParam.name);
+            LocString title = new LocEdString(shaderParam.Name);
             GUILabel guiTitle = new GUILabel(title, GUIOption.FixedWidth(100));
 
-            GUILayout mainLayout = layout.AddLayoutX();
-            mainLayout.AddElement(guiTitle);
+            mainLayout = layout.AddLayoutY();
+            GUILayoutX titleLayout = mainLayout.AddLayoutX();
+            titleLayout.AddElement(guiTitle);
+            titleLayout.AddFlexibleSpace();
 
             GUILayoutY contentLayout = mainLayout.AddLayoutY();
 
             GUILayoutX[] rows = new GUILayoutX[MAT_SIZE];
-            for (int i = 0; i < MAT_SIZE; i++)
+            for (int i = 0; i < rows.Length; i++)
                 rows[i] = contentLayout.AddLayoutX();
 
             for (int row = 0; row < MAT_SIZE; row++)
@@ -427,18 +439,19 @@ namespace BansheeEditor
                 for (int col = 0; col < MAT_SIZE; col++)
                 {
                     int index = row * MAT_SIZE + col;
-                    guiMatFields[index] = new GUIFloatField(row + ", " + col, 30);
+                    guiMatFields[index] = new GUIFloatField(row + "," + col, 20, "", GUIOption.FixedWidth(80));
 
                     GUIFloatField field = guiMatFields[index];
                     rows[row].AddElement(field);
+                    rows[row].AddSpace(5);
 
                     int hoistedRow = row;
                     int hoistedCol = col;
                     field.OnChanged += (x) =>
                     {
-                        Matrix4 value = material.GetMatrix4(shaderParam.name);
+                        Matrix4 value = material.GetMatrix4(shaderParam.Name);
                         value[hoistedRow, hoistedCol] = x;
-                        material.SetMatrix4(shaderParam.name, value);
+                        material.SetMatrix4(shaderParam.Name, value);
                         EditorApplication.SetDirty(material);
                     };
                 }
@@ -448,7 +461,7 @@ namespace BansheeEditor
         /// <inheritdoc/>
         internal override void Refresh(Material material)
         {
-            Matrix4 value = material.GetMatrix4(shaderParam.name);
+            Matrix4 value = material.GetMatrix4(shaderParam.Name);
 
             for (int row = 0; row < MAT_SIZE; row++)
             {
@@ -463,14 +476,7 @@ namespace BansheeEditor
         /// <inheritdoc/>
         internal override void Destroy()
         {
-            for (int row = 0; row < MAT_SIZE; row++)
-            {
-                for (int col = 0; col < MAT_SIZE; col++)
-                {
-                    int index = row * MAT_SIZE + col;
-                    guiMatFields[index].Destroy();
-                }
-            }
+            mainLayout.Destroy();
         }
     }
 
@@ -490,11 +496,11 @@ namespace BansheeEditor
         internal MaterialParamColorGUI(ShaderParameter shaderParam, Material material, GUILayout layout)
             : base(shaderParam)
         {
-            LocString title = new LocEdString(shaderParam.name);
+            LocString title = new LocEdString(shaderParam.Name);
             guiElem = new GUIColorField(title);
             guiElem.OnChanged += (x) =>
             {
-                material.SetColor(shaderParam.name, x);
+                material.SetColor(shaderParam.Name, x);
                 EditorApplication.SetDirty(material);
             };
 
@@ -504,7 +510,7 @@ namespace BansheeEditor
         /// <inheritdoc/>
         internal override void Refresh(Material material)
         {
-            guiElem.Value = material.GetColor(shaderParam.name);
+            guiElem.Value = material.GetColor(shaderParam.Name);
         }
 
         /// <inheritdoc/>
@@ -530,29 +536,29 @@ namespace BansheeEditor
         internal MaterialParamTextureGUI(ShaderParameter shaderParam, Material material, GUILayout layout)
             : base(shaderParam)
         {
-            LocString title = new LocEdString(shaderParam.name);
+            LocString title = new LocEdString(shaderParam.Name);
             guiElem = new GUITextureField(title);
 
-            switch (shaderParam.type)
+            switch (shaderParam.Type)
             {
                 case ShaderParameterType.Texture2D:
                     guiElem.OnChanged += (x) =>
                     {
-                        material.SetTexture2D(shaderParam.name, x as Texture2D);
+                        material.SetTexture2D(shaderParam.Name, x as Texture2D);
                         EditorApplication.SetDirty(material);
                     };
                     break;
                 case ShaderParameterType.Texture3D:
                     guiElem.OnChanged += (x) =>
                     {
-                        material.SetTexture3D(shaderParam.name, x as Texture3D);
+                        material.SetTexture3D(shaderParam.Name, x as Texture3D);
                         EditorApplication.SetDirty(material);
                     };
                     break;
                 case ShaderParameterType.TextureCube:
                     guiElem.OnChanged += (x) =>
                     {
-                        material.SetTextureCube(shaderParam.name, x as TextureCube);
+                        material.SetTextureCube(shaderParam.Name, x as TextureCube);
                         EditorApplication.SetDirty(material);
                     };
                     break;
@@ -565,16 +571,16 @@ namespace BansheeEditor
         internal override void Refresh(Material material)
         {
             Texture value = null;
-            switch (shaderParam.type)
+            switch (shaderParam.Type)
             {
                 case ShaderParameterType.Texture2D:
-                    value = material.GetTexture2D(shaderParam.name);
+                    value = material.GetTexture2D(shaderParam.Name);
                     break;
                 case ShaderParameterType.Texture3D:
-                    value = material.GetTexture3D(shaderParam.name);
+                    value = material.GetTexture3D(shaderParam.Name);
                     break;
                 case ShaderParameterType.TextureCube:
-                    value = material.GetTextureCube(shaderParam.name);
+                    value = material.GetTextureCube(shaderParam.Name);
                     break;
             }
 

+ 1 - 1
MBansheeEditor/Inspectors/SpriteTextureInspector.cs

@@ -9,7 +9,7 @@ namespace BansheeEditor
     [CustomInspector(typeof(SpriteTexture))]
     internal class SpriteTextureInspector : Inspector
     {
-        private GUITextureField textureField = new GUITextureField(new LocEdString("Texture"));
+        private GUITextureField textureField = new GUITextureField(new LocEdString("Atlas"));
         private GUIVector2Field offsetField = new GUIVector2Field(new LocEdString("Offset"));
         private GUIVector2Field scaleField = new GUIVector2Field(new LocEdString("Scale"));
 

+ 1 - 1
MBansheeEngine/LocString.cs

@@ -51,7 +51,7 @@ namespace BansheeEngine
         /// </summary>
         /// <param name="text">Localized string to retrieve the text from.</param>
         /// <returns>Translated text for the currently active language.</returns>
-        public static implicit operator string(LocString text)
+        public static explicit operator string(LocString text)
         {
             string value;
             Internal_GetValue(text.mCachedPtr, out value);

+ 30 - 9
MBansheeEngine/Shader.cs

@@ -18,19 +18,38 @@ namespace BansheeEngine
     /// </summary>
     public struct ShaderParameter
     {
+        /// <summary>
+        /// Returns the name of the parameter variable.
+        /// </summary>
+        public string Name { get { return name; } }
+
+        /// <summary>
+        /// Returns the data type of the parameter.
+        /// </summary>
+        public ShaderParameterType Type { get { return type; } }
+
+        /// <summary>
+        /// Determines is parameter managed internally be the renderer, or is it expected to be set by the user.
+        /// </summary>
+        public bool Internal { get { return isInternal; } }
+
+        private string name;
+        private ShaderParameterType type;
+        private bool isInternal;
+
         /// <summary>
         /// Creates a new shader parameter.
         /// </summary>
-        /// <param name="name">Name of the parameter.</param>
-        /// <param name="type">Type of the parameter.</param>
-        internal ShaderParameter(string name, ShaderParameterType type)
+        /// <param name="name">Name of the parameter variable.</param>
+        /// <param name="type">Data type of the parameter.</param>
+        /// <param name="isInternal">Determines is parameter managed internally be the renderer, or is expected to be set 
+        ///                          by the user.</param>
+        internal ShaderParameter(string name, ShaderParameterType type, bool isInternal)
         {
             this.name = name;
             this.type = type;
+            this.isInternal = isInternal;
         }
-
-        public string name;
-        public ShaderParameterType type;
     }
 
     /// <summary>
@@ -54,13 +73,14 @@ namespace BansheeEngine
             {
                 string[] names;
                 ShaderParameterType[] types;
+                bool[] visibility;
 
-                Internal_GetShaderParameters(mCachedPtr, out names, out types);
+                Internal_GetShaderParameters(mCachedPtr, out names, out types, out visibility);
 
                 ShaderParameter[] parameters = new ShaderParameter[names.Length];
                 for (int i = 0; i < names.Length; i++)
                 {
-                    parameters[i] = new ShaderParameter(names[i], types[i]);
+                    parameters[i] = new ShaderParameter(names[i], types[i], visibility[i]);
                 }
 
                 return parameters;
@@ -68,6 +88,7 @@ namespace BansheeEngine
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetShaderParameters(IntPtr nativeInstance, out string[] names, out ShaderParameterType[] types);
+        private static extern void Internal_GetShaderParameters(IntPtr nativeInstance, out string[] names,
+            out ShaderParameterType[] types, out bool[] visibility);
     }
 }

+ 9 - 0
SBansheeEditor/Include/BsGUIGameObjectField.h

@@ -194,6 +194,15 @@ namespace BansheeEngine
 	private:
 		virtual ~GUIGameObjectField();
 
+		/**
+		 * @brief	Sets the game object referenced by the field.
+		 * 			
+		 * @param	value			Game object to reference.
+		 * @param	triggerEvent	Determines should the ::onValueChanged event be triggered if the new object is different 
+		 * 							from the previous one.
+		 */
+		void setValue(const HGameObject& value, bool triggerEvent);
+
 		/**
 		 * @copydoc	GUIElement::styleUpdated
 		 */

+ 5 - 1
SBansheeEditor/Include/BsGUIResourceField.h

@@ -204,8 +204,12 @@ namespace BansheeEngine
 		/**
 		 * @brief	Sets the resource referenced by the field by finding
 		 *			the resource with the provided UUID.
+		 *			
+		 * @param	uuid			Unique resource identifier of the resource to show, or empty string if no resource.
+		 * @param	triggerEvent	Determines should the ::onValueChanged event be triggered if the new UUID is different 
+		 * 							from the previous one.
 		 */
-		void setUUID(const String& uuid);
+		void setUUID(const String& uuid, bool triggerEvent = true);
 
 		/**
 		 * @copydoc	GUIElement::styleUpdated

+ 10 - 6
SBansheeEditor/Include/BsGUITextureField.h

@@ -159,12 +159,6 @@ namespace BansheeEngine
 		 */
 		String getUUID() const { return mUUID; }
 
-		/**
-		 * @brief	Sets the texture referenced by the field by finding
-		 *			the texture with the provided UUID.
-		 */
-		void setUUID(const String& uuid);
-
 		/**
 		 * @copydoc	GUIElement::setTint
 		 */
@@ -193,6 +187,16 @@ namespace BansheeEngine
 		 */
 		void styleUpdated() override;
 
+		/**
+		 * @brief	Sets the texture referenced by the field by finding
+		 *			the texture with the provided UUID.
+		 *			
+		 * @param	uuid			Unique resource identifier of the texture to show, or empty string if no texture.
+		 * @param	triggerEvent	Determines should the ::onValueChanged event be triggered if the new UUID is different 
+		 * 							from the previous one.
+		 */
+		void setUUID(const String& uuid, bool triggerEvent = true);
+
 		/**
 		 * @brief	Triggered when a drag and drop operation finishes over this element.
 		 */

+ 11 - 5
SBansheeEditor/Source/BsGUIGameObjectField.cpp

@@ -173,7 +173,12 @@ namespace BansheeEngine
 
 	void GUIGameObjectField::setValue(const HGameObject& value)
 	{
-		if(value)
+		setValue(value, false);
+	}
+
+	void GUIGameObjectField::setValue(const HGameObject& value, bool triggerEvent)
+	{
+		if (value)
 		{
 			if (mInstanceId == value.getInstanceId())
 				return;
@@ -190,7 +195,8 @@ namespace BansheeEngine
 			mDropButton->setContent(GUIContent(HString(L"None (" + toWString(mType) + L")")));
 		}
 
-		onValueChanged(value);
+		if (triggerEvent)
+			onValueChanged(value);
 	}
 
 	void GUIGameObjectField::setTint(const Color& color)
@@ -247,7 +253,7 @@ namespace BansheeEngine
 
 		if (mType == sceneObjectClass->getFullName()) // A scene object
 		{
-			setValue(draggedSceneObjects->objects[0]);
+			setValue(draggedSceneObjects->objects[0], true);
 		}
 		else // A component
 		{
@@ -269,7 +275,7 @@ namespace BansheeEngine
 						{
 							if (providedClass->isSubClassOf(acceptedClass))
 							{
-								setValue(managedComponent);
+								setValue(managedComponent, true);
 							}
 						}
 					}
@@ -289,7 +295,7 @@ namespace BansheeEngine
 
 	void GUIGameObjectField::onClearButtonClicked()
 	{
-		setValue(HGameObject());
+		setValue(HGameObject(), true);
 	}
 
 	const String& GUIGameObjectField::getGUITypeName()

+ 6 - 7
SBansheeEditor/Source/BsGUIResourceField.cpp

@@ -190,7 +190,7 @@ namespace BansheeEngine
 		{
 			Path resPath = gProjectLibrary().uuidToPath(value.getUUID());
 			if (!resPath.isEmpty())
-				setUUID(value.getUUID());
+				setUUID(value.getUUID(), false);
 			else // A non-project library resource
 			{
 				if (mUUID == value.getUUID())
@@ -200,15 +200,13 @@ namespace BansheeEngine
 
 				WString title = value->getName() + L" (" + toWString(mType) + L")";
 				mDropButton->setContent(GUIContent(HEString(title)));
-
-				onValueChanged(mUUID);
 			}
 		}
 		else
-			setUUID("");
+			setUUID("", false);
 	}
 
-	void GUIResourceField::setUUID(const String& uuid)
+	void GUIResourceField::setUUID(const String& uuid, bool triggerEvent)
 	{ 
 		if (mUUID == uuid)
 			return;
@@ -224,7 +222,8 @@ namespace BansheeEngine
 		else
 			mDropButton->setContent(GUIContent(HEString(L"None (" + toWString(mType) + L")")));
 
-		onValueChanged(mUUID);
+		if (triggerEvent)
+			onValueChanged(mUUID);
 	}
 
 	void GUIResourceField::setTint(const Color& color)
@@ -416,7 +415,7 @@ namespace BansheeEngine
 
 	void GUIResourceField::onClearButtonClicked()
 	{
-		setValue(HResource());
+		setUUID(StringUtil::BLANK);
 	}
 
 	const String& GUIResourceField::getGUITypeName()

+ 6 - 7
SBansheeEditor/Source/BsGUITextureField.cpp

@@ -54,8 +54,6 @@ namespace BansheeEngine
 
 		mDropButton->onDataDropped.connect(std::bind(&GUITextureField::dataDropped, this, _1));
 		mDropButton->onClick.connect(std::bind(&GUITextureField::onDropButtonClicked, this));
-
-		setValue(HTexture());
 	}
 
 	GUITextureField::~GUITextureField()
@@ -175,12 +173,12 @@ namespace BansheeEngine
 	void GUITextureField::setValue(const HTexture& value)
 	{
 		if (value)
-			setUUID(value.getUUID());
+			setUUID(value.getUUID(), false);
 		else
-			setUUID("");
+			setUUID("", false);
 	}
 
-	void GUITextureField::setUUID(const String& uuid)
+	void GUITextureField::setUUID(const String& uuid, bool triggerEvent)
 	{
 		if (mUUID == uuid)
 			return;
@@ -205,7 +203,8 @@ namespace BansheeEngine
 			mClearButton->setVisible(false);
 		}
 
-		onValueChanged(mUUID);
+		if (triggerEvent)
+			onValueChanged(mUUID);
 	}
 
 	void GUITextureField::setTint(const Color& color)
@@ -275,7 +274,7 @@ namespace BansheeEngine
 
 	void GUITextureField::onClearButtonClicked()
 	{
-		setValue(HTexture());
+		setUUID(StringUtil::BLANK);
 	}
 
 	const String& GUITextureField::getGUITypeName()

+ 2 - 1
SBansheeEngine/Include/BsScriptShader.h

@@ -22,6 +22,7 @@ namespace BansheeEngine
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/
-		static void internal_GetShaderParameters(ScriptShader* nativeInstance, MonoArray** outNames, MonoArray** outTypes);
+		static void internal_GetShaderParameters(ScriptShader* nativeInstance, MonoArray** outNames, MonoArray** outTypes, 
+			MonoArray** outVisibility);
 	};
 }

+ 12 - 4
SBansheeEngine/Source/BsScriptShader.cpp

@@ -29,7 +29,8 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_GetShaderParameters", &ScriptShader::internal_GetShaderParameters);
 	}
 
-	void ScriptShader::internal_GetShaderParameters(ScriptShader* nativeInstance, MonoArray** outNames, MonoArray** outTypes)
+	void ScriptShader::internal_GetShaderParameters(ScriptShader* nativeInstance, MonoArray** outNames, 
+		MonoArray** outTypes, MonoArray** outVisibility)
 	{
 		HShader shader = nativeInstance->getHandle();
 		if (!shader.isLoaded())
@@ -43,6 +44,7 @@ namespace BansheeEngine
 		{
 			String name;
 			ShaderParameterType type;
+			bool internal;
 		};
 
 		Vector<ParamInfo> paramInfos;
@@ -53,6 +55,7 @@ namespace BansheeEngine
 		{
 			ShaderParameterType type;
 			bool isValidType = false;
+			bool isInternal = !param.second.rendererSemantic.empty();
 			switch (param.second.type) 
 			{
 			case GPDT_FLOAT1:
@@ -86,13 +89,14 @@ namespace BansheeEngine
 			}
 
 			if (isValidType)
-				paramInfos.push_back({ param.first, type });
+				paramInfos.push_back({ param.first, type, isInternal });
 		}
 
 		for (auto& param : textureParams)
 		{
 			ShaderParameterType type;
 			bool isValidType = false;
+			bool isInternal = !param.second.rendererSemantic.empty();
 			switch (param.second.type)
 			{
 			case GPOT_TEXTURE2D:
@@ -111,13 +115,14 @@ namespace BansheeEngine
 			}
 
 			if (isValidType)
-				paramInfos.push_back({ param.first, type });
+				paramInfos.push_back({ param.first, type, isInternal });
 		}
 
 		for (auto& param : samplerParams)
 		{
 			ShaderParameterType type = ShaderParameterType::Sampler;
-			paramInfos.push_back({ param.first, type });
+			bool isInternal = !param.second.rendererSemantic.empty();
+			paramInfos.push_back({ param.first, type, isInternal });
 		}
 
 
@@ -125,17 +130,20 @@ namespace BansheeEngine
 
 		ScriptArray names = ScriptArray::create<String>(totalNumParams);
 		ScriptArray types = ScriptArray::create<UINT32>(totalNumParams);
+		ScriptArray visibility = ScriptArray::create<bool>(totalNumParams);
 
 		UINT32 idx = 0;
 		for (auto& param : paramInfos)
 		{
 			names.set(idx, param.name);
 			types.set(idx, param.type);
+			visibility.set(idx, param.internal);
 
 			idx++;
 		}
 
 		*outNames = names.getInternal();
 		*outTypes = types.getInternal();
+		*outVisibility = visibility.getInternal();
 	}
 }