|
@@ -26,11 +26,6 @@ uint nodeContainerIndex = M_MAX_UNSIGNED;
|
|
|
uint componentContainerStartIndex = 0;
|
|
uint componentContainerStartIndex = 0;
|
|
|
uint elementContainerIndex = M_MAX_UNSIGNED;
|
|
uint elementContainerIndex = M_MAX_UNSIGNED;
|
|
|
|
|
|
|
|
-// Script Attribute session storage
|
|
|
|
|
-VariantMap scriptAttributes;
|
|
|
|
|
-const uint SCRIPTINSTANCE_ATTRIBUTE_IGNORE = 5;
|
|
|
|
|
-const uint LUASCRIPTINSTANCE_ATTRIBUTE_IGNORE = 4;
|
|
|
|
|
-
|
|
|
|
|
// Node or UIElement hash-to-varname reverse mapping
|
|
// Node or UIElement hash-to-varname reverse mapping
|
|
|
VariantMap globalVarNames;
|
|
VariantMap globalVarNames;
|
|
|
bool inspectorLocked = false;
|
|
bool inspectorLocked = false;
|
|
@@ -259,9 +254,6 @@ void UpdateAttributeInspector(bool fullUpdate = true)
|
|
|
if (fullUpdate)
|
|
if (fullUpdate)
|
|
|
DeleteAllContainers();
|
|
DeleteAllContainers();
|
|
|
|
|
|
|
|
- // Update all ScriptInstances/LuaScriptInstances
|
|
|
|
|
- UpdateScriptInstances();
|
|
|
|
|
-
|
|
|
|
|
if (!editNodes.empty)
|
|
if (!editNodes.empty)
|
|
|
{
|
|
{
|
|
|
UIElement@ container = GetNodeContainer();
|
|
UIElement@ container = GetNodeContainer();
|
|
@@ -395,61 +387,6 @@ void UpdateAttributeInspector(bool fullUpdate = true)
|
|
|
HandleWindowLayoutUpdated();
|
|
HandleWindowLayoutUpdated();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void UpdateScriptInstances()
|
|
|
|
|
-{
|
|
|
|
|
- Array<Component@>@ components = scene.GetComponents("ScriptInstance", true);
|
|
|
|
|
- for (uint i = 0; i < components.length; i++)
|
|
|
|
|
- UpdateScriptAttributes(components[i]);
|
|
|
|
|
-
|
|
|
|
|
- components = scene.GetComponents("LuaScriptInstance", true);
|
|
|
|
|
- for (uint i = 0; i < components.length; i++)
|
|
|
|
|
- UpdateScriptAttributes(components[i]);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-String GetComponentAttributeHash(Component@ component, uint index)
|
|
|
|
|
-{
|
|
|
|
|
- // We won't consider the main attributes, as they won't reset when an error occurs.
|
|
|
|
|
- if (component.typeName == "ScriptInstance")
|
|
|
|
|
- {
|
|
|
|
|
- if (index <= SCRIPTINSTANCE_ATTRIBUTE_IGNORE)
|
|
|
|
|
- return "";
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if (index <= LUASCRIPTINSTANCE_ATTRIBUTE_IGNORE)
|
|
|
|
|
- return "";
|
|
|
|
|
- }
|
|
|
|
|
- AttributeInfo attributeInfo = component.attributeInfos[index];
|
|
|
|
|
- Variant attribute = component.attributes[index];
|
|
|
|
|
- return String(component.id) + "-" + attributeInfo.name + "-" + attribute.typeName;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-void UpdateScriptAttributes(Component@ component)
|
|
|
|
|
-{
|
|
|
|
|
- for (uint i = Min(SCRIPTINSTANCE_ATTRIBUTE_IGNORE, LUASCRIPTINSTANCE_ATTRIBUTE_IGNORE) + 1; i < component.numAttributes; i++)
|
|
|
|
|
- {
|
|
|
|
|
- Variant attribute = component.attributes[i];
|
|
|
|
|
- // Component/node ID's are always unique within a scene, based on a simple increment.
|
|
|
|
|
- // This makes for a simple method of mapping a components attributes unique and consistent.
|
|
|
|
|
- // We will also use the type name in the hash to be able to recall and differentiate type changes.
|
|
|
|
|
- String hash = GetComponentAttributeHash(component, i);
|
|
|
|
|
- if (hash.empty)
|
|
|
|
|
- continue;
|
|
|
|
|
-
|
|
|
|
|
- if (!scriptAttributes.Contains(hash))
|
|
|
|
|
- {
|
|
|
|
|
- // set the initial value to the default value.
|
|
|
|
|
- scriptAttributes[hash] = attribute;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- // recall the previously stored value
|
|
|
|
|
- component.attributes[i] = scriptAttributes[hash];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- component.ApplyAttributes();
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
/// Update the attribute list of the node container.
|
|
/// Update the attribute list of the node container.
|
|
|
void UpdateNodeAttributes()
|
|
void UpdateNodeAttributes()
|
|
|
{
|
|
{
|