Esempio n. 1
0
	void MaterialInstance::save (std::ofstream& stream)
	{
		stream << "material " << mName << "\n"
			   << "{\n";

		if (mParent)
		{
			stream << "\t" << "parent " << static_cast<MaterialInstance*>(mParent)->getName() << "\n";
		}

		const PropertyMap& properties = listProperties ();
		for (PropertyMap::const_iterator it = properties.begin(); it != properties.end(); ++it)
		{
			stream << "\t" << it->first << " " << retrieveValue<StringValue>(getProperty(it->first), NULL).get() << "\n";
		}

		for (PassVector::iterator it = mPasses.begin(); it != mPasses.end(); ++it)
		{
			stream << "\tpass" << '\n';
			stream << "\t{" << '\n';
			it->save(stream);
			stream << "\t}" << '\n';
		}

		stream << "}\n";
	}
Esempio n. 2
0
static ListDimensions listIndent(WordConverter *conv, const char *numId, const char *ilvl)
{
    CSSProperties *properties = CSSPropertiesNew();
    listProperties(conv,numId,ilvl,properties);
    ListDimensions result = cssPropertiesIndent(properties);
    CSSPropertiesRelease(properties);
    return result;
}
TITANIUM_FUNCTION(Properties, listProperties)
{
    const auto js_context = this_object.get_context();
    const auto object_ptr = GetStaticObject(js_context).GetPrivate<Properties>();

    const auto props = object_ptr->listProperties();
    std::vector<JSValue> converted;
    for (size_t i = 0; i < props.size(); i++) {
        converted.push_back(js_context.CreateString(props.at(i)));
    }
    return js_context.CreateArray(converted);
}
Esempio n. 4
0
// FIXME: make private to this file
double listDesiredIndent(WordConverter *conv, const char *numId, const char *ilvl)
{
    CSSProperties *properties = CSSPropertiesNew();
    listProperties(conv,numId,ilvl,properties);
    double result = 0.0;

    if (CSSGet(properties,"margin-left") != NULL) {
        CSSLength length = CSSLengthFromString(CSSGet(properties,"margin-left"));
        if (CSSLengthIsValid(length) && (length.units == UnitsPct))
            result += length.value;
    }

    CSSPropertiesRelease(properties);
    return result;
}