Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(332)

Issue 4547071: ColorBand structs as ID properties (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 11 months ago by lukas.toenne
Modified:
12 years, 7 months ago
Reviewers:
brechtvl, ideasman42, bf-codereview
Base URL:
https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Visibility:
Public.

Description

Adds a new ID property type for ColorBands. This feature is needed as part of the new PyNodes development, since node types such as the ColorRamp node have custom storage data in the form of a ColorBand struct, which must be implemented as ID property in order to make the type definition python-based. Other node data such as RGB curves could be added in the same where when required. The IDP_COLORBAND property maps to the PROP_POINTER rna type, like the IDP_GROUP. A change to the way pointer rna properties are casted in RNA_property_pointer_get (rna_access.c) is necessary: Previously the PointerRNA data pointer could just be casted from the IDProperty pointer directly, since groups were the only id prop type mapping to rna pointer type. Now the actual pointer to be used for a property depends on the id prop type (IDProperty* for groups, ColorBand* for color bands). The solution is to store the actual data pointer in the idprop->data.pointer. For groups this is the id prop itself (idprop->data.pointer==idprop).

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+199 lines, -9 lines) Patch
source/blender/blenkernel/BKE_idprop.h View 2 chunks +10 lines, -0 lines 0 comments Download
source/blender/blenkernel/intern/idprop.c View 7 chunks +64 lines, -0 lines 1 comment Download
source/blender/blenloader/intern/readfile.c View 2 chunks +8 lines, -0 lines 0 comments Download
source/blender/blenloader/intern/writefile.c View 2 chunks +10 lines, -0 lines 0 comments Download
source/blender/makesdna/DNA_ID.h View 1 chunk +2 lines, -1 line 0 comments Download
source/blender/makesrna/intern/rna_ID.c View 1 chunk +6 lines, -0 lines 0 comments Download
source/blender/makesrna/intern/rna_access.c View 4 chunks +27 lines, -8 lines 0 comments Download
source/blender/makesrna/intern/rna_internal.h View 1 chunk +1 line, -0 lines 0 comments Download
source/blender/python/generic/CMakeLists.txt View 1 chunk +2 lines, -0 lines 0 comments Download
source/blender/python/generic/IDProp.c View 4 chunks +20 lines, -0 lines 0 comments Download
source/blender/python/intern/bpy_props.c View 4 chunks +49 lines, -0 lines 0 comments Download

Messages

Total messages: 4
lukas.toenne
12 years, 11 months ago (2011-05-30 16:26:59 UTC) #1
brechtvl
I think this should be called ColorRamp instead of ColorBand for python. It's a bit ...
12 years, 11 months ago (2011-06-02 11:13:57 UTC) #2
ideasman42
On 2011/05/30 16:26:59, lukas.toenne wrote: So far I like the way ID properties store primitive ...
12 years, 11 months ago (2011-06-03 11:27:51 UTC) #3
lukas.toenne
12 years, 11 months ago (2011-06-05 09:26:09 UTC) #4
On 2011/06/03 11:27:51, ideasman42 wrote:
> On 2011/05/30 16:26:59, lukas.toenne wrote:
> 
> So far I like the way ID properties store primitive types and would rather not
> have them store colorbands and complex blender structs.
> 
> But having custom nodes store color bands is useful, did you consider other
ways
> of doing this?

I totally understand your concerns about complex data as ID properties, i'm not
really convinced of this either. However, i can't really think of a better way
to let python nodes have custom storage data of this kind. Any new system
implemented to allow nodes to do this would basically just implement specialized
id properties under a different name.

A more restricted system could use a generic pointer in nodes (just like current
storage) and store a single struct there based on a hardcoded set of types and
access functions. But this would limit nodes to just one instance of that data
and probably require a different way of setup in python. ID properties provide a
unified interface and reuse of an existing system.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b