|
@@ -812,7 +812,7 @@ void tnspost_World(tnsWorld *w){
|
|
|
laAnimationUpdateHolderList();
|
|
|
}
|
|
|
void tnspost_Material(tnsMaterial *m){
|
|
|
- tns_RefreshMaterial2D(m);
|
|
|
+ tns_GetMaterial2D(m);
|
|
|
//if(m->AsLibrary){ tnsRefreshMaterialLibraries(); return; }
|
|
|
//tnsEnsureMaterialShader(m,1);
|
|
|
}
|
|
@@ -905,27 +905,14 @@ void tns_InvalidateMeshWithMaterial(tnsMaterial* m){
|
|
|
}
|
|
|
}
|
|
|
void tnsset_MaterialColor(tnsMaterial* m, real* c){
|
|
|
- tnsVectorCopy4d(c,m->Color); tns_InvalidateMeshWithMaterial(m); tns_RefreshMaterial2D(m); laNotifyUsers("tns.world");
|
|
|
-}
|
|
|
-void tns_RefreshMaterial2D(tnsMaterial* m){
|
|
|
- NVGcontext* vg=MAIN.CurrentWindow->nvg;
|
|
|
- if(m->GradientMode==TNS_GRADIENT_MODE_LINEAR){
|
|
|
- m->Paint=nvgLinearGradient(vg,m->GradientCenter[0],m->GradientCenter[1],m->GradientSize[0],m->GradientSize[1],
|
|
|
- nvgRGBAf(LA_COLOR4(m->Color)),nvgRGBAf(LA_COLOR4(m->Color2)));
|
|
|
- }elif(m->GradientMode==TNS_GRADIENT_MODE_BOX){
|
|
|
- m->Paint=nvgBoxGradient(vg,m->GradientCenter[0],m->GradientCenter[1],m->GradientSize[0],m->GradientSize[1],
|
|
|
- m->GradientBoxR,m->GradientBoxF,nvgRGBAf(LA_COLOR4(m->Color)),nvgRGBAf(LA_COLOR4(m->Color2)));
|
|
|
- }elif(m->GradientMode==TNS_GRADIENT_MODE_RADIAL){
|
|
|
- m->Paint=nvgRadialGradient(vg,m->GradientCenter[0],m->GradientCenter[1],m->GradientSize[0],m->GradientSize[1],
|
|
|
- nvgRGBAf(LA_COLOR4(m->Color)),nvgRGBAf(LA_COLOR4(m->Color2)));
|
|
|
- }
|
|
|
-}
|
|
|
-void tnsset_MaterialColor2(tnsMaterial* m, real* c){ tnsVectorCopy4d(c,m->Color2); tns_RefreshMaterial2D(m); laNotifyUsers("tns.world"); }
|
|
|
-void tnsset_MaterialGradientMode(tnsMaterial* m, int Mode){ m->GradientMode=Mode; tns_RefreshMaterial2D(m); laNotifyUsers("tns.world"); }
|
|
|
-void tnsset_MaterialGradientCenter(tnsMaterial* m, real* c){ tnsVectorCopy2d(c,m->GradientCenter); tns_RefreshMaterial2D(m); laNotifyUsers("tns.world"); }
|
|
|
-void tnsset_MaterialGradientSize(tnsMaterial* m, real* c){ tnsVectorCopy2d(c,m->GradientSize); tns_RefreshMaterial2D(m); laNotifyUsers("tns.world"); }
|
|
|
-void tnsset_MaterialGradientF(tnsMaterial* m, real c){ m->GradientBoxF=c; tns_RefreshMaterial2D(m); laNotifyUsers("tns.world"); }
|
|
|
-void tnsset_MaterialGradientR(tnsMaterial* m, real c){ m->GradientBoxR=c; tns_RefreshMaterial2D(m); laNotifyUsers("tns.world"); }
|
|
|
+ tnsVectorCopy4d(c,m->Color); tns_InvalidateMeshWithMaterial(m); laNotifyUsers("tns.world");
|
|
|
+}
|
|
|
+void tnsset_MaterialColor2(tnsMaterial* m, real* c){ tnsVectorCopy4d(c,m->Color2); laNotifyUsers("tns.world"); }
|
|
|
+void tnsset_MaterialGradientMode(tnsMaterial* m, int Mode){ m->GradientMode=Mode; laNotifyUsers("tns.world"); }
|
|
|
+void tnsset_MaterialGradientCenter(tnsMaterial* m, real* c){ tnsVectorCopy2d(c,m->GradientCenter); laNotifyUsers("tns.world"); }
|
|
|
+void tnsset_MaterialGradientSize(tnsMaterial* m, real* c){ tnsVectorCopy2d(c,m->GradientSize); laNotifyUsers("tns.world"); }
|
|
|
+void tnsset_MaterialGradientF(tnsMaterial* m, real c){ m->GradientBoxF=c; laNotifyUsers("tns.world"); }
|
|
|
+void tnsset_MaterialGradientR(tnsMaterial* m, real c){ m->GradientBoxR=c; laNotifyUsers("tns.world"); }
|
|
|
void tnsget_MaterialSlotname(tnsMaterialSlot* ms, char *result, char** here){
|
|
|
if(!ms){ strcpy(result,"?"); return; }
|
|
|
if(ms->Material&&ms->Material->Name&&ms->Material->Name->Ptr){
|
|
@@ -1004,9 +991,12 @@ void laget_ActionContainer(laAction* aa, char* str, char** here){ *here=aa->Hold
|
|
|
void laread_ActionContainer(laAction* aa, char* str){ aa->HolderContainer=la_ContainerLookup(str); }
|
|
|
|
|
|
int laaction_VerifyRootObject(void* Parent, laPropContainer* ParentType, void* Child, laPropContainer* ChildType){
|
|
|
- if(ParentType!=ChildType) return 0;
|
|
|
- if(ParentType!=TNS_PC_OBJECT_GENERIC) return 0;
|
|
|
- tnsObject*o=Child; if(o==Parent || o->InRoot==Parent) return 1;
|
|
|
+ if(ParentType!=TNS_PC_OBJECT_ROOT) return 0;
|
|
|
+ if (ChildType==TNS_PC_OBJECT_GENERIC||ChildType==TNS_PC_OBJECT_CAMERA||ChildType==TNS_OBJECT_SHAPE||
|
|
|
+ ChildType==TNS_PC_OBJECT_INSTANCER||ChildType==TNS_PC_OBJECT_LIGHT||ChildType==TNS_OBJECT_MESH){
|
|
|
+ tnsObject*o=Child; if(o==Parent || o->InRoot==Parent) return 1;
|
|
|
+ }
|
|
|
+ if (ChildType==TNS_PC_MATERIAL){ return 1; }
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -1161,8 +1151,8 @@ void la_RegisterTNSProps(){
|
|
|
p = laAddPropertyContainer("tns_material", "Material" "Object material", 0,0,0,sizeof(tnsMaterial),tnspost_Material,0,2);{
|
|
|
TNS_PC_MATERIAL=p;
|
|
|
laAddStringProperty(p, "name", "Material Name", "The name ff the material", 0,0,0,0,1, offsetof(tnsMaterial, Name), 0,0,0,0,LA_AS_IDENTIFIER);
|
|
|
- laAddFloatProperty(p, "color", "Color", "Base color of the material", LA_WIDGET_FLOAT_COLOR, "R,G,B,A", 0,1,0,0.025, 1, 0,offsetof(tnsMaterial, Color), 0,0,4, 0,0,0,0,tnsset_MaterialColor,0,0,0);
|
|
|
- laAddFloatProperty(p, "color2", "Color 2", "Gradient end color of the material", LA_WIDGET_FLOAT_COLOR, "R,G,B,A", 0,1,0,0.025, 1, 0,offsetof(tnsMaterial, Color2), 0,0,4, 0,0,0,0,tnsset_MaterialColor2,0,0,0);
|
|
|
+ laAddFloatProperty(p, "color", "Color", "Base color of the material", LA_WIDGET_FLOAT_COLOR, "R,G,B,A", 0,1,0,0.025, 1, 0,offsetof(tnsMaterial, Color), 0,0,4, 0,0,0,0,tnsset_MaterialColor,0,0,LA_PROP_KEYABLE);
|
|
|
+ laAddFloatProperty(p, "color2", "Color 2", "Gradient end color of the material", LA_WIDGET_FLOAT_COLOR, "R,G,B,A", 0,1,0,0.025, 1, 0,offsetof(tnsMaterial, Color2), 0,0,4, 0,0,0,0,tnsset_MaterialColor2,0,0,LA_PROP_KEYABLE);
|
|
|
ep = laAddEnumProperty(p, "colorful", "Colorful", "Use colorful display", 0,0,0,0,0,offsetof(tnsMaterial, Colorful), 0,0,0,0,0,0,0,0,0,0);{
|
|
|
laAddEnumItemAs(ep, "NONE", "None", "Display materials normally",0,0);
|
|
|
laAddEnumItemAs(ep, "COLORFUL", "Colorful", "Display material with colorful halftone",1,0);
|
|
@@ -1176,10 +1166,10 @@ void la_RegisterTNSProps(){
|
|
|
laAddEnumItemAs(ep,"LINEAR","Linear","Do linear gradient",TNS_GRADIENT_MODE_LINEAR,0);
|
|
|
laAddEnumItemAs(ep,"BOX","Box","Do box gradient",TNS_GRADIENT_MODE_BOX,0);
|
|
|
laAddEnumItemAs(ep,"RADIAL","Radial","Do radial gradient",TNS_GRADIENT_MODE_RADIAL,0);
|
|
|
- laAddFloatProperty(p,"gradient_center","Gradient Center","Starting point of the gradient",0,0,0,0,0,0,0,0,offsetof(tnsMaterial,GradientCenter),0,0,2,0,0,0,0,tnsset_MaterialGradientCenter,0,0,0);
|
|
|
- laAddFloatProperty(p,"gradient_size","Gradient Size","Size of the gradient",0,0,0,0,0,0,0,0,offsetof(tnsMaterial,GradientSize),0,0,2,0,0,0,0,tnsset_MaterialGradientSize,0,0,0);
|
|
|
- laAddFloatProperty(p,"gradient_box_r","Corner","Corner radius of the box gradient",0,0,0,0,0,0,0,0,offsetof(tnsMaterial,GradientBoxR),0,tnsset_MaterialGradientR,0,0,0,0,0,0,0,0,0);
|
|
|
- laAddFloatProperty(p,"gradient_box_f","Feather","Feather distance of the box gradient",0,0,0,0,0,0,0,0,offsetof(tnsMaterial,GradientBoxF),0,tnsset_MaterialGradientF,0,0,0,0,0,0,0,0,0);
|
|
|
+ laAddFloatProperty(p,"gradient_center","Gradient Center","Starting point of the gradient",0,0,0,0,0,0,0,0,offsetof(tnsMaterial,GradientCenter),0,0,2,0,0,0,0,tnsset_MaterialGradientCenter,0,0,LA_PROP_KEYABLE);
|
|
|
+ laAddFloatProperty(p,"gradient_size","Gradient Size","Size of the gradient",0,0,0,0,0,0,0,0,offsetof(tnsMaterial,GradientSize),0,0,2,0,0,0,0,tnsset_MaterialGradientSize,0,0,LA_PROP_KEYABLE);
|
|
|
+ laAddFloatProperty(p,"gradient_box_r","Corner","Corner radius of the box gradient",0,0,0,0,0,0,0,0,offsetof(tnsMaterial,GradientBoxR),0,tnsset_MaterialGradientR,0,0,0,0,0,0,0,0,LA_PROP_KEYABLE);
|
|
|
+ laAddFloatProperty(p,"gradient_box_f","Feather","Feather distance of the box gradient",0,0,0,0,0,0,0,0,offsetof(tnsMaterial,GradientBoxF),0,tnsset_MaterialGradientF,0,0,0,0,0,0,0,0,LA_PROP_KEYABLE);
|
|
|
laAddSubGroup(p, "shader_page", "Shader Page", "Shader page of this material","la_rack_page",0,0,0,offsetof(tnsMaterial,Page),0,0,0,0,0,0,0,LA_UDF_SINGLE|LA_HIDE_IN_SAVE);
|
|
|
laAddOperatorProperty(p,"refresh","Refresh","Refresh material shader","M_refresh_material_shader",L'🗘',0);
|
|
|
laAddOperatorProperty(p,"remove","Remove","Remove this material","M_remove_material",L'🗴',0);
|
|
@@ -1195,7 +1185,6 @@ void la_RegisterTNSProps(){
|
|
|
}
|
|
|
|
|
|
p = laAddPropertyContainer("tns_object", "Object", "3D Object Item", 0,tnsui_BaseObjectProperties,sizeof(tnsObject), tnspost_Object, 0,2);{
|
|
|
- laContainerAnimationFunctions(p,laaction_VerifyRootObject);
|
|
|
TNS_PC_OBJECT_GENERIC=p;
|
|
|
laAddStringProperty(p, "name", "Object Name", "The Name Of The Object", 0,0,0,0,1, offsetof(tnsObject, Name), 0,0,0,0,LA_AS_IDENTIFIER);
|
|
|
laAddIntProperty(p,"flags","Flags","Flags",0,0,0,0,0,0,0,0,offsetof(tnsObject,Flags),0,0,0,0,0,0,0,0,0,0,LA_READ_ONLY);
|
|
@@ -1243,6 +1232,7 @@ void la_RegisterTNSProps(){
|
|
|
}
|
|
|
p = laAddPropertyContainer("tns_root_object", "Root Object", "Root object", 0, tnsui_RootObjectProperties,sizeof(tnsRootObject), 0,0,2);{
|
|
|
laPropContainerExtraFunctions(p,0,0,tnstouched_Object,tnspropagate_Object,tnsui_RootObjectMenuUi);
|
|
|
+ laContainerAnimationFunctions(p,laaction_VerifyRootObject);
|
|
|
TNS_PC_OBJECT_ROOT=p;
|
|
|
laAddStringProperty(p, "name", "Object Name", "The Name Of The Object", 0,0,0,0,1, offsetof(tnsObject, Name), 0,0,0,0,LA_AS_IDENTIFIER);
|
|
|
laAddSubGroup(p, "base", "Base", "Object base", "tns_object",0,0,0,0,0,0,0,0,0,0,0,LA_UDF_LOCAL);
|