[sldev] A patch to allow creation of megaprims from within the viewer

Able Whitman able.whitman at gmail.com
Sun May 11 13:37:21 PDT 2008


Skipped content of type multipart/alternative-------------- next part --------------
A non-text attachment was scrubbed...
Name: megaprim-create.patch.jpg
Type: image/jpeg
Size: 114757 bytes
Desc: not available
Url : http://lists.secondlife.com/pipermail/sldev/attachments/20080511/769c766f/megaprim-create.patch-0001.jpg
-------------- next part --------------
diff -wru -X x.txt linden-orig\/indra/llmath/xform.h linden\/indra/llmath/xform.h
--- linden-orig\/indra/llmath/xform.h	2008-04-07 19:45:36.000000000 -0400
+++ linden\/indra/llmath/xform.h	2008-05-10 18:48:15.197000000 -0400
@@ -35,10 +35,10 @@
 #include "m4math.h"
 #include "llquaternion.h"
 
-const F32 MAX_OBJECT_Z 		= 768.f;
+const F32 MAX_OBJECT_Z 		= 4096.f;
 const F32 MIN_OBJECT_Z 		= -256.f;
-const F32 MIN_OBJECT_SCALE 	= 0.01f;
-const F32 MAX_OBJECT_SCALE 	= 10.f;
+const F32 MIN_OBJECT_SCALE 	= 0.0001f;
+const F32 MAX_OBJECT_SCALE 	= 512.f;
 
 class LLXform
 {
diff -wru -X x.txt linden-orig\/indra/newview/llcontroldef.cpp linden\/indra/newview/llcontroldef.cpp
--- linden-orig\/indra/newview/llcontroldef.cpp	2008-04-07 19:45:42.000000000 -0400
+++ linden\/indra/newview/llcontroldef.cpp	2008-05-11 11:49:41.402000000 -0400
@@ -1582,6 +1586,11 @@
 
 	gSavedSettings.declareBOOL("SaveMinidump", TRUE, "Save minidump for developer debugging on crash");
 
+	// default new object scale
+	gSavedSettings.declareF32("RezNewScaleX", 0.5f, "Default X dimension scale when creating a new prim");
+	gSavedSettings.declareF32("RezNewScaleY", 0.5f, "Default Y dimension scale when creating a new prim");
+	gSavedSettings.declareF32("RezNewScaleZ", 0.5f, "Default Z dimension scale when creating a new prim");
+
 	//
 	// crash_settings.xml
 	//
diff -wru -X x.txt linden-orig\/indra/newview/llfloatertools.cpp linden\/indra/newview/llfloatertools.cpp
--- linden-orig\/indra/newview/llfloatertools.cpp	2008-04-07 19:45:42.000000000 -0400
+++ linden\/indra/newview/llfloatertools.cpp	2008-05-11 14:55:05.810000000 -0400
@@ -54,6 +54,7 @@
 #include "llpanelvolume.h"
 #include "llpanelpermissions.h"
 #include "llselectmgr.h"
+#include "llspinctrl.h"
 #include "llstatusbar.h"
 #include "lltabcontainer.h"
 #include "lltextbox.h"
@@ -114,6 +115,9 @@
 void commit_radio_pan(LLUICtrl *, void*);
 void commit_grid_mode(LLUICtrl *, void*);
 void commit_slider_zoom(LLUICtrl *, void*);
+void commit_new_x(LLUICtrl *ctrl, void *data);
+void commit_new_y(LLUICtrl *ctrl, void *data);
+void commit_new_z(LLUICtrl *ctrl, void *data);
 
 
 //static
@@ -284,6 +288,21 @@
 	childSetValue("checkbox copy centers",(BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters"));
 	mCheckCopyRotates = LLUICtrlFactory::getCheckBoxByName(this,"checkbox copy rotates");
 	childSetValue("checkbox copy rotates",(BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates"));
+
+	mLabelNewSize = LLUICtrlFactory::getTextBoxByName(this, "CreateToolNewSizeLabel");
+
+	mSpinNewX = LLUICtrlFactory::getSpinnerByName(this, "CreateToolNewX");
+	childSetValue("CreateToolNewX", (F32)gSavedSettings.getF32("RezNewScaleX"));
+	childSetCommitCallback("CreateToolNewX", commit_new_x, mSpinNewX);
+
+	mSpinNewY = LLUICtrlFactory::getSpinnerByName(this, "CreateToolNewY");
+	childSetValue("CreateToolNewY", (F32)gSavedSettings.getF32("RezNewScaleY"));
+	childSetCommitCallback("CreateToolNewY", commit_new_y, mSpinNewY);
+
+	mSpinNewZ = LLUICtrlFactory::getSpinnerByName(this, "CreateToolNewZ");
+	childSetValue("CreateToolNewZ", (F32)gSavedSettings.getF32("RezNewScaleZ"));
+	childSetCommitCallback("CreateToolNewZ", commit_new_z, mSpinNewZ);
+
 	mRadioSelectLand = LLUICtrlFactory::getCheckBoxByName(this,"radio select land");
 	childSetCommitCallback("radio select land",commit_select_tool, gToolParcel);
 	mRadioDozerFlatten = LLUICtrlFactory::getCheckBoxByName(this,"radio flatten");
@@ -373,6 +392,12 @@
 	mCheckCopySelection(NULL),
 	mCheckCopyCenters(NULL),
 	mCheckCopyRotates(NULL),
+
+	mLabelNewSize(NULL),
+	mSpinNewX(NULL),
+	mSpinNewY(NULL),
+	mSpinNewZ(NULL),
+
 	mRadioSelectLand(NULL),
 	mRadioDozerFlatten(NULL),
 	mRadioDozerRaise(NULL),
@@ -674,6 +699,11 @@
 	if (mCheckCopyCenters) mCheckCopyCenters	->setVisible( create_visible );
 	if (mCheckCopyRotates) mCheckCopyRotates	->setVisible( create_visible );
 
+	if (mLabelNewSize) mLabelNewSize	->setVisible( create_visible );
+	if (mSpinNewX) mSpinNewX	->setVisible( create_visible );
+	if (mSpinNewY) mSpinNewY	->setVisible( create_visible );
+	if (mSpinNewZ) mSpinNewZ	->setVisible( create_visible );
+
 	if (mCheckCopyCenters) mCheckCopyCenters->setEnabled( mCheckCopySelection->get() );
 	if (mCheckCopyRotates) mCheckCopyRotates->setEnabled( mCheckCopySelection->get() );
 
@@ -935,6 +965,24 @@
 	gSavedSettings.setBOOL("ShowParcelOwners", show_owners);
 }
 
+void commit_new_x(LLUICtrl *ctrl, void *data)
+{
+	LLSpinCtrl* spin = (LLSpinCtrl*) data;
+	gSavedSettings.setF32("RezNewScaleX", spin->get());
+}
+
+void commit_new_y(LLUICtrl *ctrl, void *data)
+{
+	LLSpinCtrl* spin = (LLSpinCtrl*) data;
+	gSavedSettings.setF32("RezNewScaleY", spin->get());
+}
+
+void commit_new_z(LLUICtrl *ctrl, void *data)
+{
+	LLSpinCtrl* spin = (LLSpinCtrl*) data;
+	gSavedSettings.setF32("RezNewScaleZ", spin->get());
+}
+
 void commit_select_component(LLUICtrl *ctrl, void *data)
 {
 	LLFloaterTools* floaterp = (LLFloaterTools*)data;
diff -wru -X x.txt linden-orig\/indra/newview/llfloatertools.h linden\/indra/newview/llfloatertools.h
--- linden-orig\/indra/newview/llfloatertools.h	2008-04-07 19:45:40.000000000 -0400
+++ linden\/indra/newview/llfloatertools.h	2008-05-11 14:53:12.757000000 -0400
@@ -50,6 +50,7 @@
 class LLComboBox;
 class LLParcelSelection;
 class LLObjectSelection;
+class LLSpinCtrl;
 
 typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle;
 
@@ -157,6 +158,11 @@
 	LLCheckBoxCtrl	*mCheckCopyCenters;
 	LLCheckBoxCtrl	*mCheckCopyRotates;
 
+	LLTextBox		*mLabelNewSize;
+	LLSpinCtrl		*mSpinNewX;
+	LLSpinCtrl		*mSpinNewY;
+	LLSpinCtrl		*mSpinNewZ;
+
 	// Land buttons
 //	LLCheckBoxCtrl	*mRadioEditLand;
 	LLCheckBoxCtrl	*mRadioSelectLand;
diff -wru -X x.txt linden-orig\/indra/newview/lltoolplacer.cpp linden\/indra/newview/lltoolplacer.cpp
--- linden-orig\/indra/newview/lltoolplacer.cpp	2008-04-07 19:45:42.000000000 -0400
+++ linden\/indra/newview/lltoolplacer.cpp	2008-05-10 23:04:42.176000000 -0400
@@ -64,8 +64,6 @@
 #include "llviewercamera.h"
 #include "llviewerstats.h"
 
-const LLVector3 DEFAULT_OBJECT_SCALE(0.5f, 0.5f, 0.5f);
-
 //static 
 LLPCode	LLToolPlacer::sObjectType = LL_PCODE_CUBE;
 
@@ -182,7 +180,7 @@
 
 	// Set params for new object based on its PCode.
 	LLQuaternion	rotation;
-	LLVector3		scale = DEFAULT_OBJECT_SCALE;
+	LLVector3		scale(gSavedSettings.getF32("RezNewScaleX"), gSavedSettings.getF32("RezNewScaleY"), gSavedSettings.getF32("RezNewScaleZ"));
 	U8				material = LL_MCODE_WOOD;
 	BOOL			create_selected = FALSE;
 	LLVolumeParams	volume_params;
diff -wru -X x.txt linden-orig\/indra/newview/skins/xui/en-us/floater_tools.xml linden\/indra/newview/skins/xui/en-us/floater_tools.xml
--- linden-orig\/indra/newview/skins/xui/en-us/floater_tools.xml	2008-04-07 19:45:42.000000000 -0400
+++ linden\/indra/newview/skins/xui/en-us/floater_tools.xml	2008-05-11 14:33:23.043000000 -0400
@@ -208,6 +208,26 @@
 	     image_unselected="object_grass.tga" label="" label_selected=""
 	     left_delta="23" mouse_opaque="true" name="ToolGrass" scale_image="TRUE"
 	     width="24" />
+  <!-- -->
+  <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
+     bottom="-84" drop_shadow_visible="true" follows="left|top"
+     font="SansSerifSmall" h_pad="0" halign="right" height="10" left="110"
+     mouse_opaque="true" name="CreateToolNewSizeLabel" v_pad="0" width="151">
+    New Object Size (meters)
+  </text>
+  <spinner bottom_delta="-20" decimal_digits="3" follows="left|top" halign="right" height="16"
+       increment="0.001" initial_val="0" label="X" label_width="10" left="136"
+       max_val="512" min_val="0.0001" mouse_opaque="true" name="CreateToolNewX"
+       text_enabled_color="1, 0.25, 0, 1" width="87" />
+  <spinner bottom_delta="-18" decimal_digits="3" follows="left|top" halign="right" height="16"
+       increment="0.001" initial_val="0" label="Y" label_width="10" left="136"
+       max_val="512" min_val="0.0001" mouse_opaque="true" name="CreateToolNewY"
+       text_enabled_color="0, 1, 0, 1" width="87" />
+  <spinner bottom_delta="-18" decimal_digits="3" follows="left|top" halign="right" height="16"
+       increment="0.001" initial_val="0" label="Z" label_width="10" left="136"
+       max_val="512" min_val="0.0001" mouse_opaque="true" name="CreateToolNewZ"
+       text_enabled_color="0, 0.5, 1, 1" width="87" />
+  <!-- -->
 	<check_box bottom="-117" control_name="CreateToolKeepSelected" follows="left|top"
 	     font="SansSerifSmall" height="16" initial_value="false"
 	     label="Keep Tool Selected" left="4" mouse_opaque="true"
@@ -559,7 +579,7 @@
 			     text_enabled_color="0, 1, 0, 1" width="87" />
 			<spinner bottom_delta="-18" decimal_digits="3" follows="left|top" height="16"
 			     increment="0.01" initial_val="0" label="Z" label_width="10" left="10"
-			     max_val="768" min_val="0" mouse_opaque="true" name="Pos Z"
+			     max_val="4096" min_val="0" mouse_opaque="true" name="Pos Z"
 			     text_enabled_color="0, 0.5, 1, 1" width="87" />
 			<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
 			     bottom_delta="-16" drop_shadow_visible="true" follows="left|top"
@@ -568,16 +588,16 @@
 				Size (meters)
 			</text>
 			<spinner bottom_delta="-20" decimal_digits="3" follows="left|top" height="16"
-			     increment="0.01" initial_val="0" label="X" label_width="10" left="10"
-			     max_val="10" min_val="0.01" mouse_opaque="true" name="Scale X"
+			     increment="0.001" initial_val="0" label="X" label_width="10" left="10"
+			     max_val="512" min_val="0.0001" mouse_opaque="true" name="Scale X"
 			     text_enabled_color="1, 1, 1, 1" width="87" />
 			<spinner bottom_delta="-18" decimal_digits="3" follows="left|top" height="16"
-			     increment="0.01" initial_val="0" label="Y" label_width="10" left="10"
-			     max_val="10" min_val="0.01" mouse_opaque="true" name="Scale Y"
+			     increment="0.001" initial_val="0" label="Y" label_width="10" left="10"
+			     max_val="512" min_val="0.0001" mouse_opaque="true" name="Scale Y"
 			     text_enabled_color="1, 1, 1, 1" width="87" />
 			<spinner bottom_delta="-18" decimal_digits="3" follows="left|top" height="16"
-			     increment="0.01" initial_val="0" label="Z" label_width="10" left="10"
-			     max_val="10" min_val="0.01" mouse_opaque="true" name="Scale Z"
+			     increment="0.001" initial_val="0" label="Z" label_width="10" left="10"
+			     max_val="512" min_val="0.0001" mouse_opaque="true" name="Scale Z"
 			     text_enabled_color="1, 1, 1, 1" width="87" />
 			<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
 			     bottom_delta="-16" drop_shadow_visible="true" follows="left|top"
@@ -933,7 +953,7 @@
 				Transparency %
 			</text>
 			<spinner bottom_delta="-20" decimal_digits="0" follows="left|top" height="16"
-			     increment="2" initial_val="0" left="180" max_val="90" min_val="0"
+			     increment="2" initial_val="0" left="180" max_val="100" min_val="0"
 			     mouse_opaque="true" name="ColorTrans" width="80" />
 			<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
 			     bottom_delta="-12" drop_shadow_visible="true" follows="left|top"
diff -wru -X x.txt linden-orig\/indra/newview/skins/xui/en-us/floater_world_map.xml linden\/indra/newview/skins/xui/en-us/floater_world_map.xml
--- linden-orig\/indra/newview/skins/xui/en-us/floater_world_map.xml	2008-04-07 19:45:42.000000000 -0400
+++ linden\/indra/newview/skins/xui/en-us/floater_world_map.xml	2008-04-28 23:52:57.219000000 -0400
@@ -203,7 +203,7 @@
 	     mouse_opaque="true" name="spin y"
 	     tool_tip="Y coordinate of location to show on map" width="66" />
 	<spinner bottom_delta="0" decimal_digits="0" follows="bottom|right" height="16"
-	     increment="1" initial_val="0" left_delta="68" max_val="768" min_val="0"
+	     increment="1" initial_val="0" left_delta="68" max_val="4096" min_val="0"
 	     mouse_opaque="true" name="spin z"
 	     tool_tip="Z coordinate of location to show on map" width="66" />
 	<button bottom="-625" follows="right|bottom" font="SansSerif" halign="center"


More information about the SLDev mailing list