コード例 #1
0
void brushMakeSided(const cmd::ArgumentList& args) {
	if (args.size() != 1) {
		return;
	}

	// First argument contains the number of sides
	int input = args[0].getInt();

	if (input < 0) {
		globalErrorStream() << "BrushMakeSide: invalid number of sides: " << input << std::endl;
		return;
	}

	std::size_t numSides = static_cast<std::size_t>(input);
	Scene_BrushConstructPrefab(GlobalSceneGraph(), eBrushPrism, numSides, GlobalTextureBrowser().getSelectedShader());
}
コード例 #2
0
void brushMakePrefab(const cmd::ArgumentList& args)
{
	if (args.size() != 1) {
		return;
	}

	if (GlobalSelectionSystem().getSelectionInfo().brushCount != 1)
	{
		// Display a modal error dialog	
		gtkutil::errorDialog(_("Exactly one brush must be selected for this operation."), GlobalMainFrame().getTopLevelWindow());
		return;
	}

	// First argument contains the number of sides
	int input = args[0].getInt();

	if (input >= eBrushCuboid && input < eNumPrefabTypes) {
		// Boundary checks passed
		EBrushPrefab type = static_cast<EBrushPrefab>(input);

		int minSides = 3;
		int maxSides = c_brushPrism_maxSides;

		switch (type)
		{
		case eBrushCuboid:
			// Cuboids don't need to query the number of sides
			Scene_BrushConstructPrefab(GlobalSceneGraph(), type, 0, GlobalTextureBrowser().getSelectedShader());
			return;

		case eBrushPrism:
			minSides = c_brushPrism_minSides;
			maxSides = c_brushPrism_maxSides;
			break;

		case eBrushCone:
			minSides = c_brushCone_minSides;
			maxSides = c_brushCone_maxSides;
			break;

		case eBrushSphere: 
			minSides = c_brushSphere_minSides;
			maxSides = c_brushSphere_maxSides;
			break;
		default:
			maxSides = 9999;
		};

		ui::QuerySidesDialog dialog(minSides, maxSides);

		int sides = dialog.queryNumberOfSides();

		if (sides != -1)
		{
			Scene_BrushConstructPrefab(GlobalSceneGraph(), type, sides, GlobalTextureBrowser().getSelectedShader());
		}
	}
	else {
		globalErrorStream() << "BrushMakePrefab: invalid prefab type. Allowed types are: " << std::endl 
			<< eBrushCuboid << " = cuboid " << std::endl
			<< eBrushPrism  << " = prism " << std::endl
			<< eBrushCone  << " = cone " << std::endl
			<< eBrushSphere << " = sphere " << std::endl;
	}
}
コード例 #3
0
ファイル: brushmanip.cpp プロジェクト: ChunHungLiu/GtkRadiant
 void set()
 {
   Scene_BrushConstructPrefab(GlobalSceneGraph(), eBrushPrism, m_count, TextureBrowser_GetSelectedShader(GlobalTextureBrowser()));
 }