nuiSpriteDef::nuiSpriteDef(const nglPath& rSpriteDefPath) { Init(); nglString name(rSpriteDefPath.GetNodeName()); SetObjectName(name); std::map<nglString, nuiSpriteDef*>::const_iterator it = mSpriteMap.find(name); if (it != mSpriteMap.end()) it->second->Release(); mSpriteMap[name] = this; { std::list<nglPath> children; rSpriteDefPath.GetChildren(&children); std::list<nglPath>::const_iterator it = children.begin(); std::list<nglPath>::const_iterator end = children.end(); for (; it != end; it++) { nuiSpriteAnimation* pAnim = new nuiSpriteAnimation(*it); if (pAnim->GetFrameCount()) AddAnimation(pAnim); else delete pAnim; } } }
void GLMesh::Init(const std::string& sMeshFile, bool bFlipUVs /*= false*/) { SetObjectName("mesh"); m_pScene = aiImportFile( sMeshFile.c_str(), aiProcess_Triangulate | aiProcess_GenSmoothNormals | aiProcess_JoinIdenticalVertices // | //aiProcess_TransformUVCoords | (bFlipUVs == true ? aiProcess_FlipUVs : 0) // | //aiProcess_FlipWindingOrder | aiProcess_OptimizeMeshes | aiProcess_FindInvalidData // | //aiProcess_SortByPType // | //aiProcess_GenUVCoords | aiProcess_FixInfacingNormals); if (m_pScene == NULL) { throw GLMeshException("Unable to load mesh."); } else { Init(m_pScene); } }
nuiSpriteDef::nuiSpriteDef(const nglString& rSpriteDefName) { Init(); SetObjectName(rSpriteDefName); std::map<nglString, nuiSpriteDef*>::const_iterator it = mSpriteMap.find(rSpriteDefName); if (it != mSpriteMap.end()) it->second->Release(); mSpriteMap[rSpriteDefName] = this; }
void MongodbObject::SetUniqueObjectName() { char tmp[128]; bson_oid_t oid; bson_oid_gen(&oid); bson_oid_to_string(&oid, tmp); SetObjectName(tmp); }
TData::TData(af::TElement& B) { Root = B.GetRoot(); if(B.GetName() == "New") { QString s; SetObjectName("Data_" + s.sprintf("%d", Root.Tag())); SetDescription("Data_" + s.sprintf("%d", Root.Tag())); } }
int CGamesysManager::SetObjectName(const char* objName, const char* name) { int obj = g_pObjSys->GetObjectNamed(objName); if (obj) return SetObjectName(obj, name); else { DbgPrint("%s: couldn't find object %s.", __FUNCTION__, objName); return 0; } }
Include::Include(af::TElement& B) { Root = B.GetRoot(); if(B.GetName() == "New") { QString s; SetObjectName("Include_" + s.sprintf("%d", Root.Tag())); SetIncludeType(0); SetFile(""); } }
DOF1::DOF1(af::TElement& B) { Root = B.GetRoot(); if(B.GetName() == "New") { QString s; SetObjectName("DOF_" + s.sprintf("%d", Root.Tag())); SetExternal(false); SetBase(false); SetValue(0.); } }
Model::Model(af::TElement& B) { Root = B.GetRoot(); if(B.GetName() == "New") { QString s; SetObjectName("Model_" + s.sprintf("%d", Root.Tag())); SetDescription("Model_" + s.sprintf("%d", Root.Tag())); SetNodeList(); SetParameterList(); } }
OutValue::OutValue(af::TElement& B) { Root = B.GetRoot(); if(B.GetName() == "New") { QString s; SetObjectName("OutValue_" + s.sprintf("%d", Root.Tag())); SetOutValueType(4); SetNodeOfValue(); SetModelOfValue(); SetNumber(1); } }
void nuiFileTree::Init(const nglPath& rPath, const nglPath& rRootPath, const std::list<nglString>& rFilters, bool showHiddenFiles) { if (SetObjectClass(_T("nuiFileTree"))) InitAttributes(); SetObjectName(_T("nuiFileTree")); mpFileBox = NULL; mpTreeView = NULL; mShowHiddenFiles = showHiddenFiles; mFilters = rFilters; mpCurrentTree = NULL; SetRootPath(rRootPath); SetPath(rPath); }
nuiDecoration::nuiDecoration(const nglString& rName) { if (SetObjectClass(_T("nuiDecoration"))) InitAttributes(); SetObjectName(rName); mUseWidgetAlpha = true; mBorderEnabled = true; mRedrawOnHover = false; mLayer = eLayerBack; AddDecoration(this); }
ProjectGenerator::ProjectGenerator() : nuiSimpleContainer(), mEventSink(this) { SetObjectName(_T("ProjectGenerator")); mpTimer = NULL; GetPreferences().GetString(PREFERENCES_PROJECTGENERATOR, _T("nuiSourcePath"), mNuiSourcePath); if (!GetPreferences().GetString(PREFERENCES_PROJECTGENERATOR, _T("nuiTargetPath"), mProjectTargetPath)) { nglPath userPath(ePathUser); mProjectTargetPath = userPath.GetPathName(); } mProjectTargetPath.Append(_T("/newNuiProject")); nuiVBox* pVBox = new nuiVBox(0); pVBox->SetExpand(nuiExpandShrinkAndGrow); AddChild(pVBox); pVBox->AddCell(BuildBlocSourceDirectory()); pVBox->AddCell(new nuiSeparator(nuiHorizontal)); pVBox->AddCell(BuildBlocProjectDirectory()); pVBox->AddCell(new nuiSeparator(nuiHorizontal)); pVBox->AddCell(BuildBlocOptions()); pVBox->AddCell(new nuiSeparator(nuiHorizontal)); pVBox->AddCell(BuildBlocButtons()); mpTimer = new nuiTimer(0.5 /*0.5s*/); mEventSink.Connect(mpTimer->Tick, &ProjectGenerator::OnTimerTick); if (mNuiSourcePath != nglString::Null) { nuiEvent event; OnTimerTick(event); } }
Scheme::Scheme(af::TElement& B) { Root = B.GetRoot(); if(B.GetName() == "New") { QString s; SetObjectName("Scheme_" + s.sprintf("%d", Root.Tag())); SetDescription("Scheme_" + s.sprintf("%d", Root.Tag())); SetDataList(); SetModelList(); SetOutVariableList(); SetImageList(); SetRunList(); SetPrintList(); SetNodeList(); SetIncludeList(); SetFragmentList(); SetEqvList (); } }
void AnnotationObject::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("AnnotationObject"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("objectName")) != 0) SetObjectName(node->AsString()); if((node = searchNode->GetNode("objectType")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 8) SetObjectType(AnnotationType(ival)); } else if(node->GetNodeType() == STRING_NODE) { AnnotationType value; if(AnnotationType_FromString(node->AsString(), value)) SetObjectType(value); } } if((node = searchNode->GetNode("visible")) != 0) SetVisible(node->AsBool()); if((node = searchNode->GetNode("active")) != 0) SetActive(node->AsBool()); if((node = searchNode->GetNode("position")) != 0) { if(node->GetNodeType() == FLOAT_ARRAY_NODE) { const float *fn = node->AsFloatArray(); double dp[3] = {fn[0], fn[1], fn[2]}; SetPosition(dp); } else SetPosition(node->AsDoubleArray()); } if((node = searchNode->GetNode("position2")) != 0) { if(node->GetNodeType() == FLOAT_ARRAY_NODE) { const float *fn = node->AsFloatArray(); double dp[3] = {fn[0], fn[1], fn[2]}; SetPosition2(dp); } else SetPosition2(node->AsDoubleArray()); } if((node = searchNode->GetNode("textColor")) != 0) textColor.SetFromNode(node); if((node = searchNode->GetNode("useForegroundForTextColor")) != 0) SetUseForegroundForTextColor(node->AsBool()); if((node = searchNode->GetNode("color1")) != 0) color1.SetFromNode(node); if((node = searchNode->GetNode("color2")) != 0) color2.SetFromNode(node); if((node = searchNode->GetNode("text")) != 0) SetText(node->AsStringVector()); if((node = searchNode->GetNode("fontFamily")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 3) SetFontFamily(FontFamily(ival)); } else if(node->GetNodeType() == STRING_NODE) { FontFamily value; if(FontFamily_FromString(node->AsString(), value)) SetFontFamily(value); } } if((node = searchNode->GetNode("fontBold")) != 0) SetFontBold(node->AsBool()); if((node = searchNode->GetNode("fontItalic")) != 0) SetFontItalic(node->AsBool()); if((node = searchNode->GetNode("fontShadow")) != 0) SetFontShadow(node->AsBool()); if((node = searchNode->GetNode("floatAttribute1")) != 0) SetDoubleAttribute1(node->AsDouble()); if((node = searchNode->GetNode("doubleAttribute1")) != 0) SetDoubleAttribute1(node->AsDouble()); if((node = searchNode->GetNode("intAttribute1")) != 0) SetIntAttribute1(node->AsInt()); if((node = searchNode->GetNode("intAttribute2")) != 0) SetIntAttribute2(node->AsInt()); if((node = searchNode->GetNode("intAttribute3")) != 0) SetIntAttribute3(node->AsInt()); if((node = searchNode->GetNode("doubleVector1")) != 0) SetDoubleVector1(node->AsDoubleVector()); if((node = searchNode->GetNode("stringVector1")) != 0) SetStringVector1(node->AsStringVector()); if((node = searchNode->GetNode("stringVector2")) != 0) SetStringVector2(node->AsStringVector()); }
void CGamesysManager::InitializeArchCache(DWORD flags) { if (Debug.IsFlagSet(DEBUG_GENERAL)) DbgPrint("acache: initializing with flags %X.", flags); CacheArchetype(Arch.PLYR_WEAPON, "PLYR_WEAPON"); CacheArchetype(Arch.PLYR_DAMAGE, "PLYR_DAMAGE"); CacheArchetype(Arch.AI_SPEECH, "AI_SPEECH"); CacheArchetype(Arch.pinset, "pinset"); CacheArchetype(Arch.tumblerset, "tumblerset"); CacheArchetype(Arch.Crystal, "Crystal"); CacheArchetype(Arch.Cameras, "Cameras"); CacheArchetype(Arch.Projectile, "Projectile"); CacheArchetype(Arch.LockPick, "LockPick"); CacheArchetype(Arch.Marker, "Marker"); CacheArchetype(Arch.RopeArrowRope, "RopeArrowRope"); CacheArchetype(Arch.Crystal, "Crystal"); CacheArchetype(Arch.Sword, "Sword"); CacheArchetype(Arch.Blackjack, "Blackjack"); CacheArchetype(Arch.IsLoot, "IsLoot"); CacheArchetype(Arch.Garrett, "Garrett"); CacheArchetype(Arch.SecCamera2, "SecCamera2"); CacheArchetype(Arch.climbable, "climbable"); CacheArchetype(Arch.Phantom, "Phantom"); CacheArchetype(Arch.Creature, "Creature"); SetNetCategoryByName("Odometer", CAT_LocalOnly); SetNetCategoryByName("Flinders", CAT_LocalOnly); SetNetCategoryByName("TerrPt", CAT_LocalOnly); //SetNetCategoryByName("AlarmLights", CAT_LocalOnly); CreateProjectilePickups(); // Temporary fix for some lifts //SetNetCategoryByName("Lift", CAT_LocalOnly); // Allows clients to activate markers, but TrolPts can remain local SetNetCategoryByName("Marker", CAT_Hosted); SetNetCategoryByName("TrolPt", CAT_LocalOnly); // Fix projectile issues _SetNetworkCategory(Arch.Projectile, CAT_LocalOnly); SetNetCategoryByName("CritterShots", CAT_LocalOnly); // Fix duplicate vine/rope arrows _SetNetworkCategory(Arch.RopeArrowRope, CAT_LocalOnly); // Prevent frob requests from being sent when projectiles/lockpicks are used SetFrobHandler(Arch.Projectile, FROB_LocalOnly); SetFrobHandler(Arch.LockPick, FROB_LocalOnly); // Fix destroy object spam from tweqs SetNetCategoryByName("mosscarpet", CAT_LocalOnly); SetNetCategoryByName("SFX", CAT_LocalOnly); // Fix torch effect glitch SetNetCategoryByName("Extinguishable", CAT_LocalOnly); // initialize new archetypes assert(!g_pNetMan->Networking() && "shouldn't be networked yet"); AvatarWeaponsInit(); FakeLootInit(); CreateBaseAvatar(); CreateDerivedAvatars(); g_pAINoHandoffProperty->Set(Arch.SecCamera2, TRUE); g_pAINoGhostProperty->Set(Arch.SecCamera2, TRUE); // Remove ghost for climbables; prevents ropes and vines from causing save file corruption g_pAINoGhostProperty->Set(Arch.climbable, TRUE); _SetNetworkCategory(Arch.climbable, CAT_LocalOnly); g_pAINoGhostProperty->Set(Arch.Phantom, TRUE); // Base archetype names SetObjectName("Spider", "a spider"); SetObjectName("guard", "a guard"); SetObjectName("thief", "a thief"); SetObjectName("Undead", "an undead creature"); SetObjectName("Apparition", "an apparition"); SetObjectName("Phantom", "a phantom"); SetObjectName("Beast", "a beast"); SetObjectName("Robot", "a robot"); SetObjectName("KeeperAgent", "a Keeper"); // Child archetypes SetObjectName("HugeSpider", "a huge spider"); SetObjectName("SewerSpider", "a sewer spider"); SetObjectName("Mechanist", "a Mechanist"); SetObjectName("swordsman", "a swordsman"); SetObjectName("bowman", "a bowman"); SetObjectName("ZombieTypes", "a zombie"); SetObjectName("Haunt", "a haunt"); SetObjectName("Turret", "a turret"); SetObjectName("ham guard", "a Hammerite guard"); SetObjectName("hamguard2", "a Hammerite guard"); SetObjectName("ham priest", "a Hammerite priest"); SetObjectName("ham novice", "a Hammerite novice"); SetObjectName("ham worker", "a Hammerite worker"); SetObjectName("FrogSplat", "an exploding frogbeast"); if (!g_pNetMan->AmDefaultHost()) { pFrobInfoProp->Delete(Arch.Creature); // disable body carrying for now } }