Ver Fonte

Fixed post filter editor not displaying texture bindings sheet correctly

Ivan Safrin há 12 anos atrás
pai
commit
6b29115c1e
2 ficheiros alterados com 12 adições e 12 exclusões
  1. 1 1
      IDE/Contents/Include/PolycodeProps.h
  2. 11 11
      IDE/Contents/Source/PolycodeProps.cpp

+ 1 - 1
IDE/Contents/Include/PolycodeProps.h

@@ -557,7 +557,7 @@ class TargetBindingsSheet : public PropSheet {
 		Shader *shader;
 		int shaderIndex;
 		
-		UIButton *addButton;		
+		ButtonProp *addButton;
 		RenderTargetBinding *bindingToRemove;
 
 };

+ 11 - 11
IDE/Contents/Source/PolycodeProps.cpp

@@ -1750,12 +1750,10 @@ void ShaderPassesSheet::handleEvent(Event *event) {
 }
 
 TargetBindingsSheet::TargetBindingsSheet() : PropSheet("TEXTURE BINDINGS", "targetBindings") {
-	propHeight = 70;
-	addButton = new UIButton("Add Render Target", 150);
-	addButton->addEventListener(this, UIEvent::CLICK_EVENT);
-	contents->addChild(addButton);
-	addButton->setPosition(15, 35);	
-	customUndoHandler = true;	
+	addButton = new ButtonProp("Add Render Target");
+	addButton->getButton()->addEventListener(this, UIEvent::CLICK_EVENT);
+    addProp(addButton);
+	customUndoHandler = true;
 	material = NULL;
 	binding = NULL;	
 	bindingToRemove = NULL;
@@ -1783,12 +1781,15 @@ void TargetBindingsSheet::Update() {
 
 void TargetBindingsSheet::refreshTargets() {
 	for(int i=0; i < props.size(); i++) {
-		contents->removeChild(props[i]);
-		props[i]->removeAllHandlersForListener(this);
-		delete props[i];
+        if(props[i] != addButton) {
+            contents->removeChild(props[i]);
+            props[i]->removeAllHandlersForListener(this);
+            delete props[i];
+        }
 	}
 	props.clear();
 	propHeight = 0;
+    props.push_back(addButton);
 
 	if(!material) {
 		return;
@@ -1803,7 +1804,6 @@ void TargetBindingsSheet::refreshTargets() {
 		
 	}
 				
-	addButton->setPosition(15, propHeight);	
 	propHeight += 70;	
 
 	dispatchEvent(new Event(), Event::COMPLETE_EVENT);		
@@ -1812,7 +1812,7 @@ void TargetBindingsSheet::refreshTargets() {
 
 void TargetBindingsSheet::handleEvent(Event *event) {
 
-	if(event->getDispatcher() == addButton) {
+	if(event->getDispatcher() == addButton->getButton()) {
 		RenderTargetBinding* newBinding = new RenderTargetBinding();
 		newBinding->mode = RenderTargetBinding::MODE_COLOR;
 		newBinding->texture = NULL;