利用者:Antoniov/Convert bGPDpalettes to BlenderPalettes
目次
Grease Pencil: Convert bGPDpalettes to Blender Palettes
Introduction
In the last grease pencil revamp that was made for 2.78 version, a new palette system was created in order to define the colors not linked to layers anymore.
This systems works great if we work with only one bGPdata block at the same time, but as part of the changes to new Grease Pencil object, this palettes could not be the best solutions.
As the new GP object will allow to use several GP datablock at the same time, to have a palette by GP datablock is not a practical solution, because the best would be to have a palette for all scene and share this palette with all GP datablocks.
For info about objects: https://wiki.blender.org/index.php/User:Antoniov/Grease_Pencil_as_Object
Proposed change
The proposed solution is to move the palette to scene level, but as Blender has already a Palette datablock and the corresponding PaletteColors, we are going to replace the bGPDpalette by Palette and bGPDpalettecolor by PaletteColor. Using this new datablock, we will have a unique palette system for all Blender, and not two different systems.
In order to manage grease pencil requirements, a group of new fields must be added to PaletteColor struct:
- float rgb[4]; /* color for paint and strokes (alpha included) */
- float fill[4]; /* color that should be used for drawing "fills" for strokes (alpha included) */
- char info[64]; /* color name. Must be unique. */
- short flag; /* settings for palette color */
The field rgb was already in the struct, but must be redefined with a length of 4. The last value of the array will conatin the alpha value for the color.
The bGPDstroke struct will include the pointer to the Palette datablock and the corresponding PaletteColor.
The current Palette API is very limited, so it will be necessary to expand it in order to include the methods required by Grease Pencil including new context functions like active_palette or active_palettecolor.
Use the Palettes in other areas
The current uses of Palettes in areas like vertex paint or texture paint will be kept as today, no changes at UI level.
Maybe, this is a point to discuss and decide if it's better keep as today or implement a similar look and feel for all palettes in all UI panels.
Use of the Palettes in Grease Pencil
In version 2.78 only a palette could be used at the same time, and any change in the palette selection replaced all colors in all strokes to the new selected palette. As result of the new implementation, the grease pencil strokes can use several palettes at the same time.
The palette panels will be moved to Tools area and not at properties level, because now it's a common tool for all GP datablocks.
With the new system, a new operator is used to apply the palette to the strokes.
New style values and pass index
In order to integrate new tools as future modifiers or selection tools, a new field for pass index has been included for each color. This field is not used today, but will be handle for future developments.
As part of the new OpenGL version and the use of shaders, there is a new style selection list for stroke color and fill color in order to select the corresponding style. These styles will be improved in the future with new modes.
The old volumetric strokes has been moved as style and now the strokes can be solid or volumetric
Animation
The current Blender Palettes are not animatable, and it will be necessary to make them animatable.
- doneAdd Animation data to Palette struct
- doneAdd Path function for Palettes
- doneWrite RNA animation data
- doneMake Palettes animatable
- doneInclude keyframes in editors (timeline, dopesheet, etc)}}
Conversion for old files
In the corresponding versioning block, the old files will be converted to new Palette and PaletteColors. As the old system only could work with one palette at the same time, the conversion will assign the first palette by default.