add_special_json_definition(visb_updates,DefName,Type,TypedExpr,_,Class,DefPos) :- !,
check_visb_update_type(Type,DefName,DefPos),
assertz(visb_special_definition(visb_updates,DefName,Type,TypedExpr,Class,DefPos)). % will be evaluated later
add_special_json_definition(visb_contents,DefName,Type,TypedExpr,_,Class,DefPos) :- !,
assertz(visb_special_definition(visb_contents,DefName,Type,TypedExpr,Class,DefPos)).
add_special_json_definition(visb_box,DefName,Type,TypedExpr,_,Class,DefPos) :- !,
assertz(visb_special_definition(visb_box,DefName,Type,TypedExpr,Class,DefPos)).
add_special_json_definition(visb_objects,DefName,_Type,TypedExpr,_UsedTIds,_Class,DefPos) :- !,
AllowSep=allow_separation, % TODO: we re-determine the class and used ids below:
get_typed_static_definition_with_constants_state2(DefName,TypedExpr,ResBody,DefPos,CS,no_inlining,AllowSep),
get_visb_DEFINITION_svg_object(DefName,ResBody,DefPos,CS,SVG_ID,AttrList,Desc),
%formatsilent('Adding ~w : ~w (from ~w)~n',[visb_objects,SVG_ID,DefName]),
add_visb_object_from_definition(visb_objects, SVG_ID, AttrList, Desc, DefName, DefPos).
add_special_json_definition(SpecialClass,DefName,_Type,TypedExpr,UsedTIds,Class,DefPos) :-
(get_unique_initial_state_for_visb(Class,DefName,DefPos,UsedTIds,ConstantsState) -> true
; ConstantsState=[]),
get_static_visb_state(ConstantsState,FullState), % add static VisB Defs
(Class=requires_variables,
(get_preference(visb_allow_variables_for_objects,false) ; ConstantsState=[])
-> add_warning(visb_visualiser,'Ignoring VisB definition which requires variables:',DefName,DefPos)
; get_visb_DEFINITION_svg_object(DefName,TypedExpr,DefPos,FullState,SVG_ID,AttrList,Desc),
%formatsilent('Adding ~w : ~w (from ~w)~n',[SpecialClass,SVG_ID,DefName]),
add_visb_object_from_definition(SpecialClass, SVG_ID, AttrList, Desc, DefName, DefPos)
; true).