Example #1
0
Bool LiquidToolData::KeyboardInput(BaseDocument* doc, BaseContainer& data, BaseDraw* bd, EditorWindow* win, const BaseContainer& msg)
{
	Int32	 key = msg.GetData(BFM_INPUT_CHANNEL).GetInt32();
	String str = msg.GetData(BFM_INPUT_ASC).GetString();
	if (key == KEY_ESC)
	{
		// do what you want

		// return true to signal that the key is processed!
		return true;
	}
	return false;
}
Example #2
0
	virtual Bool Command(Int32 id, const BaseContainer& msg)
	{
		switch (id)
		{
			case 1004:
			{
				const GeData& d = msg.GetData(BFM_ACTION_VALUE);
				if (d.GetType() == DA_CONTAINER)
				{
					const BaseContainer* bc = d.GetContainer();
					String shortcut;
					if (bc)
					{
						shortcut = Shortcut2String(*bc);
						GePrint("Shortcut received: " + shortcut);
					}
				}
				break;
			}
		}
		return true;
	}
Example #3
0
// ------------------------------------------------------------------------------------------------
bool C4DImporter::ReadShader(aiMaterial* out, _melange_::BaseShader* shader)
{
    // based on Melange sample code (C4DImportExport.cpp)
    while(shader) {
        if(shader->GetType() == Xlayer) {
            BaseContainer* container = shader->GetDataInstance();
            GeData blend = container->GetData(SLA_LAYER_BLEND);
            iBlendDataType* blend_list = reinterpret_cast<iBlendDataType*>(blend.GetCustomDataType(CUSTOMDATA_BLEND_LIST));
            if (!blend_list)
            {
                LogWarn("ignoring XLayer shader: no blend list given");
                continue;
            }

            LayerShaderLayer *lsl = dynamic_cast<LayerShaderLayer*>(blend_list->m_BlendLayers.GetObject(0));

            // Ignore the actual layer blending - models for real-time rendering should not
            // use them in a non-trivial way. Just try to find textures that we can apply
            // to the model.
            while (lsl)
            {
                if (lsl->GetType() == TypeFolder)
                {
                    BlendFolder* const folder = dynamic_cast<BlendFolder*>(lsl);
                    LayerShaderLayer *subLsl = dynamic_cast<LayerShaderLayer*>(folder->m_Children.GetObject(0));

                    while (subLsl)
                    {
                        if (subLsl->GetType() == TypeShader) {
                            BlendShader* const shader = dynamic_cast<BlendShader*>(subLsl);
                            if(ReadShader(out, static_cast<BaseShader*>(shader->m_pLink->GetLink()))) {
                                return true;
                            }
                        }

                        subLsl = subLsl->GetNext();
                    }
                }
                else if (lsl->GetType() == TypeShader) {
                    BlendShader* const shader = dynamic_cast<BlendShader*>(lsl);
                    if(ReadShader(out, static_cast<BaseShader*>(shader->m_pLink->GetLink()))) {
                        return true;
                    }
                }

                lsl = lsl->GetNext();
            }
        }
        else if ( shader->GetType() == Xbitmap )
        {
            aiString path;
            shader->GetFileName().GetString().GetCString(path.data, MAXLEN-1);
            path.length = ::strlen(path.data);
            out->AddProperty(&path, AI_MATKEY_TEXTURE_DIFFUSE(0));
            return true;
        }
        else {
            LogWarn("ignoring shader type: " + std::string(GetObjectTypeName(shader->GetType())));
        }
        shader = shader->GetNext();
    }
    return false;
}