Re: dotXSI custom templates

Date : Mon, 9 Jul 2007 17:17:55 +0200
To : XSI(at)Softimage.COM
From : "Christopher Crouzet" <christopher.crouzet(at)gmail.com>
Subject : Re: dotXSI custom templates
I finally found how to remove some of the defaults dotXSI templates. For interested people, here is the code :

// Start code
    CdotXSITemplates *ftkTemplates = ftkScene->Parser()->dotXSITemplate();
    for (LONG i = 0; i < ftkTemplates->GetCount(); i++) {
        CSIBCString templateName = ftkTemplates->Item(i)->Name();

        if (
            templateName == "SI_Ambience" ||
            templateName == "SI_Angle" ||
            templateName == "SI_CoordinateSystem" ||
            templateName == "SI_MaterialLibrary" ||
            templateName == "SI_Scene"
            )
        {
            ftkTemplates->Remove(i);
            i--;
        }
    }
// End code



I also understood how to define a custom template and then add it under the CSLTemplate node I want :

//Start code
    int newTemplateReadCallback(CXSIParser *in_parser, CdotXSITemplate *in_currentTemplate, CdotXSITemplate *in_newTemplate)
    {
        return SI_SUCCESS;
    }

    int newTemplateWriteCallback(CXSIParser *in_parser, CdotXSITemplate *in_currentTemplate, CdotXSITemplate *in_newTemplate, SI_Int in_level)
    {
        return SI_SUCCESS;
    }



    CdotXSITemplates *ftkTemplates = ftkScene->Parser()->dotXSITemplate();

    CSIBCString *ccNewTemplateParam1Name = new CSIBCString("param1");
    CdotXSIParam *ccNewTemplateParam1 = new CdotXSIParam(ccNewTemplateParam1Name, SI_VT_BOOL);
    CdotXSITemplate *ccNewTemplate = new CdotXSITemplate("CC_NewTemplate", newTemplateReadCallback, newTemplateWriteCallback, 1, ccNewTemplateParam1);


    CSLModel *ftkModel = ftkRoot->AddModel();
    ftkModel->Template()->Children().Add(ccNewTemplate);
//End code




But I don't understand what stuff should be done in the newTemplateReadCallback and newTemplateWriteCallback functions. Anyone can give me some clues or examples ?

Thanks,
Christopher.

Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.