//*************************************************************** CToolCreateEntity::CToolCreateEntity(uint ghostSlot, const std::string &paletteId, bool arrayMode) : CToolChoosePos(ghostSlot) { _PaletteId = paletteId; if (!arrayMode) { enableMultiPos(); } _CreateState = CreateSingle; _ArrayOrigin.set(0.f, 0.f, 0.f); _ArrayEnd.set(0.f, 0.f, 0.f); _ArrayDefaultAngle = 0.f; if (arrayMode) { CObject *paletteNode = getEditor().getDMC().getPaletteElement(paletteId); if (paletteNode) { std::string sheetClient = getString(paletteNode, "SheetClient"); if (isBotObjectSheet(CSheetId(sheetClient))) { _CreateState = ChooseArrayOrigin; } } } _ArrayWantedAction = ArrayActionNone; }
CSheetId::CSheetId( const std::string& sheetName, const std::string &defaultType ) { // Don't use this function without defaultType, use the one above. nlassert(defaultType.size() != 0); if (sheetName.rfind('.') == std::string::npos) { std::string withType = sheetName + "." + defaultType; *this = CSheetId(withType); // nldebug("SHEETID: Constructing CSheetId from name '%s' without explicit type, defaulting as '%s' to '%s'", sheetName.c_str(), defaultType.c_str(), withType.c_str()); } else { *this = CSheetId(sheetName); } }
void CSheetId::initWithoutSheet() { if (_Initialised) { nlassert(_DontHaveSheetKnowledge); return; } _Initialised = true; _DontHaveSheetKnowledge = true; // Initialize id 0,0 as unknown.unknown CSheetId unknownunknown = CSheetId("unknown.unknown"); nlassert(unknownunknown == CSheetId::Unknown); }
void CSheetId::serialString(NLMISC::IStream &f, const std::string &defaultType) throw(NLMISC::EStream) { nlassert(_Initialised); if (f.isReading()) { std::string sheetName; f.serial(sheetName); *this = CSheetId(sheetName, defaultType); } else { // if this assert fails, you may be using an outdated id bin nlassert(*this != CSheetId::Unknown); std::string sheetName = toString(); f.serial(sheetName); } }