@author: 白袍小道

转载说明原处,爱护劳动

插件同步在GITHUB: DaoZhang_XDZ

 
 

 
 

说明

1、本篇是接着-----(原) MaterialEditor部- UmateriaEditor中 Node编译过程和使用(2)

2、通过上一篇小的已经知道MaterialExpression的基础过程。下面进入到加入自定义

MaterialExpression的案例(为了方便这里就直接用ABS,Gif/RAWTexture为两个案例,GIF放到单独)

3、让自定义的MaterialExpression在MaterialEditor中的GraphyEditor中包含和使用。

 
 

效果

 
 

 
 

案例过程

一、基础

先来看一个关键地方

MaterialExpressionClasses::InitMaterialExpressionClasses()

(在这里会讲所有的UCLASS进行过滤获取MaterialExpression,并按照规则放入不同

 
 

 
 

(附图,UCLASS的初始管理部分)

 
 

二、书写相关代码

下面代码就是ABS的迁移而已,有需要可以自己按规则书写

UDZMatExpressionAbs

a\ 继承于UMaterialExpression

b\ 三个函数:构造,Compile,Caption

 
 

Construct

struct FConstructorStatics

{

FText NAME_Math;

FConstructorStatics()

: NAME_Math(LOCTEXT("Math", "Math"))

{

}

};

static FConstructorStatics ConstructorStatics;

 
 

#if WITH_EDITORONLY_DATA

MenuCategories.Add(ConstructorStatics.NAME_Math);

#endif

 
 

 
 

Compile

关于Compile(案例中直接用了原来ABS的代码)

留心的话会知道在前一篇提到了FHLSLMaterialTranslator,其中FHLSLMaterialTranslator也是继承了MaterialCompile.完成实现。(当然也可以重新书写一个MaterialCompile)

 
 

FHLSLMaterialTranslator::ABS

 
 

 
 

#if WITH_EDITOR

int32 UDZMatExpressionAbs::Compile(FMaterialCompiler * Compiler, int32 OutputIndex)

{

int32 Result = INDEX_NONE;

 
 

if (!Input.GetTracedInput().Expression)

{

// an input expression must exist

Result = Compiler->Errorf(TEXT("Missing DZAbs input"));

}

else

{

// evaluate the input expression first and use that as

// the parameter for the Abs expression

// Compiler中已经实现ABS部分,一般基础都是包含了的,你也可以自由组合

// 如果新完全新加(跳入shader-HLSL篇)

Result = Compiler->Abs(Input.Compile(Compiler));

}

 
 

return Result;

}

#endif

 
 

void UDZMatExpressionAbs::GetCaption(TArray<FString>& OutCaptions) const

{

OutCaptions.Add(TEXT("DZ_Abs"));

}

 
 

(原) MaterialEditor部- UmateriaEditor中 Node编译过程和使用(3)修正的更多相关文章

  1. (原) MaterialEditor部- UmateriaEditor中 Node编译过程和使用(3)

    @author: 白袍小道 转载说明原处 插件同步在GITHUB: DaoZhang_XDZ         说明 1.本篇是接着-----(原) MaterialEditor部- UmateriaE ...

  2. (原) MaterialEditor部- UmateriaEditor中 Node编译过程和使用(1)

    @author: 白袍小道 转载说明原处 插件同步在GITHUB: DaoZhang_XDZ     最后YY需求(手滑) 1.在理清楚基础套路和细节后,自定义纹理资源,并加入到现有UE材质系统 2. ...

  3. (原) MaterialEditor部- UmateriaEditor中 Node编译过程和使用(2)

    @白袍小道 转载说明原处 插件同步在GITHUB: DaoZhang_XDZ     需求: 1.梳理FexpressionInput和Output的编译和链接(套路和逻辑目的) 2.如何做到节点编译 ...

  4. (原) MatEditor部- UmateriaEditor中Texture使用过程(1)

    @author: 白袍小道 转载说明原处 插件同步在GITHUB: DaoZhang_XDZ     最后YY需求(手滑)(开黑前弄下,充数,见谅) 1.在理清楚基础套路和细节后,自定义纹理资源,并加 ...

  5. 【Android】源码external/目录中在编译过程中生成的文件列表

    => external/eyes-free:   accessibilityvalidator.jar (host,share) => external/mesa3d:   libMesa ...

  6. 第48章 MDK的编译过程及文件类型全解—零死角玩转STM32-F429系列

    第48章     MDK的编译过程及文件类型全解 全套200集视频教程和1000页PDF教程请到秉火论坛下载:www.firebbs.cn 野火视频教程优酷观看网址:http://i.youku.co ...

  7. 第48章 MDK的编译过程及文件类型全解

    Frm: http://www.cnblogs.com/firege/p/5806134.html 全套200集视频教程和1000页PDF教程请到秉火论坛下载:www.firebbs.cn 野火视频教 ...

  8. MDK 的编译过程及文件类型全解

    MDK 的编译过程及文件类型全解 ------(在arm9的开发中,这些东西都是我们自己搞定的,但是在windows上,IDE帮我们做好了,了解这些对深入开发是很有帮助的,在有arm9开发的基础上,下 ...

  9. [译]C++, Java和C#的编译过程解析

    1.1.1 摘要 我们知道计算机不能直接理解高级语言,它只能理解机器语言,所以我们必须要把高级语言翻译成机器语言,这样计算机才能执行高级语言编写的程序,在接下来的博文中,我们将介绍非托管和托管语音的编 ...

随机推荐

  1. PCB 布线 注意哪些问题记录

    1.过孔不能打在焊盘上 ,这样 焊接的时候 会有焊锡 溢出导致 短路. 2.焊盘的线引出时应该从中间引出,不应该从角落引出 3.当有较粗的电源线连接在元器件上时,最好是 有一根小线连接在元器件上,回流 ...

  2. win7利用winSCP上传文件到ubuntu server

    1.为ubuntu server设置root密码: sudo passwd root 先设密码在登录 2. su root进入root账户: 3.安装SSH:sudo apt-get install ...

  3. win7下添加库文件出现“file is not regcognized”问题

    最近几天需要画电路图,所以安装了protel se99,安装后在添加库文件的时候出现“file is not regcognized”的问题 百度查了一下,说win7基本上都会出现这个问题. 实际上, ...

  4. STL中sort、priority_queue、map、set的自定义比较函数

    STL中,sort的默认排序为less,也就是说从小到大排序:priority_queue默认是less,也就说大顶堆:map默认是less,也就说用迭代器迭代的时候默认是小的排在前面:set默认是l ...

  5. AJAX上传文件到服务器

    上传文件是常要处理的事情,使用ajaxFileUpload.js处理比较方便,这里的ajaxFileUpload.js文件修改过的, Html部分 <input type="file& ...

  6. parsing XML document from class path resource [applicationtext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationtext.xml] cannot be opened because it does not e

    控制台异常: parsing XML document from class path resource [applicationtext.xml]; nested exception is java ...

  7. MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

    背景描述 # Time: :: # User@Host: **[**] @ [**] Id: ** # Killed: # Query_time: Rows_examined: Rows_affect ...

  8. 解决IDEA打印到控制台的中文内容乱码

    File-->Settings-->Editor-->File Encodings->将图中内容均设置为UTF-8--->点击+号选中自己的项目->Apply--& ...

  9. [转]Visual C++ 和 C++ 有什么区别?

    注:本篇内容转载与网络,方便自己学习,如有侵权请您联系我删除,谢谢. 有位同学问我“Visual C++和C++有什么区别?”,这的确是初学者会感到困惑的问题,比较常见.除此之外,还有“先学C++好, ...

  10. Go 问题集

    删除文件后缀名,出现问题 import "strings" func changePath(file_path string) string { ) } 转换路径 /转换为\\ i ...