Просмотр исходного кода

Removed material selector from mesh preview editor in Studio

Ivan Safrin 9 лет назад
Родитель
Сommit
4e958d6cdf
2 измененных файлов с 2 добавлено и 55 удалено
  1. 1 8
      include/polycode/ide/PolycodeMeshEditor.h
  2. 1 47
      src/ide/PolycodeMeshEditor.cpp

+ 1 - 8
include/polycode/ide/PolycodeMeshEditor.h

@@ -37,9 +37,6 @@ class PolycodeMeshEditor : public PolycodeEditor {
 		virtual ~PolycodeMeshEditor();
 		virtual ~PolycodeMeshEditor();
 	
 	
 		void handleEvent(Event *event);
 		void handleEvent(Event *event);
-	
-		void reloadMaterials();
-    
         void Activate();
         void Activate();
         void Deactivate();
         void Deactivate();
 	
 	
@@ -57,11 +54,7 @@ class PolycodeMeshEditor : public PolycodeEditor {
 		SceneMesh *previewMesh;
 		SceneMesh *previewMesh;
 		Entity *previewBase;
 		Entity *previewBase;
 		
 		
-		Material *currentMaterial;
-				
-		UIComboBox *materialDropDown;
-		UIRect *headerBg;
-		
+		Material *currentMaterial;		
 		TrackballCamera *trackballCamera;
 		TrackballCamera *trackballCamera;
 
 
 };
 };

+ 1 - 47
src/ide/PolycodeMeshEditor.cpp

@@ -47,26 +47,11 @@ PolycodeMeshEditor::PolycodeMeshEditor() : PolycodeEditor(true){
 	mainLight->setPosition(9999, 9999, 9999);
 	mainLight->setPosition(9999, 9999, 9999);
 	secondLight->setPosition(-9999, -9999, -9999);
 	secondLight->setPosition(-9999, -9999, -9999);
 
 
-	headerBg = new UIRect(10,10);
-	addChild(headerBg);
-	headerBg->setAnchorPoint(-1.0, -1.0, 0.0);
-	headerBg->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderBgColor"));
 	
 	
 	previewShape = new UIRect(256, 256);
 	previewShape = new UIRect(256, 256);
 	previewShape->setAnchorPoint(-1.0, -1.0, 0.0);	
 	previewShape->setAnchorPoint(-1.0, -1.0, 0.0);	
 	previewShape->setTexture(renderTexture->getTargetTexture());
 	previewShape->setTexture(renderTexture->getTargetTexture());
-	addChild(previewShape);
-	
-	UILabel *label = new UILabel("MATERIAL", 18, "section", Label::ANTIALIAS_FULL);
-	label->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderFontColor"));
-	addChild(label);
-	label->setPosition(10, 3);
-	
-	materialDropDown = new UIComboBox(globalMenu, 200);
-	addChild(materialDropDown);
-	materialDropDown->setPosition(150, 3);
-
-	reloadMaterials();
+	addChild(previewShape);	
 
 
 	previewBase = new Entity();
 	previewBase = new Entity();
 	previewScene->addChild(previewBase);
 	previewScene->addChild(previewBase);
@@ -92,37 +77,7 @@ void PolycodeMeshEditor::Deactivate() {
     
     
 }
 }
 
 
-void PolycodeMeshEditor::reloadMaterials() {
-
-	Resource *selectedMaterial = NULL;
-		
-	if(materialDropDown->getSelectedItem()) {
-		selectedMaterial = (Resource*) materialDropDown->getSelectedItem()->data;
-	}
-	
-	materialDropDown->removeAllHandlersForListener(this);
-	
-	materialDropDown->clearItems();
-	std::vector<Resource*> materials = CoreServices::getInstance()->getResourceManager()->getResources(Resource::RESOURCE_MATERIAL);
-	for(int i=0; i < materials.size(); i++) {
-		materialDropDown->addComboItem(materials[i]->getResourceName(), (void*) materials[i]);
-		if(selectedMaterial == materials[i]) {
-			materialDropDown->setSelectedIndex(i);
-		}
-	}
-	
-	materialDropDown->addEventListener(this, UIEvent::CHANGE_EVENT);	
-}
-
 void PolycodeMeshEditor::handleEvent(Event *event) {
 void PolycodeMeshEditor::handleEvent(Event *event) {
-	
-    if(event->getDispatcher() == materialDropDown) {
-		if(previewMesh) {
-			previewMesh->setMaterial((Material*)materialDropDown->getSelectedItem()->data);
-		}
-	} else if(event->getDispatcher() == CoreServices::getInstance()->getResourceManager()) {
-		reloadMaterials();
-	}
 }
 }
 
 
 PolycodeMeshEditor::~PolycodeMeshEditor() {
 PolycodeMeshEditor::~PolycodeMeshEditor() {
@@ -145,7 +100,6 @@ bool PolycodeMeshEditor::openFile(OSFileEntry filePath) {
 
 
 void PolycodeMeshEditor::Resize(int x, int y) {
 void PolycodeMeshEditor::Resize(int x, int y) {
     
     
-	headerBg->Resize(x, 30);	
 	renderTexture->resizeRenderTexture(x, y-30);
 	renderTexture->resizeRenderTexture(x, y-30);
 	previewShape->setTexture(renderTexture->getTargetTexture());	
 	previewShape->setTexture(renderTexture->getTargetTexture());	
 	previewShape->Resize(x, y-30);	
 	previewShape->Resize(x, y-30);