コード例 #1
0
Real ApplinkExporter::getParameterReal(C4DAtom& atom, LONG paramID, Real preset)
{
	GeData parameter;
	if (atom.GetParameter(DescLevel(paramID), parameter, DESCFLAGS_GET_0) && (parameter.GetType() != DA_NIL))
	{
		return parameter.GetReal();
	}
	return preset;
}
コード例 #2
0
ファイル: C4DImporter.cpp プロジェクト: Dimrok/assimp
// ------------------------------------------------------------------------------------------------
void C4DImporter::ReadMaterials(_melange_::BaseMaterial* mat)
{
    // based on Melange sample code
    while (mat)
    {
        const String& name = mat->GetName();
        if (mat->GetType() == Mmaterial)
        {
            aiMaterial* out = new aiMaterial();
            material_mapping[mat] = static_cast<unsigned int>(materials.size());
            materials.push_back(out);

            aiString ai_name;
            name.GetCString(ai_name.data, MAXLEN-1);
            ai_name.length = ::strlen(ai_name.data);
            out->AddProperty(&ai_name, AI_MATKEY_NAME);

            Material& m = dynamic_cast<Material&>(*mat);

            if (m.GetChannelState(CHANNEL_COLOR))
            {
                GeData data;
                mat->GetParameter(MATERIAL_COLOR_COLOR, data);
                Vector color = data.GetVector();
                mat->GetParameter(MATERIAL_COLOR_BRIGHTNESS, data);
                const Real brightness = data.GetReal();

                color *= brightness;

                aiVector3D v;
                v.x = color.x;
                v.y = color.y;
                v.z = color.z;
                out->AddProperty(&v, 1, AI_MATKEY_COLOR_DIFFUSE);
            }

            BaseShader* const shader = m.GetShader(MATERIAL_COLOR_SHADER);
            if(shader) {
                ReadShader(out, shader);
            }
        }
        else
        {
            LogWarn("ignoring plugin material: " + std::string(GetObjectTypeName(mat->GetType())));
        }
        mat = mat->GetNext();
    }
}
コード例 #3
0
ファイル: blinker.cpp プロジェクト: vidarn/color4d
Bool BlinkerTrack::Animate(CTrack *track, const CAnimInfo *info, Bool *chg, void *data)
{
	if ((!info->k1 && !info->k2) || !info->op->IsInstanceOf(Obase)) return TRUE;

	GeData		res;
	BaseTime  t;
	Real			p1=0.0,p2=0.0,number=0.0;
	
	if (info->k1 &&	info->k1->GetParameter(DescLevel(BLINKERKEY_NUMBER),res,DESCFLAGS_GET_0)) p1=res.GetReal();
	if (info->k2 && info->k2->GetParameter(DescLevel(BLINKERKEY_NUMBER),res,DESCFLAGS_GET_0)) p2=res.GetReal();

	if (info->k1 && info->k2)
		number = p1*(1.0-info->rel)+p2*info->rel;
	else if (info->k1)
		number = p1;
	else if (info->k2)
		number = p2;

	LONG mode;
	Real v=Sin(number*info->fac*pi2);
	if (v>=0.0)
		mode=MODE_ON;
	else
		mode=MODE_OFF;

	((BaseObject*)info->op)->SetEditorMode(mode);

	return TRUE;
}