Browse Source

added onChildUpdate

ncannasse 7 years ago
parent
commit
3a1ba59ef0
2 changed files with 9 additions and 1 deletions
  1. 8 1
      hide/prefab/EditContext.hx
  2. 1 0
      hide/prefab/HideProps.hx

+ 8 - 1
hide/prefab/EditContext.hx

@@ -16,8 +16,15 @@ class EditContext {
 	function get_ide() return hide.Ide.inst;
 	public function onChange(p : Prefab, propName : String) {
 		var ctx = getContext(p);
-		if(ctx != null)
+		if(ctx != null) {
 			p.updateInstance(ctx, propName);
+			var parent = p.parent;
+			while( parent != null ) {
+				var pr = parent.getHideProps();
+				if( pr.onChildUpdate != null ) pr.onChildUpdate(p);
+				parent = parent.parent;
+			}
+		}
 
 		var refs = rootContext.shared.references.get(p);
 		if(refs != null) {

+ 1 - 0
hide/prefab/HideProps.hx

@@ -6,4 +6,5 @@ typedef HideProps = {
 	@:optional var fileSource : Array<String>;
 	@:optional dynamic function allowChildren( type : String ) : Bool;
 	@:optional dynamic function allowParent( p : Prefab ) : Bool;
+	@:optional dynamic function onChildUpdate( p : Prefab ) : Void;
 }