Browse Source

Add the concept of base class type to Object to simplify determining if a ScriptInstance's handle variable is a Node, Component or Resource. Serialize script's resource handles as ResourceRef attributes and allow editing them.

Lasse Öörni 12 years ago
parent
commit
36eb726d36

+ 2 - 0
Docs/LuaScriptAPI.dox

@@ -811,6 +811,7 @@ Methods:
 Methods:
 Methods:
 
 
 - ShortStringHash GetType() const
 - ShortStringHash GetType() const
+- ShortStringHash GetBaseType() const
 - const String& GetTypeName() const
 - const String& GetTypeName() const
 - const String& GetCategory() const
 - const String& GetCategory() const
 - void SendEvent(const String eventName, VariantMap* eventData = 0)
 - void SendEvent(const String eventName, VariantMap* eventData = 0)
@@ -818,6 +819,7 @@ Methods:
 Properties:
 Properties:
 
 
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - const String typeName (readonly)
 - const String typeName (readonly)
 - const String category (readonly)
 - const String category (readonly)
 
 

+ 84 - 0
Docs/ScriptAPI.dox

@@ -1210,6 +1210,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 
 
@@ -1246,6 +1247,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint frameNumber (readonly)
 - uint frameNumber (readonly)
@@ -1271,6 +1273,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - int level
 - int level
@@ -1426,6 +1429,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - FileMode mode (readonly)
 - FileMode mode (readonly)
@@ -1534,6 +1538,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String currentDir
 - String currentDir
@@ -1554,6 +1559,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name (readonly)
 - String name (readonly)
@@ -1575,6 +1581,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -1613,6 +1620,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint[] memoryBudget
 - uint[] memoryBudget
@@ -1641,6 +1649,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -1667,6 +1676,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -1793,6 +1803,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -1826,6 +1837,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -1908,6 +1920,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -1965,6 +1978,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -2068,6 +2082,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -2169,6 +2184,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -2213,6 +2229,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -2336,6 +2353,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -2370,6 +2388,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - Scene@ scene
 - Scene@ scene
@@ -2414,6 +2433,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -2454,6 +2474,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -2516,6 +2537,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -2555,6 +2577,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -2585,6 +2608,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -2621,6 +2645,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -2657,6 +2682,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -2731,6 +2757,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -2800,6 +2827,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -2863,6 +2891,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -2922,6 +2951,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -2981,6 +3011,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3079,6 +3110,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3169,6 +3201,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3219,6 +3252,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3297,6 +3331,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3397,6 +3432,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3455,6 +3491,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3513,6 +3550,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3567,6 +3605,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3643,6 +3682,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3675,6 +3715,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String windowTitle
 - String windowTitle
@@ -3718,6 +3759,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numViewports
 - uint numViewports
@@ -3789,6 +3831,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - bool mouseVisible
 - bool mouseVisible
@@ -3827,6 +3870,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -3865,6 +3909,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3907,6 +3952,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3959,6 +4005,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -3998,6 +4045,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - float[] masterGain
 - float[] masterGain
@@ -4025,6 +4073,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -4093,6 +4142,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -4221,6 +4271,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -4349,6 +4400,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -4457,6 +4509,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -4597,6 +4650,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -4734,6 +4788,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -4871,6 +4926,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -5011,6 +5067,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -5148,6 +5205,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -5301,6 +5359,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -5450,6 +5509,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -5556,6 +5616,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -5665,6 +5726,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -5814,6 +5876,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -5969,6 +6032,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -6117,6 +6181,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -6254,6 +6319,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -6349,6 +6415,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String title
 - String title
@@ -6389,6 +6456,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - Cursor@ cursor
 - Cursor@ cursor
@@ -6444,6 +6512,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -6477,6 +6546,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - Scene@ scene
 - Scene@ scene
@@ -6567,6 +6637,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - int updateFps
 - int updateFps
@@ -6611,6 +6682,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -6668,6 +6740,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -6732,6 +6805,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -6803,6 +6877,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -6846,6 +6921,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -6892,6 +6968,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -6947,6 +7024,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -6977,6 +7055,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - String name
 - String name
@@ -7018,6 +7097,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - uint numAttributes (readonly)
 - uint numAttributes (readonly)
@@ -7048,6 +7128,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - ScriptFile@ defaultScriptFile
 - ScriptFile@ defaultScriptFile
@@ -7067,6 +7148,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - XMLFile@ defaultStyle
 - XMLFile@ defaultStyle
@@ -7096,6 +7178,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - XMLFile@ defaultStyle
 - XMLFile@ defaultStyle
@@ -7126,6 +7209,7 @@ Properties:
 - int refs (readonly)
 - int refs (readonly)
 - int weakRefs (readonly)
 - int weakRefs (readonly)
 - ShortStringHash type (readonly)
 - ShortStringHash type (readonly)
+- ShortStringHash baseType (readonly)
 - String typeName (readonly)
 - String typeName (readonly)
 - String category (readonly)
 - String category (readonly)
 - int minFps
 - int minFps

+ 21 - 7
Source/Engine/Core/Object.h

@@ -32,9 +32,23 @@ namespace Urho3D
 class Context;
 class Context;
 class EventHandler;
 class EventHandler;
 
 
+#define OBJECT(typeName) \
+    public: \
+        virtual Urho3D::ShortStringHash GetType() const { return GetTypeStatic(); } \
+        virtual Urho3D::ShortStringHash GetBaseType() const { return GetBaseTypeStatic(); } \
+        virtual const Urho3D::String& GetTypeName() const { return GetTypeNameStatic(); } \
+        static Urho3D::ShortStringHash GetTypeStatic() { static const Urho3D::ShortStringHash typeStatic(#typeName); return typeStatic; } \
+        static const Urho3D::String& GetTypeNameStatic() { static const Urho3D::String typeNameStatic(#typeName); return typeNameStatic; } \
+
+#define BASEOBJECT(typeName) \
+    public: \
+        static Urho3D::ShortStringHash GetBaseTypeStatic() { static const Urho3D::ShortStringHash baseTypeStatic(#typeName); return baseTypeStatic; } \
+
 /// Base class for objects with type identification, subsystem access and event sending/receiving capability.
 /// Base class for objects with type identification, subsystem access and event sending/receiving capability.
 class URHO3D_API Object : public RefCounted
 class URHO3D_API Object : public RefCounted
 {
 {
+    BASEOBJECT(Object);
+    
     friend class Context;
     friend class Context;
     
     
 public:
 public:
@@ -47,6 +61,8 @@ public:
     virtual ShortStringHash GetType() const = 0;
     virtual ShortStringHash GetType() const = 0;
     /// Return type name.
     /// Return type name.
     virtual const String& GetTypeName() const = 0;
     virtual const String& GetTypeName() const = 0;
+    /// Return base class type hash.
+    virtual ShortStringHash GetBaseType() const = 0;
     /// Handle event.
     /// Handle event.
     virtual void OnEvent(Object* sender, StringHash eventType, VariantMap& eventData);
     virtual void OnEvent(Object* sender, StringHash eventType, VariantMap& eventData);
     
     
@@ -126,6 +142,8 @@ public:
     ShortStringHash GetType() const { return type_; }
     ShortStringHash GetType() const { return type_; }
     /// Return type name of objects created by this factory.
     /// Return type name of objects created by this factory.
     const String& GetTypeName() const { return typeName_; }
     const String& GetTypeName() const { return typeName_; }
+    /// Return base type hash of objects created by this factory.
+    ShortStringHash GetBaseType() const { return baseType_; }
     
     
 protected:
 protected:
     /// Execution context.
     /// Execution context.
@@ -134,6 +152,8 @@ protected:
     ShortStringHash type_;
     ShortStringHash type_;
     /// Object type name.
     /// Object type name.
     String typeName_;
     String typeName_;
+    /// Object base type.
+    ShortStringHash baseType_;
 };
 };
 
 
 /// Template implementation of the object factory.
 /// Template implementation of the object factory.
@@ -146,6 +166,7 @@ public:
     {
     {
         type_ = T::GetTypeStatic();
         type_ = T::GetTypeStatic();
         typeName_ = T::GetTypeNameStatic();
         typeName_ = T::GetTypeNameStatic();
+        baseType_ = T::GetBaseTypeStatic();
     }
     }
     
     
     /// Create an object of the specific type.
     /// Create an object of the specific type.
@@ -241,13 +262,6 @@ private:
     HandlerFunctionPtr function_;
     HandlerFunctionPtr function_;
 };
 };
 
 
-#define OBJECT(typeName) \
-    public: \
-        virtual Urho3D::ShortStringHash GetType() const { return GetTypeStatic(); } \
-        virtual const Urho3D::String& GetTypeName() const { return GetTypeNameStatic(); } \
-        static Urho3D::ShortStringHash GetTypeStatic() { static const Urho3D::ShortStringHash typeStatic(#typeName); return typeStatic; } \
-        static const Urho3D::String& GetTypeNameStatic() { static const Urho3D::String typeNameStatic(#typeName); return typeNameStatic; } \
-
 #define EVENT(eventID, eventName) static const Urho3D::StringHash eventID(#eventName); namespace eventName
 #define EVENT(eventID, eventName) static const Urho3D::StringHash eventID(#eventName); namespace eventName
 #define PARAM(paramID, paramName) static const Urho3D::ShortStringHash paramID(#paramName)
 #define PARAM(paramID, paramName) static const Urho3D::ShortStringHash paramID(#paramName)
 #define HANDLER(className, function) (new Urho3D::EventHandlerImpl<className>(this, &className::function))
 #define HANDLER(className, function) (new Urho3D::EventHandlerImpl<className>(this, &className::function))

+ 2 - 2
Source/Engine/Physics/PhysicsWorld.h

@@ -89,11 +89,11 @@ static const float DEFAULT_MAX_NETWORK_ANGULAR_VELOCITY = 100.0f;
 /// Physics simulation world component. Should be added only to the root scene node.
 /// Physics simulation world component. Should be added only to the root scene node.
 class URHO3D_API PhysicsWorld : public Component, public btIDebugDraw
 class URHO3D_API PhysicsWorld : public Component, public btIDebugDraw
 {
 {
+    OBJECT(PhysicsWorld);
+
     friend void InternalPreTickCallback(btDynamicsWorld *world, btScalar timeStep);
     friend void InternalPreTickCallback(btDynamicsWorld *world, btScalar timeStep);
     friend void InternalTickCallback(btDynamicsWorld *world, btScalar timeStep);
     friend void InternalTickCallback(btDynamicsWorld *world, btScalar timeStep);
 
 
-    OBJECT(PhysicsWorld);
-
 public:
 public:
     /// Construct.
     /// Construct.
     PhysicsWorld(Context* scontext);
     PhysicsWorld(Context* scontext);

+ 1 - 0
Source/Engine/Resource/Resource.h

@@ -35,6 +35,7 @@ class Serializer;
 class URHO3D_API Resource : public Object
 class URHO3D_API Resource : public Object
 {
 {
     OBJECT(Resource);
     OBJECT(Resource);
+    BASEOBJECT(Resource);
     
     
 public:
 public:
     /// Construct.
     /// Construct.

+ 1 - 0
Source/Engine/Scene/Component.h

@@ -37,6 +37,7 @@ struct ComponentReplicationState;
 class URHO3D_API Component : public Serializable
 class URHO3D_API Component : public Serializable
 {
 {
     OBJECT(Component);
     OBJECT(Component);
+    BASEOBJECT(Component);
     
     
     friend class Node;
     friend class Node;
     friend class Scene;
     friend class Scene;

+ 3 - 2
Source/Engine/Scene/Node.h

@@ -47,9 +47,10 @@ enum CreateMode
 class URHO3D_API Node : public Serializable
 class URHO3D_API Node : public Serializable
 {
 {
     OBJECT(Node);
     OBJECT(Node);
-
+    BASEOBJECT(Node);
+    
     friend class Connection;
     friend class Connection;
-
+    
 public:
 public:
     /// Construct.
     /// Construct.
     Node(Context* context);
     Node(Context* context);

+ 1 - 0
Source/Engine/Script/APITemplates.h

@@ -326,6 +326,7 @@ template <class T> void RegisterObject(asIScriptEngine* engine, const char* clas
 {
 {
     RegisterRefCounted<T>(engine, className);
     RegisterRefCounted<T>(engine, className);
     engine->RegisterObjectMethod(className, "ShortStringHash get_type() const", asMETHODPR(T, GetType, () const, ShortStringHash), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "ShortStringHash get_type() const", asMETHODPR(T, GetType, () const, ShortStringHash), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "ShortStringHash get_baseType() const", asMETHODPR(T, GetBaseType, () const, ShortStringHash), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "const String& get_typeName() const", asMETHODPR(T, GetTypeName, () const, const String&), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "const String& get_typeName() const", asMETHODPR(T, GetTypeName, () const, const String&), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "const String& get_category() const", asMETHODPR(T, GetCategory, () const, const String&), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "const String& get_category() const", asMETHODPR(T, GetCategory, () const, const String&), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void SendEvent(const String&in, VariantMap& eventData = VariantMap())", asFUNCTION(ObjectSendEvent<T>), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod(className, "void SendEvent(const String&in, VariantMap& eventData = VariantMap())", asFUNCTION(ObjectSendEvent<T>), asCALL_CDECL_OBJLAST);

+ 31 - 25
Source/Engine/Script/ScriptInstance.cpp

@@ -58,8 +58,6 @@ static const char* methodDeclarations[] = {
     "void TransformChanged()"
     "void TransformChanged()"
 };
 };
 
 
-extern const char* UI_CATEGORY;
-
 ScriptInstance::ScriptInstance(Context* context) :
 ScriptInstance::ScriptInstance(Context* context) :
     Component(context),
     Component(context),
     script_(GetSubsystem<Script>()),
     script_(GetSubsystem<Script>()),
@@ -103,6 +101,17 @@ void ScriptInstance::OnSetAttribute(const AttributeInfo& attr, const Variant& sr
         AttributeInfo* attrPtr = const_cast<AttributeInfo*>(&attr);
         AttributeInfo* attrPtr = const_cast<AttributeInfo*>(&attr);
         idAttributes_[attrPtr] = src.GetUInt();
         idAttributes_[attrPtr] = src.GetUInt();
     }
     }
+    else if (attr.type_ == VAR_RESOURCEREF && attr.ptr_)
+    {
+        Resource*& resourcePtr = *(reinterpret_cast<Resource**>(attr.ptr_));
+        // Decrease reference count of the old object if any, then increment the new
+        if (resourcePtr)
+            resourcePtr->ReleaseRef();
+        const ResourceRef& ref = src.GetResourceRef();
+        resourcePtr = GetSubsystem<ResourceCache>()->GetResource(ref.type_, ref.id_);
+        if (resourcePtr)
+            resourcePtr->AddRef();
+    }
     else
     else
         Serializable::OnSetAttribute(attr, src);
         Serializable::OnSetAttribute(attr, src);
 }
 }
@@ -132,6 +141,13 @@ void ScriptInstance::OnGetAttribute(const AttributeInfo& attr, Variant& dest) co
             dest = componentID;
             dest = componentID;
         }
         }
     }
     }
+    else if (attr.type_ == VAR_RESOURCEREF && attr.ptr_)
+    {
+        Resource* resource = *(reinterpret_cast<Resource**>(attr.ptr_));
+        // If resource is non-null get its type and name hash. Otherwise get type from the default value
+        dest = resource ? ResourceRef(resource->GetType(), resource->GetNameHash()) :
+            ResourceRef(attr.defaultValue_.GetResourceRef().type_);
+    }
     else
     else
         Serializable::OnGetAttribute(attr, dest);
         Serializable::OnGetAttribute(attr, dest);
 }
 }
@@ -167,7 +183,6 @@ void ScriptInstance::ApplyAttributes()
     
     
     if (scriptObject_ && methods_[METHOD_APPLYATTRIBUTES])
     if (scriptObject_ && methods_[METHOD_APPLYATTRIBUTES])
         scriptFile_->Execute(scriptObject_, methods_[METHOD_APPLYATTRIBUTES]);
         scriptFile_->Execute(scriptObject_, methods_[METHOD_APPLYATTRIBUTES]);
-
 }
 }
 
 
 void ScriptInstance::OnSetEnabled()
 void ScriptInstance::OnSetEnabled()
@@ -570,34 +585,25 @@ void ScriptInstance::GetScriptAttributes()
             // For a handle type, check if it's an Object subclass with a registered factory
             // For a handle type, check if it's an Object subclass with a registered factory
             ShortStringHash typeHash(typeName);
             ShortStringHash typeHash(typeName);
             const HashMap<ShortStringHash, SharedPtr<ObjectFactory> >& factories = context_->GetObjectFactories();
             const HashMap<ShortStringHash, SharedPtr<ObjectFactory> >& factories = context_->GetObjectFactories();
-            const HashMap<String, Vector<ShortStringHash> >& categories = context_->GetObjectCategories();
-            
-            if (factories.Find(typeHash) != factories.End())
+            HashMap<ShortStringHash, SharedPtr<ObjectFactory> >::ConstIterator j = factories.Find(typeHash);
+            if (j != factories.End())
             {
             {
-                // There are four possibilities: the handle is for a Node, a Component or UIElement subclass, or for some
-                // other refcounted object. We can handle nodes & components with ID attributes, but want to skip the others
-                HashMap<String, Vector<ShortStringHash> >::ConstIterator ui = categories.Find(UI_CATEGORY);
-                if (ui != categories.End() && ui->second_.Contains(typeHash))
-                    continue; // Is handle to a UIElement; can not handle those
-                else if (typeHash == Node::GetTypeStatic() || typeHash == Scene::GetTypeStatic())
+                // Check base class type. Node & Component are supported as ID attributes, Resource as a resource reference
+                ShortStringHash baseType = j->second_->GetBaseType();
+                if (baseType == Node::GetTypeStatic())
                 {
                 {
                     info.mode_ |= AM_NODEID;
                     info.mode_ |= AM_NODEID;
                     info.type_ = VAR_INT;
                     info.type_ = VAR_INT;
                 }
                 }
-                else
+                else if (baseType == Component::GetTypeStatic())
+                {
+                    info.mode_ |= AM_COMPONENTID;
+                    info.type_ = VAR_INT;
+                }
+                else if (baseType == Resource::GetTypeStatic())
                 {
                 {
-                    // If is found in one of the component categories, must be a component
-                    // Note: this requires that custom components are registered inside component categories as well
-                    for (HashMap<String, Vector<ShortStringHash> >::ConstIterator i = categories.Begin(); i != categories.End();
-                        ++i)
-                    {
-                        if (i->second_.Contains(typeHash))
-                        {
-                            info.mode_ |= AM_COMPONENTID;
-                            info.type_ = VAR_INT;
-                            break;
-                        }
-                    }
+                    info.type_ = VAR_RESOURCEREF;
+                    info.defaultValue_ = ResourceRef(typeHash);
                 }
                 }
             }
             }
         }
         }

+ 6 - 5
Source/Engine/UI/UIElement.h

@@ -114,7 +114,8 @@ class ResourceCache;
 class URHO3D_API UIElement : public Serializable
 class URHO3D_API UIElement : public Serializable
 {
 {
     OBJECT(UIElement);
     OBJECT(UIElement);
-
+    BASEOBJECT(UIElement);
+    
 public:
 public:
     /// Construct.
     /// Construct.
     UIElement(Context* context);
     UIElement(Context* context);
@@ -455,13 +456,13 @@ public:
     /// Get UI rendering batches with a specified offset. Also recurses to child elements.
     /// Get UI rendering batches with a specified offset. Also recurses to child elements.
     void GetBatchesWithOffset(IntVector2& offset, PODVector<UIBatch>& batches, PODVector<float>& vertexData, IntRect
     void GetBatchesWithOffset(IntVector2& offset, PODVector<UIBatch>& batches, PODVector<float>& vertexData, IntRect
         currentScissor);
         currentScissor);
-    /// Get color attribute. Uses just the top-left color.
+    /// Return color attribute. Uses just the top-left color.
     const Color& GetColorAttr() const { return color_[0]; }
     const Color& GetColorAttr() const { return color_[0]; }
-    /// Get traversal mode.
+    /// Return traversal mode.
     TraversalMode GetTraversalMode() const { return traversalMode_; }
     TraversalMode GetTraversalMode() const { return traversalMode_; }
-    /// Get element event sender flag.
+    /// Return whether element should send child added / removed events by itself. If false, defers to parent element.
     bool IsElementEventSender() const { return elementEventSender_; }
     bool IsElementEventSender() const { return elementEventSender_; }
-    /// Get element event sender.
+    /// Get element which should send child added / removed events.
     UIElement* GetElementEventSender() const;
     UIElement* GetElementEventSender() const;
 
 
 protected:
 protected:

+ 3 - 1
Source/Extras/LuaScript/pkgs/Core/Object.pkg

@@ -3,12 +3,14 @@ $#include "Object.h"
 class Object : public RefCounted
 class Object : public RefCounted
 {
 {
     ShortStringHash GetType() const;
     ShortStringHash GetType() const;
+    ShortStringHash GetBaseType() const;
     const String& GetTypeName() const;
     const String& GetTypeName() const;
     const String& GetCategory() const;
     const String& GetCategory() const;
-    
+
     tolua_outside void ObjectSendEvent @ SendEvent(const String eventName, VariantMap* eventData = 0);
     tolua_outside void ObjectSendEvent @ SendEvent(const String eventName, VariantMap* eventData = 0);
     
     
     tolua_readonly tolua_property__get_set ShortStringHash type;
     tolua_readonly tolua_property__get_set ShortStringHash type;
+    tolua_readonly tolua_property__get_set ShortStringHash baseType;
     tolua_readonly tolua_property__get_set const String typeName;
     tolua_readonly tolua_property__get_set const String typeName;
     tolua_readonly tolua_property__get_set const String category;
     tolua_readonly tolua_property__get_set const String category;
 };
 };