void init_menu(void) { // MenuNode *taalNode = Level1Node("Taal", NULL); //de laatste is de functiepointer MenuNode *tijdNode = Level1Node("Tijd", &time_loop); MenuNode *audioNode = Level1Node("Audio", NULL); MenuNode *tijdzoneNode = Level1Node("Tijdzone", &timezone_loop); MenuNode *alarmNode = Level1Node("Alarm", &alarm_loop); MenuNode *resetNode = Level1Node("Reset", &factory_reset_loop); MenuNode *weatherNode = Level1Node("Weer", &weather_loop); MenuNode *volumeNode = ChildNode("Volume", audioNode, NULL, &volume_loop); MenuNode *bassNode = ChildNode("Bass", audioNode, NULL, &bass_loop); MenuNode *trebleNode = ChildNode("Treble", audioNode, NULL, &treble_loop); // AddL1Node(taalNode); AddL1Node(tijdNode); AddL1Node(tijdzoneNode); AddL1Node(alarmNode); AddL1Node(audioNode); AddL1Node(resetNode); AddL1Node(weatherNode); AddChildNode(volumeNode); AddChildNode(bassNode); AddChildNode(trebleNode); currentMenuItem = head; printf("\nMenu Initialized"); }
static void RDF_ParseTypeResourcePropertyElement ( XMP_Node * xmpParent, const XML_Node & xmlNode, bool isTopLevel ) { XMP_Node * newStruct = AddChildNode ( xmpParent, xmlNode, "", isTopLevel ); newStruct->options |= kXMP_PropValueIsStruct; XML_cNodePos currAttr = xmlNode.attrs.begin(); XML_cNodePos endAttr = xmlNode.attrs.end(); for ( ; currAttr != endAttr; ++currAttr ) { XMP_VarString & attrName = (*currAttr)->name; if ( attrName == "rdf:parseType" ) { continue; // ! The caller ensured the value is "Resource". } else if ( attrName == "xml:lang" ) { AddQualifierNode ( newStruct, **currAttr ); } else if ( attrName == "rdf:ID" ) { continue; // Ignore all rdf:ID attributes. } else { XMP_Throw ( "Invalid attribute for ParseTypeResource property element", kXMPErr_BadRDF ); } } RDF_PropertyElementList ( newStruct, xmlNode, kNotTopLevel ); if ( newStruct->options & kRDF_HasValueElem ) FixupQualifiedNode ( newStruct ); // *** Need to look for arrays using rdf:Description and rdf:type. } // RDF_ParseTypeResourcePropertyElement
//************************************ // 函数名称: Add // 返回类型: bool // 参数信息: CControlUI * _pTreeNodeUI // 函数说明: 通过节点对象添加节点 //************************************ bool CTreeNodeUI::Add( CControlUI* _pTreeNodeUI ) { if (_tcsicmp(_pTreeNodeUI->GetClass(), _T("TreeNodeUI")) == 0) return AddChildNode((CTreeNodeUI*)_pTreeNodeUI); return CListContainerElementUI::Add(_pTreeNodeUI); }
FReply SDockingArea::OnUserAttemptingDock( SDockingNode::RelativeDirection Direction, const FDragDropEvent& DragDropEvent ) { TSharedPtr<FDockingDragOperation> DragDropOperation = DragDropEvent.GetOperationAs<FDockingDragOperation>(); if ( DragDropOperation.IsValid() ) { if (Direction == Center) { //check(Children.Num() <= 1); TSharedRef<SDockingTabStack> NewStack = SNew(SDockingTabStack, FTabManager::NewStack()); AddChildNode( NewStack ); NewStack->OpenTab( DragDropOperation->GetTabBeingDragged().ToSharedRef() ); } else { DockFromOutside( Direction, DragDropEvent ); } return FReply::Handled(); } else { return FReply::Unhandled(); } }
static void RDF_ResourcePropertyElement ( XMP_Node * xmpParent, const XML_Node & xmlNode, bool isTopLevel ) { if ( isTopLevel && (xmlNode.name == "iX:changes") ) return; // Strip old "punchcard" chaff. XMP_Node * newCompound = AddChildNode ( xmpParent, xmlNode, "", isTopLevel ); XML_cNodePos currAttr = xmlNode.attrs.begin(); XML_cNodePos endAttr = xmlNode.attrs.end(); for ( ; currAttr != endAttr; ++currAttr ) { XMP_VarString & attrName = (*currAttr)->name; if ( attrName == "xml:lang" ) { AddQualifierNode ( newCompound, **currAttr ); } else if ( attrName == "rdf:ID" ) { continue; // Ignore all rdf:ID attributes. } else { XMP_Throw ( "Invalid attribute for resource property element", kXMPErr_BadRDF ); } } XML_cNodePos currChild = xmlNode.content.begin(); XML_cNodePos endChild = xmlNode.content.end(); for ( ; currChild != endChild; ++currChild ) { if ( ! (*currChild)->IsWhitespaceNode() ) break; } if ( currChild == endChild ) XMP_Throw ( "Missing child of resource property element", kXMPErr_BadRDF ); if ( (*currChild)->kind != kElemNode ) XMP_Throw ( "Children of resource property element must be XML elements", kXMPErr_BadRDF ); if ( (*currChild)->name == "rdf:Bag" ) { newCompound->options |= kXMP_PropValueIsArray; } else if ( (*currChild)->name == "rdf:Seq" ) { newCompound->options |= kXMP_PropValueIsArray | kXMP_PropArrayIsOrdered; } else if ( (*currChild)->name == "rdf:Alt" ) { newCompound->options |= kXMP_PropValueIsArray | kXMP_PropArrayIsOrdered | kXMP_PropArrayIsAlternate; } else { newCompound->options |= kXMP_PropValueIsStruct; if ( (*currChild)->name != "rdf:Description" ) { XMP_VarString typeName ( (*currChild)->ns ); size_t colonPos = (*currChild)->name.find_first_of(':'); if ( colonPos == XMP_VarString::npos ) XMP_Throw ( "All XML elements must be in a namespace", kXMPErr_BadXMP ); typeName.append ( (*currChild)->name, colonPos, XMP_VarString::npos ); AddQualifierNode ( newCompound, XMP_VarString("rdf:type"), typeName ); } } RDF_NodeElement ( newCompound, **currChild, kNotTopLevel ); if ( newCompound->options & kRDF_HasValueElem ) { FixupQualifiedNode ( newCompound ); } else if ( newCompound->options & kXMP_PropArrayIsAlternate ) { DetectAltText ( newCompound ); } for ( ++currChild; currChild != endChild; ++currChild ) { if ( ! (*currChild)->IsWhitespaceNode() ) XMP_Throw ( "Invalid child of resource property element", kXMPErr_BadRDF ); } } // RDF_ResourcePropertyElement
FCDENode* FCDENode::AddParameter(const char* name, const fchar* value) { FCDENode* parameter = AddChildNode(); parameter->SetName(name); parameter->SetContent(value); SetNewChildFlag(); return parameter; }
CCylinderEntity& CLoopFunctions::AddCylinder(const std::string& str_id, const CVector3& c_position, const CQuaternion& c_orientation, Real f_radius, Real f_height, bool b_movable, Real f_mass, const std::vector<std::string>& str_physics_ids, const std::vector<SAdditionalLED>& vec_additional_leds, bool b_visible) { /* Get the angles in degrees from the quaternion */ CRadians cX, cY, cZ; c_orientation.ToEulerAngles(cZ, cY, cX); CVector3 cOrientationAngles(ToDegrees(cZ).GetValue(), ToDegrees(cY).GetValue(), ToDegrees(cX).GetValue()); /* Build the XML tree */ TConfigurationNode tRootNode("cylinder"); SetNodeAttribute(tRootNode, "id", str_id); SetNodeAttribute(tRootNode, "position", c_position); SetNodeAttribute(tRootNode, "orientation", cOrientationAngles); SetNodeAttribute(tRootNode, "radius", f_radius); SetNodeAttribute(tRootNode, "height", f_height); SetNodeAttribute(tRootNode, "movable", b_movable); SetNodeAttribute(tRootNode, "mass", f_mass); SetNodeAttribute(tRootNode, "visible", b_visible); /* Add LEDs, if any */ if(!vec_additional_leds.empty()) { TConfigurationNode tLEDNode("leds"); for(UInt32 i = 0; i < vec_additional_leds.size(); ++i) { TConfigurationNode tLED("led"); SetNodeAttribute(tLED, "position", vec_additional_leds[i].Position); SetNodeAttribute(tLED, "color", vec_additional_leds[i].Color); AddChildNode(tLEDNode, tLED); } AddChildNode(tRootNode, tLEDNode); } /* Add the entity to the space */ CCylinderEntity& cEntity = AddEntityToSpace<CCylinderEntity>(tRootNode); /* Add the entity to physics */ AddEntityToPhysics(cEntity, str_physics_ids); /* Return the entity */ return cEntity; }
/** * Overridden function for Creating Child Nodes */ void FCategoryPropertyNode::InitChildNodes() { const bool bShowHiddenProperties = !!HasNodeFlags( EPropertyNodeFlags::ShouldShowHiddenProperties ); const bool bShouldShowDisableEditOnInstance = !!HasNodeFlags(EPropertyNodeFlags::ShouldShowDisableEditOnInstance); TArray<UProperty*> Properties; // The parent of a category window has to be an object window. auto ComplexNode = FindComplexParent(); if (ComplexNode) { // Get a list of properties that are in the same category for (TFieldIterator<UProperty> It(ComplexNode->GetBaseStructure()); It; ++It) { bool bMetaDataAllowVisible = true; if (!bShowHiddenProperties) { FString MetaDataVisibilityCheckString = It->GetMetaData(TEXT("bShowOnlyWhenTrue")); if (MetaDataVisibilityCheckString.Len()) { //ensure that the metadata visibility string is actually set to true in order to show this property // @todo Remove this GConfig->GetBool(TEXT("UnrealEd.PropertyFilters"), *MetaDataVisibilityCheckString, bMetaDataAllowVisible, GEditorUserSettingsIni); } } if (bMetaDataAllowVisible) { const bool bShowIfEditableProperty = (*It)->HasAnyPropertyFlags(CPF_Edit); const bool bShowIfDisableEditOnInstance = !(*It)->HasAnyPropertyFlags(CPF_DisableEditOnInstance) || bShouldShowDisableEditOnInstance; // Add if we are showing non-editable props and this is the 'None' category, // or if this is the right category, and we are either showing non-editable if (FObjectEditorUtils::GetCategoryFName(*It) == CategoryName && (bShowHiddenProperties || (bShowIfEditableProperty && bShowIfDisableEditOnInstance))) { Properties.Add(*It); } } } } for( int32 PropertyIndex = 0 ; PropertyIndex < Properties.Num() ; ++PropertyIndex ) { TSharedPtr<FItemPropertyNode> NewItemNode( new FItemPropertyNode ); FPropertyNodeInitParams InitParams; InitParams.ParentNode = SharedThis(this); InitParams.Property = Properties[PropertyIndex]; InitParams.ArrayOffset = 0; InitParams.ArrayIndex = INDEX_NONE; InitParams.bAllowChildren = true; InitParams.bForceHiddenPropertyVisibility = bShowHiddenProperties; InitParams.bCreateDisableEditOnInstanceNodes = bShouldShowDisableEditOnInstance; NewItemNode->InitNode( InitParams ); AddChildNode(NewItemNode); } }
void SDockingArea::DockFromOutside(SDockingNode::RelativeDirection Direction, const FDragDropEvent& DragDropEvent) { TSharedPtr<FDockingDragOperation> DragDropOperation = StaticCastSharedPtr<FDockingDragOperation>(DragDropEvent.GetOperation()); // // Dock from outside. // const bool bDirectionMatches = DoesDirectionMatchOrientation( Direction, this->Splitter->GetOrientation() ); if (!bDirectionMatches && Children.Num() > 1) { // We have multiple children, but the user wants to add a new node that's perpendicular to their orientation. // We need to nest our children into a child splitter so that we can re-orient ourselves. { // Create a new, re-oriented splitter and copy all the children into it. TSharedRef<SDockingSplitter> NewSplitter = SNew(SDockingSplitter, FTabManager::NewSplitter()->SetOrientation(Splitter->GetOrientation()) ); for( int32 ChildIndex=0; ChildIndex < Children.Num(); ++ChildIndex ) { NewSplitter->AddChildNode( Children[ChildIndex], INDEX_NONE ); } // Remove all our children. while( Children.Num() > 0 ) { RemoveChildAt(Children.Num()-1); } AddChildNode( NewSplitter ); } // Re-orient ourselves const EOrientation NewOrientation = (this->Splitter->GetOrientation() == Orient_Horizontal) ? Orient_Vertical : Orient_Horizontal; this->SetOrientation( NewOrientation ); } // Add the new node. { TSharedRef<SDockingTabStack> NewStack = SNew(SDockingTabStack, FTabManager::NewStack()); if ( Direction == LeftOf || Direction == Above ) { this->PlaceNode( NewStack, Direction, Children[0] ); } else { this->PlaceNode( NewStack, Direction, Children.Last() ); } NewStack->OpenTab( DragDropOperation->GetTabBeingDragged().ToSharedRef() ); } HideCross(); }
nsresult nsSubscribableServer::FindAndCreateNode(const nsACString &aPath, SubscribeTreeNode **aResult) { nsresult rv = NS_OK; NS_ASSERTION(aResult, "no result"); if (!aResult) return NS_ERROR_NULL_POINTER; if (!mTreeRoot) { nsCString serverUri; rv = mIncomingServer->GetServerURI(serverUri); NS_ENSURE_SUCCESS(rv,rv); // the root has no parent, and its name is server uri rv = CreateNode(nsnull, serverUri.get(), &mTreeRoot); NS_ENSURE_SUCCESS(rv,rv); } if (aPath.IsEmpty()) { *aResult = mTreeRoot; return NS_OK; } char *token = nsnull; nsCString pathStr(aPath); char *rest = pathStr.BeginWriting(); // todo do this only once char delimstr[2]; delimstr[0] = mDelimiter; delimstr[1] = '\0'; *aResult = nsnull; SubscribeTreeNode *parent = mTreeRoot; SubscribeTreeNode *child = nsnull; token = NS_strtok(delimstr, &rest); // special case paths that start with the hierarchy delimiter. // We want to include that delimiter in the first token name. if (token && pathStr[0] == mDelimiter) --token; while (token && *token) { rv = AddChildNode(parent, token, &child); if (NS_FAILED(rv)) return rv; token = NS_strtok(delimstr, &rest); parent = child; } // the last child we add is the result *aResult = child; return rv; }
void Node::Serialize(IOPacket& packet) { packet.Stream(mId, "uuid"); packet.Stream(mName, "name", mName); packet.Stream(mPosition, "position"); packet.Stream(mScale, "scale", Ogre::Vector3(1,1,1)); packet.Stream(mRotation, "rotation"); packet.Stream(mIsEnabled, "enabled"); OnSerialize(packet); // Components uint32_t count = packet.BeginList(mComponents.size(), "components"); if(packet.GetDirection() == IOPacket::SERIALIZE) { // serialize for(auto iter = mComponents.begin(); iter != mComponents.end(); ++iter) { packet.BeginObject(); iter->second->Serialize(packet); packet.EndObject(); } } else { for(uint32_t i = 0; i < count; ++i) { packet.BeginObject(); std::string type; packet.Stream(type, "type", std::string("")); Component* c = Serializer::CreateComponent(type); c->Serialize(packet); AddComponent(c); packet.EndObject(); } } packet.EndList(); // Children count = packet.BeginList(mChildren.size(), "children"); if(packet.GetDirection() == IOPacket::SERIALIZE) { for(auto iter = mChildren.begin(); iter != mChildren.end(); ++iter) { packet.BeginObject(); iter->second->Serialize(packet); packet.EndObject(); } } else { for(uint32_t i = 0; i < count; ++i) { packet.BeginObject(); Node* n = new Node; n->Serialize(packet); AddChildNode(n); packet.EndObject(); } } packet.EndList(); }
static void RDF_NodeElementAttrs ( XMP_Node * xmpParent, const XML_Node & xmlNode, bool isTopLevel ) { XMP_OptionBits exclusiveAttrs = 0; // Used to detect attributes that are mutually exclusive. XML_cNodePos currAttr = xmlNode.attrs.begin(); XML_cNodePos endAttr = xmlNode.attrs.end(); for ( ; currAttr != endAttr; ++currAttr ) { RDFTermKind attrTerm = GetRDFTermKind ( (*currAttr)->name ); switch ( attrTerm ) { case kRDFTerm_ID : case kRDFTerm_nodeID : case kRDFTerm_about : if ( exclusiveAttrs & kExclusiveAttrMask ) XMP_Throw ( "Mutally exclusive about, ID, nodeID attributes", kXMPErr_BadRDF ); exclusiveAttrs |= (1 << attrTerm); if ( isTopLevel && (attrTerm == kRDFTerm_about) ) { // This is the rdf:about attribute on a top level node. Set the XMP tree name if // it doesn't have a name yet. Make sure this name matches the XMP tree name. XMP_Assert ( xmpParent->parent == 0 ); // Must be the tree root node. if ( xmpParent->name.empty() ) { xmpParent->name = (*currAttr)->value; } else if ( ! (*currAttr)->value.empty() ) { if ( xmpParent->name != (*currAttr)->value ) XMP_Throw ( "Mismatched top level rdf:about values", kXMPErr_BadXMP ); } } break; case kRDFTerm_Other : AddChildNode ( xmpParent, **currAttr, (*currAttr)->value.c_str(), isTopLevel ); break; default : XMP_Throw ( "Invalid nodeElement attribute", kXMPErr_BadRDF ); break; } } } // RDF_NodeElementAttrs
/************************************************************** 功能:从 src 中分析出网页链接,并加入到当前节点的子节点上 ***************************************************************/ void GetLink(char * src) { char * pa, * pb, * pc; char * myanchor = 0; int len = 0; pa = src; do { if((pb = strstr(pa, "href='"))) { pc = strchr(pb + 6, '\''); len = strlen(pb + 6) - strlen(pc); GetMemory(&myanchor, len); memcpy(myanchor, pb + 6, len); } else if((pb = strstr(pa, "href=\""))) { pc = strchr(pb + 6, '"'); len = strlen(pb + 6) - strlen(pc); GetMemory(&myanchor, len); memcpy(myanchor, pb + 6, len); } else if((pb = strstr(pa, "href="))) { GetAfterPosWithSlash(pb + 5, &pc); len = strlen(pb + 5) - strlen(pc); GetMemory(&myanchor, len); memcpy(myanchor, pb + 5, len); } else {goto __returnLink ;} if(strlen(myanchor) > 0) AddChildNode(NodeCurr, myanchor); if(pc + 1) pa = pc + 1; }while(pa); __returnLink: return; }
/************************************************************** 功能:从 src 中分析出网页链接,并加入到当前节点的子节点上 ***************************************************************/ void GetLink(char * src) { char * pa, * pb, * pc; char * myanchor = 0; int len = 0; pa = src; do { if((pb = strstr(pa, "href='"))) { pc = strchr(pb + 6, '\''); len = strlen(pb + 6) - strlen(pc); GetMemory(&myanchor, len); memcpy(myanchor, pb + 6, len); } else if((pb = strstr(pa, "href=\""))) { pc = strchr(pb + 6, '"'); len = strlen(pb + 6) - strlen(pc); GetMemory(&myanchor, len); memcpy(myanchor, pb + 6, len); } else if((pb = strstr(pa, "href="))) { GetAfterPosWithSlash(pb + 5, &pc); len = strlen(pb + 5) - strlen(pc); GetMemory(&myanchor, len); memcpy(myanchor, pb + 5, len); } else {goto __returnLink ;} /* if(DEBUG) { if(strcmp(NodeCurr->dir, "/")) fprintf(stdout, "%s\thttp://%s/%s/%s\n", myanchor, NodeCurr->host, NodeCurr->dir, strcmp(NodeCurr->page, "`")?NodeCurr->page:""); else fprintf(stdout, "%s\thttp://%s%s%s\n", myanchor, NodeCurr->host, NodeCurr->dir, strcmp(NodeCurr->page, "`")?NodeCurr->page:""); } */ if(strlen(myanchor) > 0) AddChildNode(NodeCurr, myanchor); if(pc + 1) pa = pc + 1; }while(pa); __returnLink: return; }
static void RDF_LiteralPropertyElement ( XMP_Node * xmpParent, const XML_Node & xmlNode, bool isTopLevel ) { XMP_Node * newChild = AddChildNode ( xmpParent, xmlNode, "", isTopLevel ); XML_cNodePos currAttr = xmlNode.attrs.begin(); XML_cNodePos endAttr = xmlNode.attrs.end(); for ( ; currAttr != endAttr; ++currAttr ) { XMP_VarString & attrName = (*currAttr)->name; if ( attrName == "xml:lang" ) { AddQualifierNode ( newChild, **currAttr ); } else if ( (attrName == "rdf:ID") || (attrName == "rdf:datatype") ) { continue; // Ignore all rdf:ID and rdf:datatype attributes. } else { XMP_Throw ( "Invalid attribute for literal property element", kXMPErr_BadRDF ); } } XML_cNodePos currChild = xmlNode.content.begin(); XML_cNodePos endChild = xmlNode.content.end(); size_t textSize = 0; for ( ; currChild != endChild; ++currChild ) { if ( (*currChild)->kind != kCDataNode ) XMP_Throw ( "Invalid child of literal property element", kXMPErr_BadRDF ); textSize += (*currChild)->value.size(); } newChild->value.reserve ( textSize ); for ( currChild = xmlNode.content.begin(); currChild != endChild; ++currChild ) { newChild->value += (*currChild)->value; } #if 0 // *** XMP_DebugBuild newChild->_valuePtr = newChild->value.c_str(); #endif } // RDF_LiteralPropertyElement
//------------------------------------------------------------------------------ bool Pipe::Init( irr::scene::ISceneManager* pSceneManager ) { if ( !mbInitialised ) { if ( !Entity::Init( pSceneManager ) ) { DeInit(); return false; } // Create a cylinder to represent the pipe const irr::scene::IGeometryCreator* pCreator = pSceneManager->getGeometryCreator(); mpMesh = pCreator->createCylinderMesh( RADIUS, LENGTH, 16, COLOUR ); if ( NULL == mpMesh ) { DeInit(); return false; } mpMeshNode = pSceneManager->addMeshSceneNode( mpMesh ); if ( NULL == mpMeshNode ) { DeInit(); return false; } mpMeshNode->setMaterialFlag( irr::video::EMF_LIGHTING, false ); mpMeshNode->setMaterialFlag( irr::video::EMF_FOG_ENABLE, true ); mpMeshNode->setRotation( irr::core::vector3df( 90.0f, 0.0f, 0.0f ) ); mpMeshNode->setPosition( irr::core::vector3df( 0.0f, 0.0f, -LENGTH/2.0f ) ); // Put the node under the control of SubSim AddChildNode( mpMeshNode ); mbInitialised = true; } return true; }
void FStructurePropertyNode::InitChildNodes() { const bool bShouldShowHiddenProperties = !!HasNodeFlags(EPropertyNodeFlags::ShouldShowHiddenProperties); const bool bShouldShowDisableEditOnInstance = !!HasNodeFlags(EPropertyNodeFlags::ShouldShowDisableEditOnInstance); const UStruct* Struct = StructData.IsValid() ? StructData->GetStruct() : NULL; for (TFieldIterator<UProperty> It(Struct); It; ++It) { UProperty* StructMember = *It; if (StructMember) { static const FName Name_InlineEditConditionToggle("InlineEditConditionToggle"); const bool bOnlyShowAsInlineEditCondition = StructMember->HasMetaData(Name_InlineEditConditionToggle); const bool bShowIfEditableProperty = StructMember->HasAnyPropertyFlags(CPF_Edit); const bool bShowIfDisableEditOnInstance = !StructMember->HasAnyPropertyFlags(CPF_DisableEditOnInstance) || bShouldShowDisableEditOnInstance; if (bShouldShowHiddenProperties || (bShowIfEditableProperty && !bOnlyShowAsInlineEditCondition && bShowIfDisableEditOnInstance)) { TSharedPtr<FItemPropertyNode> NewItemNode(new FItemPropertyNode);//;//CreatePropertyItem(StructMember,INDEX_NONE,this); FPropertyNodeInitParams InitParams; InitParams.ParentNode = SharedThis(this); InitParams.Property = StructMember; InitParams.ArrayOffset = 0; InitParams.ArrayIndex = INDEX_NONE; InitParams.bAllowChildren = true; InitParams.bForceHiddenPropertyVisibility = bShouldShowHiddenProperties; InitParams.bCreateDisableEditOnInstanceNodes = bShouldShowDisableEditOnInstance; InitParams.bCreateCategoryNodes = false; NewItemNode->InitNode(InitParams); AddChildNode(NewItemNode); } } } }
void FObjectPropertyNode::InternalInitChildNodes( FName SinglePropertyName ) { HiddenCategories.Empty(); // Assemble a list of category names by iterating over all fields of BaseClass. // build a list of classes that we need to look at TSet<UClass*> ClassesToConsider; for( int32 i = 0; i < GetNumObjects(); ++i ) { UObject* TempObject = GetUObject( i ); if( TempObject ) { ClassesToConsider.Add( TempObject->GetClass() ); } } const bool bShouldShowHiddenProperties = !!HasNodeFlags(EPropertyNodeFlags::ShouldShowHiddenProperties); const bool bShouldShowDisableEditOnInstance = !!HasNodeFlags(EPropertyNodeFlags::ShouldShowDisableEditOnInstance); TSet<FName> Categories; for( TFieldIterator<UProperty> It(BaseClass.Get()); It; ++It ) { bool bHidden = false; FName CategoryName = FObjectEditorUtils::GetCategoryFName(*It); for( UClass* Class : ClassesToConsider ) { if( FEditorCategoryUtils::IsCategoryHiddenFromClass(Class, CategoryName.ToString()) ) { HiddenCategories.Add( CategoryName ); bHidden = true; break; } } bool bMetaDataAllowVisible = true; FString MetaDataVisibilityCheckString = It->GetMetaData(TEXT("bShowOnlyWhenTrue")); if (MetaDataVisibilityCheckString.Len()) { //ensure that the metadata visibility string is actually set to true in order to show this property GConfig->GetBool(TEXT("UnrealEd.PropertyFilters"), *MetaDataVisibilityCheckString, bMetaDataAllowVisible, GEditorUserSettingsIni); } if (bMetaDataAllowVisible) { const bool bShowIfNonHiddenEditableProperty = (*It)->HasAnyPropertyFlags(CPF_Edit) && !bHidden; const bool bShowIfDisableEditOnInstance = !(*It)->HasAnyPropertyFlags(CPF_DisableEditOnInstance) || bShouldShowDisableEditOnInstance; if( bShouldShowHiddenProperties || (bShowIfNonHiddenEditableProperty && bShowIfDisableEditOnInstance) ) { Categories.Add( CategoryName ); } } } ////////////////////////////////////////// // Add the category headers and the child items that belong inside of them. // Only show category headers if this is the top level object window and the parent window allows headers. if( HasNodeFlags(EPropertyNodeFlags::ShowCategories) ) { FString CategoryDelimiterString; CategoryDelimiterString.AppendChar( FPropertyNodeConstants::CategoryDelimiterChar ); TArray< FPropertyNode* > ParentNodesToSort; for( const FName& FullCategoryPath : Categories ) { // Figure out the nesting level for this category TArray< FString > FullCategoryPathStrings; FullCategoryPath.ToString().ParseIntoArray( FullCategoryPathStrings, *CategoryDelimiterString, true ); TSharedPtr<FPropertyNode> ParentLevelNode = SharedThis(this); FString CurCategoryPathString; for( int32 PathLevelIndex = 0; PathLevelIndex < FullCategoryPathStrings.Num(); ++PathLevelIndex ) { // Build up the category path name for the current path level index if( CurCategoryPathString.Len() != 0 ) { CurCategoryPathString += FPropertyNodeConstants::CategoryDelimiterChar; } CurCategoryPathString += FullCategoryPathStrings[ PathLevelIndex ]; const FName CategoryName( *CurCategoryPathString ); // Check to see if we've already created a category at the specified path level bool bFoundMatchingCategory = false; { for( int32 CurNodeIndex = 0; CurNodeIndex < ParentLevelNode->GetNumChildNodes(); ++CurNodeIndex ) { TSharedPtr<FPropertyNode>& ChildNode = ParentLevelNode->GetChildNode( CurNodeIndex ); check( ChildNode.IsValid() ); // Is this a category node? FCategoryPropertyNode* ChildCategoryNode = ChildNode->AsCategoryNode(); if( ChildCategoryNode != NULL ) { // Does the name match? if( ChildCategoryNode->GetCategoryName() == CategoryName ) { // Descend by using the child node as the new parent bFoundMatchingCategory = true; ParentLevelNode = ChildNode; break; } } } } // If we didn't find the category, then we'll need to create it now! if( !bFoundMatchingCategory ) { // Create the category node and assign it to its parent node TSharedPtr<FCategoryPropertyNode> NewCategoryNode( new FCategoryPropertyNode ); { NewCategoryNode->SetCategoryName( CategoryName ); FPropertyNodeInitParams InitParams; InitParams.ParentNode = ParentLevelNode; InitParams.Property = NULL; InitParams.ArrayOffset = 0; InitParams.ArrayIndex = INDEX_NONE; InitParams.bAllowChildren = true; InitParams.bForceHiddenPropertyVisibility = bShouldShowHiddenProperties; InitParams.bCreateDisableEditOnInstanceNodes = bShouldShowDisableEditOnInstance; NewCategoryNode->InitNode( InitParams ); // Recursively expand category properties if the category has been flagged for auto-expansion. if (BaseClass->IsAutoExpandCategory(*CategoryName.ToString()) && !BaseClass->IsAutoCollapseCategory(*CategoryName.ToString())) { NewCategoryNode->SetNodeFlags(EPropertyNodeFlags::Expanded, true); } // Add this node to it's parent. Note that no sorting happens here, so the parent's // list of child nodes will not be in the correct order. We'll keep track of which // nodes we added children to so we can sort them after we're finished adding new nodes. ParentLevelNode->AddChildNode(NewCategoryNode); ParentNodesToSort.AddUnique( ParentLevelNode.Get() ); } // Descend into the newly created category by using this node as the new parent ParentLevelNode = NewCategoryNode; } } } } else { // Iterate over all fields, creating items. for( TFieldIterator<UProperty> It(BaseClass.Get()); It; ++It ) { const bool bShowIfNonHiddenEditableProperty = (*It)->HasAnyPropertyFlags(CPF_Edit) && !FEditorCategoryUtils::IsCategoryHiddenFromClass(BaseClass.Get(), FObjectEditorUtils::GetCategory(*It)); const bool bShowIfDisableEditOnInstance = !(*It)->HasAnyPropertyFlags(CPF_DisableEditOnInstance) || bShouldShowDisableEditOnInstance; if (bShouldShowHiddenProperties || (bShowIfNonHiddenEditableProperty && bShowIfDisableEditOnInstance)) { UProperty* CurProp = *It; if( SinglePropertyName == NAME_None || CurProp->GetFName() == SinglePropertyName ) { TSharedPtr<FItemPropertyNode> NewItemNode( new FItemPropertyNode ); FPropertyNodeInitParams InitParams; InitParams.ParentNode = SharedThis(this); InitParams.Property = CurProp; InitParams.ArrayOffset = 0; InitParams.ArrayIndex = INDEX_NONE; InitParams.bAllowChildren = SinglePropertyName == NAME_None; InitParams.bForceHiddenPropertyVisibility = bShouldShowHiddenProperties; InitParams.bCreateDisableEditOnInstanceNodes = bShouldShowDisableEditOnInstance; NewItemNode->InitNode( InitParams ); AddChildNode(NewItemNode); if( SinglePropertyName != NAME_None ) { // Generate no other children break; } } } } } }
static void RDF_EmptyPropertyElement ( XMP_Node * xmpParent, const XML_Node & xmlNode, bool isTopLevel ) { bool hasPropertyAttrs = false; bool hasResourceAttr = false; bool hasNodeIDAttr = false; bool hasValueAttr = false; const XML_Node * valueNode = 0; // ! Can come from rdf:value or rdf:resource. if ( ! xmlNode.content.empty() ) XMP_Throw ( "Nested content not allowed with rdf:resource or property attributes", kXMPErr_BadRDF ); // First figure out what XMP this maps to and remember the XML node for a simple value. XML_cNodePos currAttr = xmlNode.attrs.begin(); XML_cNodePos endAttr = xmlNode.attrs.end(); for ( ; currAttr != endAttr; ++currAttr ) { RDFTermKind attrTerm = GetRDFTermKind ( (*currAttr)->name ); switch ( attrTerm ) { case kRDFTerm_ID : // Nothing to do. break; case kRDFTerm_resource : if ( hasNodeIDAttr ) XMP_Throw ( "Empty property element can't have both rdf:resource and rdf:nodeID", kXMPErr_BadRDF ); if ( hasValueAttr ) XMP_Throw ( "Empty property element can't have both rdf:value and rdf:resource", kXMPErr_BadXMP ); hasResourceAttr = true; if ( ! hasValueAttr ) valueNode = *currAttr; break; case kRDFTerm_nodeID : if ( hasResourceAttr ) XMP_Throw ( "Empty property element can't have both rdf:resource and rdf:nodeID", kXMPErr_BadRDF ); hasNodeIDAttr = true; break; case kRDFTerm_Other : if ( (*currAttr)->name == "rdf:value" ) { if ( hasResourceAttr ) XMP_Throw ( "Empty property element can't have both rdf:value and rdf:resource", kXMPErr_BadXMP ); hasValueAttr = true; valueNode = *currAttr; } else if ( (*currAttr)->name != "xml:lang" ) { hasPropertyAttrs = true; } break; default : XMP_Throw ( "Unrecognized attribute of empty property element", kXMPErr_BadRDF ); break; } } // Create the right kind of child node and visit the attributes again to add the fields or qualifiers. // ! Because of implementation vagaries, the xmpParent is the tree root for top level properties. // ! The schema is found, created if necessary, by AddChildNode. XMP_Node * childNode = AddChildNode ( xmpParent, xmlNode, "", isTopLevel ); bool childIsStruct = false; if ( hasValueAttr | hasResourceAttr ) { childNode->value = valueNode->value; if ( ! hasValueAttr ) childNode->options |= kXMP_PropValueIsURI; // ! Might have both rdf:value and rdf:resource. } else if ( hasPropertyAttrs ) { childNode->options |= kXMP_PropValueIsStruct; childIsStruct = true; } currAttr = xmlNode.attrs.begin(); endAttr = xmlNode.attrs.end(); for ( ; currAttr != endAttr; ++currAttr ) { if ( *currAttr == valueNode ) continue; // Skip the rdf:value or rdf:resource attribute holding the value. RDFTermKind attrTerm = GetRDFTermKind ( (*currAttr)->name ); switch ( attrTerm ) { case kRDFTerm_ID : case kRDFTerm_nodeID : break; // Ignore all rdf:ID and rdf:nodeID attributes.w case kRDFTerm_resource : AddQualifierNode ( childNode, **currAttr ); break; case kRDFTerm_Other : if ( (! childIsStruct) || (*currAttr)->name == "xml:lang" ) { AddQualifierNode ( childNode, **currAttr ); } else { AddChildNode ( childNode, **currAttr, (*currAttr)->value.c_str(), false ); } break; default : XMP_Throw ( "Unrecognized attribute of empty property element", kXMPErr_BadRDF ); break; } } } // RDF_EmptyPropertyElement
#include "FCDocument/FCDSceneNode.h" TESTSUITE_START(FCTestXRefAcyclic) TESTSUITE_TEST(0, Export) // None of the previous tests should be leaving dangling documents. PassIf(FCollada::GetTopDocumentCount() == 0); FCDocument* firstDoc = FCollada::NewTopDocument(); FCDocument* secondDoc = FCollada::NewTopDocument(); FCDGeometry* mesh1 = firstDoc->GetGeometryLibrary()->AddEntity(); FCDGeometry* mesh2 = secondDoc->GetGeometryLibrary()->AddEntity(); FCDSceneNode* node1 = firstDoc->AddVisualScene(); node1 = node1->AddChildNode(); FCDSceneNode* node2 = secondDoc->AddVisualScene(); node2 = node2->AddChildNode(); node2->AddInstance(mesh1); node1->AddInstance(mesh2); firstDoc->SetFileUrl(FS("XRefDoc1.dae")); FCollada::SaveDocument(secondDoc, FC("XRefDoc2.dae")); FCollada::SaveDocument(firstDoc, FC("XRefDoc1.dae")); SAFE_RELEASE(firstDoc); SAFE_RELEASE(secondDoc); TESTSUITE_TEST(1, ImportOne) // None of the previous tests should be leaving dangling documents.
static void VisitParseInternal(char *buf, Node **result) { int candidate ; Node *nd = new Node(ParentNode) ; char *vname ; while (*buf != '\0') { while (isspace(*buf)) ++buf ; switch (*buf) { case '(' : // Views { ++buf ; ++buf ; // advance to next token vname = buf ; // advance to next token while (!isspace(*buf)) ++buf ; *buf++ = '\0' ; for (candidate=0; candidate<nd->numChild; ++candidate) if (!strcmp(vname, nd->child[candidate]->text)) break ; if (candidate == nd->numChild) { AddChildNode(nd) ; // create the node for the subview nd->child[nd->numChild] = new Node(ViewNode, nd) ; ++nd->numChild ; // set the current node to the subview node nd = nd->child[nd->numChild-1] ; // get the name of the subview nd->text = vname ; } else { /* this view already exists */ nd = nd->child[candidate] ; } } break ; case '{' : // Relations { ++buf ; ++buf ; // advance to next token AddChildNode(nd) ; // create the node for the relation nd->child[nd->numChild] = new Node(RelationNode, nd) ; ++nd->numChild ; // set the current node to the relation node nd = nd->child[nd->numChild-1] ; // get the name of the relation nd->text = buf ; // advance to next token while (!isspace(*buf)) ++buf ; *buf++ = '\0' ; } break ; case '[' : // Fields { ++buf ; ++buf ; // advance to next token AddChildNode(nd) ; // create the node for the field nd->child[nd->numChild] = new Node(FieldNode, nd) ; ++nd->numChild ; // set the current node to the field node nd = nd->child[nd->numChild-1] ; // get the name of the field nd->text = buf ; // advance to next token while (!isspace(*buf)) ++buf ; *buf++ = '\0' ; } break ; case ')' : case '}' : case ']' : // go up a level of scope nd = nd->parent ; // advance to next token ++buf ; ++buf ; break ; default: // add sibling to list nd->next = new Node(nd->type, nd->parent) ; nd = nd->next ; // point at current text nd->text = buf ; // advance to next token while (!isspace(*buf)) ++buf ; *buf++ = '\0' ; } } *result = nd ; }
void SDockingArea::Construct( const FArguments& InArgs, const TSharedRef<FTabManager>& InTabManager, const TSharedRef<FTabManager::FArea>& PersistentNode ) { MyTabManager = InTabManager; InTabManager->GetPrivateApi().OnDockAreaCreated( SharedThis(this) ); bManageParentWindow = InArgs._ShouldManageParentWindow; bIsOverlayVisible = false; bIsCenterTargetVisible = false; const TAttribute<EVisibility> TargetCrossVisibility = TAttribute<EVisibility>(SharedThis(this), &SDockingArea::TargetCrossVisibility); const TAttribute<EVisibility> TargetCrossCenterVisibility = TAttribute<EVisibility>(SharedThis(this), &SDockingArea::TargetCrossCenterVisibility); // In DockSplitter mode we just act as a thin shell around a Splitter widget this->ChildSlot [ SNew(SOverlay) .Visibility( EVisibility::SelfHitTestInvisible ) +SOverlay::Slot() [ SAssignNew(Splitter, SSplitter) . Orientation( PersistentNode->GetOrientation() ) ] + SOverlay::Slot() // Houses the minimize, maximize, restore, and icon .Expose(WindowControlsArea) .HAlign(HAlign_Fill) .VAlign(VAlign_Top) +SOverlay::Slot() .HAlign(HAlign_Left) .VAlign(VAlign_Fill) [ SNew(SDockingTarget) .Visibility(TargetCrossVisibility) .OwnerNode( SharedThis(this) ) .DockDirection( SDockingNode::LeftOf ) ] +SOverlay::Slot() .HAlign(HAlign_Right) .VAlign(VAlign_Fill) [ SNew(SDockingTarget) .Visibility(TargetCrossVisibility) .OwnerNode( SharedThis(this) ) .DockDirection( SDockingNode::RightOf ) ] +SOverlay::Slot() .HAlign(HAlign_Fill) .VAlign(VAlign_Top) [ SNew(SDockingTarget) .Visibility(TargetCrossVisibility) .OwnerNode( SharedThis(this) ) .DockDirection( SDockingNode::Above ) ] +SOverlay::Slot() .HAlign(HAlign_Fill) .VAlign(VAlign_Bottom) [ SNew(SDockingTarget) .Visibility(TargetCrossVisibility) .OwnerNode( SharedThis(this) ) .DockDirection( SDockingNode::Below ) ] +SOverlay::Slot() [ SNew(SDockingTarget) .Visibility(TargetCrossCenterVisibility) .OwnerNode( SharedThis(this) ) .DockDirection( SDockingNode::Center ) ] ]; bCleanUpUponTabRelocation = false; // If the owner window is set and bManageParentWindow is true, this docknode will close the window when its last tab is removed. if (InArgs._ParentWindow.IsValid()) { SetParentWindow(InArgs._ParentWindow.ToSharedRef()); } // Add initial content if it was provided if ( InArgs._InitialContent.IsValid() ) { AddChildNode( InArgs._InitialContent.ToSharedRef() ); } }
//------------------------------------------------------------------------------ bool Pool::Init( irr::scene::ISceneManager* pSceneManager ) { if ( !mbInitialised ) { if ( !Entity::Init( pSceneManager ) ) { DeInit(); return false; } // Create cuboids to represent the walls const irr::scene::IGeometryCreator* pCreator = pSceneManager->getGeometryCreator(); irr::core::vector3df bottomDims( WIDTH, WALL_THICKNESS, LENGTH ); irr::core::vector3df leftDims( WALL_THICKNESS, HEIGHT, LENGTH ); irr::core::vector3df rightDims( WALL_THICKNESS, HEIGHT, LENGTH ); irr::core::vector3df frontDims( WIDTH, HEIGHT, WALL_THICKNESS ); irr::core::vector3df backDims( WIDTH, HEIGHT, WALL_THICKNESS ); mpBottomMesh = pCreator->createCubeMesh( bottomDims ); mpLeftMesh = pCreator->createCubeMesh( leftDims ); mpRightMesh = pCreator->createCubeMesh( rightDims ); mpFrontMesh = pCreator->createCubeMesh( frontDims ); mpBackMesh = pCreator->createCubeMesh( backDims ); if ( NULL == mpBottomMesh || NULL == mpLeftMesh || NULL == mpRightMesh || NULL == mpFrontMesh || NULL == mpBackMesh ) { DeInit(); return false; } // Colour the meshes irr::scene::IMesh* pMeshList[] = { mpBottomMesh, mpLeftMesh, mpRightMesh, mpFrontMesh, mpBackMesh }; for ( S32 meshIdx = 0; meshIdx < 5; meshIdx++ ) { irr::scene::IMeshBuffer* pMeshBuffer = pMeshList[ meshIdx ]->getMeshBuffer( 0 ); S32 numVertices = pMeshBuffer->getVertexCount(); irr::video::S3DVertex* pVertices = (irr::video::S3DVertex*)pMeshBuffer->getVertices(); for ( S32 vertexIdx = 0; vertexIdx < numVertices; vertexIdx++ ) { pVertices[ vertexIdx ].Color = WALL_COLOUR; } } mpBottomMeshNode = pSceneManager->addMeshSceneNode( mpBottomMesh ); mpLeftMeshNode = pSceneManager->addMeshSceneNode( mpLeftMesh ); mpRightMeshNode = pSceneManager->addMeshSceneNode( mpRightMesh ); mpFrontMeshNode = pSceneManager->addMeshSceneNode( mpFrontMesh ); mpBackMeshNode = pSceneManager->addMeshSceneNode( mpBackMesh ); if ( NULL == mpBottomMeshNode || NULL == mpLeftMeshNode || NULL == mpRightMeshNode || NULL == mpFrontMeshNode || NULL == mpBackMeshNode ) { DeInit(); return false; } mpBottomMeshNode->setMaterialFlag( irr::video::EMF_LIGHTING, false ); mpBottomMeshNode->setMaterialFlag( irr::video::EMF_FOG_ENABLE, true ); mpLeftMeshNode->setMaterialFlag( irr::video::EMF_LIGHTING, false ); mpLeftMeshNode->setMaterialFlag( irr::video::EMF_FOG_ENABLE, true ); mpRightMeshNode->setMaterialFlag( irr::video::EMF_LIGHTING, false ); mpRightMeshNode->setMaterialFlag( irr::video::EMF_FOG_ENABLE, true ); mpFrontMeshNode->setMaterialFlag( irr::video::EMF_LIGHTING, false ); mpFrontMeshNode->setMaterialFlag( irr::video::EMF_FOG_ENABLE, true ); mpBackMeshNode->setMaterialFlag( irr::video::EMF_LIGHTING, false ); mpBackMeshNode->setMaterialFlag( irr::video::EMF_FOG_ENABLE, true ); // Position the walls that make up the pool mpBottomMeshNode->setPosition( irr::core::vector3df( 0.0f, -HEIGHT / 2.0f, 0.0f ) ); //mpLeftMeshNode->setRotation( irr::core::vector3df( 0.0f, 0.0f, 90.0f ) ); mpLeftMeshNode->setPosition( irr::core::vector3df( -WIDTH / 2.0f, 0.0f, 0.0f ) ); //mpRightMeshNode->setRotation( irr::core::vector3df( 0.0f, 0.0f, 90.0f ) ); mpRightMeshNode->setPosition( irr::core::vector3df( WIDTH / 2.0f, 0.0f, 0.0f ) ); //mpFrontMeshNode->setRotation( irr::core::vector3df( 90.0f, 0.0f, 0.0f ) ); mpFrontMeshNode->setPosition( irr::core::vector3df( 0.0f, 0.0f, LENGTH / 2.0f ) ); //mpBackMeshNode->setRotation( irr::core::vector3df( 90.0f, 0.0f, 0.0f ) ); mpBackMeshNode->setPosition( irr::core::vector3df( 0.0f, 0.0f, -LENGTH / 2.0f ) ); // Put the nodes under the control of SubSim AddChildNode( mpBottomMeshNode ); AddChildNode( mpLeftMeshNode ); AddChildNode( mpRightMeshNode ); AddChildNode( mpFrontMeshNode ); AddChildNode( mpBackMeshNode ); mbInitialised = true; } return true; }