File tree Expand file tree Collapse file tree 2 files changed +15
-20
lines changed
Expand file tree Collapse file tree 2 files changed +15
-20
lines changed Original file line number Diff line number Diff line change @@ -26,29 +26,26 @@ export function processColorInMaterial(material) {
2626}
2727
2828export function processMaterialPropertyContents ( material ) {
29- const propsWithMaps = intersection (
29+ const propsToUpdate = intersection (
3030 Object . keys ( material ) ,
3131 materialPropertiesWithMaps ,
3232 ) ;
33-
34- return propsWithMaps . reduce ( ( prev , curr ) => {
35- const { contents } = curr ;
36-
37- if ( ! contents || ( ! contents . path && ! contents . color ) ) {
38- return prev ;
39- }
40-
41- return {
33+ // legacy support for old diffuse.color
34+ const color =
35+ typeof material . diffuse === 'string' || material . color
36+ ? material . diffuse || material . color
37+ : undefined ;
38+
39+ return propsToUpdate . reduce (
40+ ( prev , curr ) => ( {
4241 ...prev ,
4342 [ curr ] : {
4443 ...prev [ curr ] ,
45- contents : {
46- [ contents . path ? 'path' : 'color' ] :
47- contents . path || processColor ( contents . color ) ,
48- } ,
44+ color : color ? processColor ( color ) : processColor ( prev [ curr ] . color ) ,
4945 } ,
50- } ;
51- } , material ) ;
46+ } ) ,
47+ material ,
48+ ) ;
5249}
5350
5451export { processColor } ;
Original file line number Diff line number Diff line change @@ -62,10 +62,8 @@ export const colorBufferWriteMask = PropTypes.oneOf(
6262export const opacity = PropTypes . number ;
6363
6464export const materialProperty = PropTypes . shape ( {
65- contents : PropTypes . shape ( {
66- path : PropTypes . string ,
67- color : PropTypes . string ,
68- } ) ,
65+ path : PropTypes . string ,
66+ color : PropTypes . string ,
6967 intensity : PropTypes . number ,
7068} ) ;
7169
You can’t perform that action at this time.
0 commit comments