[Bf-committers] Feature Request: Per-polygon properties

Ton Roosendaal bf-committers@blender.org
Thu, 12 Jun 2003 14:48:45 +0200


Hi,

Can one Mesh block have multiple portals (per face) each with different  
settings? And what would the average be for it? If that's only a few  
(below 16) you could just introduce a pointer in a face to a portal  
struct.

I think, for a Crystal space editor, .blend filesize wouldn't be any  
issue. So I would just extend the Tface with CrystalFace struct or so,  
like this:

typedef struct CrystalPortal {
	char name[32];
	float transform[3][3];
	int flags;				<- this int makes the entire struct paddingless
} CrystalPortal;

typedef struct CrystalFace {

	int flags; <--- for all the booleans, use flags!
	int mixmode;
	float alpha; <---- btw: tface has alpha too, in col[0]
	int pad;     <---- sdna rule in blender, no padding, not even at 64  
bits systems
	CrystalPortal *portal;
} CrystalFace;

typedef struct TFace {
	void *tpage;
	float uv[4][2];	
	unsigned int col[4];
	char flag, transp;
	short mode, tile, pad;
	struct CrystalFace cf;  <------ new
} TFace;

(read instructions in genfile.c to get insight in what is allowed and  
what not)

Now, I think you can imagine how to add buttons and so for this, just  
hack in the editface code, and in buttons.c.
Don't forget to add read and write for this struct in readfile,  
writefile.c. Look at how other structs do it, and copy the behaviour.

> So I think a generic system would be
> best here in order not to polute Blender with CS specific stuf

Don't know what you mean here... I would suggest you just take the  
bf-blender release and hack this in, and make your own release?
Blender files written with your additions (provided its coded correct)  
will be full compatible. In both ways!

-Ton-



On Thursday, Jun 12, 2003, at 13:59 Europe/Amsterdam, Jorrit Tyberghein  
wrote:

> Ton Roosendaal wrote:
>
>> Hi,
>>
>> If you look at the Mesh structure (directory makesdna), it has links  
>> to  alternative (extension) blocks as well. They're used for vertex  
>> groups,  for texture faces, for vertex colors, etc.
>>
>> The properties you describe don't seem to be too obscure, so you can   
>> just decide to hardcode them in the TFace (texture face) and just   
>> provide buttons for it in Blender.
>> If you nicely #ifdef it in the code (structs too) the Blender   
>> fileformat won't complain...  you can just include much more data per  
>>  face, and your blender reads it, whilst other blenders just skip it.
>>
>> Third option is the 'Property' system in Blender... but doing this  
>> per  face is far to clumsy. I need to know more about CrystalSpace   
>> requirements. How much important is having real freedom to add   
>> properties, or is it just a pretty fixed list?
>
> It is a fixed list. Basically at this moment we would need the  
> following
> properties:
>
>    - Lighting: (boolean)
>    - Collision detect: (boolean)
>    - Visibility culling: (boolean)
>    - Shading: (boolean)
>    - Alpha: (float)
>    - Mixmode: one of the following:
>            - Copy
>            - Add
>            - Mult
>            - Mult2
>            - Alpha
>            - Keycolor
>    - Portal: complex attribute with the following components:
>            - Destination sector name: (string)
>            - Optional transformation (3x3 matrix + vector)
>            - Mirror: (boolean)
>            - Static: (boolean)
>            - Float: (boolean)
>            - ZFill: (boolean)
>            - Clipdest: (boolean)
>
> That's basically it. The property system doesn't really have to be  
> hierarchical
> like I showed above. A propery like 'portal_mirror' would be  
> sufficient.
>
> Most of these properties are rather CS specific. So I think a generic  
> system would be
> best here in order not to polute Blender with CS specific stuff.
>
> Greetings,
>
> --  
> ======================================================================= 
> =======
> Jorrit.Tyberghein@uz.kuleuven.ac.be, University Hospitals KU Leuven  
> BELGIUM
>
> - "What is it that a man may call the greatest things in life?"
> - "Hot water, good dentishtry and shoft lavatory paper."
>        -- Cohen the Barbarian in conversation with Discworld nomads
>           (Terry Pratchett, The Light Fantastic)
> ======================================================================= 
> =======
>
>
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers@blender.org
> http://www.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton@blender.org  
http://www.blender.org