eLandon před 2 roky
revize
5d17610ffd
3 změnil soubory, kde provedl 97 přidání a 0 odebrání
  1. 53 0
      Chataigne_ScriptObjectExplorer.js
  2. 6 0
      README.md
  3. 38 0
      module.json

+ 53 - 0
Chataigne_ScriptObjectExplorer.js

@@ -0,0 +1,53 @@
+
+
+
+/////////////////////////   INIT   ///////////////////////////////
+
+function init(){
+    local.scripts.chataigne_ScriptObjectExplorer.enableLog.set(true);
+}
+
+
+function moduleParameterChanged(param){
+
+    if(param.is(local.parameters.print)){
+        getObjectString();
+    }
+    if(param.is(local.parameters.object)){
+        getObjectString();
+    }
+}
+
+function getObjectString(){
+    var splitAdress = local.parameters.object.get().split(".");
+        var obj = root;
+        var lost = false;
+        for (var i=1; i<splitAdress.length; i++){
+            obj = obj.getChild(splitAdress[i]);
+            if (obj==undefined){lost = true;}
+        }
+        if(!lost){getMethodsProperties(obj);}
+        else{script.log("script adress not recognized");}
+        
+}
+
+function getMethodsProperties(myObject){
+    script.log("OBJECT : "+local.parameters.object.get());
+	var log = util.getObjectProperties(myObject, true, true);
+	script.log("Properties :");
+	for (var i = 0 ; i<log.length; i++){
+		script.log(".      "+log[i]);
+	}
+    script.log("\n");
+	log = util.getObjectMethods(myObject);
+	script.log("Methods :");
+	for (var i = 0 ; i<log.length; i++){
+		script.log(".      "+log[i]);
+	}
+    script.log("\n");
+}
+
+
+
+
+

+ 6 - 0
README.md

@@ -0,0 +1,6 @@
+# Chataigne script object explorer
+
+This module allows to get all methods and properties of any object in chataigne by providing it's script adress.
+
+Get the script adress of desired object by right-clicking and "copy script adress". Paste the adress in the "object" string and look at log.
+If needed you may re-print using "print" trigger

+ 38 - 0
module.json

@@ -0,0 +1,38 @@
+{
+	"name":"Chataigne_ScriptObjectExplorer",
+	"type":"Empty",
+	"path":"Helpers",
+	"version":"1.0",
+	"description":"",
+	"url": "https://gogs.madology.myds.me/Chataigne/Chataigne_ScriptObjectExplorer",
+	"downloadURL": "",
+	
+	"hasInput":false,
+	"hasOutput":true,
+	"hideDefaultCommands":true,
+	"defaults":
+	{		
+	},
+
+	"parameters":
+	{
+		"print":{
+			"type":"Trigger"
+		},
+		"object":{
+			"type":"String",
+			 "default":"paste here script adress"
+		}
+	},
+
+	"values":
+	{
+	},
+	"scripts":
+	[
+		"Chataigne_ScriptObjectExplorer.js"
+	],
+	"commands": {	
+	}	
+}
+