Пример #1
0
std::string CGuildScanJob::getStatus()
{
	return getShortStatus();
}
Пример #2
0
// ImGui is ready to be used, just place your Gui elements.
bool basicEffect::showGuiWindow( const shapesDB& _scene ) {
	if( !bShowGuiWindow ) return false;
	
	ImGui::SetNextWindowSize(ImVec2(400,ofGetHeight()*0.8), ImGuiSetCond_Once);
	ImGui::Begin( ((string)"Effect Settings: ").append(getName()).append("###effect-").append( ofToString(this) ).c_str() , &bShowGuiWindow );
	
	ImGui::LabelText("Type", "%s", getType().c_str() );
	static char nameBuffer[32] = "";
	if( ImGui::InputText("Name", nameBuffer, 32) ){
		effectName = nameBuffer;
	}
	ImGui::TextWrapped("Status: %s", getShortStatus().c_str() );
	if( ImGui::Button("Reset effect") ){
		reset();
	}
	if (!ImGui::IsItemActive()){
		memcpy(nameBuffer, effectName.c_str(), effectName.size() );
	}
	if( ImGui::Checkbox("Enabled", &bEnabled) ){
		bEnabled?enable():disable();
	}
	ImGui::SameLine(-150);
	ImGui::LabelText((isLoading()?"(Loading...)":"(Loaded)" ), "");
	ImGui::SameLine(-50);
	ImGui::LabelText((bHasError?"(Has Error)":"(No Errors)" ), "");
	
	ImGui::Spacing();
	ImGui::Spacing();
	
	ImGui::ColorEdit4("Effect Color", &mainColor[0]);
	
	ImGui::Spacing();
	ImGui::Spacing();
	
	if (ImGui::CollapsingHeader( GUIBoundShapesTitle, "GUIBoundShapesTitle", true, true)){
		
		ImGui::PushID("shapeBindings");
		
		ImGui::TextWrapped("Bound to %i shapes", getNumShapes());
		
		ImGui::Spacing();
		
		ImGui::SameLine();
		if( ImGui::Button("Bind to shape group...") ){
				ImGui::OpenPopup("batchBindShapes");
		}
		if( ImGui::BeginPopup("batchBindShapes") ){
			ImGui::SameLine();
			
			//ImGui::Text( "" );
			//ImGui::Separator();
			
			if( ImGui::Selectable( "All shapes", false) ){
				int newBoundShapes = 0;
				for(auto s=_scene.getShapesItConstBegin(); s!=_scene.getShapesItConstEnd(); ++s){
					if( !isBoundWithShape(*s) ){
						if( bindWithShape(*s) ) newBoundShapes++;
					}
				}
				// toggle selection ?
				if( newBoundShapes==0 ){
					detachFromAllShapes();
				}
			}
			
			else {
				auto groups = _scene.getAllShapesByGroup();
				for (auto g=groups.cbegin(); g!=groups.cend(); ++g){
					if( ImGui::Selectable( ofToString(g->first).c_str(), false) ){
						for( auto s=g->second.cbegin(); s!=g->second.cend(); ++s ){
								bindWithShape(*s);
						}
					}
				}
			}
		
			ImGui::EndPopup();
		}
		
		ImGui::SameLine();
		if (ImGui::Button("Unbind All")){
			detachFromAllShapes();
		}
		
		// list shapes
		ImGui::ListBoxHeader("shapeBindings");
		if(_scene.getNumShapes()<1) ImGui::Selectable("<None Available>", false);
		else for (auto s=_scene.getShapesItConstBegin(); s!=_scene.getShapesItConstEnd(); ++s){
			bool tmpSelected = (bool)(std::find(shapes.cbegin(), shapes.cend(), *s) !=shapes.cend() );
			
			if( ImGui::Selectable( (*s)->getName().c_str(), &tmpSelected ) ){
				if (tmpSelected) bindWithShape( *s );
				else detachFromShape( *s );
			};
		}
		ImGui::ListBoxFooter();
		
		ImGui::PopID(); // pop boundShapes
		
		ImGui::Spacing();
	}
	
	ImGui::Spacing();
	ImGui::Spacing();
	
	printCustomEffectGui();
	
	// spacing
	ImGui::Text(" ");
	
	ImGui::End();
	
	return true;
}