﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3A2.4%2FSource%2FRender%2FYafray%2FConfigurationScheme</id>
	<title>Dev:2.4/Source/Render/Yafray/ConfigurationScheme - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3A2.4%2FSource%2FRender%2FYafray%2FConfigurationScheme"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:2.4/Source/Render/Yafray/ConfigurationScheme&amp;action=history"/>
	<updated>2026-09-12T13:41:53Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:2.4/Source/Render/Yafray/ConfigurationScheme&amp;diff=41604&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:2.4/Source/Render/Yafray/ConfigurationScheme&amp;diff=41604&amp;oldid=prev"/>
		<updated>2018-06-28T17:45:09Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 17:45時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:2.4/Source/Render/Yafray/ConfigurationScheme&amp;diff=41603&amp;oldid=prev</id>
		<title>wiki&gt;Mindrones bot: Bot: Fixing redirects</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:2.4/Source/Render/Yafray/ConfigurationScheme&amp;diff=41603&amp;oldid=prev"/>
		<updated>2010-05-27T08:27:03Z</updated>

		<summary type="html">&lt;p&gt;Bot: Fixing redirects&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Object Configuration=&lt;br /&gt;
&lt;br /&gt;
Public objects created by the user like lights and shaders have to be configured.&lt;br /&gt;
In the current yafray core this is done by passing a parameter map. This map associates&lt;br /&gt;
a label with a value which can be float, bool, a color, etc ... The problem with this&lt;br /&gt;
is that we have to pass data using stl containers (i.e std::map and std::string).&lt;br /&gt;
&lt;br /&gt;
Passing data from blender or other programs to a plugin that could be using other stl&lt;br /&gt;
implementation is dangerous. Also it's a mess to respect the stupid free msvc law of allocating&lt;br /&gt;
and deleting memory always in the same binary object.&lt;br /&gt;
&lt;br /&gt;
Therefore, I propose here an alternative scheme to configure objects without using stl&lt;br /&gt;
in the interface. The idea is to have a base class called &amp;lt;/tt&amp;gt;configurable_t= which will hold&lt;br /&gt;
the basic methods to perform the configuration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;img src&amp;lt;tt&amp;gt;%ATTACHURLPATH%/configurable_class.png&amp;quot; alt=&amp;quot;configurable_t class diagram&amp;quot;  width=&amp;quot;621&amp;quot; height=&amp;quot;377&amp;quot;  /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The simplified process would be this:&lt;br /&gt;
1. User request the creation of an instance of class A.&lt;br /&gt;
1. Class A constructor fills the defaults and prepares values to be configured.&lt;br /&gt;
1. User sets params by calling &amp;lt;/tt&amp;gt;set(const char *attr,type value)= methods.&lt;br /&gt;
1. User adds the object to the scene.&lt;br /&gt;
1. Scene calls =init()= method to tell it configuration is done.&lt;br /&gt;
&lt;br /&gt;
So now let's define that =configurable_t= class.&lt;br /&gt;
&lt;br /&gt;
==Set methods==&lt;br /&gt;
&lt;br /&gt;
They are called by the &amp;quot;user&amp;quot; program. The purpose is to configure certain attributes&lt;br /&gt;
to concrete values of those types shown below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool set(const char *attr,float value);&lt;br /&gt;
bool set(const char *attr,bool value);&lt;br /&gt;
bool set(const char *attr,int value);&lt;br /&gt;
bool set(const char *attr,const char *str);&lt;br /&gt;
bool set(const char *attr,const color_t &amp;amp;color);&lt;br /&gt;
bool set(const char *attr,const vector3d_t &amp;amp;vec);&lt;br /&gt;
bool set(const char *attr,const point3d_t &amp;amp;p);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For instance, a sequence of actions to configure a point light could be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
light-&amp;gt;set(&amp;quot;from&amp;quot;,point3d_t(0,0,10)); // Set possition&lt;br /&gt;
light-&amp;gt;set(&amp;quot;color&amp;quot;,color_t(1,1,1)); // Set color to white&lt;br /&gt;
light-&amp;gt;set(&amp;quot;power&amp;quot;,10.0); // Set power to 10&lt;br /&gt;
light-&amp;gt;set(&amp;quot;shadow&amp;quot;,true); // Set shadows on&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Push methods==&lt;br /&gt;
&lt;br /&gt;
We also take into account the object may have list of elements to configure.&lt;br /&gt;
For instance, a mixer shading block with several inputs. We need a way to configure&lt;br /&gt;
such list of inputs. For that reason we define a special set of methods to handle&lt;br /&gt;
list configurations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool push(const char *attr,float value);&lt;br /&gt;
bool push(const char *attr,bool value);&lt;br /&gt;
bool push(const char *attr,int value);&lt;br /&gt;
bool push(const char *attr,const char *str);&lt;br /&gt;
bool push(const char *attr,const color_t &amp;amp;color);&lt;br /&gt;
bool push(const char *attr,const vector3d_t &amp;amp;vec);&lt;br /&gt;
bool push(const char *attr,const point3d_t &amp;amp;p);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The same syntax as &amp;quot;set&amp;quot; methods but instead of setting a single value, the given&lt;br /&gt;
values are pushed at the end of a list associated withe the attribute name.&lt;br /&gt;
For example, a mixer block configuration:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
mixer-&amp;gt;push(&amp;quot;input&amp;quot;,&amp;quot;clouds12&amp;quot;);&lt;br /&gt;
mixer-&amp;gt;push(&amp;quot;inputweight&amp;quot;,0.5);&lt;br /&gt;
mixer-&amp;gt;push(&amp;quot;input&amp;quot;,&amp;quot;rgbred&amp;quot;);&lt;br /&gt;
mixer-&amp;gt;push(&amp;quot;inputweight&amp;quot;,0.25);&lt;br /&gt;
mixer-&amp;gt;push(&amp;quot;input&amp;quot;,&amp;quot;marble&amp;quot;);&lt;br /&gt;
mixer-&amp;gt;push(&amp;quot;inputweight&amp;quot;,0.25);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Regist methods==&lt;br /&gt;
&lt;br /&gt;
This is the scheme to export a certain member variable to be configured from the exterior.&lt;br /&gt;
&lt;br /&gt;
Supose we have a class whose name is pointLight_t and looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
class pointLight_t : public configurable_t&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
pointLight_t();&lt;br /&gt;
protected:&lt;br /&gt;
point3d_t from;&lt;br /&gt;
color_t color;&lt;br /&gt;
float power;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The proposed convention is that in the constructor, this class registers those vars that could be&lt;br /&gt;
configured by the user. For instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
pointLight_t::pointLight_t()&lt;br /&gt;
{&lt;br /&gt;
regist(&amp;quot;position&amp;quot;,from);&lt;br /&gt;
regist(&amp;quot;color&amp;quot;,color);&lt;br /&gt;
regist(&amp;quot;power&amp;quot;,power);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To do this, we will put in configurable_t class the following methods:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
void regist(const char *attr,float &amp;amp;value);&lt;br /&gt;
void regist(const char *attr,bool &amp;amp;value);&lt;br /&gt;
void regist(const char *attr,int &amp;amp;value);&lt;br /&gt;
void regist(const char *attr,std::string &amp;amp;str);&lt;br /&gt;
void regist(const char *attr,color_t &amp;amp;color);&lt;br /&gt;
void regist(const char *attr,vector3d_t &amp;amp;vec);&lt;br /&gt;
void regist(const char *attr,point3d_t &amp;amp;p);&lt;br /&gt;
// list version:&lt;br /&gt;
void regist(const char *attr,std::list&amp;lt;float&amp;gt; &amp;amp;value);&lt;br /&gt;
void regist(const char *attr,std::list&amp;lt;bool&amp;gt; &amp;amp;value);&lt;br /&gt;
void regist(const char *attr,std::list&amp;lt;int&amp;gt; &amp;amp;value);&lt;br /&gt;
void regist(const char *attr,std::list&amp;lt;std::string&amp;gt; &amp;amp;str);&lt;br /&gt;
void regist(const char *attr,std::list&amp;lt;color_t&amp;gt; &amp;amp;color);&lt;br /&gt;
void regist(const char *attr,std::list&amp;lt;vector3d_t&amp;gt; &amp;amp;vec);&lt;br /&gt;
void regist(const char *attr,std::list&amp;lt;point3d_t&amp;gt; &amp;amp;p);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- [[Dev:2.4/Source/Render/Yafray/AlejandroContyEstevez (jandro)|AlejandroContyEstevez]] - 02 Nov 2004&lt;br /&gt;
&lt;br /&gt;
[[Category:Script]]&lt;/div&gt;</summary>
		<author><name>wiki&gt;Mindrones bot</name></author>
		
	</entry>
</feed>