Asset Pipeline: Support All ID Types #256

Closed
opened 2024-03-12 12:13:49 +01:00 by Nick Alberelli · 2 comments
Member

def get_fundamental_id_type(datablock: bpy.types.ID) -> Any:

Replace this hard coded list with a programmatic way of find the fundemntal id type, to avoid commits like this c0e3980955

ID_INFO = {
    (types.WindowManager, 'WINDOWMANAGER', 'window_managers'),
    (types.Scene, 'SCENE', 'scenes'),
    (types.World, 'WORLD', 'worlds'),
    (types.Collection, 'COLLECTION', 'collections'),
    (types.Armature, 'ARMATURE', 'armatures'),
    (types.Mesh, 'MESH', 'meshes'),
    (types.Camera, 'CAMERA', 'cameras'),
    (types.Lattice, 'LATTICE', 'lattices'),
    (types.Light, 'LIGHT', 'lights'),
    (types.Speaker, 'SPEAKER', 'speakers'),
    (types.Volume, 'VOLUME', 'volumes'),
    (types.GreasePencil, 'GREASEPENCIL', 'grease_pencils'),
    (types.GreasePencilv3, 'GREASEPENCIL_V3', 'grease_pencils_v3'),
    (types.Curve, 'CURVE', 'curves'),
    (types.LightProbe, 'LIGHT_PROBE', 'lightprobes'),
    (types.MetaBall, 'METABALL', 'metaballs'),
    (types.Object, 'OBJECT', 'objects'),
    (types.Action, 'ACTION', 'actions'),
    (types.Key, 'KEY', 'shape_keys'),
    (types.Sound, 'SOUND', 'sounds'),
    (types.Material, 'MATERIAL', 'materials'),
    (types.NodeTree, 'NODETREE', 'node_groups'),
    (types.Image, 'IMAGE', 'images'),
    (types.Mask, 'MASK', 'masks'),
    (types.FreestyleLineStyle, 'LINESTYLE', 'linestyles'),
    (types.Library, 'LIBRARY', 'libraries'),
    (types.VectorFont, 'FONT', 'fonts'),
    (types.CacheFile, 'CACHE_FILE', 'cache_files'),
    (types.PointCloud, 'POINT_CLOUD', 'pointclouds'),
    (types.Curves, 'HAIR_CURVES', 'hair_curves'),
    (types.Text, 'TEXT', 'texts'),
    # (types.Simulation, 'SIMULATION', 'simulations'),
    (types.ParticleSettings, 'PARTICLE', 'particles'),
    (types.Palette, 'PALETTE', 'palettes'),
    (types.PaintCurve, 'PAINT_CURVE', 'paint_curves'),
    (types.MovieClip, 'MOVIE_CLIP', 'movieclips'),
    (types.WorkSpace, 'WORKSPACE', 'workspaces'),
    (types.Screen, 'SCREEN', 'screens'),
    (types.Brush, 'BRUSH', 'brushes'),
    (types.Texture, 'TEXTURE', 'textures'),
}
https://projects.blender.org/studio/blender-studio-pipeline/src/commit/c0e3980955c87b562ddd8e2d990cb9924cfa46a6/scripts-blender/addons/asset_pipeline/merge/util.py#L80 Replace this hard coded list with a programmatic way of find the fundemntal id type, to avoid commits like this https://projects.blender.org/studio/blender-studio-pipeline/commit/c0e3980955c87b562ddd8e2d990cb9924cfa46a6 ```python ID_INFO = { (types.WindowManager, 'WINDOWMANAGER', 'window_managers'), (types.Scene, 'SCENE', 'scenes'), (types.World, 'WORLD', 'worlds'), (types.Collection, 'COLLECTION', 'collections'), (types.Armature, 'ARMATURE', 'armatures'), (types.Mesh, 'MESH', 'meshes'), (types.Camera, 'CAMERA', 'cameras'), (types.Lattice, 'LATTICE', 'lattices'), (types.Light, 'LIGHT', 'lights'), (types.Speaker, 'SPEAKER', 'speakers'), (types.Volume, 'VOLUME', 'volumes'), (types.GreasePencil, 'GREASEPENCIL', 'grease_pencils'), (types.GreasePencilv3, 'GREASEPENCIL_V3', 'grease_pencils_v3'), (types.Curve, 'CURVE', 'curves'), (types.LightProbe, 'LIGHT_PROBE', 'lightprobes'), (types.MetaBall, 'METABALL', 'metaballs'), (types.Object, 'OBJECT', 'objects'), (types.Action, 'ACTION', 'actions'), (types.Key, 'KEY', 'shape_keys'), (types.Sound, 'SOUND', 'sounds'), (types.Material, 'MATERIAL', 'materials'), (types.NodeTree, 'NODETREE', 'node_groups'), (types.Image, 'IMAGE', 'images'), (types.Mask, 'MASK', 'masks'), (types.FreestyleLineStyle, 'LINESTYLE', 'linestyles'), (types.Library, 'LIBRARY', 'libraries'), (types.VectorFont, 'FONT', 'fonts'), (types.CacheFile, 'CACHE_FILE', 'cache_files'), (types.PointCloud, 'POINT_CLOUD', 'pointclouds'), (types.Curves, 'HAIR_CURVES', 'hair_curves'), (types.Text, 'TEXT', 'texts'), # (types.Simulation, 'SIMULATION', 'simulations'), (types.ParticleSettings, 'PARTICLE', 'particles'), (types.Palette, 'PALETTE', 'palettes'), (types.PaintCurve, 'PAINT_CURVE', 'paint_curves'), (types.MovieClip, 'MOVIE_CLIP', 'movieclips'), (types.WorkSpace, 'WORKSPACE', 'workspaces'), (types.Screen, 'SCREEN', 'screens'), (types.Brush, 'BRUSH', 'brushes'), (types.Texture, 'TEXTURE', 'textures'), } ```
Nick Alberelli added the
Kind
Enhancement
Kind
Studio Request
labels 2024-03-12 12:13:50 +01:00
Member

doine

doine
Author
Member

4c6f8de52b thank you for completing @Mets I have linked the commit in this comment

https://projects.blender.org/studio/blender-studio-pipeline/commit/4c6f8de52b80dcfd6012ca1e2d0d432e11e28e25 thank you for completing @Mets I have linked the commit in this comment
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: studio/blender-studio-pipeline#256
No description provided.