/*
//override
*/
xui_method_explain(onity_prop2dsasset, get_dragtype,	std::string	)( void )
{
	NP2DSAsset* asset = get_asset();
	if (asset)
		return asset->GetRTTI()->GetName();

	return "";
}
Example #2
0
 Texture* GetTexture(std::string relative_path){
     Asset* assetClass = get_asset(relative_path);
     
     if (assetClass == NULL || assetClass->getType() != TEXTURE) return NULL;
     
     Texture* texture = static_cast<Texture *>(assetClass);
     
     if (texture) return texture;
     
     return NULL;
 }
Example #3
0
Shader* GetShader(std::string relative_path){
    Asset* assetClass = get_asset(relative_path);

    if (assetClass == NULL || assetClass->getType() != SHADER) return NULL;

    Shader* shader = static_cast<Shader *>(assetClass);

    if (shader) return shader;

    return NULL;
}
/*
//event
*/
xui_method_explain(onity_prop2dsasset, on_namechanged,	void		)( xui_component* sender, xui_method_args& args )
{
	xui_textbox* textbox = xui_dynamic_cast(xui_textbox, sender);
	std::wstring text = textbox->get_text();
	std::string  name = xui_global::unicode_to_ascii(text);
	m_reskind->set_name(text);

	NP2DSAsset* asset = get_asset();
	if (asset->GetName() != name)
	{
		asset->SetName(name);
		asset->GetOwnedFile()->SetNeedSave(true);
	}

	if (m_linkdata)
	{
		xui_treenode* node = m_linkdata->get_node();
		node->use_linkdata();
	}
}
/*
//constructor
*/
xui_create_explain(onity_prop2dsasset)( xui_bitmap* icon, onity_propfile* propfile, u32 id )
: onity_propleaf(propfile)
, m_assetid(id)
{
	NP2DSAsset* asset = get_asset();
	m_reskind = new xui_propkind(this, xui_global::ascii_to_unicode(asset->GetName()), "2DSAsset", xui_kindctrl::create, icon, true);
	m_reskind->xm_namechanged += new xui_method_member<xui_method_args, onity_prop2dsasset>(this, &onity_prop2dsasset::on_namechanged);
	std::map<s32, std::wstring> textmap;
	textmap[0] = L"Auto";
	textmap[1] = L"Never";
	textmap[2] = L"Immediate";
	m_reskind->add_propdata(new xui_propdata_enum_func(
		m_reskind,
		L"Free Style",
		xui_propctrl_enum::create,
		textmap,
		get_freetype,
		set_freetype,
		this));

	add_propkind(m_reskind);
}
xui_method_explain(onity_prop2dsasset, get_dragdata,	void*		)( void )
{
	return get_asset();
}
Example #7
0
/*
//method
*/
xui_method_explain(onity_propimage, get_image,		NP2DSImage*		)( void )
{
	return NPDynamicCast(NP2DSImage, get_asset());
}